www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Saturday night stack tracing

reply Robert Fraser <fraserofthenight gmail.com> writes:
Hi --

I've been using Flectioned for stack tracing, which has been doing some 
wonderful things to me. However, the stack trace, though nice, doesn't 
show the file/line where each function is defined. This isn't a MAJOR 
problem for me, since I can report the function overload & search for 
the function based on that, however in the interests of time it might be 
nice to get the exact line the function was called on.

Is there any way to do this, perhaps by using the debug info & comparing 
the call address against that somehow? I'm not too up on these things, 
but it seems like it would be possible.

Thanks!
Jan 12 2008
next sibling parent reply Jascha Wetzel <firstname mainia.de> writes:
Robert Fraser wrote:
 Hi --
 
 I've been using Flectioned for stack tracing, which has been doing some 
 wonderful things to me. However, the stack trace, though nice, doesn't 
 show the file/line where each function is defined. This isn't a MAJOR 
 problem for me, since I can report the function overload & search for 
 the function based on that, however in the interests of time it might be 
 nice to get the exact line the function was called on.
 
 Is there any way to do this, perhaps by using the debug info & comparing 
 the call address against that somehow? I'm not too up on these things, 
 but it seems like it would be possible.
 
 Thanks!
you'll need to parse the debug info that contains lists of address-range to line number mappings. if you're interested in doing this, i can give you the ddbg source to check out how it's done for codeview debug info. for dwarf there is libdwarf, which appears to be pretty good. i'd recommend looking at that before implementing a dwarf parser from scratch.
Jan 13 2008
parent Robert Fraser <fraserofthenight gmail.com> writes:
Jascha Wetzel wrote:
 Robert Fraser wrote:
 Hi --

 I've been using Flectioned for stack tracing, which has been doing 
 some wonderful things to me. However, the stack trace, though nice, 
 doesn't show the file/line where each function is defined. This isn't 
 a MAJOR problem for me, since I can report the function overload & 
 search for the function based on that, however in the interests of 
 time it might be nice to get the exact line the function was called on.

 Is there any way to do this, perhaps by using the debug info & 
 comparing the call address against that somehow? I'm not too up on 
 these things, but it seems like it would be possible.

 Thanks!
you'll need to parse the debug info that contains lists of address-range to line number mappings. if you're interested in doing this, i can give you the ddbg source to check out how it's done for codeview debug info. for dwarf there is libdwarf, which appears to be pretty good. i'd recommend looking at that before implementing a dwarf parser from scratch.
Thanks! Could you send me the source just related to the line no. stuff?
Jan 14 2008
prev sibling next sibling parent reply Frank Benoit <keinfarbton googlemail.com> writes:
Robert Fraser schrieb:
 Hi --
 
 I've been using Flectioned for stack tracing, which has been doing some 
 wonderful things to me. However, the stack trace, though nice, doesn't 
 show the file/line where each function is defined. This isn't a MAJOR 
 problem for me, since I can report the function overload & search for 
 the function based on that, however in the interests of time it might be 
 nice to get the exact line the function was called on.
 
 Is there any way to do this, perhaps by using the debug info & comparing 
 the call address against that somehow? I'm not too up on these things, 
 but it seems like it would be possible.
 
 Thanks!
on linux I use addr2line addr2line -e myprog 0x12345678
Jan 13 2008
parent Frank Benoit <keinfarbton googlemail.com> writes:
Frank Benoit schrieb:
 Robert Fraser schrieb:
 Hi --

 I've been using Flectioned for stack tracing, which has been doing 
 some wonderful things to me. However, the stack trace, though nice, 
 doesn't show the file/line where each function is defined. This isn't 
 a MAJOR problem for me, since I can report the function overload & 
 search for the function based on that, however in the interests of 
 time it might be nice to get the exact line the function was called on.

 Is there any way to do this, perhaps by using the debug info & 
 comparing the call address against that somehow? I'm not too up on 
 these things, but it seems like it would be possible.

 Thanks!
on linux I use addr2line addr2line -e myprog 0x12345678
Actually i use the jive stacktrace which contains all available line numbers. See http://zygfryd.net/hg
Jan 13 2008
prev sibling parent reply John Reimer <terminal.node gmail.com> writes:
Robert Fraser wrote:

 Hi --
 
 I've been using Flectioned for stack tracing, which has been doing some
 wonderful things to me. However, the stack trace, though nice, doesn't
 show the file/line where each function is defined. This isn't a MAJOR
 problem for me, since I can report the function overload & search for
 the function based on that, however in the interests of time it might be
 nice to get the exact line the function was called on.
 
 Is there any way to do this, perhaps by using the debug info & comparing
 the call address against that somehow? I'm not too up on these things,
 but it seems like it would be possible.
 
Have you tried zerobugs yet?
Jan 13 2008
parent Robert Fraser <fraserofthenight gmail.com> writes:
John Reimer wrote:
 Robert Fraser wrote:
 
 Hi --

 I've been using Flectioned for stack tracing, which has been doing some
 wonderful things to me. However, the stack trace, though nice, doesn't
 show the file/line where each function is defined. This isn't a MAJOR
 problem for me, since I can report the function overload & search for
 the function based on that, however in the interests of time it might be
 nice to get the exact line the function was called on.

 Is there any way to do this, perhaps by using the debug info & comparing
 the call address against that somehow? I'm not too up on these things,
 but it seems like it would be possible.
Have you tried zerobugs yet?
I'm trying to integrate the line no. info into Flectioned, not get a stack trace for any one exception.
Jan 14 2008