summaryrefslogtreecommitdiff
path: root/src/debug/gdbinit.py
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2021-08-24 14:09:29 -0500
committerBrett Weiland <brett_weiland@bpcspace.com>2021-08-24 14:09:29 -0500
commit9b22a6965579ea1867aea291d910c96f386b518b (patch)
treed06dbb9c4708f1cc713bcb115b32ff9bce4cf9b9 /src/debug/gdbinit.py
parentbad4b0e9bdfee336bfc1c23761408279eaec1558 (diff)
major backup 8.24.21
Diffstat (limited to 'src/debug/gdbinit.py')
-rwxr-xr-xsrc/debug/gdbinit.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/debug/gdbinit.py b/src/debug/gdbinit.py
new file mode 100755
index 0000000..75ab5ca
--- /dev/null
+++ b/src/debug/gdbinit.py
@@ -0,0 +1,28 @@
+class NextInstructionAddress(gdb.Command):
+ """
+Run until Next Instruction address.
+
+Usage: nia
+
+Put a temporary breakpoint at the address of the next instruction, and continue.
+
+Useful to step over int interrupts.
+
+See also: http://stackoverflow.com/questions/24491516/how-to-step-over-interrupt-calls-when-debugging-a-bootloader-bios-with-gdb-and-q
+"""
+ def __init__(self):
+ super().__init__(
+ 'nia',
+ gdb.COMMAND_BREAKPOINTS,
+ gdb.COMPLETE_NONE,
+ False
+ )
+ def invoke(self, arg, from_tty):
+ frame = gdb.selected_frame()
+ arch = frame.architecture()
+ pc = gdb.selected_frame().pc()
+ length = arch.disassemble(pc)[0]['length']
+ gdb.Breakpoint('*' + str(pc + length), temporary = True)
+ gdb.execute('continue')
+
+NextInstructionAddress()