www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to break gdb on D exception ?

reply BBasile <bb.temp gmx.com> writes:
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 ?
Oct 01 2015
next sibling parent BBasile <bb.temp gmx.com> writes:
On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:
 Does anyone manage this ?
I meant: Does anyone master this ?
Oct 01 2015
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
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
Oct 01 2015
parent reply BBasile <bb.temp gmx.com> writes:
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.
Oct 01 2015
parent reply BBasile <bb.temp gmx.com> writes:
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
Oct 01 2015
parent reply Dmitri <deemok gmail.com> writes:
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.
Oct 02 2015
parent reply BBasile <bb.temp gmx.com> writes:
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). How can I do that, for example with FileException class ?
Oct 04 2015
next sibling parent BBasile <bb.temp gmx.com> writes:
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). 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 ;)
Oct 04 2015
prev sibling parent Dmitri <deemok gmail.com> writes:
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). 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.
Oct 05 2015