[AArch64] Teach prologue unwinder to terminate gracefully
authorPierre Langlois <pierre.langlois@arm.com>
Thu, 9 Jul 2015 15:35:11 +0000 (16:35 +0100)
committerPierre Langlois <pierre.langlois@arm.com>
Thu, 9 Jul 2015 15:35:11 +0000 (16:35 +0100)
commit7dfa3edc033c443036d9f2a3e01120f7fb54f498
treea6e9c35f891efd382bc8cc799374fa508a9c224e
parentdb634143224dc7cb985d996bed15257f5cb86b25
[AArch64] Teach prologue unwinder to terminate gracefully

Without debugging information, we have the following issue when
examining a trace buffer:

~~~
...
(gdb) trace f
Tracepoint 3 at 0x7fb7fc28c0
(gdb) tstart
(gdb) continue
...
(gdb) tstop
(gdb) tfind start
Register 31 is not available.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Found trace frame 0, tracepoint 3
#-1 0x0000007fb7fc28c0 in f () ...
^^^
~~~

The reason for this is that the target's stack pointer is unavailable
when examining the trace buffer.  What we are seeing is due to the
'tfind' command creating a sentinel frame and unwinding it.  If an
exception is thrown, we are left with the sentinel frame being displayed
at level #-1.  The exception is thrown when the prologue unwinder tries
to read the stack pointer to construct an ID for the frame.

This patch fixes this by making the prologue unwinder catch
NOT_AVAILABLE_ERROR exceptions when either registers or memory is
unreadable and report back to the frame core code with
UNWIND_UNAVAILABLE.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_prologue_cache) <available_p>: New
field.
(aarch64_make_prologue_cache_1): New function, factored out from
aarch64_make_prologue_cache.  Do not allocate cache.  Set
available_p.
(aarch64_make_prologue_cache): Reimplement wrapping
aarch64_make_prologue_cache_1, and swallowing
NOT_AVAILABLE_ERROR.
(aarch64_prologue_frame_unwind_stop_reason): New function.
Return UNWIND_UNAVAILABLE if available_p is not set.
(aarch64_prologue_unwind): Install it.
(aarch64_prologue_this_id): Move prev_pc and prev_sp limit
checks into aarch64_prologue_frame_unwind_stop_reason.  Call
frame_id_build_unavailable_stack if available_p is not set.
gdb/ChangeLog
gdb/aarch64-tdep.c
This page took 0.02647 seconds and 4 git commands to generate.