Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-skip STL functions during step-by-step debugging in Visual Studio

Tags:

During step-by-step debugging, I often use "step into" to halt at every line in the section that I am debugging, to see all my code that's executed.

But library calls can disrupt this work flow: The debugger will jump into some STL file and continue there. I then have to press "jump out" to go back to my own code.

Is there a way to prevent the debugger from opening STL source files? A blacklist or a setting somewhere? I work with native C++ code. The "only my code" debugger setting unfortunately only works for managed code.

like image 741
Felix Dombek Avatar asked Mar 17 '11 02:03

Felix Dombek


People also ask

How do I skip a step while debugging in Visual Studio?

You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.

How do you debug step by step in visual code?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.

How do I skip a line in Visual Studio?

Show activity on this post. The "Set Next Statement" (CTRL+SHIFT+F10) shortcut will work at the end of a function... but you need to use the mouse though as well. On VS 2019 there are those green arrows in front of lines, hold CTRL key and you can set next statement directly there, skipping anything in between.

How do I run multiple debugger codes in Visual Studio?

To debug multiple services at the same time Open the folder corresponding to your first service in VS Code. In VS Code, select File > Add Folder to Workspace…, and pick the folder corresponding to your other service.


2 Answers

good question, the debugger constantly jumping into everything is indeed a huge slowdown and distraction during debugging. Luckily there's a solution:

open your registry editor, navigate to

HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\NativeDE\StepOver

(add \Wow6432Node after SOFTWARE if you're on a 64bit machine, this casued me headaches in the past).

Add a new String Value (REG_SZ). The name is not so important, I used NoSTL for clarity and set it's value to

std\:\:.*=NoStepInto

This tells the debugger to not step into anything matching that regex so it will skip every function (global and class level) in the std namespace. By using StepInto you can add overrides for specific methods, and you can still use breakpoints off course. It's also handy to add some of your own methods that get stepped into often but of which you know the result by head.

Here is a more detailed explanation, google on NoStepInto for more scattered information.

like image 193
stijn Avatar answered Oct 07 '22 00:10

stijn


The answer is as above mentioned, but in case you use VisualStudio 2017 or it didn't work for you, then try the following:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Packages\Debugger\Visualizers

Open the following file with notepad or whatever you have:

default.natjmc

and add this line: <Function><Name>std\:\:.*</Name><Action>NoStepInto</Action></Function> The 'name' means the value of the registry key in that file and 'action' is self-explanatory.

If you want to add the registry key too, (not sure if it is necessary), then you will find it here: \HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VSTA\8.0\NativeDE\StepOver At least, that was the path in my case. It took a good hour to find these, so I hope that it will help somebody. Remove the 'Wow6432Node' if you have 32bit machine, as above mentioned.

like image 26
CorpseDead Avatar answered Oct 07 '22 02:10

CorpseDead