Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
August 28, 2008 Exception Handling | ||||
---|---|---|---|---|
| ||||
Is there an easy way to get a stack trace when an exception is caught? |
August 28, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | On Wed, 27 Aug 2008 20:18:30 -0400, sleek wrote:
> Is there an easy way to get a stack trace when an exception is caught?
I believe that is currently a no.
|
August 28, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | sleek wrote: > Is there an easy way to get a stack trace when an exception is caught? The only way I know of currently is http://petermodzelewski.blogspot.com/2008/01/development-in-d-with-use-of-backtrace.html . It's Windows-only. However, my most recent test of the binary tango libs ( http://petermodzelewski.blogspot.com/2008/08/tango-patched-libs-for-0997.html ) had some linking issue, and I was too lazy to follow up on it. There's a Phobos hack there as well as the Tango one, I haven't tried that. Flectioned ( flectioned.kuehne.cn ) used to be able to do it, but it hasn't been updated for over a year. I know the Tango one no longer compiles (though it shouldn't be _too_ much work to get it to do so). Phobos might still work. To trace non-user-defined exceptions with it you need to call TracedException.traceAllExceptions(true); Flectioned works better on Linux (on Windows, it won't trace segfaults/access violations). |
August 28, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | sleek wrote:
> Is there an easy way to get a stack trace when an exception is caught?
On Linux, there's a library called jive floating around. It may be tango-only, and the official version is defunct, but you can find versions of it updated to more recent versions of D and tango.
I know for a fact that it doesn't help when you segfault due to stack overflow (debugging a circular dependency verifier in dconstructor; it only takes a couple seconds to overflow your stack, but it takes ages if you're printing to stdout in the meantime). I don't know whether it catches other segmentation faults, though.
|
August 28, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to sleek | "sleek" <cslush@gmail.com> wrote in message news:g94qsm$t5$1@digitalmars.com... > Is there an easy way to get a stack trace when an exception is caught? > On Windows, you can run your program in ddbg, and it will print out a stack trace when you get an exception (segfaults/stack overflows included) as long as you compiled your program with debug symbols (-g). You can get it here: http://ddbg.mainia.de/releases.html You just use ddbg -cmd="r" myprog.exe on the commandline to load your program and immediately start running it. On linux... yeah I don't know. |
August 28, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | "Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:g95d2h$1ojq$1@digitalmars.com... > "sleek" <cslush@gmail.com> wrote in message news:g94qsm$t5$1@digitalmars.com... >> Is there an easy way to get a stack trace when an exception is caught? >> > > On Windows, you can run your program in ddbg, and it will print out a stack trace when you get an exception (segfaults/stack overflows included) as long as you compiled your program with debug symbols (-g). > > You can get it here: http://ddbg.mainia.de/releases.html > > You just use > > ddbg -cmd="r" myprog.exe > > on the commandline to load your program and immediately start running it. > > On linux... yeah I don't know. > The downside here of course being that it's an external program and not a library/part of the language, but hey, how often do you need a stack trace unless you're debugging? |
August 28, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christopher Wright | Christopher Wright schrieb: > sleek wrote: >> Is there an easy way to get a stack trace when an exception is caught? > > On Linux, there's a library called jive floating around. It may be tango-only, and the official version is defunct, but you can find versions of it updated to more recent versions of D and tango. > > I know for a fact that it doesn't help when you segfault due to stack overflow (debugging a circular dependency verifier in dconstructor; it only takes a couple seconds to overflow your stack, but it takes ages if you're printing to stdout in the meantime). I don't know whether it catches other segmentation faults, though. I use Jive a lot on linux. I put a copy on the DWT project page: http://downloads.dsource.org/projects/dwt/jive.zip |
August 29, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | After considering this for a few hours, I think ddbg is my best bet here. Quite honestly, I should only be catching known exceptions. Anything else that occurs that is unexpected should absolutely bubble up and out. "Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:g95d2h$1ojq$1@digitalmars.com... > "sleek" <cslush@gmail.com> wrote in message news:g94qsm$t5$1@digitalmars.com... >> Is there an easy way to get a stack trace when an exception is caught? >> > > On Windows, you can run your program in ddbg, and it will print out a stack trace when you get an exception (segfaults/stack overflows included) as long as you compiled your program with debug symbols (-g). > > You can get it here: http://ddbg.mainia.de/releases.html > > You just use > > ddbg -cmd="r" myprog.exe > > on the commandline to load your program and immediately start running it. > > On linux... yeah I don't know. > |
August 29, 2008 Re: Exception Handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote:
> "Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:g95d2h$1ojq$1@digitalmars.com...
>> "sleek" <cslush@gmail.com> wrote in message news:g94qsm$t5$1@digitalmars.com...
>>> Is there an easy way to get a stack trace when an exception is caught?
>>>
>> On Windows, you can run your program in ddbg, and it will print out a stack trace when you get an exception (segfaults/stack overflows included) as long as you compiled your program with debug symbols (-g).
>>
>> You can get it here: http://ddbg.mainia.de/releases.html
>>
>> You just use
>>
>> ddbg -cmd="r" myprog.exe
>>
>> on the commandline to load your program and immediately start running it.
>>
>> On linux... yeah I don't know.
>>
>
> The downside here of course being that it's an external program and not a library/part of the language, but hey, how often do you need a stack trace unless you're debugging?
Conversely, when do you explicitly want a lacok of debug information on a crash? Maybe if you're distributing a super-secret closed source application, but that's the only situation I can think of.
|
Copyright © 1999-2021 by the D Language Foundation