Thread overview
Exception stack traces on Phobos2? (Win or Lin)
Sep 04, 2010
Nick Sabalausky
Sep 04, 2010
Nick Sabalausky
Sep 04, 2010
Brad Roberts
Sep 05, 2010
Jonathan M Davis
Sep 05, 2010
Nick Sabalausky
Sep 05, 2010
Jonathan M Davis
Sep 05, 2010
Nick Sabalausky
Sep 05, 2010
Nick Sabalausky
September 04, 2010
Is there a way to get stack traces for exceptions on Phobos2? For either Windows (preferably), or for Linux.

-------------------------------
Not sent from an iPhone.


September 04, 2010
"Nick Sabalausky" <a@a.a> wrote in message news:i5ufqs$1v26$1@digitalmars.com...
> Is there a way to get stack traces for exceptions on Phobos2? For either Windows (preferably), or for Linux.
>

Oops, sorry, I completely forgot I asked the exact same thing here little more than a month ago :)

But, someone there reported they're getting them in Linux as long as they don't use -release, but on Linux, even with both -debug and -g, I'm just getting meaningless addresses, no names or anything.


September 04, 2010
On 9/4/2010 3:14 PM, Nick Sabalausky wrote:
> "Nick Sabalausky" <a@a.a> wrote in message news:i5ufqs$1v26$1@digitalmars.com...
>> Is there a way to get stack traces for exceptions on Phobos2? For either Windows (preferably), or for Linux.
>>
> 
> Oops, sorry, I completely forgot I asked the exact same thing here little more than a month ago :)
> 
> But, someone there reported they're getting them in Linux as long as they don't use -release, but on Linux, even with both -debug and -g, I'm just getting meaningless addresses, no names or anything.
> 

Progress has been made, but it's slow in coming.  Sean just landed a rewrite of the buggy and inefficient std.demangle as core.demangle, an important stepping stone to adding that to the stack trace generator.  I'm investigating a couple issues with it right now, in fact.

  See also: bug 1001

Later,
Brad
September 05, 2010
On Saturday 04 September 2010 15:14:30 Nick Sabalausky wrote:
> "Nick Sabalausky" <a@a.a> wrote in message news:i5ufqs$1v26$1@digitalmars.com...
> 
> > Is there a way to get stack traces for exceptions on Phobos2? For either Windows (preferably), or for Linux.
> 
> Oops, sorry, I completely forgot I asked the exact same thing here little more than a month ago :)
> 
> But, someone there reported they're getting them in Linux as long as they don't use -release, but on Linux, even with both -debug and -g, I'm just getting meaningless addresses, no names or anything.

Add

-L--export-dynamic

to your dmd build command, and you should get mangled names. Demangled names are still in the works unfortunately, but it's better than nothing.

Personally, my real problem is the difficulty in figuring out which unittest an exception was thrown from when it's not an assert in the unit test itself which fails. But fixing that would require name unit tests, and Walter hasn't agreed to do those yet...

In any case, you should be able to get mangled names on linux.

- Jonathan M Davis
September 05, 2010
"Jonathan M Davis" <jmdavisprog@gmail.com> wrote in message news:mailman.95.1283646171.858.digitalmars-d-learn@puremagic.com...
> On Saturday 04 September 2010 15:14:30 Nick Sabalausky wrote:
>> "Nick Sabalausky" <a@a.a> wrote in message news:i5ufqs$1v26$1@digitalmars.com...
>>
>> > Is there a way to get stack traces for exceptions on Phobos2? For
>> > either
>> > Windows (preferably), or for Linux.
>>
>> Oops, sorry, I completely forgot I asked the exact same thing here little more than a month ago :)
>>
>> But, someone there reported they're getting them in Linux as long as they don't use -release, but on Linux, even with both -debug and -g, I'm just getting meaningless addresses, no names or anything.
>
> Add
>
> -L--export-dynamic
>
> to your dmd build command, and you should get mangled names. Demangled
> names are
> still in the works unfortunately, but it's better than nothing.
>
> Personally, my real problem is the difficulty in figuring out which
> unittest an
> exception was thrown from when it's not an assert in the unit test itself
> which
> fails. But fixing that would require name unit tests, and Walter hasn't
> agreed to
> do those yet...
>
> In any case, you should be able to get mangled names on linux.
>

Didn't work for me on Linux/2.048.


September 05, 2010
On Saturday 04 September 2010 17:25:23 Nick Sabalausky wrote:
> Didn't work for me on Linux/2.048.

I'm not sure what to tell you. I'm using dmd 2.048 on linux, and if I compile the following program

void func()
{
    assert(1 == 0);
}

void main()
{
    func();
}


with the command

dmd d.d -L--export-dynamic


I get

core.exception.AssertError@d(3): Assertion failure
----------------
./d(_d_assertm+0x16) [0x805ae46]
./d(_D1d8__assertFiZv+0x12) [0x8058912]
./d(_D1d4funcFZv+0xd) [0x80588f1]
./d(_Dmain+0x8) [0x80588fc]
./d(_D2rt6dmain24mainUiPPaZi7runMainMFZv+0x1a) [0x805b036]
./d(_D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv+0x24) [0x805af90]
./d(_D2rt6dmain24mainUiPPaZi6runAllMFZv+0x32) [0x805b07a]
./d(_D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv+0x24) [0x805af90]
./d(main+0x96) [0x805af36]
/opt/lib32/lib/libc.so.6(__libc_start_main+0xe6) [0xf7557c76]
./d() [0x8058831]


So, it _should_ work on liunx with dmd 2.048.

- Jonathan M Davis
September 05, 2010
"Jonathan M Davis" <jmdavisprog@gmail.com> wrote in message news:mailman.96.1283648486.858.digitalmars-d-learn@puremagic.com...
> On Saturday 04 September 2010 17:25:23 Nick Sabalausky wrote:
>> Didn't work for me on Linux/2.048.
>
> I'm not sure what to tell you. I'm using dmd 2.048 on linux, and if I
> compile
> the following program
>
...
>
> So, it _should_ work on liunx with dmd 2.048.
>

It is working now, thanks. The problem turned out to be rdmd refusing to actually rebuild when using the -of switch and adding -L--export-dynamic.


September 05, 2010
"Nick Sabalausky" <a@a.a> wrote in message news:i5v7gv$226$1@digitalmars.com...
> "Jonathan M Davis" <jmdavisprog@gmail.com> wrote in message news:mailman.96.1283648486.858.digitalmars-d-learn@puremagic.com...
>> On Saturday 04 September 2010 17:25:23 Nick Sabalausky wrote:
>>> Didn't work for me on Linux/2.048.
>>
>> I'm not sure what to tell you. I'm using dmd 2.048 on linux, and if I
>> compile
>> the following program
>>
> ...
>>
>> So, it _should_ work on liunx with dmd 2.048.
>>
>
> It is working now, thanks. The problem turned out to be rdmd refusing to actually rebuild when using the -of switch and adding -L--export-dynamic.
>

http://d.puremagic.com/issues/show_bug.cgi?id=4814