diff options
author | Tom Tromey <tromey@adacore.com> | 2020-03-03 15:27:04 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-03-03 15:27:04 -0700 |
commit | 1009d92fc621bc4d017029b90a5bfab16e17fde5 (patch) | |
tree | f26cda6eaeec61a7d4c4761c22d4ab2ad35cfffd /gdbserver/linux-aarch32-tdesc.h | |
parent | 89725b0d5357b85ffc35ae451db0c0ddf1aa5831 (diff) | |
download | binutils-gdb-1009d92fc621bc4d017029b90a5bfab16e17fde5.tar.gz |
Find tailcall frames before inline frames
A customer reported a failure to unwind in a certain core dump. A
lengthy investigation showed that the problem came from the
interaction between the tailcall and inline frame sniffers.
Normally, the regular DWARF unwinder may discover a chain of tail
calls ending in the current frame. In this case, it sets a member on
the dwarf2_frame_cache object, so that a subsequent call into the
tailcall sniffer will create the tailcall frames.
However, in this scenario, what happened is that the DWARF unwinder
did find tailcall frames -- but then the PC of the first such frame
was recognized and claimed by the inline frame sniffer.
This then caused unwinding to go astray further up the stack.
This patch fixes the problem by arranging for the tailcall sniffer to
be called before the inline sniffer. This way, if a DWARF frame has
tailcall information, the tailcalls will always be processed first.
This is safe to do, because the tailcall sniffer can only claim a
frame if the previous frame did in fact find this information. (So,
for example, if no DWARF frame is ever found, then this sniffer will
never trigger.)
This patch also partially reverts:
commit 1ec56e88aa9b052ab10b806d82fbdbc8d153d977
Author: Pedro Alves <palves@redhat.com>
Date: Fri Nov 22 13:17:46 2013 +0000
Eliminate dwarf2_frame_cache recursion, don't unwind from the dwarf2 sniffer (move dwarf2_tailcall_sniffer_first elsewhere).
That patch moved the call to dwarf2_tailcall_sniffer_first out of
dwarf2_frame_cache, and into dwarf2_frame_prev_register. However, in
this situation, this is too late -- by the time
dwarf2_frame_prev_register is called, the frame in question is already
recognized by the inline frame sniffer.
Rather than fully revert that patch, though, this just arranges to
call dwarf2_tailcall_sniffer_first from dwarf2_frame_cache -- which is
called shortly after the DWARF frame sniffer succeeds, via
compute_frame_id.
I don't know how to write a test case for this.
gdb/ChangeLog
2020-03-03 Tom Tromey <tromey@adacore.com>
* dwarf2/frame.c (struct dwarf2_frame_cache)
<checked_tailcall_bottom, entry_cfa_sp_offset,
entry_cfa_sp_offset_p>: Remove members.
(dwarf2_frame_cache): Call dwarf2_tailcall_sniffer_first.
(dwarf2_frame_prev_register): Don't call
dwarf2_tailcall_sniffer_first.
(dwarf2_append_unwinders): Don't append tailcall unwinder.
* frame-unwind.c (add_unwinder): New fuction.
(frame_unwind_init): Use it. Add tailcall unwinder.
Diffstat (limited to 'gdbserver/linux-aarch32-tdesc.h')
0 files changed, 0 insertions, 0 deletions