Skip to content

Instantly share code, notes, and snippets.

@nmaier
Created May 16, 2012 16:20
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 nmaier/2711823 to your computer and use it in GitHub Desktop.
Save nmaier/2711823 to your computer and use it in GitHub Desktop.
gdb unique code paths
$ gdb binary
(gdb) b JS_NewCompartmentAndGlobalObject
(gdb) commands
> bt 12
> continue
> end
(gdb) set logging on
(gdb) r <args>
import re
import sys
d = []
o = None
with open(sys.argv[1]) as op:
for line in op:
m = re.match("#0", line)
if m:
if o:
d += "\n".join(o),
o = []
continue
m = re.match(r"(#\d+)\s+.*?in\s+(.*?)\s", line)
if m:
o += "{} {}".format(*m.groups()),
for c in set(d):
print c
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment