public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libbacktrace/112263] [C++23] std::stacktrace does not identify symbols in shared library
Date: Wed, 01 Nov 2023 11:16:38 +0000	[thread overview]
Message-ID: <bug-112263-4-5UmphJmxq1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112263-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
so if I add to
    std::cout << std::stacktrace::current() << '\n';
I get what needed
   Dl_info dlinfo;
   for (auto & entry : std::stacktrace::current() ) {
     dladdr((const void*)(entry.native_handle()),&dlinfo);
     std::cout << dlinfo.dli_sname << ' ' << dlinfo.dli_fname <<'\n';
   }

 c++ -std=c++23 testStacktrace.cpp -lstdc++exp -g -DINLIB -fpic -shared -o
liba.so -ldl ; 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
/data/user/innocent/MallocProfiler/tests/testStacktrace.cpp:44
   3# main at /data/user/innocent/MallocProfiler/tests/testStacktrace.cpp:49
   4#      at :0
   5# _start at :0
   6#

_Z12nested_func2i ./liba.so
_Z11nested_funci ./liba.so

of course not de-mangled....

so is it a feature or a defect?

I'm not sure how the implementation works (did not look to the code)
dladdr can be slow and may "hang" in some situations.
so it would be useful to have an option that the "name" is not immediately
resolved
and have a function that returns the name from the native_handle
"asynchronously"

  parent reply	other threads:[~2023-11-01 11:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-28 15:35 [Bug libstdc++/112263] New: " vincenzo.innocente at cern dot ch
2023-10-28 21:04 ` [Bug libstdc++/112263] " redi at gcc dot gnu.org
2023-10-30 13:43 ` [Bug libbacktrace/112263] " vincenzo.innocente at cern dot ch
2023-10-31  1:07 ` ian at airs dot com
2023-10-31 10:45 ` vincenzo.innocente at cern dot ch
2023-11-01 11:16 ` vincenzo.innocente at cern dot ch [this message]
2023-11-01 13:09 ` vincenzo.innocente at cern dot ch
2023-11-03  3:05 ` ian at airs dot com
2023-11-03  9:55 ` vincenzo.innocente at cern dot ch
2023-11-03 16:32 ` redi at gcc dot gnu.org
2023-11-04  5:56 ` pinskia at gcc dot gnu.org
2023-11-05  0:05 ` ian at airs dot com
2023-11-05 10:49 ` vincenzo.innocente at cern dot ch
2023-11-06 23:11 ` cvs-commit at gcc dot gnu.org
2023-11-06 23:12 ` cvs-commit at gcc dot gnu.org
2023-11-06 23:13 ` cvs-commit at gcc dot gnu.org
2023-11-06 23:13 ` ian at airs dot com
2023-11-06 23:30 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112263-4-5UmphJmxq1@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).