Skip to content

Instantly share code, notes, and snippets.

@gabrielschulhof
Last active October 2, 2020 20:25
Show Gist options
  • Save gabrielschulhof/2128e79eb27d89a5f55897ad9b747f4f to your computer and use it in GitHub Desktop.
Save gabrielschulhof/2128e79eb27d89a5f55897ad9b747f4f to your computer and use it in GitHub Desktop.
class FinishMapsBreak (gdb.FinishBreakpoint):
def stop(self):
gdb.write('----------- End Event ------------\n')
gdb.flush()
return False
def out_of_scope(self):
return self.stop()
class MapsBreak (gdb.Breakpoint):
def stop(self):
gdb.write('----------- Start Event -----------\n')
gdb.flush()
gdb.execute('bt 10')
FinishMapsBreak()
return False
gdb.execute("set pagination off")
gdb.execute("set breakpoint pending on")
gdb.execute("set style enabled off")
gdb.execute("start")
MapsBreak("mmap")
MapsBreak("munmap")
MapsBreak("mremap")
MapsBreak("madvise")
MapsBreak("mprotect")
gdb.execute("continue")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment