[AArch64] Teach stub unwinder to terminate gracefully
The stub unwinder is used on AArch64 if the target's memory is not
readable at the current PC. For example, the user could try to call at
an invalid address such as 0x0, as covered in the gdb.base/signull.exp
test case. Many GDB ports use a similar unwinder to handle this case
too.
If we purposely kill the inferior before examining the trace then we get
the following issue:
~~~
...
(gdb) trace f
Tracepoint 3 at 0x7fb7fc28c0
(gdb) tstart
(gdb) continue
...
(gdb) tstop
(gdb) tsave /tmp/trace
(gdb) kill
...
(gdb) target tfile /tmp/trace
...
(gdb) tfind
Register 31 is not available.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Found trace frame 0, tracepoint 3
#-1 0x0000007fb7fc28c0 in f () ...
^^^
~~~
This patch teaches the stub unwinder to report to the core frame code
with UNWIND_UNAVAILABLE when either the stack pointer of the return
address are unavailable to read from the target.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_make_stub_cache): Set available_p and
swallow NOT_AVAILABLE_ERROR.
(aarch64_stub_this_id): Call frame_id_build_unavailable_stack if
available_p is not set.
(aarch64_stub_frame_unwind_stop_reason): New function.
(aarch64_stub_unwind): Install it.