I'm searching for a way to block the Visual Studio debugger to step into certain classes and functions when pressing F11. Or block some files so the IDE won't open them, just step trough (except when there's an exception).
I know this sounds kind of stupid, but I'm using smart pointers and other helper classes, many overloaded operators, simple expression are composed of many function calls, which disappear on optimization, so it's not a speed issue, but it is a debugging issue, opening and closing that many files all the time, going through many functions, accidentally leaving the target code and so on.
Here's an example, of what I'm talking about:
stepToThisFunction(objectOfIgnoreClass->ignoreFunction());
When the debugger is on this line, pressing F11 should enter only stepToThisFunction
, stepping through the ignoreFunction()
or possibly any function call from objectOfIgnoreClass
.
Some native equivalent of the managed DebuggerStepThrough
. I don't want to use CLI. Just a keyword or macro written before the function/class. I also found something, some registry key modifications, but that doesn't seem to be the thing I'm looking for, or I don't understand it's mechanism (I don't even understand what registry keys have to do with this). Also, "put a breakpoint" and "run to cursor" are not accepted solution.
1) Start CodeBlocks 2) Select the Settings menu 3) Select the Debugger... option in the Settings menu 4) In the Debugger Settings window, select the Default category under GDB/CDB debugger 5) You should see a field named "Executable path:" in the Debugger settings window.
You can use step-back via the new Step Backward and Step Forward icons in the Debug toolbar. These icons navigate the events in the Events Tab. So, if you've just taken a step in live debugging (F10 or F11), you can use the Step Backward button to quickly navigate to the previous step.
You can disable the NT debug heap by setting the environment variable _NO_DEBUG_HEAP to 1 (on XP and later).
VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.
I have a macro to do precisely this. It's not very fast, but it's very useful (in fact I've also converted it to C# so I can use it in an AddIn, which is much faster). Just customise the regexp with the functions you want to ignore and bind to F11 or another key of your choice:
Sub StepIntoNextRealFunction()
DTE.Debugger.StepInto(True)
Dim frame As EnvDTE.StackFrame = DTE.Debugger.CurrentStackFrame
Dim fn As String = frame.FunctionName
Dim skipRE As Regex = New Regex("operator.*->|MyString::MyString|operator new|operator.*\*|ignoreFunction")
If (skipRE.Match(fn).Success) Then
DTE.Debugger.StepOut(True)
DTE.Debugger.StepInto(True)
End If
End Sub
Edit: here's a C# version - you'll need to create an addin and then wire up to the DTE object:
public void StepIntoNextRealFunction(DTE2 dte)
{
Debugger2 debugger=(Debugger2)dte.Debugger;
debugger.StepInto(true);
while (true) {
EnvDTE.StackFrame frame = debugger.CurrentStackFrame;
string fn = frame.FunctionName;
Regex skipRE = new Regex("operator.*->|basic_string.*basic_string");
if ((skipRE.Match(fn).Success)) {
debugger.StepOut(true);
debugger.StepInto(true);
} else {
break;
}
}
}
Right-click on the line and choose "Step into specific". Then choose the function you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With