Re: How to break gdb on D exception ?

2015-10-05 Thread Dmitri via Digitalmars-d-learn

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

0x005ff7c4  std.file.FileException.this(const(char[]), 
const(char[]), immutable(char)[], ulong)
0x005ff89c  std.file.FileException.this(const(char[]), 
uint, immutable(char)[], ulong)
0x006139ec  
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.


Re: How to break gdb on D exception ?

2015-10-04 Thread BBasile via Digitalmars-d-learn

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 ?


Re: How to break gdb on D exception ?

2015-10-04 Thread BBasile via Digitalmars-d-learn

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 ;)


Re: How to break gdb on D exception ?

2015-10-02 Thread Dmitri via Digitalmars-d-learn

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.


How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn
Currently it works fine when throwing with core.exception 
functions 'on', 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 ?


Re: How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn

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.


Re: How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn

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


Re: How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn

On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote:

Does anyone manage this ?

I meant: Does anyone master this ?



Re: How to break gdb on D exception ?

2015-10-01 Thread Adam D. Ruppe via Digitalmars-d-learn

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