Date: Fri, 29 Nov 2024 11:29:01 +0100
Getting a list of the callsites from within a function would not be possible with the current way of compiling and linking?
The function can be called from another translation unit or be dynamically called by function pointer.
What could really make sense is to define a list of things you want to do for debugging, then think about, why it might conflict with compilation (e.g. optimization, inlining, ...) or what might profit from compiler support.
(Then it would still be quite some way for standardization, as it would be quite implementation dependent.)
-----Ursprüngliche Nachricht-----
Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Fr 29.11.2024 11:06
Betreff:Re: [std-proposals] #include <debug>
An:std-proposals_at_[hidden];
CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>;
On Thu, Nov 28, 2024 at 10:55 PM Sebastian Wittmeier via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> The return address is not necessarily a function pointer.
I use a function pointer to store an address of code memory (as
opposed to data memory).
So if we have the address of a function:
void (*func)(void) = &SomeFunction;
And if we know that the first 16 bytes of that function are the
machine code to test a variable and jump, then we can add 16 to the
function pointer to elide the test. Of course this would be very
low-level nitty gritty debugging.
Another thing would be to keep track of all the places from which a
function is invoked (i.e. keep track of all the call sites), something
like:
void Func(void)
{
static thread_local std::set<void(*)(void)> callsites;
callsites.insert( std::debug::get_return_address() );
}
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2024-11-29 10:30:31