gdb: suggest &main instead of main (address of symbol) in commands

pull/3033/head
Disconnect3d 7 months ago
parent 506f895841
commit 64e6d85c8e

@ -524,8 +524,15 @@ def fix_int_reraise_arg(arg) -> int:
fixed = fix_reraise_arg(arg)
return int(fixed)
except pwndbg.dbg_mod.Error as e:
try:
address_value = int(fix_reraise_arg(f"&{arg}"))
colored_arg = message.notice(f"&{arg}")
suggestion = f"\nDid you mean to use {colored_arg} ? (&{arg} = {address_value:#x})"
except:
raise
suggestion = ""
raise argparse.ArgumentTypeError(
f"couldn't convert '{arg}' ({fixed.type.name_to_human_readable}) to int: {e}"
f"couldn't convert '{arg}' ({fixed.type.name_to_human_readable}) to int: {e}{suggestion}"
)

Loading…
Cancel
Save