Skip to content

Instantly share code, notes, and snippets.

@sudhackar
Created March 26, 2018 17:46
Show Gist options
  • Save sudhackar/e80f8c15f8c2024a80c1e0175673118e to your computer and use it in GitHub Desktop.
Save sudhackar/e80f8c15f8c2024a80c1e0175673118e to your computer and use it in GitHub Desktop.
gdb tea bp
import gdb
class MyBreakpoint (gdb.Breakpoint):
def stop (self):
rdi = int(gdb.parse_and_eval("$rdi").cast(gdb.lookup_type('uint64_t')))
rsi = int(gdb.parse_and_eval("$rsi").cast(gdb.lookup_type('uint64_t')))
print("d( %x, %x)" % (rdi, rsi)),
print("rdi : [%x, %x]" % (int(gdb.Value(rdi).cast(gdb.lookup_type('uint32_t').pointer()).dereference()),
int(gdb.Value(rdi+4).cast(gdb.lookup_type('uint32_t').pointer()).dereference()))),
print("rsi : [%x, %x, %x, %x]" % (int(gdb.Value(rsi).cast(gdb.lookup_type('uint32_t').pointer()).dereference()),
int(gdb.Value(rsi+4).cast(gdb.lookup_type('uint32_t').pointer()).dereference()),
int(gdb.Value(rsi+8).cast(gdb.lookup_type('uint32_t').pointer()).dereference()),
int(gdb.Value(rsi+12).cast(gdb.lookup_type('uint32_t').pointer()).dereference())))
return False
MyBreakpoint("d")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment