digitalmars.D.learn - Query Parser Callstack
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (5/5) Sep 01 2014 Are there some nice traits or internals to query the current call
- Kagamin (2/2) Sep 02 2014 You can try to create an exception and get stack trace from it.
- Gary Willoughby (15/21) Sep 02 2014 I've no idea how it is used but '_d_traceContext' might be of use:
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (5/7) Sep 02 2014 Ok, thanks. I just realized that
Are there some nice traits or internals to query the current call stack for address or perhaps even their (mangled) names. I'm mostly interested in using this to detect infinite recursions in my recursive descent parser. This provided that my parser slice hasn't changed since last call to the same function.
Sep 01 2014
You can try to create an exception and get stack trace from it. The functionality is in druntime.
Sep 02 2014
On Monday, 1 September 2014 at 21:00:46 UTC, Nordlöw wrote:Are there some nice traits or internals to query the current call stack for address or perhaps even their (mangled) names. I'm mostly interested in using this to detect infinite recursions in my recursive descent parser. This provided that my parser slice hasn't changed since last call to the same function.I've no idea how it is used but '_d_traceContext' might be of use: import std.stdio; int foo(int n) { writefln("&foo: 0x%X", &foo); writefln("%s", _d_traceContext(&foo)); return n; } extern(C) Throwable.TraceInfo _d_traceContext(void* ptr = null); void main(string[] args) { auto x = foo(100); } Found in object_.d in the druntime repo.
Sep 02 2014
On Tuesday, 2 September 2014 at 18:10:19 UTC, Gary Willoughby wrote:I've no idea how it is used but '_d_traceContext' might be of use:Ok, thanks. I just realized that http://code.dlang.org/packages/backtrace-d might be of use here aswell.
Sep 02 2014