Commit graph

140 commits

Author SHA1 Message Date
frmdstryr
c9fe729ce0
Make rz_core_analysis_var_display work with stack vars when debugging (#3687) 2023-07-28 01:40:22 +08:00
Hertatijanto Hartono
d1fd135df3 Reopening file should not be identified as an error 2023-07-25 11:02:11 +08:00
Anton Kochkov
d581fc2528
test: remove duplicate dbg.fds.count test (#3673) 2023-07-20 13:33:20 +08:00
billow
6eb14128ad
Adding tricore support for rz_debug_plugin_gdb (#3557) 2023-06-06 12:53:51 +08:00
billow
d0732c5c88 Update tests 2023-06-05 22:41:20 +08:00
billow
abfa59c1a1 Fix rz_core_file_reopen_debug 2023-05-24 08:49:05 +08:00
billow
59f32b6db8
Rename asm.dwarf* to asm.debuginfo* (#3513)
* Rename `asm.dwarf` to `asm.debuginfo`
* Rename members in `RzDisasmState`
* Improve `asm.debuginfo.*` descriptions
* Rename `ds_print_dwarf` -> `ds_print_debug` and refactor
* Fix tests
2023-05-16 10:55:18 +08:00
Khairul Azhar Kasmiran
20081eba44
Fix dbg_step test on Ubuntu 20.04 (#3503)
* Fix dbg_step test on Ubuntu 20.04
* Move r13 to separate line
2023-05-08 10:00:13 +08:00
Khairul Azhar Kasmiran
344b460f6e
dbg.follow: Follow when pc >= core->offset + dbg.follow (#3499) 2023-05-06 07:18:47 +08:00
Giovanni
15c35ce974
Convert ps to newshell (#3451) 2023-04-06 08:43:04 +08:00
brightprogrammer
16e722cffc
Replace rz_core_cmd0 calls in tui/panels.c and port cmd_help commands to RzShell as cmd_math (#3421) 2023-03-30 18:36:48 +08:00
Anton Kochkov
315ba643b0 Fix CI by making GAS test Linux x86-only 2023-02-22 17:42:39 +08:00
Anton Kochkov
fd64b7ee25 Convert pr commands to the rzshell 2023-02-02 08:21:09 +08:00
Florian Märkl
70c1a3e109
Fix some tests for platforms without native debugger (#3278) 2023-01-09 17:57:39 +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
Florian Märkl
d9950f7479
Replace bp/sp-vars by generic stack-based ones (#3167)
Variables on the stack are not identified by bp/sp+<offset> anymore, but
by their address from the bottom of the stack frame (RzStackAddr),
independent of how they are accessed.
So now there are only two kinds of variables: stack and register.

This required some major refactoring and other changes:
* RzAnalysisVar.isarg was removed. Whether a variable is an argument is
  now specified implicitly by its storage location.
* Varsub of struct fields had to be rewritten so fields can be queried
  by arbitrary stack addresses using the recently introduced sp
  tracking, as the old approach to fill a list with all fields would not
  work anymore.
* analysis.vars.stackname was removed, new behavior is more similar to
  this being true before.
* Variables will not be created at stack+0 now, because the return
  address is there. Before, vars were only created sometimes in such
  cases.
* Variables created from bp offsets in x86 are not deleted anymore if
  the function's bp_frame is false (see removed
  rz_analysis_function_delete_vars_by_kind(fcn,
  RZ_ANALYSIS_VAR_KIND_BPV); calls). This may lead to some
  false-positive detected variables. Whether this really is a practical
  issue is yet to be seen. At least there are no meaningful tests that
  are broken by this.
* Applying variables from dwarf needed some fixes for determining the
  correct stack locations of variables in order to write meaningful
  tests. The handling is still not entirely correct for all
  possibilities of dwarf info, but at least the changed/added test cases
  are right and serve as a reference for future changes.
* Projects version 11 is introduced.
* afvb commands have been removed, afvs now handles all stack vars.
2023-01-02 11:36:21 +08:00
wargio
a3b8ed48b7 Remove esil debugger since it is a big todo 2022-12-04 16:53:58 +01:00
Khairul Azhar Kasmiran
3ddbda0a9a
rz_heap_glibc.h: Add have_fastchunks member to RzHeap_MallocState_ structs (#3200)
* Add `have_fastchunks` member to `RzHeap_MallocState_` structs

* Show only last few lines of `dmh` output in "dmh allocated" test
2022-11-24 09:42:07 +08:00
Khairul Azhar Kasmiran
ea07efdfb8
Improve "dmh allocated" test (#3199) 2022-11-22 18:29:38 +01:00
Khairul Azhar Kasmiran
1b57ec3c2e
Make "dmi ld" test more robust to different ld (#3190) 2022-11-17 22:13:51 +08:00
Khairul Azhar Kasmiran
83eea37c4e
Make first dbg_dmh test invariant to r13 (#3188) 2022-11-16 21:36:13 +08:00
Khairul Azhar Kasmiran
935361e31b
Mask out ebx too in "Conditional dr/ar" test (#3183) 2022-11-13 14:51:33 +08:00
Khairul Azhar Kasmiran
315433d286
Make "dbg.px0" test invariant to ld (#3181) 2022-11-12 21:05:31 +08:00
Khairul Azhar Kasmiran
13a5aebea3
Make "debug stepback from callee" test invariant to env (#3179) 2022-11-12 00:28:07 +08:00
Khairul Azhar Kasmiran
5611bc3c79
Make dbg.stepback test invariant to env (#3176) 2022-11-10 19:32:08 +08:00
Khairul Azhar Kasmiran
2314f18063
Nop out calls_x64's printf call in some dbg_step and dbg_step_back tests (#3159) 2022-11-05 22:42:47 +08:00
wargio
2b3c6b5102 Updated all tests 2022-11-01 10:58:16 +08:00
Florian Märkl
68a06e69d2
Rewrite reading in io_mach (#3101)
The previous reading code was slow (performed too many
vm_region_recurse_64 calls) and broken, for example at boundaries of
memory maps. Details can be found in the code comments.
2022-10-17 09:15:59 +08:00
Anton Kochkov
4a037c2f2a
Convert dk commands to the rzshell (#3078) 2022-10-11 18:02:52 +08:00
Khairul Azhar Kasmiran
4cdad14ccd
Remove dk 9 from debug tests (#3070)
* Add `dk 9` test
2022-10-08 16:44:22 +08:00
Khairul Azhar Kasmiran
137d376f54
Kill debugged process on exit if non-interactive and dbg.exitkills is true (#3068) 2022-10-07 22:46:36 +08:00
Florian Märkl
2e8ec8ac75
Always detach when quitting from -q or -Q (#3058)
Previously, on macOS we were detaching properly when the user quit rizin
after an interactive `rz -d <file>` session, but not on
`rz -d -Qc <cmd> <file>`, which would leave behind a zombie process.
Now, the process is detached and keeps running, which also matches the
behavior on Linux. Hence the `dk 9` additions in the tests, to not
spoil the output with whatever the processes print.
2022-10-01 17:38:01 +02:00
Anton Kochkov
4bf6b67212
Convert dd commands to rzshell (#3049)
* Convert `dd` command to rzshell
* Remove unimplemented `dH` command
* Remove `ddt` command
* Move `date` command to the "shell" category
2022-09-29 08:24:50 +08:00
Giovanni
c89b12a046
Removed plenty of eprintfs in rz_core (#2950) 2022-08-29 00:32:17 +08:00
Riccardo Schirone
9ba89d8116 core/cmd: rewrite rz_cmd_macro API 2022-08-26 07:53:43 +08:00
wargio
0eef58115b Rewritten (partially) rz_run_parseline 2022-08-22 13:50:39 +02:00
Florian Märkl
e893d2fb66 Fix arm64 register access in xnu debugger
ARM_THREAD_STATE64 fetches arm_thread_state64_t but our struct was
arm_unified_thread_state_t, which adds a header. The pc in the register
profile was hacked to account for the shift, but all the x-regs were
not, so x7 had the value of x8 for example. Now we just use the specific
state for 32 or 64.
2022-08-07 19:22:40 +02:00
Florian Märkl
8681cdc43b Use cpu_type_t for checking xnu debuggee's arch
This fixes basic single-stepping on macOS/arm64.
dbg->bits is affected by all kinds of things going on in rizin, in
particular it currently randomly switches to 16 when calling pd during
an arm64 debug session, causing the stepping code to break.
We now fetch the cpu type of the process once during attach, similar to
how lldb does it. They also use 0 for the "invalid" value, so we do that
as well.
2022-08-07 19:22:40 +02:00
Florian Märkl
2525507152 Add tests for stepping and breakpoints on macOS/x86_64 2022-08-07 19:22:40 +02:00
Florian Märkl
1d88af3c56
Refactor and replace .dm* calls with pure C (#2847)
This fixes the following minor issues:
* Errors like "Cannot create flag (...) because there is already (...)
  flag" during debug startup
* Unnecessary seeks during .dm* causing io reads and e.g. delays of up
  to 5s on x86 macOS during debug startup
* Flags are now created in the "maps" flagspace, rather than globally,
  making them easier to clean up later
* Flags now have the same size as the maps and not +1
2022-07-28 13:40:44 +02:00
Florian Märkl
91e48624b5 Add very basic debug tests for macOS
The system.privilege.taskport change in CI could also be simplified without
having to manually edit a plist.
2022-07-17 20:31:32 +02:00
Peiwei Hu
8e6f7e1a78
Add hints for fe/f commands (#2785) 2022-07-07 22:27:26 +08:00
GustavoLCR
807c64de3e Fix missing rip reg flag for 32-bit binaries on Windows x86-64
* Always add `PC` register flag
* Fix `PC` highlighting when debugging 32-bit binaries in x64 Windows
* Add test
2022-06-17 21:15:59 +08:00
GustavoLCR
23a3468834 Fix register flag address not updating after dc 2022-06-17 21:15:59 +08:00
Riccardo Schirone
5e43ea2f97
RzCore: read core block before printing (#2694)
* RzCore: read core block before printing
* Add debug test for pd with dbH
2022-06-14 15:27:27 +00:00
billow
e767046197
Convert dL to rzshell (becomes dl) and expose API
- Convert `dL` to rzshell
- `dL` becomes `dl`
- Expose `rz_core_debug_backtraces()` API
- Expose `rz_core_analysis_hint_set_offset()` API
2022-05-13 20:17:56 +08:00
billow
457105f640
Convert do to rzshell (#2573)
* `doo` -> `ood`
* `doof` -> `oodf`
* expose `rz_core_debug_process_close()` API
2022-05-07 09:07:02 +08:00
Florian Märkl
b40dde5fbf
Move DEBUGGER checks from C to meson.build (#2577)
Entire files are now avoided to be built by checking in meson rather
than using #if DEBUGGER. This now also includes bsd_debug.c, which
is currently slightly broken on OpenBSD/sparc64 and caused compile
errors even with -Ddebugger=false.
2022-05-02 11:22:35 +02:00
Riccardo Schirone
272be57bcd
RzCore: default dbg.verbose to false (#2506)
Some messages printed by Rizin might be hard to decode at times. Just
stick to the basic information by default.
2022-04-06 01:28:15 +02:00
Rot127
10bedc2b00
Add Hexagon register profile (#2490)
Although the reg profile was not really used yet it will be relevant for the RZIL uplifting.
Introduces:
* Double/quadruple registers now properly overlap with their counterparts.
* Registers have correct types assigned (vec, ctr, sys etc. Before, all regs were of type gbr)
* Consistent register names (asm name style: c3:2, r31 etc, alias style: lc1:sa1, lr etc.)
* Adds _tmp registers in the profile. Later used by uplifted instructions (think of .new registers).
2022-04-03 18:26:17 +02:00