How to break gdb on D exception ?

Dmitri via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 5 01:34:19 PDT 2015


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.


More information about the Digitalmars-d-learn mailing list