Boost logo

Boost Users :

From: Foelsche, Peter (peter.foelsche_at_[hidden])
Date: 2024-02-19 12:59:52


According to chatgpt the stracktrace object is only valid while the stack on which it has been allocated is still active and an allocation using new is not legal.

From: Antony Polukhin <antoshkka_at_[hidden]>
Sent: Sunday, February 18, 2024 8:07 AM
To: boost-users <boost-users_at_[hidden]>
Cc: Foelsche, Peter (DI SW ICS CICV R&D SIM1 5) <peter.foelsche_at_[hidden]>
Subject: Re: [Boost-users] boost::stacktrace::stacktrace AND addr2line

On Fri, Feb 9, 2024, 20:02 Foelsche, Peter via Boost-users <boost-users_at_[hidden]<mailto:boost-users_at_[hidden]>> wrote:
Dear All,

Thanks for outstanding quality of boost!

I'm using the stacktrace object together with debug info and BOOST_STACKTRACE_USE_ADDR2LINE defined.
Would it be possible to cache the output of addr2line assuming that during the lifetime of the calling process the queried executable or shared objects do not change?

You could do a generic cache that does not depend on the stacktrace implementation. Just make a unordered_map and map a stacktrace object to a string with decoded stacktrace. Or you could do a per-frame cache, mapping a frame to demangled name. Here's an example: https://github.com/userver-framework/userver/blob/develop/universal/src/logging/stacktrace_cache.cpp
Thanks
Peter

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]<mailto:Boost-users_at_[hidden]>
https://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net