Commit 19d39a0f authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[gdb] Print DCHECK error message

When selecting the frame above the V8_Dcheck method (at the DCHECK
location), it helps enormously to immediately see the error message
generated by the DCHECK. This extends the dcheck_stop_handler to find
and print this message.

Drive-by: Speed up the handler by stopping after the first V8_Dcheck
frame.

R=mstarzinger@chromium.org

Bug: v8:8562
Change-Id: If3a8f3aaab6a0014006ccac7260f37d5d90363c5
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1378170Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58238}
parent 5f6b7803
......@@ -137,17 +137,25 @@ set disable-randomization off
# immediately at the line of code that triggered the DCHECK.
python
def dcheck_stop_handler(event):
orig_frame = gdb.selected_frame()
frame = orig_frame
frame = gdb.selected_frame()
select_frame = None
message = None
while frame is not None:
if frame.name() in ('V8_Dcheck', 'V8_Fatal'):
if frame.name() == 'V8_Dcheck':
frame_message = gdb.lookup_symbol('message', frame.block())[0]
if frame_message:
message = frame_message.value(frame).string()
select_frame = frame.older()
break
if frame.name().startswith('V8_Fatal'):
select_frame = frame.older()
frame = frame.older()
if select_frame is not None:
select_frame.select()
gdb.execute('frame')
if message:
print('DCHECK error: {}'.format(message))
gdb.events.stop.connect(dcheck_stop_handler)
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment