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

Refactor to use API in Visual Mode #4339

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from

Conversation

HN026
Copy link
Contributor

@HN026 HN026 commented Mar 6, 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 #382

...

librz/core/tui/visual.c Outdated Show resolved Hide resolved
@HN026
Copy link
Contributor Author

HN026 commented Mar 11, 2024

I've somewhat implemented switching to a basic block after I list the basic blocks in the function. I feel it's far from complete. I would really like more insights on this. @XVilka

@XVilka
Copy link
Member

XVilka commented Mar 11, 2024

I've somewhat implemented switching to a basic block after I list the basic blocks in the function. I feel it's far from complete. I would really like more insights on this. @XVilka

I think extracting and implementing ~... mode as an API would make more sense. Just like we extracted histogram creation with different options and data, the same could be done for the "search to navigate" "widget". Then you will be able to convert all of the s $(<command>~...) invocations ease.

@HN026
Copy link
Contributor Author

HN026 commented Mar 11, 2024

I've somewhat implemented switching to a basic block after I list the basic blocks in the function. I feel it's far from complete. I would really like more insights on this. @XVilka

I think extracting and implementing ~... mode as an API would make more sense. Just like we extracted histogram creation with different options and data, the same could be done for the "search to navigate" "widget". Then you will be able to convert all of the s $(<command>~...) invocations ease.

sure I will look into it, thanks

librz/core/core.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
@HN026
Copy link
Contributor Author

HN026 commented Mar 24, 2024

I'm not somehow able to get the output for afb~... but it works fine in the visual mode, can you help ? @XVilka

@HN026 HN026 requested a review from XVilka March 25, 2024 12:30
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.

../librz/core/canalysis.c:455: error: identifier expected

librz/core/canalysis.c Show resolved Hide resolved
librz/core/canalysis.c Outdated Show resolved Hide resolved
librz/core/core.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
librz/core/canalysis.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
librz/core/tui/visual.c Outdated Show resolved Hide resolved
@HN026 HN026 requested a review from XVilka March 26, 2024 14:47
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.

Much better. Maybe you could also convert vbT to use (almost) the same logic. It should help you to make those functions more general.

librz/util/str.c Outdated Show resolved Hide resolved
@HN026
Copy link
Contributor Author

HN026 commented Mar 26, 2024

Much better. Maybe you could also convert vbT to use (almost) the same logic. It should help you to make those functions more general.

Should I do that in this PR only ?

@XVilka
Copy link
Member

XVilka commented Mar 26, 2024

Much better. Maybe you could also convert vbT to use (almost) the same logic. It should help you to make those functions more general.

Should I do that in this PR only ?

I think it would be nice to do that in the same PR, yes.

@HN026 HN026 requested a review from XVilka March 31, 2024 09:50
@HN026 HN026 requested a review from wargio March 31, 2024 14:20
@@ -446,33 +451,40 @@ static void bb_info_print(RzCore *core, RzAnalysisFunction *fcn, RzAnalysisBlock
pj_ki(pj, "ninstr", bb->ninstr);
pj_kb(pj, "traced", bb->traced);
pj_end(pj);
char *json_str = rz_str_dup(pj_string(pj));
pj_free(pj);
rz_strbuf_append(buf, json_str);
break;
}
case RZ_OUTPUT_MODE_TABLE:
Copy link
Member

Choose a reason for hiding this comment

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

It broke tables output:

[XX] db/cmd/tables tables sum
RZ_NOPLUGINS=1 /Users/runner/bin/rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -eflirt.sigdb.load.system=false -eflirt.sigdb.load.home=false -N -Qc 's main
af
afbt
afbt:fancy
afbt:size/sort/inc:simple
' bins/elf/hello_world
-- stdout
--- expected
+++ actual
@@ -1,17 +1,29 @@
-addr  size jump  fail  
------------------------
-0x7aa 92   0x844 0x806
-0x806 62   0x844 -1
-0x844 3    -1    -1
-.------------------------------.
-| addr  | size | jump  | fail  |
-)------------------------------(
-| 0x7aa | 92   | 0x844 | 0x806 |
-| 0x806 | 62   | 0x844 | -1    |
-| 0x844 | 3    | -1    | -1    |
-`------------------------------'
-addr  size jump  fail  
------------------------
-0x844 3    -1    -1
-0x806 62   0x844 -1
-0x7aa 92   0x844 0x806
+addr size jump fail 
+--------------------
+addr size jump fail 
+--------------------
+addr size jump fail 
+--------------------
+
+addr size jump fail 
+--------------------
+addr size jump fail 
+--------------------
+addr size jump fail 
+--------------------
+addr size jump fail 
+--------------------
+
+.---------------------------.
+| addr | size | jump | fail |
+)---------------------------(
+`---------------------------'
+addr size jump fail 
+--------------------
+addr size jump fail 
+--------------------
+addr size jump fail 
+--------------------
+
+addr size jump fail 
+--------------------

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure I will take a look on weekend and fix it, I had tried to fix it multiple times but it didn't help. On Weekend, I will try again.

@XVilka
Copy link
Member

XVilka commented May 26, 2024

Could you please finish this one?

@HN026
Copy link
Contributor Author

HN026 commented Jun 7, 2024

Could you please finish this one?

Sure thing, Will do it once my exams are done.

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