Lock the debugger to enter functions

I'm looking for a way to block the Visual Studio debugger to jump to specific classes and functions when I press F11. Or lock some files so that the IDE does not open them, just step by step (except in cases of exception).

I know this sounds silly, but I use smart pointers and other helper classes, many overloaded operators, a simple expression consists of many function calls that disappear during optimization, so this is not a speed issue, but it is a debugging problem, opening and closing so many files all the time, going through many functions, accidentally leaving the target code, etc.

Here is an example of what I'm talking about:

stepToThisFunction(objectOfIgnoreClass->ignoreFunction()); 

When the debugger is on this line, pressing F11 should only enter stepToThisFunction , passing through ignoreFunction() or, possibly, any function call from objectOfIgnoreClass .

Invalid equivalent of managed DebuggerStepThrough . I do not want to use the CLI. Just a keyword or macro written before a function / class. I also found something, some changes in the registry key, but that doesn’t seem to be what I’m looking for, or I don’t understand its mechanism (I don’t even understand which registry keys are associated with this), In addition, “put breakpoint "and" start cursor "are not accepted.

+6
source share
3 answers

I have a macro to do just that. It is not very fast, but it is very useful (in fact, I also converted it to C #, so I can use it in AddIn, which is much faster). Just tweak the regex with the features you want to ignore, and bind them 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 is the C # version - you need to create an addon and then connect 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; } } } 
+6
source

Right-click on the row and select "Step into specific". Then select the desired function.

+3
source

Visual Studio has an unsupported feature that allows you to constantly configure the debugger so as not to go into specific functions. Details are provided in this MSDN blog post:

http://blogs.msdn.com/b/andypennell/archive/2004/02/06/69004.aspx

+3
source

Source: https://habr.com/ru/post/890401/


All Articles