Skip to content

bp_prefix not set on breakpoints declared with function name instead of hex_address ( #1039

@Angelo942

Description

@Angelo942

gef/gef.py

Line 7571 in deeab2f

def context_code(self) -> None:

gef/gef.py

Lines 7578 to 7579 in deeab2f

breakpoints = gdb.breakpoints() or []
bp_locations = [b.location for b in breakpoints if b.location and b.location.startswith("*")]

gef/gef.py

Line 7589 in deeab2f

for insn in self.instruction_iterator(pc, nb_insn, nb_prev=nb_insn_prev):

gef/gef.py

Line 7593 in deeab2f

bp_prefix = Color.redify(BP_GLYPH) if self.addr_has_breakpoint(insn.address, bp_locations) else " "

gef/gef.py

Lines 7568 to 7569 in deeab2f

def addr_has_breakpoint(self, address: int, bp_locations: List[str]) -> bool:
return any(hex(address) in b for b in bp_locations)

b.location is just the string used by the user to set the breakpoint not its address, so the current code relies on the user using an hexadecimal address and doesn't handle breakpoints set on a function.

Would it be worth it to parse info breakpoints to extract all the addresses instead of ignoring some breakpoints ?

I also considered parsing b.location and look for the address from the symbol name, but I still have troubles with that part of the API and we would have to handle ourselves the differences between declarations such as b <fun>, b *<fun> and b *'<fun>'+<offset>.

GDB 13.1 did introduce Breakpoint.locations that can return the exact address, but I don't think it's an option since it relies on a recent version of gdb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions