INNER CODE UNIT · Python
addresses_gdb
xoseperez/espurna · code/scripts/decoder.py:80
def addresses_gdb(gdb: pathlib.Path, elf: pathlib.Path, addresses: list[str]):
cmd = [str(gdb), "--batch"]
for address in addresses:
if not address.startswith("0x"):
address = f"0x{address}"
cmd.extend(["--ex", f"info line *{address}"])
cmd.append(str(elf))
for line in run_command(cmd):
if "No line number" in line:
continue
yield line.strip()
# original approach using addr2line, which is pretty enough already
def addresses_addr2line(
addr2line: pathlib.Path, elf: pathlib.Path, addresses: list[str]
):