https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112263
Bug ID: 112263 Summary: [C++23] std::stacktrace does not identify symbols in shared library Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: vincenzo.innocente at cern dot ch Target Milestone: --- using gcc version 14.0.0 20231028 (experimental) [master r14-4988-g5d2a360f0a5] (GCC) that contains the fix for #111936 This simple example [1] when run as a single executable prints all symbols in the stacktrace when the nested functions are in a shared library their names are missing c++ -std=c++23 testStacktrace.cpp -lstdc++exp -g -DINMAIN -DINLIB ; ./a.out 0# nested_func2(int) at /afs/cern.ch/user/i/innocent/public/ctest/testStacktrace.cpp:13 1# nested_func(int) at /afs/cern.ch/user/i/innocent/public/ctest/testStacktrace.cpp:18 2# func(int) at /afs/cern.ch/user/i/innocent/public/ctest/testStacktrace.cpp:26 3# main at /afs/cern.ch/user/i/innocent/public/ctest/testStacktrace.cpp:31 4# at :0 5# _start at :0 6# c++ -std=c++23 testStacktrace.cpp -lstdc++exp -g -DINLIB -fpic -shared -o liba.so ; c++ -std=c++23 testStacktrace.cpp -lstdc++exp -g -DINMAIN -L. -la -Wl,-rpath=. ; ./a.out 0# at :0 1# at :0 2# func(int) at /afs/cern.ch/user/i/innocent/public/ctest/testStacktrace.cpp:26 3# main at /afs/cern.ch/user/i/innocent/public/ctest/testStacktrace.cpp:31 4# at :0 5# _start at :0 6# [1] cat testStacktrace.cpp //compile and run with either // c++ -std=c++23 testStacktrace.cpp -lstdc++exp -g -DINMAIN -DINLIB; ./a.out // or // c++ -std=c++23 testStacktrace.cpp -lstdc++exp -g -DINLIB -fpic -shared -o liba.so;c++ -std=c++23 testStacktrace.cpp -lstdc++exp -g -DINMAIN -L. -la -Wl,-rpath=.; ./a.out // #include <iostream> #include <stacktrace> #ifdef INLIB int nested_func2(int c) { std::cout << std::stacktrace::current() << '\n'; return c + 1; } int nested_func(int c) { return nested_func2(c + 1); } #else int nested_func(int c); #endif #ifdef INMAIN int func(int b) { return nested_func(b + 1); } int main() { std::cout << func(777); return 0; } #endif