Get variables with call stack

Vladimir Panteleev thecybershadow.lists at gmail.com
Sat Sep 22 05:49:05 UTC 2018


On Saturday, 22 September 2018 at 05:43:53 UTC, Vladimir 
Panteleev wrote:
> The only way to do that would be using a debugger.
>
> The specifics of the solution would thus depend on the 
> platform. On POSIX, it would probably mean getting gdb to print 
> a detailed backtrace for your project. On Windows, you might be 
> able to achieve this by spawning a thread which then uses 
> dbgeng.dll to get a detailed stack trace.

One thing to note: only variables in stack frames since the most 
top-level exception block will be visible (so, you'll also need 
to disable D runtime's standard exception handler). The reason 
for this is that exceptions do not capture the entire stack, but 
extract only a stack trace during instantiation, so to get the 
entire stack, you'd need to breakpoint _d_throw or such, but at 
that point you don't know if you're within an exception frame 
ready to catch the thrown exception.

In short: there is no easy way, in the general sense.



More information about the Digitalmars-d-learn mailing list