Some build help
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user