Add scripts to export function metrics (JSON/CSV) and function call graph (DOT) #8574
+487
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
ExportFunctionMetricsToJson: per-function metrics to JSON with a summary section and optional selection/highlight filtering.ExportFunctionMetricsToCsv: same metrics to CSV with a stable header.ExportFunctionCallGraphToDot: exports the program function call graph to Graphviz DOT; supports selection/highlight filtering.Motivation
Details
name,entry,namespacesize_bytes(address count),address_ranges,instruction_count,basic_blockscyclomatic_complexity,parameters,localsexternal,thunk,variadic,inline,no_return,custom_storagestack_purge_size,calling_convention,callers,calleesreturn_type,prototype,prototype_with_ccfunctionName\nentryAddressand writes simple edges from callers to callees.Usage
.json.csv.dotFiles Changed
Ghidra/Features/Base/ghidra_scripts/ExportFunctionMetricsToJson.java:1Ghidra/Features/Base/ghidra_scripts/ExportFunctionMetricsToCsv.java:1Ghidra/Features/Base/ghidra_scripts/ExportFunctionCallGraphToDot.java:1How To Test
program,functions[], andsummary.dot -Tpng out.dot -o out.png, and reflects expected edges.Scope / Compliance
ghidra_scripts.Notes
size_bytesreports address count in the function body;address_rangesclarifies segmentation.Optional Checklist