On 05/10/2021 19:03, Segher Boessenkool wrote:
On Tue, Oct 05, 2021 at 03:32:52PM -0300, Raphael Moreira Zinsly wrote:
Without dwarf2 unwind tables available _Unwind_Backtrace() is not
able to return the full backtrace.
This patch adds a fallback function on powerpc to get the backtrace
by doing a backchain, this code was originally at glibc.
libgcc/ChangeLog:
* config/rs6000/linux-unwind.h (struct rt_sigframe): Move it to
outside of get_regs() in order to use it in another function, this
is done twice: for __powerpc64__ and for !__powerpc64__.
(struct trace_arg): New struct.
(struct layout): New struct.
(ppc_backchain_fallback): New function.
* unwind.inc (_Unwind_Backtrace): Look for _URC_NORMAL_STOP code
state and call MD_BACKCHAIN_FALLBACK.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/unwind-backchain.c: New test.
---
.../gcc.target/powerpc/unwind-backchain.c | 24 +++++
libgcc/config/rs6000/linux-unwind.h | 102 +++++++++++++++---
libgcc/unwind.inc | 14 ++-
3 files changed, 124 insertions(+), 16 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/powerpc/unwind-backchain.c
So what is new or different in v3 compared to v2?
gcc/testsuite/gcc.target/powerpc/unwind-backchain.c:
- Added a comment explaining why test only on *-linux targets.
- Changed the dejagnu target from powerpc*-*-linux* to *-*-linux*.
--
Raphael Moreira Zinsly