Commit graph

270 commits

Author SHA1 Message Date
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
billow
acace32cad
Fix windows debug plugin (#4099) 2024-01-13 08:16:38 +08:00
Giovanni
8fba9b4189
Force usage of RzList methods instead of direct access of the fields (#4036) 2023-12-18 21:05:57 +08:00
Riccardo Schirone
3b903caa96
librz: add some initial documentation (#3782) 2023-10-13 13:46:19 +08:00
Riccardo Schirone
a1cb888f95
core/cmd: fix some leftover of ?i command (#3911) 2023-10-05 21:31:21 +08:00
Florian Märkl
f3469946c5 Add specifiable size for watchpoints and tests
rz_bp_size_at() is not always the right size for a watchpoint, so we add
the possibility to specify the size as an extra argument to dmw.
2023-09-16 22:35:20 +08:00
David CARLIER
285ea07ab5
bsd_generate_corefile for FreeBSD adjust version since the feature is available in the 13.2 serie (#3820) 2023-09-03 19:38:40 +08:00
Khairul Azhar Kasmiran
681a6b04b8
Fix #3806: fuzzy dbt checks for CALL indirect on x86 (#3809) 2023-08-31 11:02:28 +08:00
Anton Kochkov
3278ec77d0
ci: use clang-format from LLVM 16 (#3696)
Co-authored-by: wargio <wargio@libero.it>
2023-08-01 09:11:26 +08:00
Giovanni
8efdb3d3a3
Refactoring debug plugin and cleanup output (#3634) 2023-07-04 10:42:41 +08:00
billow
6eb14128ad
Adding tricore support for rz_debug_plugin_gdb (#3557) 2023-06-06 12:53:51 +08:00
billow
73c546ddc0
Fix compile warnings (#3522) 2023-05-23 09:52:47 +08:00
Riccardo Schirone
65e4e9ebd1
Fix few sscanf issues reported by @yeggor (#3428) 2023-03-22 18:36:54 +08:00
Riccardo Schirone
d6196703d8 Fix conversion from GDB register profile to rizin profile 2023-03-14 11:41:29 +01:00
Anton Kochkov
e307b32c6d Fix Linux native debugger compilation for ARM64 2023-02-27 17:03:37 +08:00
Anton Kochkov
c2ecb289ef
Coverity fixes - memory leaks, UAFs (#3335)
* Fix CID 404596 - memory leak

* Fix CID 404594 - memory leak

* Fix CID 404595 - memory leak

* Fix CID 404593 - memory leak

* Fix CID 404592 - memory leak

* Fix CID 404349 - memory leak

* Fix CID 404021 - memory leak

* Fix CID 403816 - memory leak

* Fix CID 403733 - memory leak

* Fix CID 403587 - use after free

* Fix CID 403585 - memory leak

* Fix CID 402981 - memory leak

* Fix CID 402915 - memory leak

* Fix CID 402914 - memory leak

* Fix CID 402911 - memory leak

* Fix CID 402910 - memory leak

* Fix CID 401662 - memory leak

* Fix CID 401542 - resource leak

* Fix CID 400949 - memory leak

* Fix CID 400948 - memory leak
2023-02-02 08:59:07 +08:00
rizan21
cc18d675e6 Use clang-format 15 instead of 14 2023-01-25 22:02:26 +08:00
Riccardo Schirone
e933003b5b
librz: do not duplicate plugins (#3313)
* librz: do not duplicate plugins

Plugins structures are statically defined at the file scope and not
dynamically allocated. Plugins should not allocate them either as
RzLibPlugin keeps a reference to them anyway.
2023-01-23 12:51:09 +00:00
Riccardo Schirone
c4767cf1ac
Fix plugin removal and clean code (#3277)
* cmd: Fix summary of few "L" sub-commands
* util: start decluttering plugins handling

- Add Doxygen docs
- Remove unused API functions and make others internal only
- Use RzLibType enum for plugin type instead of int

* util: move dlopen/dlsym/dlclose to rz_sys
* util: make rz_lib_open/close return bool
* util: simplify rz_lib_add_handler and rz_lib_open*
* libs: implement rz_*_plugin_del to remove a plugin
* core: remove commands from RzCmd when removing plugins
* librz: call plugins 'fini' method when removing a plugin
* core/cmd: do not fail if the hashmap removal fails

When removing a group command, the inner command might have the same
name, thus it would result in trying to remove the same name twice.
Ignore it, as it is fine.

* librz: make RzCrypto plugins handling like the others
* librz/crypto: add rz_crypto_reset and use it
* librz: allocate the plugin structures before adding them
2023-01-16 13:32:46 +01:00
Florian Märkl
0acc7f11a1 Set dbg->bits in debug_dmp
This fixes the last tests in db/formats/dmp on OpenBSD/sparc64.
2023-01-15 19:01:18 +01:00
Florian Märkl
e40d9a6cf3 Fix dmp reg profile depending on host bitness
dbg->bits was checked in reg/windows_arm64.h, but when returning the reg
profile from the dmp plugin, this (deprecated) variable held the host
value when 64 was expected.
So it is better to move this check to the respective points where the
profile file is included.
2023-01-15 19:01:18 +01:00
Florian Märkl
1b4385e224
Make xnu reg profile depend on cpu type instead of RzDebug.bits (#3270)
RzDebug.bits often has nonsensical contents set from all kinds of
places. Specifically, when debugging fat binaries on arm64, it had a
value not matching the debuggee when the reg profile was loaded,
resulting in the arm32 profile being used.
The right way to determine the profile is to do it after attach, when
the cpu type of the debuggee is known.
2023-01-07 17:43:41 +01:00
Giovanni
55e690990b
Fix endianness for win pagedump and winkd (#3204) 2022-12-09 11:41:28 +01:00
wargio
1165b20ee7 arch name is always set in debug native even when the arch is unknown 2022-12-06 10:07:38 +08:00
wargio
bc5eb09782 Removed rzbochs 2022-12-04 16:53:58 +01:00
wargio
a3b8ed48b7 Remove esil debugger since it is a big todo 2022-12-04 16:53:58 +01:00
wargio
f137f983a7 Remove unimplemented methods in debug 2022-12-04 16:53:58 +01:00
wargio
18a4cb5582 Rewrite of bochs debugger and io plugin 2022-12-04 16:53:58 +01:00