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.
- 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.
* 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
* 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.
* 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.
- 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 *)`
- Add tcache heap heuristics
- Fetch glibc version from libc
- Add unit testcases for glibc version
Co-authored-by: Giridhar Prasath R <giridh1337@gmail.com>
* 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
Adds /*<type>*/ comments and a linter check from rz-bindgen to enforce
their existence and consistency
Also includes the following fixes made when adding the annotations:
* removed unused intern_table arguments in pyc_dis.c, pyc_dis.h, asm_pyc.c
* removed unused classes argument from place_nodes in agraph.c
* removed unused recurse and recurse_bb functions in canalysis.c
* removed unused vars field from RzPrint struct
* removed unused RzAnalysisType* structs from rz_analysis.h
* removed unused list field from RzEgg struct
* fixed bug in bp_plugin.c where duplication-checking logic iterates over the wrong list
* removed unused q_regs field from RzDebug struct
* removed unused backtrace field from RzDebugPlugin struct
* removed unused classes_list field from RzBinNXOObj struct
* removed unused methods_list and classes_list fields from RzBinZimgObj struct
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.
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
If the kernel/system where Rizin is currently run does not support
ptrace(PTRACE_GETREGSET, ..., NT_X86_XSTATE, ...), ENODEV is returned by
the kernel. In such cases, we print the error message once and never
execute the ptrace call again, assuming it is not supported.
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
In practice, dbg.bpsize was always automatically set to
rz_bp_size(core->dbg->bp, core->analysis->bits) whenever the global bits
changed. But this breaks as soon as different bits are needed for where
the breakpoint is supposed to be set vs. the current value of asm.bits
(for example for thumb/arm32).
So this removes the global bpsize and always calculates it for the
specific breakpoint address.
As a sidenote, dbg.bpsize was not even used for manual db (for dcu it
was though).
This was holding the name of a "current" register that was awkwardly set
during register printing, to then be used for setting in visual mode.
The features make sense, but it's too confusingly implemented to be
useful or stable.
* Logic for getting a register by role or name, whichever matches, moved
to RzReg (rz_reg_get_by_role_or_name)
* Removed rz_debug_reg_err() because it's unnecessary
* Added rz_core_reg_getv_by_role_or_name() and
rz_core_reg_aetv_by_role_or_name() to replace rz_debug_reg_get() for
for usage whenever it is not debug-specific.
* Fix function return type for `rz_debug_.*_wait` functions
* Use preprocessor condition to use `RzDebugReasonType` only for Windows
* Return `RzDebugReasonType` instead of `int` for `.*_wait` functions
* Use correct return values for wait functions in debug
* Migrate project from v5 to v6
* Add serialization for debug (RzDebug) instance (only for breakpoints as of now)
* Replace commit hash once the PR is merged into dev
* Add new namespaces added in v6
* Fix regression showing threads `rip` for `dpt` on Windows
* Improve `dpt` output
* Consider flags too when printing thread address
* Improve `RzCoreBind->getNameDelta` to use realname if `flags->realnames` is true
* Fix negative offsets
* Fix flagspace selection side-effects after calling `rz_core_bin_apply()` APIs
* Fix wrong register profile after attaching to a process with `dpa`
* Fix wrong base address when opening a process memory
* Fix wrong register profile after opening a process memory
* Implement `rz_debug_reg_profile_sync()`
* Fix diff tests