Files
trailofbits-buttercup/program-model/api.md
T
Evan Downing f4446543ae Get function body by name (#73)
* Add skeleton for api call

* Modify encoding and decoding nodes/edges

* Add change encoding from base64 to hex

* reformat

* Target libpng function in example

* remove old project name

* cli fixes

* Add get_function via byte offsets

* refactor

---------

Co-authored-by: Ian Smith <ian.smith@trailofbits.com>
2025-02-25 10:21:08 -05:00

26 lines
650 B
Markdown

# Program Model API
Kythe [schema](https://kythe.io/docs/schema/).
## Getters
`get_function_body(source_path: Path | None, function_name: str) -> List[str]`: Get function body(s) by name.
`get_distinct_edge_types() -> List[str]`: Get distinct edge types.
`get_distinct_node_types() -> List[Node]`: Get distinct node types.
## Setters
`set_node_property(node: Node, property_name: str, property_value: str) -> bool`: Set a property on a node.
`set_edge_property(edge: Edge, property_name: str, property_value: str) -> bool`: Set a property on an edge.
## Example Usage
```shell
cd afc-crs-trail-of-bits/program-model
uv run mock/api.py
```