Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 07, 2006 source of exception | ||||
---|---|---|---|---|
| ||||
On linux with gdb: If i have an exception I cannot get the source of the exception. A msg like "std.format formatArg" lets me grep through my program and search for all lines calling format and analyse them as potential sources. And this is a good one. Try to find a ArrayBoundsException. Is there a chance to get the "catch throw" command (breaks on a c++ throw) in gdb working? Or is there any better way to find the source? |
May 07, 2006 Re: source of exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | Frank Benoit wrote:
> On linux with gdb:
> If i have an exception I cannot get the source of the exception. A msg
> like "std.format formatArg" lets me grep through my program and search
> for all lines calling format and analyse them as potential sources. And
> this is a good one. Try to find a ArrayBoundsException.
>
> Is there a chance to get the "catch throw" command (breaks on a c++
> throw) in gdb working?
>
> Or is there any better way to find the source?
That's a non-trivial function to add to GDB.
As a hack, I have two different versions of libphobos.a-- the regular one,
plus one that I compiled wherein I insert the following code in the
Exception constructor:
Object o;
o.toString();
GDB catches the segfault, and I can do a backtrace to see what caused the
exception.
~John Demme
|
May 07, 2006 Re: source of exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | In article <e3jg4m$1jj0$1@digitaldaemon.com>, Frank Benoit says... > >On linux with gdb: >If i have an exception I cannot get the source of the exception. A msg >like "std.format formatArg" lets me grep through my program and search >for all lines calling format and analyse them as potential sources. And >this is a good one. Try to find a ArrayBoundsException. > >Is there a chance to get the "catch throw" command (breaks on a c++ >throw) in gdb working? > >Or is there any better way to find the source? I haven't tried it but you might be able to set a break point the exception's constructor. If they don't have one, thay should (at least in the debug version). |
May 07, 2006 Re: source of exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS Attachments: | BCS schrieb am 2006-05-07:
> In article <e3jg4m$1jj0$1@digitaldaemon.com>, Frank Benoit says...
>>
>>On linux with gdb:
>>If i have an exception I cannot get the source of the exception. A msg
>>like "std.format formatArg" lets me grep through my program and search
>>for all lines calling format and analyse them as potential sources. And
>>this is a good one. Try to find a ArrayBoundsException.
>>
>>Is there a chance to get the "catch throw" command (breaks on a c++
>>throw) in gdb working?
>>
>>Or is there any better way to find the source?
>
>
> I haven't tried it but you might be able to set a break point the exception's constructor. If they don't have one, thay should (at least in the debug version).
the interresting breakpoint is:
_d_throw@4
the problem:
gdb interpretes "break _d_throw@4" as "break _d_throw" :(
workaround:
Compile and link your programm.
Use the output of the following shell command to set a breakpoint:
objdump -t yourProgramm | grep "_d_throw@4" | head -n 1 | sed "s: .*::;s:^:break *0x:"
Thomas
|
Copyright © 1999-2021 by the D Language Foundation