Line number of Exception instantiation

Fawzi Mohamed fmohamed at mac.com
Fri Mar 5 03:20:13 PST 2010


On 2010-03-05 02:05:19 +0100, Ellery Newcomer 
<ellery-newcomer at utulsa.edu> said:

> On 03/04/2010 02:49 PM, Fawzi Mohamed wrote:
>>>> 
>>>> Bye,
>>>> bearophile
>>> 
>>> Doesn't tango's exception tracing do that?
>> 
>> sure it does, just import TraceExceptions...
>> The exception will contain the stacktrace at the throwing point
>> (adresses)... and with printOut you can get a symbolic trace (if possible).
>> 
> 
> Can you actually get line number information with the stack trace? With 
> my setup, it looks like line numbers should be in there, but they never 
> get initialized.

the answer is "it depends", first you have to compile with -g, then 
windows works (thanks to h3r3tic impl), linux has recently been added 
by wm4 (after release if I remember correctly), with mac you are out of 
luck.

please not that a solution using addr2line as BCS did should also work 
on linux, it was not done because being able to give a partial info 
even if the program was crashing was considered more important.
Still you can call addr2line yourself after the fact to get the line 
information (if available), I had asked for someone to write a 
stacktrace parser that would complete the stacktrace, or writing a 
addr2line backend, but nobody stepped up, and now wm4 solution seem to 
work well.

> p.s. TraceExceptions is awesome; I can't believe I never knew about 
> them until a week or two ago

happy to hear that :)




More information about the Digitalmars-d mailing list