www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Tango backtrace hack?

reply Robert Fraser <fraserofthenight gmail.com> writes:
Has anyone been able to get the backtrace hack working with the newest 
Tango?

Thanks,
Robert
Mar 28 2009
next sibling parent reply Robert Fraser <fraserofthenight gmail.com> writes:
Robert Fraser wrote:
 Has anyone been able to get the backtrace hack working with the newest 
 Tango?
 
 Thanks,
 Robert

... On Windows + DMD 1.041?
Mar 28 2009
parent Robert Fraser <fraserofthenight gmail.com> writes:
Robert Fraser wrote:
 Robert Fraser wrote:
 Has anyone been able to get the backtrace hack working with the newest 
 Tango?

 Thanks,
 Robert

... On Windows + DMD 1.041?

In particular, I've narrowed the problem down to CreateProcessW, which is sending "The parameter is incorrect." This is rendered as: tango.sys.Process.ProcessCreateException: Could not create process for C:/d/dmd/bin/dmc.exe : The parameter is incorrect. Any Tango lovers know what the issue might be? (I know I should have posted this in learn, sorry!)
Mar 30 2009
prev sibling next sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
Robert Fraser wrote:
 Has anyone been able to get the backtrace hack working with the newest 
 Tango?

What is the state of backtrace support, anyway? I know the flectioned plugin is outdated and broken now. I don't suppose someone could enumerate and link to the others?
Mar 30 2009
parent Robert Fraser <fraserofthenight gmail.com> writes:
Sean Kelly wrote:
 Robert Fraser wrote:
 Has anyone been able to get the backtrace hack working with the newest 
 Tango?

What is the state of backtrace support, anyway? I know the flectioned plugin is outdated and broken now. I don't suppose someone could enumerate and link to the others?

This is the one I was trying to get to work: http://petermodzelewski.blogspot.com/2008/01/installing-tango-backtrace-hack-on.html I could just do it manually, but that seems like a lot of work ;-P. It seems to be in the proposed patches of the tango svn, but hasn't been applied yet.
Apr 01 2009
prev sibling parent reply Fawzi Mohamed <fmohamed mac.com> writes:
On 2009-03-28 23:10:44 +0100, Robert Fraser <fraserofthenight gmail.com> said:

 Has anyone been able to get the backtrace hack working with the newest Tango?
 
 Thanks,
 Robert

The svn version of tango has some backtracing ability: - windows: backtrace non optimized executables compiled with -g to get function names and line numbers (thanks to h3) - mac: backtrace executables, get nice names, but no line numbers - linux: backtrace, get just the addresses, those can be resolved through addr2line to have function and file/line number The goal is to make it as memory friendly as possible (i.e. without heap allocations, but also with limited stack usage, to use that in fibers stacks that might be small), thus it is different from how it used to be. This is especially true for the demangler (based on Hxal's jive demangler). Unfortunately the main obstacles toward having a good stacktrace on linux are license problems: the main utilities/libraries are GPL, and using them would make the whole tango GPL. There are ways to avoid these problems, but require more coding, if anybody wants to take a stab at it he is welcome, there is some discussion in http://www.dsource.org/projects/tango/ticket/1368 The support is still partial, but will hopefully improve Fawzi
Apr 01 2009
parent reply grauzone <none example.net> writes:
 - linux: backtrace, get just the addresses, those can be resolved 
 through addr2line to have function and file/line number

You can get the mangled function name in a very simple way: just open /proc/self/exe and read the .symtab and .strtab sections. That's not perfect, but better than nothing, and it's probably much simpler than to parse the debugging infos.
Apr 01 2009
parent Fawzi Mohamed <fmohamed mac.com> writes:
On 2009-04-01 19:16:20 +0200, grauzone <none example.net> said:

 - linux: backtrace, get just the addresses, those can be resolved 
 through addr2line to have function and file/line number

You can get the mangled function name in a very simple way: just open /proc/self/exe and read the .symtab and .strtab sections. That's not perfect, but better than nothing, and it's probably much simpler than to parse the debugging infos.

patch are welcome ;) at the moment I use dladdr which on mac gives info for both static and dynamically loaded objects, but on linux gives just the offset to the beginning of the static exe image. Fawzi
Apr 01 2009