Add gdb macro to find assertion scopes on the stack.

This is how it would look like.

(gdb) bta
[1 ] V8_Fatal                                         ../../src/base/logging.cc:67
[2 ] v8::internal::Heap::AllocateRaw                  ../../src/heap/heap-inl.h:298
[3 ] v8::internal::Heap::AllocateHeapNumber           ../../src/heap/heap.cc:2432
[4 ] v8::internal::Factory::NewHeapNumber             ../../src/factory.cc:1253
[5 ] v8::internal::Factory::NewNumber                 ../../src/factory.cc:1228
[6 ] v8::internal::__RT_impl_Runtime_ConstructDouble  ../../src/runtime/runtime-test.cc:32
 -> Allow HEAP_ALLOCATION (yes_gc)
 -> Disallow HEAP_ALLOCATION (no_gc)
[7 ] v8::internal::Runtime_ConstructDouble            ../../src/runtime/runtime-test.cc:24

R=jochen@chromium.org

Review-Url: https://codereview.chromium.org/2466263007
Cr-Commit-Position: refs/heads/master@{#40748}
This commit is contained in:
yangguo 2016-11-04 00:27:39 -07:00 committed by Commit bot
parent 288d9ffd95
commit 6ab61037f3

View File

@ -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