Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: tools/gdbinit

Issue 2466263007: Add gdb macro to find assertion scopes on the stack. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698