https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105590

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
disclaimer: I have not looked at libbacktrace for some time - but the current
behaviour matches my understanding of the situation.

On Darwin, debug information is not stored in the main executable, but in a
separate file package named 'exe-name'.dSYM (where the exe has a name
'exe-name').

Actually, for most executables there are unwind frames in the main executable
(but those might also be 'compacted').  I guess it might be possible to amend
libbacktrace to attempt to find the unwind data from the exe and then fall back
to using the .dSYM (someone needs to find the time to implement [or fix that if
it is supposed to work already])

Anyway, AFAIR, the current implementation of libbacktrace does not attempt to
find the unwind data from the exe, but instead looks for the 'exe-name.dSYM' to
find it.  If that file package is absent, the backtrace is omitted.

We do not automatically build the .dSYM files for a gcc build [cc1, cc1plus
etc] (nor do we install them).

However, suppose you have a current build of gcc:

"dsymutil gcc/cc1plus" will generate 'cc1plus.dSYM' and then we get a working
backtrace:

$ ./gcc/xg++ -Bgcc -std=c++20
/src-local/cxx-coroutines/gcc/testsuite/g++.dg/coroutines/pr102508-2.C -S
/src-local/cxx-coroutines/gcc/testsuite/g++.dg/coroutines/pr102508-2.C: In
function ‘void
foo(foo()::_Z3foov.Frame*)’:/src-local/cxx-coroutines/gcc/testsuite/g++.dg/coroutines/pr102508-2.C:34:17:
internal compiler error: in gimplify_expr, at gimplify.cc:15905
   34 |                 co_return ex;
      |                 ^~~~~~~~~
0x100fa4b28 gimplify_cleanup_point_expr
        /src-local/gcc-master/gcc/gimplify.cc:7151
0x100fa4b28 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
        ???:0
0x100fa7658 gimplify_stmt(tree_node**, gimple**)
        /src-local/gcc-master/gcc/gimplify.cc:7151
0x100fa5353 gimplify_statement_list
        /src-local/gcc-master/gcc/gimplify.cc:2019
0x100fa5353 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
        ???:0
0x100fa7658 gimplify_stmt(tree_node**, gimple**)
        /src-local/gcc-master/gcc/gimplify.cc:7151
<snip>

So one could generate the gcc/.dSYM for cc1*, f951, gnat1 etc. before a test
suite run.

NOTE: I have no idea if this would work for my (currently out of tree) arm64
port it's unlikely, I guess without some work to implement the low-level glue.

Reply via email to