Re: scope guards & debugger breakpoints?

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn

On 5/21/18 1:50 PM, Robert M. Münch wrote:

On 2018-05-21 17:24:12 +, Steven Schveighoffer said:


I'm not 100% sure but I expect:

scope(failure)
    someCode();

putting a breakpoint on someCode should work.


When calling a function an then setting the breakpoint there, like in 
someCode() yes, that should work.


I used code like this:

scope(failure) {
 ... several lines of code
}

And for this it seems (maybe I need to check in more detail) that in 
MSVC, I can set a breakpoint, but the breakpoint is not triggered when 
an exception is thrown.




Seems like the debugger not understanding D source in that case.

What you could try is:

void breakOnThis()
{
   return; // breakpoint here
}
scope(failure)
{
breakOnThis();
...
}

and then see where it goes when you step out of that function.

-Steve


Re: scope guards & debugger breakpoints?

2018-05-21 Thread Robert M. Münch via Digitalmars-d-learn

On 2018-05-21 17:24:12 +, Steven Schveighoffer said:


I'm not 100% sure but I expect:

scope(failure)
someCode();

putting a breakpoint on someCode should work.


When calling a function an then setting the breakpoint there, like in 
someCode() yes, that should work.


I used code like this:

scope(failure) {
... several lines of code
}

And for this it seems (maybe I need to check in more detail) that in 
MSVC, I can set a breakpoint, but the breakpoint is not triggered when 
an exception is thrown.


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: scope guards & debugger breakpoints?

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn

On 5/21/18 1:00 PM, Robert M. Münch wrote:
If I use scope(failure) with code that should be run if an exception is 
thrown, how can I set a breakpoint for this code in the debugger?




I'm not 100% sure but I expect:

scope(failure)
   someCode();

putting a breakpoint on someCode should work.

-Steve


scope guards & debugger breakpoints?

2018-05-21 Thread Robert M. Münch via Digitalmars-d-learn
If I use scope(failure) with code that should be run if an exception is 
thrown, how can I set a breakpoint for this code in the debugger?


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster