Skip to content

Make disassembly metrics available - #305

Merged
waskyo merged 3 commits into
static-analysis-engineering:masterfrom
waskyo:disassembly_metrics
Nov 2, 2026
Merged

waskyo merged 3 commits into
static-analysis-engineering:masterfrom
waskyo:disassembly_metrics

Conversation

@waskyo

@waskyo waskyo commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator
  • Disassembly metrics are now available both in full analysis and disassembly-only mode. This depends on changes to the ocaml side of things: Always save disassembly metrics codehawk#263
  • Add a new ddata stats command which prints the statistics or saves them to a json file.

@waskyo
waskyo requested a review from sipma October 30, 2026 01:32
Comment thread chb/app/AppAccess.py Resolved

@sipma sipma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! Saving the disassembly metrics is useful to have.

If normal analysis is done, the disassembly metrics are part of the
r/<binary>_metrics.xml file. However, if only disassembly is done
(chkx analyze -d), that file does not exist, and instead the
metrics are saved to s/<binary>_disassembly.xml.

This change creates a dataclass to represent the disassembly metrics,
AppDisassemblyMetrics, which gets the information from a passed xnode.
AppResultMetrics now uses that class to provide the metrics it exposes
from the disassembly.

AppAccess also gains a method, disassembly_metrics, which tries the
two possible locations where they can be found.
it uses the DisassemblyMetrics class to either print the information
or save it to json. The DisassemblyMetrics dataclass gained a
to_json_result method to support this.

Along the way I realized that the AppResultMetrics to_json_result method
was asking the disasembly stats to be converted to int/float when
they are already of that type
@waskyo
waskyo force-pushed the disassembly_metrics branch from 4d783d6 to 0a6eeb1 Compare November 2, 2026 15:05
@waskyo
waskyo merged commit 34bd5cf into static-analysis-engineering:master Nov 2, 2026
4 checks passed
@waskyo
waskyo deleted the disassembly_metrics branch November 2, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants