Annotations (Labels, Comments, Bookmarks)

What is an annotation?

Annotations refer to labels, comments, and bookmarks.

x64dbg automate supports setting and removing labels / comments, with bookmark support coming soon.

API Method Reference

set_label_at(address, text)

Sets a label at the specified address

Parameters:

Name Type Description Default
address int

Address to set the label at

required
text str

Label text

required

Returns:

Type Description
bool

Success

Source code in x64dbg_automate/hla_xauto.py
def set_label_at(self, address: int, text: str) -> bool:
    """
    Sets a label at the specified address

    Args:
        address: Address to set the label at
        text: Label text

    Returns:
        Success
    """
    if '"' in text:
        raise ValueError("Text cannot contain double quotes")
    return self.cmd_sync(f'lblset 0x{address:x}, "{text}"')

del_label_at(address)

Deletes a label at the specified address

Parameters:

Name Type Description Default
address int

Address to clear the label at

required

Returns:

Type Description
bool

Success

Source code in x64dbg_automate/hla_xauto.py
def del_label_at(self, address: int) -> bool:
    """
    Deletes a label at the specified address

    Args:
        address: Address to clear the label at

    Returns:
        Success
    """
    return self.cmd_sync(f'lbldel 0x{address:x}')

set_comment_at(address, text)

Sets a comment at the specified address

Parameters:

Name Type Description Default
address int

Address to set the comment at

required
text str

comment text

required

Returns:

Type Description
bool

Success

Source code in x64dbg_automate/hla_xauto.py
def set_comment_at(self, address: int, text: str) -> bool:
    """
    Sets a comment at the specified address

    Args:
        address: Address to set the comment at
        text: comment text

    Returns:
        Success
    """
    if '"' in text:
        raise ValueError("Text cannot contain double quotes")
    return self.cmd_sync(f'cmtset 0x{address:x}, "{text}"')

del_comment_at(address)

Deletes a comment at the specified address

Parameters:

Name Type Description Default
address int

Address to clear the comment at

required

Returns:

Type Description
bool

Success

Source code in x64dbg_automate/hla_xauto.py
def del_comment_at(self, address: int) -> bool:
    """
    Deletes a comment at the specified address

    Args:
        address: Address to clear the comment at

    Returns:
        Success
    """
    return self.cmd_sync(f'cmtdel 0x{address:x}')

get_label_at(addr, segment_reg=SegmentReg.SegDefault)

Retrieves the label at the specified address

Parameters:

Name Type Description Default
addr int

The address to get the label for

required
segment_reg SegmentReg

The segment register to use

SegDefault

Returns:

Type Description
str

The label or an empty string if no label was found

Source code in x64dbg_automate/commands_xauto.py
def get_label_at(self, addr: int, segment_reg: SegmentReg = SegmentReg.SegDefault) -> str:
    """
    Retrieves the label at the specified address

    Args:
        addr: The address to get the label for
        segment_reg: The segment register to use

    Returns:
        The label or an empty string if no label was found
    """
    res, label = self._send_request(XAutoCommand.XAUTO_REQ_GET_LABEL, addr, segment_reg)
    if not res:
        return ""
    return label

get_comment_at(addr)

Retrieves the comment at the specified address

Parameters:

Name Type Description Default
addr int

The address to get the comment for

required

Returns:

Type Description
str

The label or an empty string if no comment was found

Source code in x64dbg_automate/commands_xauto.py
def get_comment_at(self, addr: int) -> str:
    """
    Retrieves the comment at the specified address

    Args:
        addr: The address to get the comment for

    Returns:
        The label or an empty string if no comment was found
    """
    res, comment = self._send_request(XAutoCommand.XAUTO_REQ_GET_COMMENT, addr)
    if not res:
        return ""
    return comment