Some build help

This commit is contained in:
2022-01-04 21:57:21 +01:00
parent d69a047172
commit e97f614cac
3 changed files with 97 additions and 5 deletions

View File

@@ -21,10 +21,9 @@ import os
gdb.execute('file ' + os.environ['BUILDROOT'] + '/sysroot/kernel')
end
# Inspect registers with `reg RAX` or just `reg`
python
import re
class Reg(gdb.Command):
def __init__(self):
@@ -52,6 +51,27 @@ class Reg(gdb.Command):
print(matches[0])
else:
print(f"Register {arg.upper()} unknown")
Reg()
end
# Break on any label called panic_breakpoint_X which is defined by the PANIC() macro
python
import re
syms = gdb.execute('maintenance print msymbols', False, True)
for l in syms.splitlines():
matches = re.findall("panic_breakpoint_.*\\b", l)
if matches:
name = matches[0].split()[0]
gdb.execute(f"break {name}", to_string=True)
end
define restore_env
set $name = $arg0
python
regs = ['rax', 'rbx', 'rcx', 'rdx', 'rsi', 'rdi', 'rbp', 'rsp', 'r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15', 'rip']
stored = {r: gdb.parse_and_eval('$name->'+r) for r in regs}
for r in regs:
gdb.parse_and_eval(f"${r}={stored[r]}")
gdb.execute("frame 0")
end