Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cs_buffer. Breaking API change. #2367

Closed
wants to merge 24 commits into from
Closed

Commits on May 31, 2024

  1. Add test with ASAN enabled.

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    44bb10d View commit details
    Browse the repository at this point in the history
  2. Fix leaks in cstool and cs.c

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    0816274 View commit details
    Browse the repository at this point in the history
  3. Add work around so ASAN binaries don't DEADSIGNAL due to too many ran…

    …domized address bits.
    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    d328cb8 View commit details
    Browse the repository at this point in the history
  4. Add ASAN build arguments to cstest

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    aff1ff7 View commit details
    Browse the repository at this point in the history
  5. Fix leaks in cstest

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    6b0b734 View commit details
    Browse the repository at this point in the history
  6. Use cstest binary build by the main build.

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    73eaedc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d0dbed7 View commit details
    Browse the repository at this point in the history
  8. Skip Python tests for ASAN

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    1b401c9 View commit details
    Browse the repository at this point in the history
  9. Remove make build from CI

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    083efaa View commit details
    Browse the repository at this point in the history
  10. Fix leaks in cstest.

    - Rewrite split to remove leaks and improve runtime by 6%
    - Add free()
    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    a037c66 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    9315918 View commit details
    Browse the repository at this point in the history
  12. Revert "Fix leaks in cstest."

    This reverts commit bf8ee12.
    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    46c9baf View commit details
    Browse the repository at this point in the history
  13. Fix memleaks in cstest

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    99fca76 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    97773dc View commit details
    Browse the repository at this point in the history
  15. Add CAPSTONE_BUILD_CSTEST to build docs

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    0017c2a View commit details
    Browse the repository at this point in the history
  16. Fix double free

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    5b58616 View commit details
    Browse the repository at this point in the history
  17. Add more detail tests to CI and fix them

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    68a51a8 View commit details
    Browse the repository at this point in the history
  18. Initialize variables

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    190e2f6 View commit details
    Browse the repository at this point in the history
  19. Fix typo

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    161271e View commit details
    Browse the repository at this point in the history
  20. Update cstest build docs

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    909d5c4 View commit details
    Browse the repository at this point in the history
  21. Revert "Remove make build from CI"

    This reverts commit 84f7360.
    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    a37f30e View commit details
    Browse the repository at this point in the history
  22. Make cstest only run for cmake builds.

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    0f07220 View commit details
    Browse the repository at this point in the history
  23. Add cstest job for make build.

    Rot127 authored and numas13 committed May 31, 2024
    Configuration menu
    Copy the full SHA
    bc771f4 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2024

  1. Add cs_buffer. Breaking API change.

    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().
    numas13 committed Jun 1, 2024
    Configuration menu
    Copy the full SHA
    8563211 View commit details
    Browse the repository at this point in the history