diff --git a/tools/gdbinit b/tools/gdbinit index 1eae053f2c..f332c35876 100644 --- a/tools/gdbinit +++ b/tools/gdbinit @@ -68,5 +68,31 @@ Skip the jitted stack on x64 to where we entered JS last. Usage: jss end +# Print stack trace with assertion scopes. +define bta +python +import re +frame_re = re.compile("^#(\d+).* in (\S+) .+ at (.+)") +assert_re = re.compile("^\s*(\S+) = .+") +btl = gdb.execute("backtrace full", to_string = True).splitlines() +for l in btl: + match = frame_re.match(l) + if match: + print("[%-2s] %-60s %-40s" % (match.group(1), match.group(2), match.group(3))) + match = assert_re.match(l) + if match: + if match.group(3) == "false": + prefix = "Disallow" + color = "\033[91m" + else: + prefix = "Allow" + color = "\033[92m" + print("%s -> %s %s (%s)\033[0m" % (color, prefix, match.group(2), match.group(1))) +end +document bta +Print stack trace with assertion scopes +Usage: bta +end + set disassembly-flavor intel set disable-randomization off