Reading signal handler frame in AIX
In AIX if gdb is debugging an application which has a signal handler
and reaches the signal handler frame, then we need to read the back
chain address from sigcontext saved on the stack, similarly the LR.
As backchain at an offset 0 will be 0, because we will have a
sigconext saved after the minimum stack size. So the correct
backchain will be at an offset after minimum stack and the LR at
an offset 8 will be of the signal millicode address.
If the back chain pointer is NULL and the LR field is in the kernel
segment(ex. 0x00004a14) then we can probably assume we are in a
signal handler.
sample output
(gdb) bt
0 sig_handle_aix (signo=11) at aix-sighandle.c:7
1 0x0000000000004a94 in ?? ()
(gdb)
expected output
(gdb) bt
0 sig_handle_aix (signo=11) at aix-sighandle.c:7
1 <signal handler called>
2 0x0000000100000748 in foo () at aix-sighandle.c:14
3 0x000000010000079c in main () at aix-sighandle.c:19
gdb/ChangeLog:
2018-11-01 Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
* rs6000-aix-tdep.c: Include "trad-frame.h" and "frame-unwind.h".
(SIG_FRAME_LR_OFFSET64): New define.
(SIG_FRAME_FP_OFFSET64): New define.
(aix_sighandle_frame_cache): New Function.
(aix_sighandle_frame_this_id): New Function.
(aix_sighandle_frame_prev_register): New Function.
(aix_sighandle_frame_sniffer): New Function.
(aix_sighandle_frame_unwind): New global variable.
(rs6000_aix_init_osabi): Install new frame unwinder.
gdb/testsuite/ChangeLog:
2018-11-01 Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
* gdb.arch/aix-sighandle.c: New file.
* gdb.arch/aix-sighandle.exp: New file.