Native Debugger plugin for RISC-V#5966
Conversation
d30e2b4 to
04ed5b8
Compare
notxvilka
left a comment
There was a problem hiding this comment.
@wargio @well-mannered-goat take a look too, please
|
i dont like passing thr RzIO layer here. i would prefer to invoke the disassembler and thenpassing down the disassembled instruction |
a7e26d6 to
48e76e2
Compare
|
Depends-on: #6029 |
notxvilka
left a comment
There was a problem hiding this comment.
Great! Indeed, further improvements could be done in separate PRs.
I meant to write some tests. But leave it for now, since anyways i have to work on PR i'll see about that 😅 |
fb88c2c to
b1e7cac
Compare
b1e7cac to
4cd562d
Compare
This comment was marked as resolved.
This comment was marked as resolved.
4cd562d to
b68091b
Compare
|
@wargio done. |
| if (list) { | ||
| pcname = rz_reg_get_name(dbg->reg, RZ_REG_NAME_LR); | ||
| if (pcname) { | ||
| ut64 addr = rz_reg_getv(dbg->reg, pcname); | ||
| frame = RZ_NEW0(RzDebugFrame); | ||
| frame->addr = addr; | ||
| frame->size = 0; | ||
| rz_list_prepend(list, frame); | ||
| } | ||
| } |
wargio
left a comment
There was a problem hiding this comment.
one small change and for me can be merged
…ments,failcases for ops_count<n_lines(memory reading),return 0 if vector is null() fix typo format fixes updated test cases librz/io: fix book link in io_mach (rizinorg#6285) librz/debug: fix coredump creation on macOS * librz/debug: fix coredump creation on xnu * librz/debug: fix numbers of vmmap entries in xnu * test/db/archos/darwin-arm64: add coredump test tools/rz: Revert weird-looking test (rizinorg#6288) * tools/rz: Revert weird-looking test * Do `dos2unix` on whole file librz/debug: native debugger plugin for RISC-V (rizinorg#5966) * added breakpoints and stepping * add link register to allow single-stepping a ret instruction, fix stacktraces * refactor to avoid passing the IO layer structs to the breakpoint function * add tests, refine the stacktrace to not include non-function * add register information for core file parsing * core file generation for RISC-V * make tests run under riscv-64 * make tests run under riscv-32 Fix rz_vector_set() behavior to match the rz_pvector version one. (rizinorg#6274) * Fix rz_vector_set() behavior to match the rz_pvector version one. * Use existing vector functions for setting elements. librz/bin: ELF coredump parsing support for RISC-V (rizinorg#6266) librz/bin: ELF coredump parsing support for s390x (rizinorg#6271) librz/bin: ELF coredump parsing support for LoongArch (rizinorg#6273) Fix qnx out of bound reads and writes. (rizinorg#6292) build(deps): bump actions/upload-artifact from 4 to 7 (rizinorg#6229) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v4...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> build(deps): bump softprops/action-gh-release from 2 to 3 (rizinorg#6228) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2 to 3. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](softprops/action-gh-release@v2...v3) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-version: '3' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> build(deps): bump actions/cache from 4 to 5 (rizinorg#6262) Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Cleanup luac code (rizinorg#6298) RzReg: Associate roles with RzRegItem instead of name strings (rizinorg#6291) Register roles (RzRegisterId) are now associated directly with an RzRegItem in RzReg rather than mapping to name strings, which previously needed an additional hashtable lookup to get more information about the register. Conversely, if the name is needed from an RzRegItem, it is available directly as a member. This is not a pure refactor as there were cases before where a register name was assigned to a role in the register profile, but no register actually existed under that name. Such cases will now cause a warning to be printed during profile load and the role association will be ignored. Changes in register profiles in this commit are for fixing such cases. librz/bin: fix regstate load in ELF corefiles for x86_64 (rizinorg#6195) * regstate retrieval in ELF corefiles * remove rzbin call from cmd_debug * increase FP_LAYOUT to 128 rz-bindgen: Test with rz-test (rizinorg#6299) util: extend string search with user-defined printable characters (rizinorg#6161) * util: extend string search with user-defined printable characters * util: use RzVector for user_unprintable options * util: address review for configurable unprintable chars * core/cconfig: use goto error_free pattern in cb_str_unprintable * test/cmd_search_z: merge duplicate Armenian utf16le tests debug: make xnu attach idempotent for di (rizinorg#6295) librz/bin: add more ELF header warning detail (rizinorg#6301) elf: Simplify phdr checking code (rizinorg#6302) Remove unused xnu_native_hwstep_enable implementations (dead code) (rizinorg#6300) Implement Pool Node allocation for RzList (rizinorg#6203) Add new implementation of RzConfig (rizinorg#5820) Remove rz_range (rizinorg#6303) Replace strnlen calls Non-C-standard strnlen is not available on Mac OS X 10.5 Fix build on sparc64 and ppc Dynamic endian checking can't be used in RZ_SYS_ENDIAN because its value is used in the preprocessor. When __BYTE_ORDER__ is not available, as is the case on OpenBSD/sparc64, we fall back to big endian. Fix build with debugger=false option Fetch the addends from the relocation position in REL types of object files (rizinorg#6112) Revert "Implement Pool Node allocation for RzList (rizinorg#6203)" (rizinorg#6313) This reverts commit d3a97d5. tui: build filtered panel commands dynamically (rizinorg#6221) * build filtered panel commands with dynamic string growth * build filtered panel cmds with RzStrBuf Update capstone for M68k (rizinorg#6309) * Bump capstone to the latest next * Add capstone M68k changes * Update M68k instruction size and fix tests * Add M68K assembly instruction definitions for 68000, 68020, 68030, 68060, and CPU32 * Update maxopsz to 22 for bflt, hunk, and smd formats * Add M68k ELF coredump parsing support librz/arch: add RS08 and HCS12X as new M680X CPU types (rizinorg#5977) librz/arch: fix m68k CPU32 detection with Capstone v6 (rizinorg#6314) Co-authored-by agent: Codex/GPT-5 Remove RzConfig.lock and re-introduce rz_config_lock for compatibility (rizinorg#6315) rz_config_lock() is still in use by some external plugins. It should be removed completely once plugins have migrated to the new API. For now, it is a no-op to not break compilation of plugins. librz/arch: check if M680X HSC12X/RS08 is present in Capstone (rizinorg#6318) build: propagate OpenSSL in CMake exports (rizinorg#6284) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: NOT XVilka <notxvilka@proton.me> log.level help: Don't show `0:DEBUG` on Release builds (rizinorg#6319) * log.level help: Don't show `0:DEBUG` on Release builds * Use `choco install python310` instead test: make consistent `sysz regs` test output (rizinorg#6326) Add analysis pass to make `avgl` command show global variables (rizinorg#6306) Mark bytes as data and show as such in disassembly if referenced as DATA (rizinorg#6307) librz/bin: fix the false-positive detection of the C166 bins as AVR bins Fix s390x build without debugger (rizinorg#6316) * Fix s390x build without debugger From: Andreas Schneider <asn@cryptomilk.org> Date: Wed, 23 Apr 2026 11:35:00 +0200 Subject: [PATCH] Fix s390x link error when debugger is disabled When the debugger is disabled (-Ddebugger=false), debug_native.c is not compiled, so rz_debug_get_tls() and rz_debug_native_threads() are never defined. However, linux_heap_glibc.c (part of librz_core) calls both functions unconditionally, causing a link failure on s390x. Add stub implementations in debug.c guarded by #if !DEBUGGER so the symbols are always present in librz_debug regardless of the debugger option. * Fix formatting --------- Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com> test: fix avr/c166 test on big endian machine (rizinorg#6329) Improve mips args & prelude detection (rizinorg#6320) test: fix avr/c166 detection test on SystemZ (rizinorg#6333) analysis: fix data in K64F-RIOT-SPI.elf not marked properly (rizinorg#6331) Apply patches/fix_zydis_amalgamated_riscv32_build to subproject We already vendor a patched zydis and this fix should be available to everyone, not only CI. Patch zydis to work on OpenBSD/sparc64 This combines the following patches already sent upstream: zyantific/zycore-c#97 zyantific/zydis#603 ...and introduces a workaround to fix segfaults caused by accesses into arrays of the packed ZydisShortString struct. The final solution will likely be an upstream rework of this structure: zyantific/zydis#263 Finally, we adjust the condition for when ZydisStringAppendHexU32 is used, since it is not defined by default. This is already solved more elegantly in Zydis development upstream, but it requires more changes, so we stick to a smaller patch on top of the latest release for now. Fix double free and reject invalid values for `search.in` (rizinorg#6327) pdq: Downgrade "Failed to read chunk" msg from error to warning (rizinorg#6332) Feature: JOP and COP support (rizinorg#6257) * Refactor handlers * COP Support * JOP support * Fix RISCV gadget search test * Remove redundant cop,jop test * Add COP tests * Add JOP tests * Combine gadget_[rjc]op.c into gadget.c Reduce verbose error messages from unsupported native debugger (rizinorg#6337) init and fini are called on regular rizin start, even if not debugging. These errors were distracting and not very meaningful there. They do however make sense when executing any actual debug operation. Fix OOB read in OMF format plugin (rizinorg#6336) * Fix OOB read of section due to invalid bounds check. * Move array offset to variable for readability. Use libdemangle commit with fixed CVE. (rizinorg#6340) added reviewd changes updated to upstream updated type flags Support Siemens/Infineon C16x microcontroller (rizinorg#6321) librz/arch: add LuaJIT 2.1 bytecode support (rizinorg#5961) * Add LuaJIT binary loader * Add LuaJIT analysis and disassembly plugin * New CPU format `luajit` for luac plugin librz/bin/omf: fix build warning (rizinorg#6341) librz/bin/omf: OMF166 fix error handling (rizinorg#6342) Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com> librz/core: fix OMF debug type error (rizinorg#6343) Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com> librz/arch/c166: fix behavior on big-endian hosts Fix `afb-*` (rizinorg#6347) * Base test output * Fix `afb-*` librz/bin/elf: add some missing MIPS relocs (rizinorg#6348) * Add support to various MIPS reloc conversion. R_MIPS_26, R_MIPS_HI16, R_MIPS_LO16, R_MIPS_GOT16, R_MIPS_PC16, R_MIPS_CALL16, R_MIPS_64, R_MIPS_GOT_HI16, R_MIPS_GOT_LO16, R_MIPS_CALL_HI16, R_MIPS_CALL_LO16, R_MIPS_REL16 * Fix test missing RUN at the end.
…ments,failcases for ops_count<n_lines(memory reading),return 0 if vector is null() fix typo format fixes updated test cases librz/io: fix book link in io_mach (rizinorg#6285) librz/debug: fix coredump creation on macOS * librz/debug: fix coredump creation on xnu * librz/debug: fix numbers of vmmap entries in xnu * test/db/archos/darwin-arm64: add coredump test tools/rz: Revert weird-looking test (rizinorg#6288) * tools/rz: Revert weird-looking test * Do `dos2unix` on whole file librz/debug: native debugger plugin for RISC-V (rizinorg#5966) * added breakpoints and stepping * add link register to allow single-stepping a ret instruction, fix stacktraces * refactor to avoid passing the IO layer structs to the breakpoint function * add tests, refine the stacktrace to not include non-function * add register information for core file parsing * core file generation for RISC-V * make tests run under riscv-64 * make tests run under riscv-32 Fix rz_vector_set() behavior to match the rz_pvector version one. (rizinorg#6274) * Fix rz_vector_set() behavior to match the rz_pvector version one. * Use existing vector functions for setting elements. librz/bin: ELF coredump parsing support for RISC-V (rizinorg#6266) librz/bin: ELF coredump parsing support for s390x (rizinorg#6271) librz/bin: ELF coredump parsing support for LoongArch (rizinorg#6273) Fix qnx out of bound reads and writes. (rizinorg#6292) build(deps): bump actions/upload-artifact from 4 to 7 (rizinorg#6229) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v4...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> build(deps): bump softprops/action-gh-release from 2 to 3 (rizinorg#6228) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2 to 3. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](softprops/action-gh-release@v2...v3) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-version: '3' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> build(deps): bump actions/cache from 4 to 5 (rizinorg#6262) Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Cleanup luac code (rizinorg#6298) RzReg: Associate roles with RzRegItem instead of name strings (rizinorg#6291) Register roles (RzRegisterId) are now associated directly with an RzRegItem in RzReg rather than mapping to name strings, which previously needed an additional hashtable lookup to get more information about the register. Conversely, if the name is needed from an RzRegItem, it is available directly as a member. This is not a pure refactor as there were cases before where a register name was assigned to a role in the register profile, but no register actually existed under that name. Such cases will now cause a warning to be printed during profile load and the role association will be ignored. Changes in register profiles in this commit are for fixing such cases. librz/bin: fix regstate load in ELF corefiles for x86_64 (rizinorg#6195) * regstate retrieval in ELF corefiles * remove rzbin call from cmd_debug * increase FP_LAYOUT to 128 rz-bindgen: Test with rz-test (rizinorg#6299) util: extend string search with user-defined printable characters (rizinorg#6161) * util: extend string search with user-defined printable characters * util: use RzVector for user_unprintable options * util: address review for configurable unprintable chars * core/cconfig: use goto error_free pattern in cb_str_unprintable * test/cmd_search_z: merge duplicate Armenian utf16le tests debug: make xnu attach idempotent for di (rizinorg#6295) librz/bin: add more ELF header warning detail (rizinorg#6301) elf: Simplify phdr checking code (rizinorg#6302) Remove unused xnu_native_hwstep_enable implementations (dead code) (rizinorg#6300) Implement Pool Node allocation for RzList (rizinorg#6203) Add new implementation of RzConfig (rizinorg#5820) Remove rz_range (rizinorg#6303) Replace strnlen calls Non-C-standard strnlen is not available on Mac OS X 10.5 Fix build on sparc64 and ppc Dynamic endian checking can't be used in RZ_SYS_ENDIAN because its value is used in the preprocessor. When __BYTE_ORDER__ is not available, as is the case on OpenBSD/sparc64, we fall back to big endian. Fix build with debugger=false option Fetch the addends from the relocation position in REL types of object files (rizinorg#6112) Revert "Implement Pool Node allocation for RzList (rizinorg#6203)" (rizinorg#6313) This reverts commit d3a97d5. tui: build filtered panel commands dynamically (rizinorg#6221) * build filtered panel commands with dynamic string growth * build filtered panel cmds with RzStrBuf Update capstone for M68k (rizinorg#6309) * Bump capstone to the latest next * Add capstone M68k changes * Update M68k instruction size and fix tests * Add M68K assembly instruction definitions for 68000, 68020, 68030, 68060, and CPU32 * Update maxopsz to 22 for bflt, hunk, and smd formats * Add M68k ELF coredump parsing support librz/arch: add RS08 and HCS12X as new M680X CPU types (rizinorg#5977) librz/arch: fix m68k CPU32 detection with Capstone v6 (rizinorg#6314) Co-authored-by agent: Codex/GPT-5 Remove RzConfig.lock and re-introduce rz_config_lock for compatibility (rizinorg#6315) rz_config_lock() is still in use by some external plugins. It should be removed completely once plugins have migrated to the new API. For now, it is a no-op to not break compilation of plugins. librz/arch: check if M680X HSC12X/RS08 is present in Capstone (rizinorg#6318) build: propagate OpenSSL in CMake exports (rizinorg#6284) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: NOT XVilka <notxvilka@proton.me> log.level help: Don't show `0:DEBUG` on Release builds (rizinorg#6319) * log.level help: Don't show `0:DEBUG` on Release builds * Use `choco install python310` instead test: make consistent `sysz regs` test output (rizinorg#6326) Add analysis pass to make `avgl` command show global variables (rizinorg#6306) Mark bytes as data and show as such in disassembly if referenced as DATA (rizinorg#6307) librz/bin: fix the false-positive detection of the C166 bins as AVR bins Fix s390x build without debugger (rizinorg#6316) * Fix s390x build without debugger From: Andreas Schneider <asn@cryptomilk.org> Date: Wed, 23 Apr 2026 11:35:00 +0200 Subject: [PATCH] Fix s390x link error when debugger is disabled When the debugger is disabled (-Ddebugger=false), debug_native.c is not compiled, so rz_debug_get_tls() and rz_debug_native_threads() are never defined. However, linux_heap_glibc.c (part of librz_core) calls both functions unconditionally, causing a link failure on s390x. Add stub implementations in debug.c guarded by #if !DEBUGGER so the symbols are always present in librz_debug regardless of the debugger option. * Fix formatting --------- Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com> test: fix avr/c166 test on big endian machine (rizinorg#6329) Improve mips args & prelude detection (rizinorg#6320) test: fix avr/c166 detection test on SystemZ (rizinorg#6333) analysis: fix data in K64F-RIOT-SPI.elf not marked properly (rizinorg#6331) Apply patches/fix_zydis_amalgamated_riscv32_build to subproject We already vendor a patched zydis and this fix should be available to everyone, not only CI. Patch zydis to work on OpenBSD/sparc64 This combines the following patches already sent upstream: zyantific/zycore-c#97 zyantific/zydis#603 ...and introduces a workaround to fix segfaults caused by accesses into arrays of the packed ZydisShortString struct. The final solution will likely be an upstream rework of this structure: zyantific/zydis#263 Finally, we adjust the condition for when ZydisStringAppendHexU32 is used, since it is not defined by default. This is already solved more elegantly in Zydis development upstream, but it requires more changes, so we stick to a smaller patch on top of the latest release for now. Fix double free and reject invalid values for `search.in` (rizinorg#6327) pdq: Downgrade "Failed to read chunk" msg from error to warning (rizinorg#6332) Feature: JOP and COP support (rizinorg#6257) * Refactor handlers * COP Support * JOP support * Fix RISCV gadget search test * Remove redundant cop,jop test * Add COP tests * Add JOP tests * Combine gadget_[rjc]op.c into gadget.c Reduce verbose error messages from unsupported native debugger (rizinorg#6337) init and fini are called on regular rizin start, even if not debugging. These errors were distracting and not very meaningful there. They do however make sense when executing any actual debug operation. Fix OOB read in OMF format plugin (rizinorg#6336) * Fix OOB read of section due to invalid bounds check. * Move array offset to variable for readability. Use libdemangle commit with fixed CVE. (rizinorg#6340) added reviewd changes updated to upstream updated type flags Support Siemens/Infineon C16x microcontroller (rizinorg#6321) librz/arch: add LuaJIT 2.1 bytecode support (rizinorg#5961) * Add LuaJIT binary loader * Add LuaJIT analysis and disassembly plugin * New CPU format `luajit` for luac plugin librz/bin/omf: fix build warning (rizinorg#6341) librz/bin/omf: OMF166 fix error handling (rizinorg#6342) Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com> librz/core: fix OMF debug type error (rizinorg#6343) Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com> librz/arch/c166: fix behavior on big-endian hosts Fix `afb-*` (rizinorg#6347) * Base test output * Fix `afb-*` librz/bin/elf: add some missing MIPS relocs (rizinorg#6348) * Add support to various MIPS reloc conversion. R_MIPS_26, R_MIPS_HI16, R_MIPS_LO16, R_MIPS_GOT16, R_MIPS_PC16, R_MIPS_CALL16, R_MIPS_64, R_MIPS_GOT_HI16, R_MIPS_GOT_LO16, R_MIPS_CALL_HI16, R_MIPS_CALL_LO16, R_MIPS_REL16 * Fix test missing RUN at the end. added tests, newstruct RzCoreILPrintOptions,buffer is taken from arguments,failcases for ops_count<n_lines(memory reading),return 0 if vector is null() fix typo format fixes
* added breakpoints and stepping * add link register to allow single-stepping a ret instruction, fix stacktraces * refactor to avoid passing the IO layer structs to the breakpoint function * add tests, refine the stacktrace to not include non-function * add register information for core file parsing * core file generation for RISC-V * make tests run under riscv-64 * make tests run under riscv-32
Your checklist for this pull request
RZ_APIfunction and struct this PR changes.RZ_API).Detailed description
...
Test plan
...
Closing issues
...