[OT] Which IDE / Editor do you use?
Adam D. Ruppe
destructionator at gmail.com
Sat Sep 14 10:34:26 PDT 2013
On Saturday, 14 September 2013 at 12:25:44 UTC, Paolo Invernizzi
wrote:
> Give me a way to writeln the callstack frames at a certain
Challenge accepted:
import std.stdio;
string getStackTrace() {
import core.runtime;
version(Posix) {
// druntime cuts out the first few functions on
the trace as they are internal
// so we'll make some dummy functions here so our
actual info doesn't get cut
Throwable.TraceInfo f5() { return
defaultTraceHandler(); }
Throwable.TraceInfo f4() { return f5(); }
Throwable.TraceInfo f3() { return f4(); }
Throwable.TraceInfo f2() { return f3(); }
auto stuff = f2();
} else {
auto stuff = defaultTraceHandler();
}
return stuff.toString();
}
void foo() {
writeln("on foo");
bar();
}
void bar() {
writeln("on bar");
omg();
}
void omg() {
writeln("on omg");
writeln(getStackTrace());
}
void main() {
omg();
writeln("\n****\n");
foo();
}
More information about the Digitalmars-d
mailing list