[tools] Fix the j6tw GDB command

The j6tw (j6 table walk) command to debug page tables was throwing an
exception for an integer that was too big when the default radix was 16,
because it would interpret ints as hex even without the 0x prefix. Now
j6tw explicitly converts to hex and uses the prefix to be explicit.
This commit is contained in:
Justin C. Miller
2021-12-31 20:30:42 -08:00
parent 3c44bf55eb
commit 348b64ebb0

View File

@@ -114,7 +114,7 @@ class TableWalkCommand(gdb.Command):
table = pml4
entry = 0
for i in range(len(indices)):
entry = int(gdb.parse_and_eval(f'((uint64_t*){table})[{indices[i]}]'))
entry = int(gdb.parse_and_eval(f'((uint64_t*)0x{table:x})[0x{indices[i]:x}]'))
flagset = flagsets[i]
flag_names = " | ".join([f[1] for f in flagset if (entry & f[0]) == f[0]])