-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove cs_malloc() and cs_free(). API change unifies disassembly process. Before, there were two separate functions to disassemble one instruction at a time in a loop and many instructions into a dynamic buffer. Commit will introduce user allocatable buffer that can be used in both situations with one function. cs_disasm_iter() is a tiny wrapper around cs_disasm(). Updating the use of cs_disasm_iter(): // old api cs_insn *insn = cs_malloc(handle); while (cs_disasm_iter(handle, &code, &code_size, &ip, insn)) { disassembled_instructions += 1; } cs_free(insn); Must be changed to: // new api cs_buffer *buffer = cs_buffer_new(1); // create buffer with 1 element while (cs_disasm_iter(handle, &code, &code_size, &ip, buffer)) { cs_insn *insn = &buffer->insn[0]; // get first insn in a buffer disassembled_instructions += 1; } cs_buffer_free(buffer); // free buffer Updating the use of cs_disasm() is straightforward, just use cs_buffer_new(0) to create a buffer and pass it to cs_disasm().
- Loading branch information
Showing
37 changed files
with
531 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.