Commit graph

634 commits

Author SHA1 Message Date
billow
d0732c5c88 Update tests 2023-06-05 22:41:20 +08:00
wargio
8cfc86a82e Fix all tests and add aaC test 2023-06-01 23:16:09 +08:00
billow
c0154a26a0
Fix function arguments augmentation with DWARF (#3530)
* Add `VariableKind` to Dwarf `Variable`
* Refactor `rz_analysis_dwarf_integrate_functions`
* Add `RzAnalysisVarKind` to `RzAnalysisVar`
* Add function parameters tests for x86, ARM, Tricore
2023-05-30 16:40:09 +08:00
Anton Kochkov
e924ea7f11
Remove incomplete ESIL support for RSP (#3531) 2023-05-26 14:36:00 +08:00
billow
9497f711eb
Add project migrate v12 (#3515)
* Revert rzdb change in 59f32b6db8
* Add `rz_project_migrate_v11_v12` and integration test
* Add v12 rzdb
2023-05-17 06:28:39 +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
billow
da84bb0029
Refactor disasm.c color (#3514)
* Refactor `disasm.c` color
* Fix `ds_print_dwarf`
* Fix `ds_show_functions`
* Fix `ds_init_theme`
* Flush cons when `DEBUGGER`
* Fix tests
2023-05-16 10:27:06 +08:00
Anton Kochkov
c7c42afb61
Remove incomplete ESIL support for WASM (#3497) 2023-05-04 16:33:39 +08:00
Giovanni
59080758fb
Split bin field from class fields and fix demangling on java (#3479)
* Split Bin Field from Class fields.
* Fix tests and plugins
2023-04-26 15:25:42 +08:00
Giovanni
15c35ce974
Convert ps to newshell (#3451) 2023-04-06 08:43:04 +08:00
Riccardo Schirone
10f7f1f92a db/cmd/cmd_r: do not hardcode the fd num 2023-04-05 17:15:52 +08:00
Riccardo Schirone
e28345946a util: fix resize of mmap-ed files
When resizing files through `r` commands, although the buffers seemed to
be resized while the file was opened, the files were not really
truncated. Thus when re-opening the written file, no actual change was
made.
2023-04-05 17:15:52 +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
2762beba68 Support BE platforms in value range search 2023-03-24 15:40:20 +08:00
Florian Märkl
8c9568e733 Add analysis for Objective-C selector stubs
aalo is renamed to aalor to make room for the new aalos command, which
analyzes the __objc_stubs section and assigns names to all detected
selector stubs there. The stub patterns currently supported are all that
are hardcoded in ld64 version 820.
This analysis is also run automatically in aaa if the binary is detected
to potentially having such stubs.
To cleanly rename functions which have been created previously at
unnamed stub locations, rz_core_analysis_function_rename() has been
enhanced to not leave behind flags called fcn.0x<offset>.
2023-03-21 19:33:49 +01:00
Riccardo Schirone
c9d6ad9ee6
io: return error when reading/writing to unmapped memory (#3323)
* core: 'wow' command was replaced with 'wb'

* io: on_map_skyline returns false when nothing was done

Before this patch on_map_skyline returned true even when the callback
was not called on any part of the skyline. In other words,
reading/writing to an unmapped memory returned true.

This commit changes the behaviour to return false in those cases.

* analysis/esil: mem_read/mem_write were alway returning true

* use o malloc instead of oC

* librz: deal with seek errors
2023-02-11 11:36:27 +01:00
Riccardo Schirone
505bc3da7e tests/db: fix wrong tests using nonexisting eval/cmd 2023-02-09 08:44:53 +08:00
Anton Kochkov
5d7335c8b6
Add some missing Windows types (#3347) 2023-02-05 14:27:43 +08:00
Anton Kochkov
5082c1f0e8 Convert p= commands to rzshell 2023-01-31 08:27:30 +08:00
Giovanni
c3f9d4c1d3
Fix #2859 - Use minstring in all bin plugins (#3328)
* Do not hardcode min string size for bins using `rz_bin_file_strings()`
* Fix rz-bin to set properly `bin.[min|max]str`
* Add and fix tests
2023-01-30 18:38:08 +08:00
Riccardo Schirone
d6c586bc3b
core: replace 'it' with 'iT' (#3320)
`it` is the table mode of the `i` command, thus leave it available and
use `iT` instead.
2023-01-26 16:01:06 +08:00
Anton Kochkov
38a909738c
Convert pC commands to rzshell (#3213) 2023-01-23 17:54:52 +08:00
Giovanni
7af1353166
Use proper methods to detect strings in analysis loop. (#3284) 2023-01-20 12:02:10 +08:00
Florian Märkl
7c6579a614 Fix asm.bits-dependent open tests
Passing arch and bits as args instead of commands ensures they take
effect earlier. This fixes these tests on platforms where the default
asm.bits is 32.
2023-01-15 19:01:18 +01:00
Florian Märkl
953a81afc0
Make afs respect the cc (Fix #3291) (#3292)
Applying a function signature with afs to a function was using a
combination of the existing args and wrong stack addresses to apply the
args to function variables. This generally resulted in incorrect
locations. Instead, we now use the info from the cc.
2023-01-15 13:40:14 +01:00
Giovanni
4a9740d11d
Fix pxj output (#3290) 2023-01-14 14:14:34 +08:00
Giovanni
3edb12c2d2
Temporary fix for the meta strings (#3283)
* Temporary fix for the meta strings
* Fix unit test
* Added test for Csl with raw binary
2023-01-11 12:31:49 +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
01a82490d7 Raise timeout for some aez tests
On some platforms, the rizin startup itself takes multiple seconds,
which can make these tests timeout even if they would otherwise work.
2023-01-09 10:26:30 +08:00
Giovanni
2c91585125
Fix wrong subvar in json (#3263) 2023-01-03 16:53:03 +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
Peiwei Hu
276306b587
Add search.case_sensitive for grep case-sensitive/insensitive (#3241) 2022-12-28 09:38:32 +08:00
Florian Märkl
13cd3942d1
Rewrite stack pointer tracking and storage (#3207)
The stack pointer was previously already tracked during analysis for
variables and their accesses, but not stored in any sensible form for
further use. RzAnalysisBlock.stackptr and parent_stackptr were used in
some places, but they had no evident meaning.
Now we store the sp at the entry of a basic block and the difference
from that for every instruction inside the block to allow for efficient
querying of the sp value at arbitrary analyzed addresses.
RzAnalysisFunction.stackptr is now deprecated as its previous use was
primarily as a temporary accumulator, which is now handled locally, but
full removal of it would go beyond the scope here.

asm.stackptr visualizes both the absolute sp value and the delta of each
instruction in disassembly.

Changes in librz/analysis/p fix some test cases with the new tracking.

Introduces project version v10 with sp_entry/sp_delta instead of
stackptr/parent_stackptr.
2022-12-23 15:01:15 +01:00
Riccardo Schirone
f64ef48277 test: fix 'core: ' message in help log error 2022-12-19 11:46:18 +01:00
Anton Kochkov
1d3fbac74a
Add Nord color theme (#3250) 2022-12-18 11:48:15 +08:00
Anton Kochkov
dcaf3ecd69
Add Mars color theme (#3252) 2022-12-17 20:25:41 +08:00
wargio
d7f793bb6f Fix endianness in analysis mips.gnu plugin 2022-12-06 07:51:33 +08:00
Giovanni
89717b141c
Fix wB test due broken pv1 (#3225) 2022-12-06 06:50:19 +08:00
Giovanni
e7e2156eed
Do not load sigdb from system and home when running rz-test (#3222) 2022-12-05 02:51:36 +01:00
wargio
a3b8ed48b7 Remove esil debugger since it is a big todo 2022-12-04 16:53:58 +01:00
Dhruv Maroo
ce80a13aed
x86 RzIL uplifting (#2747) 2022-11-28 09:33:19 +08:00
Anton Kochkov
70a7016d97
Convert p- commands to rzshell (#3198) 2022-11-22 23:46:40 +08:00
Anton Kochkov
f2ca09fe24
Extract histograms and bars into RzCons (#3189) 2022-11-17 14:41:50 +01:00
Florian Märkl
3f077bce4a Remove deprecated rz_analysis_var_all_list()
This function only did a needlessly inefficient clone of
RzAnalysisFunction.vars, which can also be iterated directly.
Test differences are from different ordering of variables iterated, but
both are fine as there was no deliberate order before either.
2022-11-04 16:24:50 +01:00
wargio
b59d9a03b2 Fix test 2022-11-02 00:53:54 +01:00
wargio
2b3c6b5102 Updated all tests 2022-11-01 10:58:16 +08:00
OGRE
3f6a8d54ba
Replace " with ' in ag* dot command (#3133) 2022-10-28 08:34:30 +08:00
wargio
da68d2507a Fix tests 2022-10-26 21:46:22 +02:00
Giovanni
3e5217456d
Fix mdmp endianness (#3126)
* MiniDmpHeader & MiniDmpLocDescr32/64 & MiniDmpMemDescr32/64

* MiniDmpException & MiniDmpExcStream

* MiniDmpModule

* MiniDmpThread & MiniDmpThreadList

* MiniDmpThreadEx & MiniDmpThreadExList

* Removed struct minidump_string

* MiniDmpDir

* MiniDmpExcPointers & MiniDmpExcInfo & MiniDmpFuncTableDescr

* MiniDmpFuncTableStream & MiniDmpHandleDataStream

* MiniDmpExcRecord & MiniDmpHandleDescr/2

* MiniDmpHandleObjInfo

* MiniDmpMemList64 & MiniDmpMemDescr64 (init)

* MiniDmpMemInfo & MiniDmpMemInfoList

* MiniDmpMiscInfo

* MiniDmpMiscInfo2

* MiniDmpSysInfo

* MiniDmpThreadInfoList & MiniDmpThreadInfo

* MiniDmpTokenInfo & MiniDmpTokenInfoList

* MiniDmpUnloadedModule & MiniDmpUnloadedModuleList

* MiniDmpUserStream & MiniDmpUserStreamInfo

* MiniDmpIncludeThreadCallback

* MiniDmpModuleCallback

* MiniDmpIncludeModuleCallback

* MiniDmpIOCallback

* MiniDmpReadMemoryFailureCallback

* MiniDmpCallbackOutput

* AVRFBacktraceInfo & AVRFHandleOp & MiniDmpHandleOpList

* MiniDmpObj
2022-10-25 09:37:05 +08:00
Giovanni
64a9459ea4
Fix flirt detection when function size is less than 32 bytes (#3118) 2022-10-23 16:34:43 +02:00