angr.knowledge_plugins.comments

class angr.knowledge_plugins.comments.CommentKind

Bases: IntEnum

How a comment is displayed.

PLAIN shows only at its own address. FUNCTION renders as a header block above the function, which is also what the decompiler does with a comment on a function entry. REPEATABLE additionally shows at every location referencing the commented address.

PLAIN = 0
FUNCTION = 1
REPEATABLE = 2
property display_name: str
__new__(value)
class angr.knowledge_plugins.comments.Comment

Bases: object

A comment together with its display metadata. Rebuilt on demand from the knowledge base.

__init__(addr, text, kind, func_addr=None, func_name=None)
Parameters:
Return type:

None

addr
text
kind
func_addr
func_name
property first_line: str
class angr.knowledge_plugins.comments.Comments

Bases: KnowledgeBasePlugin, dict

Tracks comments via a Dict of Address -> Text, along with a per-address CommentKind.

property kinds: dict[int, CommentKind]

Explicitly-set comment kinds. Addresses not present here use kind_of() defaults.

kind_of(addr)
Return type:

CommentKind

Parameters:

addr (int)

set_kind(addr, kind)

Set the display kind for the comment at addr, or reset it to the default with None.

Return type:

None

Parameters:
is_function_entry(addr)
Return type:

bool

Parameters:

addr (int)

function_comment(func_addr)

The comment rendered as a function’s header block, if any.

Return type:

str | None

Parameters:

func_addr (int)

inline_comment(addr)

The comment rendered next to the instruction at addr. A comment that already renders as a function header block is not repeated inline.

Return type:

str | None

Parameters:

addr (int)

iter_comments()

All comments in address order, with their kinds and owning functions.

Return type:

Iterator[Comment]

repeatable_comments_at(ins_addr)

Repeatable comments that should show at ins_addr because it references their address.

Return type:

list[tuple[int, str]]

Parameters:

ins_addr (int)

invalidate()

Drop the cached repeatable-comment map, e.g. after xrefs or functions change.

Return type:

None