* Rename functions properly and ensure to remove the old flags.
* Rename flag instead of deleting it
* When renamed, the flags are not set in the right flag space.
This reverts commit bf39802452b7545551f52c4c32f8c01764ab2a75.
asm.cmt.esil was handled in a somewhat peculiar way, printing below the
disassembly if asm.cmt.right=0, even though every other comment is
printed above. Now it is more in line with all other commenting and the
new asm.cmt.il works in the same way.
* Changed behavior of `f` to only add flag if there is none
* Changed behavior of `f+` to add flag in any case
* Moved listing subcommands from `f` to `fl`
* Moved listing subcommands from `f.` to `f.l`
* Added subcommand `f.l*` to list all local flags in all functions
* Listing flags at the current offset became `fl.`
* Moved `f=` to `fl=`
* Old `fl` (flag length) now became `fL`
* Removed original `fe` commands
* Old `f?` (check if flag exists) now became `fe`
* Removed `fV` commands
* Removed `fn` commands in favor of `fl` and `asm.flags.real=true`
* Removed `fS` commands (`fSo` and `fSn`)
* `fo` became `fortune` and moved from "flags" to "shell" category
* Removed oldshell handlers of the `z` commands
RzAnalysisILVM wraps around the low-level RzILVM and enables emulation
of real code from disassembly, rather than raw IL.
Analysis plugins now don't actively initialize the vm anymore, but
return a fully declarative description RzAnalysisILConfig of how to set
up the vm and optionally its initial state.
This also enables multiple IL vms to exist at the same time as plugins
can not mess with the global vm anymore. See the added integration test
for an example.
* removal of `omo` command
* use of `oml`, `oml.` and `oml=` to list maps instead of `om`
* removal of RIZIN output from `oml`
* removal of `omn.` and just assume `omn` uses core->offset
Plugins do not create register-based variables themselves anymore, but
they are derived from the register profile. However not all registers
may be bound and not all variables may be actual registers. The concrete
relations between an RzILVM and registers is described by an
RzILRegBinding object. It is simply a list of register names and
variables are created of the same names. When stepping with aezs, the
registers are synchronized automatically. From now on, aezv is primarily
useful for debugging, but interacting with emulation from the user side
should be done with ar.
Previously, `fs+ myname` would use the flagspace " myname" with a
leading space. This made .arf inconsistent with setting regs-flags from
C and the syntax `fs+myname` would not be allowed in the future with
newshell anyway.
Add pac and sig creation with options & compression via commands and via new rz-sign
Add missing arch (arc, pic, riscv, spc700 xtensa, and more)
Side note:
on other tools public functions and references are generated in a sequential
way besides the first one which is the first to be assigned.
since we do not search for sequential references, then we can avoid to
add extra public or referenced functions
Extra:
* Refactoring rz_analysis_mask definition
* Add rz_str_startswith_const and rz_list_iter_get_next_data
ESIL Pins were an untested feature to run a command when emulation hit a
specific address. This can be solved in other ways, e.g. scripting.
Project version 7 has been introduced for this change.
* Show group-level details of commands
Details can be defined at either a group command or its subcommand of
the same name. If define on group-level it will also be shown in the
group help without needing ??.
* Fix > $ redirection for errored command and leak
* Rewrite ar and dr commands with newshell
Breaking changes:
ar* => arf, ar- => arf-, ar. => ar*
ar, => art, ar? => arq
ar0 => ara0, arb => arab, ars => araS
arC => arpC
arn => arR
art => arT
arf => arF
Removed: drm, aer
* Remove o-*h because it was the same as o--
* Remove o-! because not used
* Remove unread test case because it was not doing anything (o-fd did
not work)
* Refactor `rz_core_theme_nextpal()`
* Add tests for `ecp`, `ecn` and `ecoj`
* Add braces to avoid declaration after the label
* Use `RzCmdStateOutput` in `eco`
* Fix the output of the test for `ecoj`
* Introduce `RzConsPalSeekMode` and refactor `nextpal_item`
* Rename the APIs related to themes
* Rename `rz_core_get_theme` to `rz_core_theme_get`
* Rename `rz_core_load_theme` to `rz_core_theme_load`
* Rename `rz_core_list_themes` to `rz_core_theme_list`
* Add `curtheme` to `RzCore`
* Eliminate all global variables in cmd_eval.c
* Put the loop outside the `switch` in
`rz_cmd_eval_color_load_theme_handler`
* Remove `getNext` variable and use the `RzListIter`'s `p` variable
* Sort the list of loadable themes
* Use a normal `strcmp` as the comparator function while sorting themes
* Convert `ec` to the rzshell
* Port the `echo` command
* Make the `color` argument optional for `ecHw`
* Remove `rz_core_echo`
* Make `echo` a part of `e` commands
* Add tests for `eco` and `ecHw`
* Move the definition of `bool2status` to `cmd_eval.c`
* Fix `ecHj` and add a test for it
* Rename `rz_str_escape_latin1()` to `rz_str_escape_8bit()`
* test_serialize_analysis.c: Change string from "latin1" to "8bit"
* `bin.str.enc`: Rename `latin1` to the more generic `8bit`
* Do not escape strings during the search
* Port `C` (metainformation) commands to the rzshell
* Improve string autodetection
* Remove `Cr` and RZ_META_TYPE_RUN
* Escape `\x1b` as `\e` character in strings
* Move string encoding options to `RzStrEncOptions` struct
* Add `esc_double_quotes` option to `RzStrEncOptions`
* Do not filter out unprintable characters for uppercase check
* Use `esc_double_quotes` when printing the string between '"' in disasm
* Use signed chars on all platforms/architectures
Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
The new intermediate language is based on the BAP (Binary Analysis Platform) Core Theory.
It operates on SMT-like bitvectors and their arrays to represent values and memory.
Apart from that, it has also representation for the data and code side effects.
* Rewrite PDB parser to become endianess-independent
* Use type pretty-printing API
* Use `RzCmdStateOutput` instead of `RzOutputMode` to solve invalid JSON issue
* Move PDB-related print functions to `cpdb.c`
* Use flag API instead of calling commands from the code
* Separate printing from parsing and applying the type information
* Delete useless `main.c`
* Add `db` commands in `cmd_debug.yaml`
* Use bool instead of int as return value
* Port `db` commands to newshell
* Fix integration tests. Use `db- <addr>`, instead of `db-<addr>`
* Fix `dbW` handler and update `rz_w32_add_winmsg_breakpoint`
* Remove checks for `argc` in `cmd_debug.c` (from review)
* Fix failing Windows tests
* Change control flow in conditional expressions
* Use `RzCmdStateOutput` in handler for `dbt` to print backtrace in various formats
* Use forward slash (/) instead of pipe (|) for command descriptions
* Use output modes for printing breakpoints in `db` handler
* Remove extra newline while printing breakpoints in JSON format
* Change description for `dbc` command
* Update descriptions and handlers; Remove <addr> argument wherever necessary
* Use `RZ_CMD_ARG_TYPE_CHOICES` for perm in `dbw`
* Add details for `dbC` and `dbw`
* Add quiet printing mode for breakpoints
* Remove unnecessary <addr> argument for `db` commands
* Also add a quiet output mode for `dbl` and `dbt`
* Return if no breakpoint found in function `add_breakpoint`
* Update tests for new `db` commands
* Update `db` command descriptions
* Remove `dbi.` redundant command
* Add details for iterating through the list of breakpoints
* Extract `rz_debug_bp_add_noreturn_func` into `debug.c` as RZ_API
* Fix `dbil` handler and `dbg_bps` test
* Shift the noreturn function breakpoint to `cdebug.c`
* Format according to clang-format
* Fix failing integration tests
* TODO: Find why `db- @@c:dblq` is failing, and fix the bug
* Update `db` commands
* Use `db- @@c:dblq` instead of `db-*`
* This will also work as a test for command edits (see https://github.com/rizinorg/rizin/pull/1806)
* Use the numerical value string as parameter of `rz_core_debug_reg_set()`
* Add test for changing rflags using dr
* Add test for changing rflags using ar
* Replace `rz_type_db_base_type_as_string` with `rz_type_db_base_type_as_pretty_string`
* Use the new type pretty printing API to pretty print base types
* Add option to return newline terminated string by pretty printing API
* Add `RZ_TYPE_PRINT_END_NEWLINE` option to RzTypePrintOpts
* Improve printing in cases of empty structs/unions/enums
* Initially, the separator was printed between the curly breaces
irrespective of whether the struct/union/enum is empty. Now the
separator is not printed if the given type is empty
* Add pretty printing support for typedefs
* Also, add another type printing option to show typedefs. To be used in
`rz_cores_types_typedef_as_c`
* Refactor `.*_as_c` functions to use the new type pretty printing API
* Add tests for typedef and `unknown_t` for pretty printing API
* Add `rz_type_db_base_type_as_string` back. Update tests.
* Use ternary operator to make expression more concise
* Add doxygen documentation for `rz_type_db_base_type_as_string`
* Use `rz_vector_len` to determine if empty, instead of convoluted logic
* Remove redundant `RZ_NONNULL` for RzTypeDB
* Fix integration tests for type printing
* Update Doxygen documentation
* Fix failint enum printing itegration tests
* Fix according to clang-format
* Added demangling as plugins and libdemangle as external dependency
* Added iDl to return the list of demanglers
* moved demangling tests into rz-libdemangle and keep only bin tests
* Add function to check if a register is a system register
* Only checks for ARM64 system registers as of now
* Check for system registers in ARM64 when printing registers using "dr"
* Does not completely remove the unnecessary register, but removes a
huge number of useless registers printed by "dr"
* Rename `RZ_REG_TYPE_ALL` to `RZ_REG_TYPE_ANY`
* ADd register types for "sys" and "pauth": `RZ_REG_TYPE_SYS` and
`RZ_REG_TYPE_PAUTH` respectively
* Remove `rz_reg_is_system_reg`
* Add `sys` and `pauth` register profiles
* Update debug tests to account for new arenas and register profiles
* REplace "pauth" with "sec" reg profile
* Update integration tests to account for new register profiles: `sys`, `sec`
* 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
* Refactored string search
string search logic moved from librz/bin/bfile.c to
librz/util/str_search.c
* UTF-16BE and UTF-32BE support
* Decoupled rz_str_search with rz_bin
* Changed parameter order in rz_scan_strings
* Fixed needle reset in rz_string_search
Now when the string search fails, needle is restored to original_needle+1,
i.e., we continue the searching process starting from the next byte.
* Changed heuristic for UTF BE detection
one more byte in for the detection (6 instead of 5)
* Fixed unit test in str_search
* Refactored rz_scan_strings and better UTF16-LE and UTF16-BE detection
Now if there is an ambiguity between UTF16-LE and UTF16-BE, we take the
longest one.
* Changed UTF BE heuristic
If there is any ambiguity about big-endian or little-endian, always
choose little endian
* Small format fixes in str_search
* Added preferred endianess switch in RzUtilStrScanOptions
* Fixed str_search regression tests
* Start to create some RzBinObject specific API
Adding some unit tests
Fix for new relocs storage system
Fix test_bin unit test for oob-write
* Add `iA` command to newshell
Add `ie`/`iee` commands
Add support for `is`/`iE` commands
Add support for `ii` command
Add support for `il` command
Add support for `iM` command
Add support for `ir` command
Add support for `iS`/`iSS` commands
Add support for `iz` command
Add support for `i` command
Add support for `ic` command
Add support for `iC` command
Add support for `ih` and `iHH` commands
Add support for `iI` command
Add support for `iL` command
Fix descriptions of commands already converted
Add support for `idp` commands
Add support for `iD` command
Add support for `im` commands
Add support for `iR` command
Add support for `it` command
Add support for `iV` commands
Add support for `iw` command
Add support for `ix` commands
Add support for `iZ` command
Add support for `ik` command
Add support for `is.` command
Add support for `iS.` command
Reduce arguments in print_arch
Few Doxygen and ownership annotations
Add support for `iS=` command
Add support for `izz` and `izzz` commands
Add support for `ib` command
Add support for `ic*` command
Put section flags as the last field of the table
* Proper language detection.
* Rewritten blang.c
* implemented `icc/icm/icf <class name>`
* ignore blocks when printing langs
Remove num from `iA` output
* Fixed flags on java and added class column
Add support for `ia` commands
Fix `iCj` command
* RzBin: add rz_bin_object_sections_mapping_list API
* Fix rz-bin for new API
Remove unused va var in rz-bin.c
Fix `iA`/`-A` output
* implemented classdump_cpp
* Support namespaces
Use `icc`, `icl` does not exist anymore
Update output of broken tests for `icc`
Add `rz_return_*()` asserts in new `*_print()` functions
* Provide rz_core_bin_print API
* Select which parts to print also based on the mode
* Return bool from all `rz_core_bin_*_print()` API
* Use RzBinFile in new `rz_core_bin_*_print()` API
* Restore `dbg_dmi` test
* Remove oldshell handlers for `i` commands
* Remove `ieq` call in rizin, not needed
* Allow NULL `bf` in `rz_cmd_info_handler()`
* Re-add support for RZ_BIN_PREFIX for symbols/sections/segments/imports/relocs
* Move `ib` command to `obR`
* Show 'N/A' in `i` command when info are not available
* Assert on bf->o, just to be sure
* Make error messages clearer in `idp` commands
Co-authored-by: wargio <wargio@libero.it>
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
* Fill `op->reg` for ARM64 `br`/`blr` analysis
* This fixes software single-stepping on `br`/`blr` instructions on ARM64
* Fill `op->reg` for ARM `bx`/`blx` analysis
* This fixes software single-stepping on `bx`/`blx` instructions on ARM
* Set `bx` as `RZ_ANALYSIS_OP_TYPE_RJMP`
* Fill `RzAnalysisValue->type`
* Use only `RzAnalysisValue` in `rz_core_link_stroff()`
* Fill `op->ireg/disp/scale` for ARM `ldr` analysis
* This fixes software single-stepping for `ldr pc` on ARM
* Fix riscv inverted src/dst values for store instructions
* Fix riscv analysis with buffer of size 2
* Add unit tests for `RzAnalysisOp` and `RzAnalysisValue`
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
* Add global var concept
* Doxygen & ownership & delete `delete_all` & argc check
* Use RBTree to manage the address of global variable
* Kill comment and access & use ht_pp_new
* Add unit test and regressions test
* Remove GlobalVarNode
* Implement global variable [de]serialization
* Moved `rz_cmd_state_output_array_start`
* Added complex type tests
* delete/get at or in address & convert type links to global variable & minor fix
* Remove `size` field
* Migration of typelinks to global var
* Use exists type parser
* Recover typelink unit test
- Removed oldshell version of `t` (types) commands
- Removed `tk` command because types storage switched to the hashtable
- Added `tfc` command to show the calling convention of the function or set it
- Added `tsl` (RZ_OUTPUT_MODE_LONG) to show structure members' sizes and offsets
- Added `tul` (RZ_OUTPUT_MODE_LONG) to show union members' sizes
- Switched the types storage to the hashtable instead of SDB
- Added load and export from/to SDB for standard type libraries and serialization for Projects
- Changed all `char *type` occurences to the proper `RzType`
- Added `RzCallable` type for the function/class method types
- Changed all function types API to use the `RzCallable` API
- Switched the function types (`RzCallable`) storage to the hashtable instead of SDB
- Added a connection between `RzAnalysisFunction` and `RzCallable` - `rz_analysis_function_derive_type()` API function to derive new `RzCallable` type from the `RzAnalysisFunction` even if it doesn't exist in the RzTypeDB.
- Moved type links to the RzAnalysis where they belong
- Removed TCC and MPC-based parsers
- Added Tree-Sitter-based parser for C grammar (see `librz/type/parser/*`)
- Reworked type databases in `librz/analysis/d/` to be consistent with C standard, libc, platform-specific definitions
- Switched the type links from `char *` to `RzType`
- Switched the type links from SDB to the hashtable
- Added concept of the "type paths", e.g. `a.b[20].c` where `b` is a member of `a` (`a` is either structure or a union) and `c` is a member of `b`, and `b` is an array where we take 20-th element.
- Added concept of the typeclasses (a bit similar to Haskell) for numerical types: `None` (the most generic one), `Num` (includes `Integral` and `Floating`), `Integral` (includes `Signed Integral` and `Unsigned Integral`), `Floating`.
- Added concept of type equality (`rz_types_equal(a, b)` API function)
- Added Doxygen documentation to every API function in the `librz/type/*`.
- Updated the project format from **V2** to **V3**, added migration.
* Reduce recursion when analyzing function control-flow
* Jump table refactoring
* Use rz_ prefix for the API
* Use struct instead of long parameter list
* Add `analysis.jmp.tblmax` to configure maximun amount of cases to analyze
* Remove recursion
* Use `RZ_CMD_ARG_TYPE_FILE` in all the `dir` tags for `dts`
* Convert `pg` commands to newshell
* Add cmd_print.yaml to the corresponding meson.build
* Add tests for `pgm`, `pg*` and `pg-*`
* Run cmd_descs_generate.py and update cmd_descs.c
* Added function diffing and graph diffing (json and dot only)
* Added tests for new functions and graph diffing
* diff graph more clear
* enforce same colors everywhere.
* using realsize for calculating function size
* renaming unconditional jump color name
* fixed memory issues and weird behaviour
* Implement `aLj` in cmd_analysis.c ##print ##json
* Replace `,` with a `:` in `Loj` json ##test
* Replace `L` and `Lj` with `Ll` and `Llj` ##test
* Add tests for rz plugin json cmds ##print ##json
* List BinLdrPlugins for `Lij` ##print ##json
* Add spaces to represent no authors for `Li` ##test
* Convert `L` and `Ll` to newshell
* Convert `La` and `Laj` to newshell
* Move `Ll` handler to `clang.c`, rename `La` handler ##print ##json
* Convert `Lc` to newshell ##print ##json
* Convert `Ld` cmd to newshell ##print ##json
* Add `Laq` cmd test ##test
* Convert `Lh` to newshell and fix `La` check ##print ##json
* Fix `Lh` and convert `Li` cmd to newshell ##print ##json
* Convert `Lo` to newshell and modify `Lh` ##print ##json ##test
* Convert `Lp` to newshell ##print ##json ##test
* Use newshell cmd for `aL` ##print ##json
* Fix `Li`, lowercase json properties, add tests ##print ##json ##test
* Fix `Ld` and add `Lds` to set dbg backend ##print ##json ##test
* Revert `oL` and `aL` and replace `Lds` with `Ld` ##print ##json
* Use newshell for `obL`
* Replace `lang->cb_printf` with `rz_cons_printf`
* Replace `bin->cb_printf` with `rz_cons_printf` ##print
* Use `rz_lang_list()` instead of cmd0 ##print
* Set `Lo` and `Loj` tests as broken ##test
* Introduce `rz_core_gadget_print` API to print gadgets
* Use the API at all instances where the rz_core_cmd was used
* Add a test and doxygen styled documentation for the API
old RzBinReloc.vaddr contained either the reloc address or
the target address, depending on how the bin was loaded.
Now there are two members and dedicated query function for each.
* Added authors and licenses and plugin access to crypto related files
* removed `rz_hash` and related files
* introduced `rz_msg_digest_*` with plugins
* updated all old methods with newer ones.
* added HMAC support to `rz-hash` (moved key option under `-K`)
* removed wrong algorithms on `woD`/`woE`
* fixed parity digest size
* fixed the behaviour on all hash functions
* added unit test for hash
* optimized code for HMAC key calculation
* removed hash legacy tests
* Refactoring rz-hash main, crypto interfaces and hashes
* ops. removed method that was removed later on
* fixed punycode oob read
* use RZ_ARRAY_SIZE instead of looking for null pointer
* Added broken flag on rz-hash -L test
* RzType introduction
* Move format processing to RzTypes from RzUtil
* Rename RzType to RzTypeDB
* Join RzType and RzAnalysis noreturn functions
* Add noreturn column in `aflt` output
* Remove D (disassembly) pf tests
* Fix `tn` test
* Add function noreturn serialization
* Modify meaningless type test
* Fix wrongly written `Cf` test
* Fix `za t` (zignature type) command
* Fix signature type test