diff --git a/librz/core/cgraph.c b/librz/core/cgraph.c index e10d3103422..b24a350650e 100644 --- a/librz/core/cgraph.c +++ b/librz/core/cgraph.c @@ -725,5 +725,6 @@ RZ_API bool rz_core_graph_write(RZ_NONNULL RzCore *core, ut64 addr, RzCoreGraphT return false; } rz_core_graph_write_graph(core, graph, path); + rz_graph_free(graph); return true; } diff --git a/librz/core/cmd_descs/cmd_analysis.yaml b/librz/core/cmd_descs/cmd_analysis.yaml index 291c556be32..b28abf647b2 100644 --- a/librz/core/cmd_descs/cmd_analysis.yaml +++ b/librz/core/cmd_descs/cmd_analysis.yaml @@ -1171,6 +1171,27 @@ commands: type: RZ_CMD_ARG_TYPE_OPTION flags: RZ_CMD_ARG_FLAG_OPTION optional: true + details: + - name: "Graph Type" + entries: + - text: "dataref" + comment: "Data reference graph" + - text: "funcall" + comment: "Function call graph" + - text: "diff" + comment: "Diff graph" + - text: "funblock" + comment: "Function basic block graph" + - text: "import" + comment: "Imports graph" + - text: "ref" + comment: "References graph" + - text: "line" + comment: "Line graph" + - text: "xref" + comment: "Cross references graph" + - text: "custom" + comment: "Custom made graph" ##################################################### # Keep this in sync with dr in cmd_debug.yaml from here... - name: ar diff --git a/librz/core/cmd_descs/cmd_descs.c b/librz/core/cmd_descs/cmd_descs.c index 823349f3596..db48c07ee15 100644 --- a/librz/core/cmd_descs/cmd_descs.c +++ b/librz/core/cmd_descs/cmd_descs.c @@ -17,6 +17,7 @@ static const RzCmdDescDetail analysis_all_esil_details[2]; static const RzCmdDescDetail analyze_all_preludes_details[2]; static const RzCmdDescDetail analysis_functions_merge_details[2]; static const RzCmdDescDetail analysis_appcall_details[2]; +static const RzCmdDescDetail analysis_graph_write_details[2]; static const RzCmdDescDetail ag_details[2]; static const RzCmdDescDetail analysis_reg_cond_details[4]; static const RzCmdDescDetail ar_details[2]; @@ -3431,6 +3432,22 @@ static const RzCmdDescHelp analysis_graph_custom_edge_remove_help = { .args = analysis_graph_custom_edge_remove_args, }; +static const RzCmdDescDetailEntry analysis_graph_write_Graph_space_Type_detail_entries[] = { + { .text = "dataref", .arg_str = NULL, .comment = "Data reference graph" }, + { .text = "funcall", .arg_str = NULL, .comment = "Function call graph" }, + { .text = "diff", .arg_str = NULL, .comment = "Diff graph" }, + { .text = "funblock", .arg_str = NULL, .comment = "Function basic block graph" }, + { .text = "import", .arg_str = NULL, .comment = "Imports graph" }, + { .text = "ref", .arg_str = NULL, .comment = "References graph" }, + { .text = "line", .arg_str = NULL, .comment = "Line graph" }, + { .text = "xref", .arg_str = NULL, .comment = "Cross references graph" }, + { .text = "custom", .arg_str = NULL, .comment = "Custom made graph" }, + { 0 }, +}; +static const RzCmdDescDetail analysis_graph_write_details[] = { + { .name = "Graph Type", .entries = analysis_graph_write_Graph_space_Type_detail_entries }, + { 0 }, +}; static const char *analysis_graph_write_graphtype_choices[] = { "dataref", "funcall", "diff", "funblock", "import", "ref", "line", "xref", "custom", NULL }; static const RzCmdDescArg analysis_graph_write_args[] = { { @@ -3456,6 +3473,7 @@ static const RzCmdDescArg analysis_graph_write_args[] = { }; static const RzCmdDescHelp analysis_graph_write_help = { .summary = "Write to path or display graph image (see graph.gv.format)", + .details = analysis_graph_write_details, .args = analysis_graph_write_args, };