Commit graph

297 commits

Author SHA1 Message Date
Ayush Goyal
a9fc5d3ca6
Fix: asn and asr command #3885 (#5477) 2025-11-04 23:38:16 +08:00
billow
7a77b8f7bd
linter: update clang-format installation to version 20 (#5451)
* fix: format with clang-format-20
* fix: fix clang-format linter with rewrite '^#define.*/\*.*\\$'
* fix: update clang-format to version 20 in workflows and documentation
* fix: add SPDX license information to .git-blame-ignore-revs
2025-10-12 08:02:03 +08:00
NOT XVilka
58f02ec36d
debug: fix coredump compilation for ARM64 (#5380)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-09-16 02:39:24 +08:00
Rot127
e8c04e0cf9
Separate the setters for binfile objects and current binfile in RzBin. (#5342) 2025-09-07 12:19:29 +00:00
well-mannered-goat
a77afb0a29
Refactor debug native plugin archos-wise and other minor refactors (#5295)
- separate plugin archos wise.
- move all register profiles under reg directory.
- move architecture specific from linux_debug.c and bsd_debug.c to respective files.
- replace eprintf with rz_sys_perror and RZ_LOG_*
- remove debug_native.c and reg.c
- refactor librz/debug/meson.build to compile the native plugins archos wise.

This improves code readability and maintainibility.
2025-09-01 00:00:35 +08:00
Khairul Azhar Kasmiran
a47402ad9e
Add util lib to FreeBSD debug deps (#5301) 2025-08-17 17:44:39 +08:00
well-mannered-goat
48c53b0296
Add openBSD debug tests and fix errors (#5226) 2025-06-27 22:10:35 +08:00
Anton Kochkov
58b0b3715b
Add FreeBSD x86_64 debug tests (#3273)
Co-authored-by: well-mannered-goat <takshformal@gmail.com>
Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
2025-06-24 21:19:31 +08:00
well-mannered-goat
7117ba75ea
librz/debug: add NetBSD debug tests and fix errors (#5208)
* Fix netbsd-x86_64 register profile
* Fix native_wait in netbsd.c
* Fix netbsd attach to show error
* Add netbsd-x64 debug tests
2025-06-20 00:22:33 +08:00
well-mannered-goat
b25a0d0a55
Add tests for PPC64LE debugger support (#5184) 2025-06-03 11:36:19 +05:30
Giovanni
76d41f75f8
Fixes for Haiku OS (#5149)
* Fix sys.c unused variable.
* Add native/unsupported.c
* Clean rz_debug.h from comments and functions which does not exists
* Add fall-thru comment for haiku os case
* Fix warning: "MIN" redefined /boot/system/develop/headers/posix/sys/param.h:18: note: this is the location of the previous definition
2025-05-18 20:17:40 +08:00
Giovanni
144b47d455
Move RzBreakpoint into RzDebug (#5124)
- Move trap/sw breakpoint into RzArch
- Remove RzBreakpointPlugin & RzBreakpointArch
- Add get_sw_breakpoint_at/get_sw_breakpoint_size_at binds
- Remove `dbh-`
- Change `dbh` to just list supported archs for sw breakpoints
- Implement correct PPC traps
- Add missing x86 breakpoint callback
2025-05-13 01:57:37 +08:00
NOT XVilka
30ae60a759
Remove RAP protocol (#5046)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-03-27 00:55:06 +08:00
Rot127
6d10861ace String/Hex-Search 1/9: Add hexadecimal number helpers, doxygen and type annotations.
Part 1/9. Likely won't build in between parts.

Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
2025-02-22 04:12:49 +08:00
Rot127
87b75910b5
Port remaining debug commands to RzShell (#4753)
* Port `dmhb` to RzShell
* Port `dmhf` to RzShell
* Remove 'to' argument from rz_core_debug_continue_until(). It was never used in the whole function. Hence, whatever it was supposed to do, it didn't
* Port `dcu` to RzShell
* Fix tests of `dmh[bf]` commands
* Port `dmi` commands to RzShell
* Port `dmx` to RzShell
* Remove `dta` command.

Originally it limited the addresses to trace.
But it was not used in any test, and the implementation was not optimal.
It allowed only specific addresses (no range).
Also worked on strings (not ut64 values).
Also, the usefulness is limited, considering the alternative
to just not tracing a certain address.

* Add quiet and quietest mode to `dmi` commands.

This also removes the test for `dmias`.
The command was not documented and it doesn't seem to
do anything special `dmia` can't do.
2024-12-06 08:10:25 +08:00
Giovanni
e78a7be614
Remove dead code (#4705) 2024-11-08 18:46:13 +08:00
Rot127
30953d3bf6
refactor: Use HtSP for storing plugins. (#4687)
* Refactor: Use HtSP for storing plugins.

This saves iterations when searching for a plugin of a given name.
It also allows to save plugin configurations and data in hash table,
all addressed by their name. Hence, usage is more streamlined.

* Fix: iterators iterate over pointers of pointers.

* Soften the NULL check.

If arch is passed on from another struct, NULL is an allowed invalid value.

* Fix some leaks

* Fix NULL checks and incorrect inits

* Fix more leaks

* Add warning if plugin with same name was added before and is overwritten.

* Document rz_str_cmp

* Add function to create new list from iterator.

* Sort plugins alphabetically when listed.

* Fix parameter attributes, NULL checks, leaks and single rename.
2024-10-26 16:31:13 +08:00
Giovanni
db1e4993a0
Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
Tushar Jain
526946f552
debug: Travis CI compilation error fixes (#4615) 2024-09-07 01:14:18 +08:00
Tushar Jain
1057cf6eb6
debug: refactor native debugger (#4604) 2024-09-05 01:39:35 +08:00
Claudio Jeker
0ef349398e
Adjust OpenBSD code to set the process state to be less wrong. (#4579)
Use the p_stat of the main thread to decide in which state the process is.
For multi-threaded applications this is still not quite correct but at
least this compiles on OpenBSD-current.

See also 5d4f90ee10

Fix for #4576
2024-07-28 10:05:46 +00:00
zhangwenlong
cbd086a7ec
Fix build error on loongarch64 (#4558) 2024-07-05 15:00:17 +08:00
Khairul Azhar Kasmiran
5129fdb5b1
Fix NetBSD 10 build (#4524)
* Fix NetBSD 10 build
* It's TRAP_BRKPT, not TRAP_BKPT
2024-06-01 23:34:42 +08:00
pelijah
9c34738977
Remove SdbList (#4496) 2024-05-17 19:23:04 +08:00
pelijah
706a6bf6c2
sdb: remove unused cas and expire features (#4487) 2024-05-12 18:27:54 +08:00
pelijah
f818ca4296
Refactor sdb_foreach and related APIs (#4471)
* Refactor sdb_foreach and related APIs
* Strengthen bounds check in sdb_dump_next()
* Switch to RzPVector
* Use length info in filter_noreturn()
* Fix cmp function
* Remove unused sdb_like() API
* Pass SdbKv to SdbForeachCallback
* Add sdbkv_dup_value() helper
2024-05-07 07:57:52 +08:00
Anton Kochkov
63d6d93195 debug: fix Android X86 builds 2024-04-27 16:44:21 +08:00
pelijah
b8ebd5ac42
Add missing vector foreach macros to clang-format cfg (#4456)
* Add rz_vector_foreach to clang-format cfg
* Add other vector foreach macros
2024-04-22 07:16:46 +08:00
z3phyr
0551f2545f
Fix memory leaks in linux heap parser (#4426)
* Fix memory leaks in debug path
* Fix memory leaks in mach and mdmp format
* Update the fix for mach
* Add support for aarch64 tcache parsing
* Test case fix
* Comment update

---------

Co-authored-by: Giridhar Prasath R <giridh1337@gmail.com>
2024-04-21 12:14:06 +08:00
Florian Märkl
2cacf880c1
Add missing newlines to some RZ_LOG_* calls (#4439) 2024-04-18 00:04:38 +08:00
pelijah
f2d8e0db3d
Add HtSP, HtSS, HtSU, SetS (#4415)
- All `ht_*_new0()` are removed
- `freefn` field of HT options was renamed to `finiKV`
- `finiKV_user` fields was added to HT options
- Added `ht_*_new_opt_size` API
- `HtSP` and `HtUP` are created with `ValueFree` callback  that allows to reduce extra LOC and prevent bugs
- `SetP` replaced with `SetS` (based on `HtSP`)
- `rz_th_ht_*_new0()` and `rz_th_ht_*_new_opt()` are replaced with `rz_th_ht_*_new(HtXX *)`
2024-04-16 20:27:48 +08:00
Florian Märkl
149453bd51 Fix debugger build on Mac OS X 10.5/x86
Some more APIs were incorrectly checked for with __POWERPC__, even
though they have nothing to do with the architecture, but were only
introduced in Mac OS X 10.6.
2024-04-09 10:54:12 +02:00
Florian Märkl
505893bdce Fix debugger build on Mac OS X 10.5/ppc
Debugging itself is still not working, but now it does not prevent a successful
build for static analysis.
2024-04-09 10:54:12 +02:00
Rot127
efd5f2532d
Add note to not use rz_time_now() for timestamps. (#4388) 2024-03-25 19:20:25 +08:00
wargio
c53b053b61 Remove useless semicolon 2024-03-25 18:36:02 +08:00
z3phyr
39278ab891
debug: Android doesn't have gs_base (#4384)
Co-authored-by: Giridhar Prasath R <giridh1337@gmail.com>
2024-03-25 07:45:50 +08:00
Anton Kochkov
957a2997b3
debug: i386 register profile lacks gs_base (#4382) 2024-03-24 12:18:13 +08:00
Anton Kochkov
fb5bc404b6
debug: i386 register profile lacks gs_base (#4380) 2024-03-23 12:58:25 +08:00
z3phyr
ab593b3c7e
Make TLS detection only X86-specific (#4378) 2024-03-22 21:37:39 +08:00
z3phyr
de4a3c7419
Enhance dmht tcache command (#4355)
- Add tcache heap heuristics
- Fetch glibc version from libc
- Add unit testcases for glibc version

Co-authored-by: Giridhar Prasath R <giridh1337@gmail.com>
2024-03-22 11:00:58 +08:00
Giovanni
c17881ba2f
Initialize RzAnalysisOp properly. (#4350) 2024-03-10 18:26:10 +08:00
Giovanni
c7ddd77546
Remove rz_list_get_top/bottom & rz_list_get_head/tail_data (#4348) 2024-03-09 18:24:23 +08:00
wargio
d47ceedbd3 Merge rz_asm and rz_analysis into one library but keep deprecated apis.
The tms320c64x has been merged into tms320.
2024-03-07 18:38:49 +08:00
Huzaifa
58f7032f26
Add C API rz_debug_switch_to_first_thread() (#4287) 2024-02-26 21:13:33 +08:00
Rot127
a6c7864198
Fix mismatch 'rz_cons_break_push' and 'rz_cons_break_pop' calls. (#4289)
If a function calls 'rz_cons_break_push()' but never calls 'rz_cons_break_pop()' before return,
the stack count of 'RzConsContext->break_stack' contains too many elements (each time one too much).

This in turn will lead to not resetting 'RzConsContext->breaked' flag.
Because the flag is only set to false, if 'rz_stack_is_empty(context->break_stack) == true'
(in 'rz_cons_context_break_push()').

This wasn't a problem so far, because 'RzConsContext->breaked' is simply never set to true
(exceptions are some timeout cases as far as I can see).
Also these cases when 'rz_cons_break_pop()' was forgetten to be called, were edge error cases.
So not often hit.

But if Rizin is usd by Cutter 'RzConsContext->breaked' is set to 'true',
if an `AnalysisTask` interrupt is handled (in 'AnalysisTask::interrupt()').
This interrupt is triggered for example, when the introduction dialog is closed
and the main Cutter window opens (after the optional 'aaa').

Now, if the binary file was analysed with 'aaa', and a lot of error cases were hit,
those error cases sometimes never called 'rz_cons_break_pop()' before returning from their function.
Although, of course, they should have to the `RzConsContext->break_stack` is in a proper state.

This means, when the main Cutter window opens binary files which trigger many error edge cases,
the `RzConsContext->break_stack` is not empty
(because of the not executed 'rz_cons_break_pop()').

This also means, that the last thing done, was setting 'RzConsContext->breaked = true'
(by 'AnalysisTask::interrupt()').

If Cutter wants to show some disassembly, it calls 'rz_core_print_disasm()' which checks
'RzConsContext == false' via 'rz_cons_is_breaked()'. This condition is never true, because
the flag was not reset to `false` because the stack was never empty.
So it returns before anything was disassembled.

Hence Cutter gets no disassembly text.

Fixes https://github.com/rizinorg/cutter/issues/2552
Fixes https://github.com/rizinorg/cutter/issues/3275
2024-02-23 23:50:11 +08:00
Giovanni
2886608d59
Rewrite how rz_cons_pipe_open/close behave to remove globals (#4223) 2024-02-14 09:05:17 +08:00
Giovanni
29b2093650
Fix Windows compilation warnings (#4209)
* Fix 'bool' differs in levels of indirection from 'void *'
* Fix function declaration.
2024-02-12 14:28:04 +08:00
Anton Kochkov
25fd417a28
Add user pointer to RzListComparator (#4204) 2024-02-11 13:28:33 +08:00
Anton Kochkov
85ffa899ec
Remove sdb_fmt() calls in RzDebug (#4135) 2024-01-21 23:24:52 +08:00
billow
5b36c7c6e0
Patch for windows debugger to load libraries (#4113) 2024-01-16 13:55:10 +08:00