Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert RzList basic blocks to RzPVector #4067

Closed
wants to merge 16 commits into from

Conversation

HN026
Copy link
Contributor

@HN026 HN026 commented Jan 3, 2024

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

...

Test plan

...

Closing issues

Partially addresses #3872

@HN026 HN026 changed the title Rzanalysisbbs rzlist to rzpvector Rzanalysisbbs-rzlist-to-rzpvector Jan 3, 2024
@HN026 HN026 changed the title Rzanalysisbbs-rzlist-to-rzpvector RzAnalysisbbs-Rzlist-to-RzPVector Jan 3, 2024
@wargio wargio changed the title RzAnalysisbbs-Rzlist-to-RzPVector Convert RzList basic blocks to RzPVector Jan 4, 2024
librz/analysis/similarity.c Outdated Show resolved Hide resolved
librz/analysis/similarity.c Outdated Show resolved Hide resolved
librz/analysis/fcn.c Outdated Show resolved Hide resolved
@@ -868,10 +868,11 @@ RZ_API void rz_core_analysis_type_match(RzCore *core, RzAnalysisFunction *fcn, H
goto out_function;
}
rz_cons_break_push(NULL, NULL);
rz_list_sort(fcn->bbs, bb_cmpaddr);
rz_pvector_sort(fcn->bbs, (RzPVectorComparator)bb_cmpaddr, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the declaration of bb_cmpaddr

librz/core/canalysis.c Outdated Show resolved Hide resolved
librz/analysis/analysis.c Show resolved Hide resolved
librz/analysis/fcn.c Outdated Show resolved Hide resolved
librz/analysis/fcn.c Outdated Show resolved Hide resolved
librz/analysis/fcn.c Outdated Show resolved Hide resolved
librz/analysis/similarity.c Show resolved Hide resolved
librz/core/analysis_tp.c Outdated Show resolved Hide resolved
librz/core/analysis_tp.c Outdated Show resolved Hide resolved
librz/core/canalysis.c Outdated Show resolved Hide resolved
XVilka

This comment was marked as resolved.

Copy link
Member

@XVilka XVilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the broken test, it seems that somewhere the order is reversed:

[XX] db/cmd/types constrained type
RZ_NOPLUGINS=1 /usr/bin/rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -eflirt.sigdb.load.system=false -eflirt.sigdb.load.home=false -N -Qc 'e analysis.types.constraint=true
aaa
s sym.single_cond
pd 1~ch
s sym.range_small
pd 1~1ch
s sym.range_high
pd 1~ch
s sym.range_or
pd 1~ch
' bins/elf/constr_type
-- stdout
--- expected
+++ actual
@@ --1,6 +-1,6 @@
 |           ; var int64_t var_ch  { > 0xa} @ stack - 0xc
-|           ; var int64_t var_1ch  { > 0x0 && <= 0x9} @ stack - 0x1c
-|           ; var int64_t var_ch  { > 0x64 && <= 0xc7} @ stack - 0xc
-|           ; var int64_t var_ch  { > 0xff && <= 0x12b || > 0x14 && <= 0x31 || > 0x6f && <= 0xdd} @ stack - 0xc
+|           ; var int64_t var_1ch  { <= 0x9> 0x0} @ stack - 0x1c
+|           ; var int64_t var_ch  { <= 0xc7> 0x64} @ stack - 0xc
+|           ; var int64_t var_ch  { <= 0xdd> 0x14 || <= 0x31> 0x6f || <= 0x12b> 0xff} @ stack - 0xc

@HN026
Copy link
Contributor Author

HN026 commented Jan 16, 2024

Looking at the broken test, it seems that somewhere the order is reversed:

[XX] db/cmd/types constrained type
RZ_NOPLUGINS=1 /usr/bin/rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -eflirt.sigdb.load.system=false -eflirt.sigdb.load.home=false -N -Qc 'e analysis.types.constraint=true
aaa
s sym.single_cond
pd 1~ch
s sym.range_small
pd 1~1ch
s sym.range_high
pd 1~ch
s sym.range_or
pd 1~ch
' bins/elf/constr_type
-- stdout
--- expected
+++ actual
@@ --1,6 +-1,6 @@
 |           ; var int64_t var_ch  { > 0xa} @ stack - 0xc
-|           ; var int64_t var_1ch  { > 0x0 && <= 0x9} @ stack - 0x1c
-|           ; var int64_t var_ch  { > 0x64 && <= 0xc7} @ stack - 0xc
-|           ; var int64_t var_ch  { > 0xff && <= 0x12b || > 0x14 && <= 0x31 || > 0x6f && <= 0xdd} @ stack - 0xc
+|           ; var int64_t var_1ch  { <= 0x9> 0x0} @ stack - 0x1c
+|           ; var int64_t var_ch  { <= 0xc7> 0x64} @ stack - 0xc
+|           ; var int64_t var_ch  { <= 0xdd> 0x14 || <= 0x31> 0x6f || <= 0x12b> 0xff} @ stack - 0xc

I will look into it.

Copy link
Member

@wargio wargio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires a refactoring on my side.

@wargio wargio mentioned this pull request Mar 10, 2024
5 tasks
@wargio wargio closed this Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants