[gdb] Select frame above the DCHECK function

Rather than having GDB always stop on the line containing
V8_IMMEDIATE_CRASH(), walk up the stack looking for V8_Dcheck and select
the frame above it. This will be the frame containing DCHECK (including
related macros like DCHECK_EQ).

Change-Id: I9760e7a4dd78b567dfa77ff12569d287d80ca873
Reviewed-on: https://chromium-review.googlesource.com/1172780
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55112}
This commit is contained in:
Dan Elphick 2018-08-13 17:14:06 +01:00 committed by Commit Bot
parent 5fecd146bf
commit 421571953f

View File

@ -122,3 +122,22 @@ end
set disassembly-flavor intel
set disable-randomization off
# Install a handler whenever the debugger stops due to a signal. It walks up the
# stack looking for V8_Dcheck and moves the frame to the one above it so it's
# immediately at the line of code that triggered the DCHECK.
python
def dcheck_stop_handler(event):
orig_frame = gdb.selected_frame()
frame = orig_frame
while frame is not None:
if frame.name() == 'V8_Dcheck':
select_frame = frame.older()
if select_frame is not None:
select_frame.select()
gdb.execute('frame')
break
frame = frame.older()
gdb.events.stop.connect(dcheck_stop_handler)
end