Commit b04d9eea authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[gdbinit] Also look for OS::DebugBreak frames

If such a frame is near the top of the stack frame, move to the frame
below instead, which is the caller of OS::DebugBreak.
Also, rename dcheck_stop_handler to v8_stop_handler since we handle more
than DCHECKs there.

R=leszeks@chromium.org

No-Try: true
Change-Id: Ib31c2dc8278ec779a00babfdc952453e66e5f110
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3366238Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78481}
parent 406d65d3
...@@ -161,16 +161,17 @@ end ...@@ -161,16 +161,17 @@ end
set disable-randomization off set disable-randomization off
# Install a handler whenever the debugger stops due to a signal. It walks up the # 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 # stack looking for V8_Dcheck / V8_Fatal / OS::DebugBreak frame and moves the
# immediately at the line of code that triggered the DCHECK. # frame to the one above it so it's immediately at the line of code that
# triggered the stop condition.
python python
def dcheck_stop_handler(event): def v8_stop_handler(event):
frame = gdb.selected_frame() frame = gdb.selected_frame()
select_frame = None select_frame = None
message = None message = None
count = 0 count = 0
# limit stack scanning since they're usually shallow and otherwise stack # Limit stack scanning since the frames we look for are near the top anyway,
# overflows can be very slow. # and otherwise stack overflows can be very slow.
while frame is not None and count < 7: while frame is not None and count < 7:
count += 1 count += 1
# If we are in a frame created by gdb (e.g. for `(gdb) call foo()`), gdb # If we are in a frame created by gdb (e.g. for `(gdb) call foo()`), gdb
...@@ -186,6 +187,8 @@ def dcheck_stop_handler(event): ...@@ -186,6 +187,8 @@ def dcheck_stop_handler(event):
break break
if frame.name() is not None and frame.name().startswith('V8_Fatal'): if frame.name() is not None and frame.name().startswith('V8_Fatal'):
select_frame = frame.older() select_frame = frame.older()
if frame.name() == 'v8::base::OS::DebugBreak':
select_frame = frame.older()
frame = frame.older() frame = frame.older()
if select_frame is not None: if select_frame is not None:
...@@ -194,7 +197,7 @@ def dcheck_stop_handler(event): ...@@ -194,7 +197,7 @@ def dcheck_stop_handler(event):
if message: if message:
print('DCHECK error: {}'.format(message)) print('DCHECK error: {}'.format(message))
gdb.events.stop.connect(dcheck_stop_handler) gdb.events.stop.connect(v8_stop_handler)
end end
# Code imported from chromium/src/tools/gdb/gdbinit # Code imported from chromium/src/tools/gdb/gdbinit
......
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