Commit graph

29 commits

Author SHA1 Message Date
wargio
fbad0b4859 Remove agd and add rz_analysis_similarity/match + refactoring
- Introduce the following new methods:
  * `rz_analysis_similarity_basic_block()`
  * `rz_analysis_similarity_function()`
  * `rz_analysis_similarity_basic_block_2()`
  * `rz_analysis_similarity_function_2()`
  * `rz_analysis_match_basic_blocks()`
  * `rz_analysis_match_functions()`
  * `rz_analysis_match_basic_blocks_2()`
  * `rz_analysis_match_functions_2()`
- Remove `RzAnalysisDiff` and its usages
- Remove `librz/analysis/diff.c` entirely to and adds `librz/analysis/similarity.c`
- Remove a lot of unused structures and simplified the code by a lot
- Fix typo in levenshtein
- Remove `librz/core/gdiff.c` and `gdiff` functions since they were unused or only used in rz-diff
- Remove `difftype` (or "color") from `RzANode` which lead to dead code
- Decrease serialized data in projects.
- Add `RzAnalysisVarKind` and `RzAnalysisVarType` and replaces all the hardcoded values
- Remove command `agd`
- Remove all `rz_core_gdiff` usages from `rz_core.h`
- Refactor `rz_analysis_var_list` and `rz_analysis_var_count` due unused argument (`RzAnalysis` was not used)
- Add new method `rz_analysis_var_count_total` to simplify some usages
- Remove `rz_core_graph_diff`
- Add `typedef RzAnalysisFcnType` on `enum``used for function types
- Remove unused `RZ_ANALYSIS_FCN_VARKIND_LOCAL`
- Remove from `RzAnalysisFunction` the following variables:
  * `fingerprint`
  * `fingerprint_size`
  * `diff`
  * `diff_ops`
  * `diff_thbb`
  * `diff_thfcn`
- Remove from `RzAnalysisBlock` the following variables:
  * `fingerprint`
  * `diff`
- Remove `RZ_ANALYSIS_THRESHOLDBB` and `RZ_ANALYSIS_THRESHOLDFCN`
- Remove the following callbacks from `RzAnalysisPlugin`
  * `RzAnalysisDiffBBCallback`
  * `RzAnalysisDiffFcnCallback`
  * `RzAnalysisDiffEvalCallback`
- Fix fancy table columns/rows when a color string is in a cell
- Bumped project version to 9
2022-10-04 20:02:35 +02:00
billow
46a1929397
Refactor rz_core_analysis_graph*() functions (#2949)
- fix `ags` and `agl` commands
- add more tests for the `ag` commands
- move graph related code to cgraph.c
- remove APIs `rz_core_print_bb_custom` `rz_core_print_bb_gml`
- exports
    - `rz_graph_drawable_to_json_str`
    - `rz_graph_drawable_to_cmd`
    - `rz_graph_drawable_to_gml`
    - `rz_core_graph`
    - `rz_core_graph_diff`
    - `rz_core_graph_format_from_string`
    - `rz_core_graph_type_from_string`
    - `rz_core_graph_write`
    - `create_agraph_from_graph_at`
- add unit/integration tests for the graph API
2022-08-29 22:48:23 +08:00
Riccardo Schirone
02a0b7a1ad core/cmd: just store RzCore reference instead of void *data 2022-08-26 07:53:43 +08:00
Riccardo Schirone
ac1b0e4d94
core/cmd: fix CHOICES argument selection between choices_cb/choices (#2932) 2022-08-18 20:10:13 +08:00
Riccardo Schirone
8939fdbd7d
Use add_global_arguments instead of passing cflags/ldflags all around (#2812)
See also 66a0e22293/docs/TESTING_WITH_SANITIZERS.md (clang)
2022-07-17 21:33:51 +08:00
Riccardo Schirone
1331474286 test: Use rz_file_tmpdir to have temporary dir 2022-07-17 12:11:13 +02:00
Giovanni
2e0d490d2f
Add RzBaseFindOpt for custom thread status callback (#2768) 2022-07-06 11:34:00 +02:00
Giovanni
f355dcf557
Add RzBinStrDb and api to interact with it via rz_bin_object_string_* (#2754)
* Add RzBinStrDb and api to interact with it via rz_bin_object_string_*
* use update instead of insert
* check for null deref in rz_analysis_set_stringrefs
* Never delete strings just add them and fixed comments
2022-07-01 06:34:41 +08:00
Giovanni
ea02b0d25f
Remove zignatures and move aaF[l] -> F[al] , zf[sdc] -> F[sdc] (#2682) 2022-06-29 07:49:43 +08:00
Giovanni
6f6ae6e019
Rename rz_arch to rz_platform (#2708) 2022-06-22 17:22:13 +02:00
Riccardo Schirone
6f8a59072c test: allow to run unit tests without installation 2022-05-10 16:57:44 +02:00
Riccardo Schirone
27e0d7ae82
RzBin: improve handling of addresses in ELF (#2591)
* RzBin/ELF: avoid the creation of useless flags at 0

Use UT64_MAX as an error value for addresses like symbols, imports,
sections, etc., and do not create flags for those because they are not
meaningful. This is useful for imports that do not have an address in
the virtual/file space and for non-alloc sections (e.g. .comment).
2022-05-10 10:17:35 +08:00
Riccardo Schirone
474effacc6 RzBin: add APIs to convert paddr/vaddr addresses based on binary info 2022-05-06 18:09:17 +02:00
Giovanni
f87025d1e8
Remove cb_printf() from RzBin (#2446)
* Remove `cb_printf()` from RzBin
* Removed `bin.rawstr` from `rz-bin`
* Dropping `izzz` since does the same as `izz`
* Fix PE one section executables
* Fix behaviour of BFLT, LE, and SMD bin plugins
2022-03-26 20:30:55 +08:00
Riccardo Schirone
7f19c8f867 Split unit and integration tests 2022-03-23 10:34:53 +01:00
Florian Märkl
f9e01ba07d [RzIL] Rewrite RzAnalysisRzil as RzAnalysisILVM with config
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.
2022-01-17 16:50:40 +01:00
Khairul Azhar Kasmiran
906ece4211
Add asan build for clang (#1910) 2021-11-17 21:02:02 +08:00
Riccardo Schirone
9c3e6c15b4 Add few unit tests for @ autocompletion 2021-10-27 09:31:50 +02:00
Giovanni
215113b49e
Fixed build warning (#1832) 2021-10-13 17:38:08 +02:00
Dhruv Maroo
a25ef4e9c6
Add rz_deflate* functions and save projects in compressed format (#1446) 2021-08-30 16:54:09 +08:00
Riccardo Schirone
dd38e70964
Add some SPDX headers (#1469)
* Add copyright and license to all librz/include/*.h files in dep5

* SPDX headers for most include files except bin/arch/debug

* Add SPDX headers in asm/arch/{8051,arm}

* Add SPDX header for shlr/gdb include files

* Add SPDX header for shlr/bochs include files

* Add SPDX header for librz/reg

* Add SPDX header for librz/debug/p/native/xnu

* Add SPDX header for librz/debug/p/native/windows

* Add SPDX header for librz/debug/p/native/reg include files

* Add SPDX header for librz/debug/p/native/maps include files

* Add SPDX header for librz/debug/p/native/linux include files
2021-08-17 18:27:03 +02:00
Alexis Ehret
1c7daaf12e
Modification of rz_buf_read* API (#1440)
* Small cleanup RzBuffer constructors
* Small cleanup RzBuffer methods
* Refactor rz_buf_read* for a better error handling
* Add documentation for RzBuffer API ##doc
2021-08-16 18:23:46 +08:00
Aswin C
93defcfb4b
Fix the broken integration test for CPU profiles (#1307)
* Use resource packing and fix the broken integration test for CPU profiles
* Use `sizeof` to calculate size and run `clang-format`
* Use `rz_file_temp` to create a temporary SDB file rather than manually naming it
2021-07-15 10:13:57 +02:00
Aswin C
dafa52b48b
RzArch: Fix clang-ci and Coverity warnings (#1302) 2021-07-13 10:15:11 +02:00
Aswin C
a07663a212
Add integration test for CPU and Platform profiles. (#1271)
* Add integration test and a fix Coverity scan issue

* Return `NULL` if `target->platforms` is `NULL` in
`rz_arch_platform_target_new`

* Move the call of the API which adds the flags/comments for both
CPU and platform profiles inside `rz_core_analysis_all()`.

* Use `rz_file_is_directory` instead of `rz_file_exists` for the
integration tests

* Use `RZ_SYS_DIR` on the path while checking for `.tmp` folder

* Add a comma at the end of the list on \`meson.build\`
2021-07-07 15:16:51 +08:00
Riccardo Schirone
28faeff9ef
Use rz_file_is_directory to check if the directory .tmp already exists (#1273)
* Use rz_file_is_directory to check if the directory .tmp already exists
* Update test/integration/test_open_analyse_save_load_project.c

Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2021-07-06 22:04:20 +08:00
Florian Märkl
d0c66d2724
Add Integration Test for RzBinVirtualFiles without RzCore (#1186) 2021-06-03 12:06:34 +08:00
Florian Märkl
b212b462d6 Clean up RzCoreFile 2021-05-01 20:41:29 +02:00
Anton Kochkov
80b41ed827 First integration test 2021-04-12 20:13:05 +08:00