Skip to content

Instantly share code, notes, and snippets.

@mirekfranc
Created April 24, 2015 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirekfranc/5d25237a9882e3ee49f5 to your computer and use it in GitHub Desktop.
Save mirekfranc/5d25237a9882e3ee49f5 to your computer and use it in GitHub Desktop.
how to process gdb breakpoints in python
# https://sourceware.org/gdb/onlinedocs/gdb/Breakpoints-In-Python.html
# https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Breakpoint-Commands.html
def my_breakpoint_handler (event):
if (isinstance(event, gdb.BreakpointEvent) and (event.breakpoint.location == "g")):
print event.breakpoint.hit_count
gdb.events.stop.connect(my_breakpoint_handler)
gdb.execute("start")
gdb.execute("break g")
gdb.execute("continue")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment