Closed fxcoudert closed 1 year ago
thanks. This looks exciting to debug ..
Out of interest, does the same code build and/or function if the compiler is clang?
(since the unwinder we are using is libunwind [not libgcc_s] I wonder if the actions are supported).
to answer my own question: clang ~/src-local/gcc-master/gcc/testsuite/gcc.dg/cleanup-8.c -I gcc/include -fexceptions -fnon-call-exceptions -o t ./t (no output)
$ ./gcc/xgcc -Bgcc ~/src-local/gcc-master/gcc/testsuite/gcc.dg/cleanup-8.c -fexceptions -fnon-call-exceptions -o t $ ./t Abort trap: 6
(I suppose at least we can compare the unwind frames between the two)
these fails are triggered by a missing FDE record that updates the CFA to refer to the saved FP(we actually save the FP, but did not update the CFA to refer to it).
For the record, in principle, the unwinder should be able to use the existing CFA (stack pointer) info - but even if that is (a) a bug and (b) it gets fixed for some future OS release, that will not help the existing ones.
The fix was to force the FP on for Darwin (which is OK, since the ABI mandates a FP for non-leaf functions).
We will allow the user to override this with -fomit-frame-pointer
on the assumption that such a user knows the intent.
All four failures are identical, the simplest code is
cleanup-8.c
.The abort that is triggered is this one:
That function,
force_unwind_stop()
, is called 7 times:actions
argument has value_UA_CLEANUP_PHASE | _UA_FORCE_UNWIND
_UA_END_OF_STACK
Running the same code under Linux, the seventh time the argument is still
_UA_CLEANUP_PHASE | _UA_FORCE_UNWIND
.PS: sorry @iains I couldn't reduce that one much further, I really don't know much about exceptions and this unwinding code.