Comments
comments
Classes:
-
CommentKind
–Enumeration for IDA comment types.
-
Comments
–Provides access to user-defined comments in the IDA database.
CommentKind
Bases: Enum
Enumeration for IDA comment types.
Attributes:
-
ALL
– -
REGULAR
– -
REPEATABLE
–
ALL
class-attribute
instance-attribute
ALL = 'all'
REGULAR
class-attribute
instance-attribute
REGULAR = 'regular'
REPEATABLE
class-attribute
instance-attribute
REPEATABLE = 'repeatable'
Comments
Comments(database: 'Database')
Provides access to user-defined comments in the IDA database.
IDA supports two types of comments: - Regular comments: Displayed at specific addresses - Repeatable comments: Displayed at all references to the same address
Constructs a comment manager for the given database.
Args: database: Reference to the active IDA database.
Methods:
-
delete
–Deletes a comment at the specified address.
-
get
–Retrieves the comment at the specified address.
-
get_all
–Creates an iterator for comments in the database.
-
get_any
–Retrieves any comment at the specified address, checking both regular and repeatable.
-
set
–Sets a comment at the specified address.
Attributes:
m_database
instance-attribute
m_database = database
delete
delete(
ea: int, comment_kind: CommentKind = REGULAR
) -> bool
Deletes a comment at the specified address.
Args: ea: The effective address. comment_kind: Type of comment to delete (REGULAR or REPEATABLE).
Returns: True if the comment was successfully deleted, False otherwise.
get
get(
ea: int, comment_kind: CommentKind = REGULAR
) -> str | None
Retrieves the comment at the specified address.
Args: ea: The effective address. comment_kind: Type of comment to retrieve (REGULAR or REPEATABLE).
Returns: The comment string, or None if no comment exists.
get_all
get_all(
comment_kind: CommentKind = REGULAR,
) -> Iterator[Tuple[int, str, bool]]
Creates an iterator for comments in the database.
Args: comment_kind: Type of comments to retrieve: - CommentType.REGULAR: Only regular comments - CommentType.REPEATABLE: Only repeatable comments - CommentType.ALL: Both regular and repeatable comments
Yields: Tuples of (address, comment_text, is_repeatable) for each comment found.
get_any
get_any(ea: int) -> Tuple[bool, str]
Retrieves any comment at the specified address, checking both regular and repeatable.
Args: ea: The effective address.
Returns: A tuple (success, comment string). If no comment exists, success is False.
set
set(
ea: int,
comment: str,
comment_kind: CommentKind = REGULAR,
) -> bool
Sets a comment at the specified address.
Args: ea: The effective address. comment: The comment text to assign. comment_kind: Type of comment to set (REGULAR or REPEATABLE).
Returns: True if the comment was successfully set, False otherwise.