Index: tools/gdbinit |
diff --git a/tools/gdbinit b/tools/gdbinit |
index 1eae053f2ce0317619eedee4e87bb1b0f1e7c215..f332c358766f122afbd7de175b2bf4f44489b193 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+) = .+<v8::internal::Per\w+AssertType::(\w+)_ASSERT, (false|true)>") |
+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 |