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 ag to rzshell #2916

Merged
merged 56 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c2674dc
Convert `ag` commands to the rzshell
XVilka Jun 29, 2022
3646895
fix
imbillow Aug 13, 2022
7510c07
`agw`
imbillow Aug 13, 2022
344f748
x `rz_core_analysis_datarefs`
imbillow Aug 13, 2022
2492860
`rz_core_analysis_datarefs` -> `rz_core_analysis_datarefs`
imbillow Aug 14, 2022
225ef46
unify `rz_core_analysis_callgraph`
imbillow Aug 14, 2022
0ed0cff
fix
imbillow Aug 14, 2022
fdb0970
fix
imbillow Aug 14, 2022
06c99ab
fix
imbillow Aug 14, 2022
b0863c5
fix
imbillow Aug 14, 2022
75cc632
xxx
imbillow Aug 14, 2022
481404f
fix `agn` `agw`
imbillow Aug 14, 2022
4d68eea
fix
imbillow Aug 14, 2022
e455383
rename
imbillow Aug 14, 2022
334b100
fix tests command
imbillow Aug 14, 2022
0eb629f
fix `agd`
imbillow Aug 14, 2022
c9a1fdc
fix tests
imbillow Aug 14, 2022
35762e9
fix `agx`
imbillow Aug 14, 2022
b337d75
fix json tests
imbillow Aug 14, 2022
1407437
rename
imbillow Aug 14, 2022
be7998e
doxygen
imbillow Aug 14, 2022
63c89e5
fix leak
imbillow Aug 14, 2022
63a4a0a
cleanup comments
imbillow Aug 15, 2022
04fcd89
fix
imbillow Aug 15, 2022
bc69418
`graph_print` -> `rz_core_graph_print` as a RZ_IPI
imbillow Aug 16, 2022
b3daaa7
`choices`
imbillow Aug 18, 2022
2b0ecae
Compatible with previous commands?
imbillow Aug 18, 2022
2c306fe
remove `ag[jJkv?]` aliases
imbillow Aug 18, 2022
dee9041
fix `agw`
imbillow Aug 18, 2022
dbff561
Update librz/core/cmd/cmd_analysis.c
imbillow Aug 18, 2022
61aac7b
`short_opt`
imbillow Aug 18, 2022
17539a6
add test `aga multiple formats`
imbillow Aug 18, 2022
bb5b220
add test `agA multiple formats`
imbillow Aug 18, 2022
2701e09
fix
imbillow Aug 18, 2022
1d262eb
add test `ag[cd] multiple formats` and fix
imbillow Aug 18, 2022
ef5cb91
add test `agf multiple formats`
imbillow Aug 18, 2022
4c14081
add test `agr multiple formats`
imbillow Aug 18, 2022
7f57e60
add test `agx multiple formats`
imbillow Aug 18, 2022
d6e9a3d
fix
imbillow Aug 18, 2022
2e97a93
fix `agd` color
imbillow Aug 19, 2022
f18a408
fix
imbillow Aug 19, 2022
7952a9b
`strcmp`
imbillow Aug 19, 2022
3f8d45e
Apply suggestions from code review
imbillow Aug 19, 2022
0274567
Merge remote-tracking branch 'refs/remotes/origin/asan-fuzz-ag-rzshel…
imbillow Aug 19, 2022
363515e
apply suggestion
imbillow Aug 19, 2022
9760b61
Revert "fix"
imbillow Aug 19, 2022
099e144
fix
imbillow Aug 19, 2022
4f16503
fix
imbillow Aug 19, 2022
45487b6
remove test `ag[df] (dot|gml)`
imbillow Aug 19, 2022
775068d
choices
imbillow Aug 19, 2022
65e4288
Merge branch 'dev' into asan-fuzz-ag-rzshell
imbillow Aug 19, 2022
60b0c71
Revert "remove test `ag[df] (dot|gml)`"
imbillow Aug 19, 2022
46f7e35
`BROKEN=1` for `ag[df]`
imbillow Aug 19, 2022
ce83ae3
Merge branch 'dev' into asan-fuzz-ag-rzshell
imbillow Aug 20, 2022
fde375c
fix `rz_analysis_diff_fcn`
imbillow Aug 20, 2022
dfac67e
fix `rz_analysis_diff_fcn`
imbillow Aug 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
438 changes: 167 additions & 271 deletions librz/core/canalysis.c

Large diffs are not rendered by default.

937 changes: 400 additions & 537 deletions librz/core/cmd/cmd_analysis.c

Large diffs are not rendered by default.

214 changes: 196 additions & 18 deletions librz/core/cmd_descs/cmd_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ commands:
cname: autoname_all_functions
args: []
- name: aanr
summary: Renames all functions which does not return
summary: Renames all functions which does not return
cname: autoname_all_functions_noreturn
args: []
- name: aap
Expand Down Expand Up @@ -996,6 +996,184 @@ commands:
- name: number
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: ag
summary: Analysis graph commands
details:
Copy link
Member

Choose a reason for hiding this comment

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

if you want you can use details_cb: my_cb_function (look at rz_hash_bang_details_cb) and for the choices below you can use another callback (with choices_cb: my_other_cb_function, see rz_cmd_info_demangle_lang_choices), so that you don't have to repeat the same values everywhere and you avoid repetition.

It is fine as is anyway... Just wanted to share what can be done with rzshell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But using details_cb here does not seem to have obvious advantages, but requires a lot of handwritten c code.

- name: "Formats"
entries:
- text: "ascii"
comment: "Ascii art"
- text: "cmd"
comment: "rizin commands"
- text: "dot"
comment: "Graphviz dot"
- text: "gml"
comment: "Graph Modelling Language"
- text: "json"
comment: "json"
- text: "json_disasm"
comment: "json formatted disassembly"
- text: "sdb"
comment: "SDB key-value"
- text: "tiny"
comment: "Tiny ascii art"
- text: "interactive"
comment: "Interactive ascii art"
subcommands:
- name: aga
summary: Data reference graph
cname: analysis_graph_dataref
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agA
summary: Global data references graph
cname: analysis_graph_dataref_global
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agc
summary: Function callgraph
cname: analysis_graph_callgraph_function
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agC
summary: Global callgraph
cname: analysis_graph_callgraph_global
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agd
summary: Diff graph
cname: analysis_graph_diff
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: agf
summary: Basic blocks function graph
cname: analysis_graph_bb_function
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agi
summary: Imports graph
cname: analysis_graph_imports
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agr
summary: References graph
cname: analysis_graph_refs
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agR
summary: Global references graph
cname: analysis_graph_refs_global
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: ags
summary: Normal graph
cname: analysis_graph_normal
args: []
- name: agl
summary: Line graph ?
cname: analysis_graph_line
args: []
- name: agx
summary: Cross-references graph
cname: analysis_graph_xrefs
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: agg
summary: Custom graph
cname: analysis_graph_custom
args:
- name: format
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "ascii"
choices_cb: rz_analysis_graph_format_choices
- name: ag-
summary: Clear the custom graph
cname: analysis_graph_custom_clear
args: []
- name: agn
summary: Managing custom graph nodes
subcommands:
- name: agn
summary: Add a node to the custom graph
cname: analysis_graph_custom_node_add
args:
- name: title
type: RZ_CMD_ARG_TYPE_STRING
- name: body
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: color
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: agn-
summary: Remove a node from the custom graph
cname: analysis_graph_custom_node_remove
args:
- name: title
type: RZ_CMD_ARG_TYPE_STRING
- name: age
summary: Managing custom graph edges
subcommands:
- name: age
summary: Add an edge to the custom graph
cname: analysis_graph_custom_edge_add
args:
- name: title1
type: RZ_CMD_ARG_TYPE_STRING
- name: title2
type: RZ_CMD_ARG_TYPE_STRING
- name: age-
summary: Remove an edge from the custom graph
cname: analysis_graph_custom_edge_remove
args:
- name: title1
type: RZ_CMD_ARG_TYPE_STRING
- name: title2
type: RZ_CMD_ARG_TYPE_STRING
- name: agw
summary: Write to path or display graph image (see graph.gv.format)
cname: analysis_graph_write
args:
- name: graphtype
type: RZ_CMD_ARG_TYPE_CHOICES
default_value: "dataref"
choices: ["dataref", "dataref_global", "funcall", "funcall_global", "diff", "funblock", "import", "ref",
"ref_global", "line", "xref", "custom"]
- name: path
type: RZ_CMD_ARG_TYPE_STRING
#####################################################
# Keep this in sync with dr in cmd_debug.yaml from here...
- name: ar
Expand Down Expand Up @@ -1277,23 +1455,23 @@ commands:
- name: aii
summary: global import (like afii, but global)
subcommands:
- name: aii
summary: list/add global import (like afii, but global)
type: RZ_CMD_DESC_TYPE_ARGV_STATE
cname: global_imports
modes:
- RZ_OUTPUT_MODE_STANDARD
args:
- name: namespace
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: aii-
summary: delete all global imports
type: RZ_CMD_DESC_TYPE_ARGV_STATE
cname: delete_global_imports
modes:
- RZ_OUTPUT_MODE_STANDARD
args: []
- name: aii
summary: list/add global import (like afii, but global)
type: RZ_CMD_DESC_TYPE_ARGV_STATE
cname: global_imports
modes:
- RZ_OUTPUT_MODE_STANDARD
args:
- name: namespace
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: aii-
summary: delete all global imports
type: RZ_CMD_DESC_TYPE_ARGV_STATE
cname: delete_global_imports
modes:
- RZ_OUTPUT_MODE_STANDARD
args: []
- name: av
summary: C++ vtables and RTTI
subcommands:
Expand Down
Loading