On Sun, Dec 07, 2003, Oded Arbel wrote about "I wish stack traces had line numbers":
> 
> But they don't. instead they have memory addresses and the function name. so 
> I've been thinking - suppose I have a binary with debugging information, and 
> the source code and a stack trace - shouldn't I be able to extrapolate from 
> it in what line in the code each frame in the stack is ?
> 
> Note: I don't have a core dump - just a textual stack trace.

Yes, you can easily do what you want, and you don't even need the function
name, just the pointers. The program you're looking for is add2line.

Like you suspected, you'll need an executable with debuging information
for this to work. More interestingly, you can get a stack trace from a
stripped executable and then run add2line on the unstripped executable
(the one before the strip) and get correct results - this is convenient
when space is tight on the actual runtime environment.

-- 
Nadav Har'El                        |       Sunday, Dec 7 2003, 13 Kislev 5764
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-790466, ICQ 13349191 |If you're looking for a helping hand,
http://nadav.harel.org.il           |look first at the end of your arm.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to