Thread overview |
---|
October 02, 2015 How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Currently it works fine when throwing with core.exception functions 'onXXXX', like explained in the wiki, for example: --- break onFinalizeError --- But I can't manage to break when a new Exception instance is thrown in the code: --- throw new Exception("ouch"); --- none of the following GB commands work: --- catch catch catch throw catch signal all catch signal --- It looks like there are some tricks, like put a break on the vtbl of the base throwable class (no quite sure about this to be honest...) Does anyone manage this ? |
October 02, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:
> Does anyone manage this ?
I meant: Does anyone master this ?
|
October 02, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:
> none of the following GB commands work:
give
break d_throw
or maybe `break d_throwc` a try
|
October 02, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote:
> On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:
>> none of the following GB commands work:
>
> give
>
> break d_throw
>
> or maybe `break d_throwc` a try
unfortunately it doesn't work, i get
---
(gdb) Function "d_throw"/"d_throwc" not defined.
|
October 02, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote:
> On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote:
>> On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:
>>> none of the following GB commands work:
>>
>> give
>>
>> break d_throw
>>
>> or maybe `break d_throwc` a try
>
> unfortunately it doesn't work, i get
>
> ---
> (gdb) Function "d_throw"/"d_throwc" not defined.
it was almost that actually,
'break _d_throwc
|
October 02, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 2 October 2015 at 04:50:59 UTC, BBasile wrote:
> On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote:
>> On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote:
>>> On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:
>>>> none of the following GB commands work:
>>>
>>> give
>>>
>>> break d_throw
>>>
>>> or maybe `break d_throwc` a try
>>
>> unfortunately it doesn't work, i get
>>
>> ---
>> (gdb) Function "d_throw"/"d_throwc" not defined.
>
> it was almost that actually,
> 'break _d_throwc
Or you could break on a specific exception class's constructor.
|
October 04, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitri | On Friday, 2 October 2015 at 09:15:13 UTC, Dmitri wrote:
> On Friday, 2 October 2015 at 04:50:59 UTC, BBasile wrote:
>> On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote:
>>> On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote:
>>>> On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:
>>>>> none of the following GB commands work:
>>>>
>>>> give
>>>>
>>>> break d_throw
>>>>
>>>> or maybe `break d_throwc` a try
>>>
>>> unfortunately it doesn't work, i get
>>>
>>> ---
>>> (gdb) Function "d_throw"/"d_throwc" not defined.
>>
>> it was almost that actually,
>> 'break _d_throwc
>
> Or you could break on a specific exception class's constructor.
This would be better.
1/ because I could propose a modifiable list of the exception kinds to track in the options).
2/ because with _d_trow_c, info stack #1 is really not interesting. #2 or #3 is usually where the 'thing' really happens.
How can I do that, for example with FileException class ?
|
October 05, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Sunday, 4 October 2015 at 14:31:43 UTC, BBasile wrote:
> On Friday, 2 October 2015 at 09:15:13 UTC, Dmitri wrote:
>> On Friday, 2 October 2015 at 04:50:59 UTC, BBasile wrote:
>>> On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote:
>>>> On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote:
>>>>> [...]
>>>>
>>>> unfortunately it doesn't work, i get
>>>>
>>>> ---
>>>> (gdb) Function "d_throw"/"d_throwc" not defined.
>>>
>>> it was almost that actually,
>>> 'break _d_throwc
>>
>> Or you could break on a specific exception class's constructor.
>
> This would be better.
>
> 1/ because I could propose a modifiable list of the exception kinds to track in the options).
> 2/ because with _d_trow_c, info stack #1 is really not interesting. #2 or #3 is usually where the 'thing' really happens.
>
> How can I do that, for example with FileException class ?
Ast visitor -> ThrowStatement -> detect class from token text -> break file:line ?
Puting BP manally is not an option. I ask this for GDB integration in my IDE ;)
|
October 05, 2015 Re: How to break gdb on D exception ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Sunday, 4 October 2015 at 14:31:43 UTC, BBasile wrote: > On Friday, 2 October 2015 at 09:15:13 UTC, Dmitri wrote: >> On Friday, 2 October 2015 at 04:50:59 UTC, BBasile wrote: >>> On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote: >>>> On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote: >>>>> On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote: >>>>>> none of the following GB commands work: >>>>> >>>>> give >>>>> >>>>> break d_throw >>>>> >>>>> or maybe `break d_throwc` a try >>>> >>>> unfortunately it doesn't work, i get >>>> >>>> --- >>>> (gdb) Function "d_throw"/"d_throwc" not defined. >>> >>> it was almost that actually, >>> 'break _d_throwc >> >> Or you could break on a specific exception class's constructor. > > This would be better. > > 1/ because I could propose a modifiable list of the exception kinds to track in the options). > 2/ because with _d_trow_c, info stack #1 is really not interesting. #2 or #3 is usually where the 'thing' really happens. > > How can I do that, for example with FileException class ? Well, you look it up: info func FileException 0x00000000005ff7c4 std.file.FileException.this(const(char[]), const(char[]), immutable(char)[], ulong) 0x00000000005ff89c std.file.FileException.this(const(char[]), uint, immutable(char)[], ulong) 0x00000000006139ec std.stream.StreamFileException.this(immutable(char)[]) and then set either via a name or an address: b std.file.FileException.this or b *0x5ff7c4 with the difference that the name version potentially sets multiple breakpoints and moves it just after the frame setup code. |
Copyright © 1999-2021 by the D Language Foundation