[gdb] Limit stack search when looking for DCHECK

Only look 5 frames up the stack when looking for a DCHECK to move the
frame to to prevent excessive iteration especially after a stack
overflow.

Change-Id: I227c46596f09c9af0a47e6673d3165eaccb75163
Reviewed-on: https://chromium-review.googlesource.com/c/1400408
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58621}
This commit is contained in:
Dan Elphick 2019-01-08 10:07:20 +00:00 committed by Commit Bot
parent f49efaef06
commit 3ef8ae90d1

View File

@ -140,7 +140,11 @@ def dcheck_stop_handler(event):
frame = gdb.selected_frame()
select_frame = None
message = None
while frame is not None:
count = 0
# limit stack scanning since they're usually shallow and otherwise stack
# overflows can be very slow.
while frame is not None and count < 5:
count += 1
if frame.name() == 'V8_Dcheck':
frame_message = gdb.lookup_symbol('message', frame.block())[0]
if frame_message: