BCS wrote:
I just created a module that generates stack traces on asserts (D2):
http://www.dsource.org/projects/scrapple/browser/trunk/backtrace_assert/debugging.d
Just compile and link it.
It does have some not exactly ideal bits:
-it won't work nicely unless you link with gcc and add the -rdynamic flag.
-accessing some of the posix stuff fubared my link (unresolved
ModuleInfos) so I had to add the prototypes directly (yuck)
-it uses the c function dprintf that on some system does what I want
(print to a low level file stream) and on some system does something
totaly different.
-it has the expected executable name and the location of addr2line hard
coded
(any ideas on how to fix these issues welcomed)
that would be great if i manage to make it work.... for now i get:
/usr/bin/ld: optind: TLS definition in
[...]/crosa/xfbuild/debug/core-sys-posix-unistd.o section .tbss
mismatches non-TLS definition in /lib/libc.so.6 section .data
/lib/libc.so.6: could not read symbols: Bad value
collect2: ld returned 1 exit status
I am using xfbuild, so i have to pass -L-export-dynamic instead of
"-rdynamic. I also have to use your hardcoded declarations, as some of
them "backtrace..." seem not to be in the druntime source.
But i am still fairly new with d, so i might have screwed anywhere else.
j.