Object Code Graph (ocgraph)
ocgraph converts the disassembly of one function into a control-flow graph (CFG). It can enrich the graph with instruction and branch coverage from OCCTRE or TSIM.
The analyzer supports ARM, MSP430, PowerPC, RISC-V, SPARC V8, and x86 GNU
objdump output. Every run writes both a PDF for review and the corresponding
Graphviz source (.gv).
A graph is a view of the disassembly you supply: it depends on that disassembly, on the architecture selection, and on the optional runtime coverage, so validate a generated graph for the intended toolchain and assurance process.
Quick start
Python 3.11 or newer and the Graphviz system package are required, because the
dot binary renders the PDF. Install the tool with
pipx, which keeps it in its own virtual environment:
pipx install ocgraph
objdump -d --disassemble=my_function ./application > my_function.asm
ocgraph --file my_function.asm --arch x86 --diss objdump
python -m pip install ocgraph installs it into the active environment instead,
which is what a packager wants. python -m ocgraph runs the same command from a
checkout of the source tree, and ocgraph --version reports the version.
This creates my_function.pdf and my_function.gv. Use --output to choose a
different output basename and --view to open the generated PDF after both
files have been written.
Documentation
The full documentation covers installation, accepted disassembly input, coverage formats, command-line and Python usage, graph interpretation, and extension development:
Build it locally with:
poetry install
poetry run sphinx-build -W -b html doc doc_html
The generated entry page is doc_html/index.html.
Development
CONTRIBUTING.md describes the development environment, and the development chapter explains the analysis flow and the extension points. The short version:
poetry install
poetry run pytest
poetry run mypy -p ocgraph
poetry run pre-commit run --all-files
The pipeline runs the suite on Debian bookworm, Debian trixie, Ubuntu 24.04, and Arch Linux, which pins the interpreters 3.11, 3.13, 3.12, and the rolling 3.14.
License
Released under the MIT License, see LICENSE. The project was forked from asm2cfg by Mauri Mustonen, who holds the copyright of 2021 for the work it builds on, and Celeres holds the copyright of 2023 to 2026 for the extensions. The two notices are kept apart in LICENSES.
Links
Metadata
Release files for ocgraph 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ocgraph-1.0.0.tar.gz | 2.4 MB | Without provenance | Details for ocgraph-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ocgraph-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for ocgraph-1.0.0-py3-none-any.whl |
Total release size: 2.5 MB
Release files / ocgraph-1.0.0.tar.gz
| Download URL | ocgraph-1.0.0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
867b0464e80b8f596bfbae69e07d0ea12967918a0f62d6aa7b6c3b262720c2a7
|
|
BLAKE2b-256 checksum How to use checksums |
e9039cc9e10888a8e0dc3dca1729c11bd7db21ee8e95a0f830a6ce07741c5494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.2 Linux/7.0.2-2-pve
|
Release files / ocgraph-1.0.0-py3-none-any.whl
| Download URL | ocgraph-1.0.0-py3-none-any.whl |
|---|---|
| Size | 42.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed368eba643078d00414cac3c0233cf377f586e6585536deda547e1d773285cb
|
|
BLAKE2b-256 checksum How to use checksums |
bf187be1717f77de96637b0741ddec348d37fdd1518cfcf77558b4a7f85b8a88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.2 Linux/7.0.2-2-pve
|
Security for ocgraph 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.