Remove previous frame if an error occurs when computing frame id during unwind.
authorAndrew Burgess <aburgess@broadcom.com>
Wed, 2 Apr 2014 16:02:51 +0000 (17:02 +0100)
committerAndrew Burgess <aburgess@broadcom.com>
Fri, 30 May 2014 21:36:14 +0000 (22:36 +0100)
commit938f0e2f6766e90a5ddc5df00e97a68873fd1252
tree44da0dc82ea1b1c1ff9134d8eaed17e28b8c0161
parentf6fb832249b8c64e9c35571fdabc323a62ad31fa
Remove previous frame if an error occurs when computing frame id during unwind.

  https://sourceware.org/ml/gdb-patches/2014-05/msg00712.html

If an error is thrown during computing a frame id then the frame is left
in existence but without a valid frame id, this will trigger internal
errors if/when the frame is later visited (for example in a backtrace).

This patch catches errors raised while computing the frame id, and
arranges for the new frame, the one without a frame id, to be removed
from the linked list of frames.

gdb/ChangeLog:

* frame.c (remove_prev_frame): New function.
(get_prev_frame_if_no_cycle): Create / discard cleanup using
remove_prev_frame.

gdb/testsuite/ChangeLog:

* gdb.arch/amd64-invalid-stack-middle.S: New file.
* gdb.arch/amd64-invalid-stack-middle.c: New file.
* gdb.arch/amd64-invalid-stack-middle.exp: New file.
* gdb.arch/amd64-invalid-stack-top.c: New file.
* gdb.arch/amd64-invalid-stack-top.exp: New file.
gdb/ChangeLog
gdb/frame.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.S [new file with mode: 0644]
gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c [new file with mode: 0644]
gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp [new file with mode: 0644]
gdb/testsuite/gdb.arch/amd64-invalid-stack-top.c [new file with mode: 0644]
gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp [new file with mode: 0644]