Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stepping into a function, but not into the evaluation of the arguments with VS2017

If often encounter following situation:

 int HelperFunction(int somevalue)
 {
    ...
 }

 void FunctionToDebug(int somearg)
 {
    ...
 }

    ...
    SomeFunction();
 >> FunctionToDebug(HelperFunction(somevalue))    
    ...

Now I'm stepping through my code and I arrive at the function call marked with >> in the code snippet above.

When I use the "step into" command, the debugger will first step into HelperFunction and then into FunctionToDebug which is expected but which can be annoying e.g. if HelperFunction is fully debugged.

Is there some functionality or trick that would allow me to step directly into FunctionToDebug without stepping into the functions called during the evaluation of the arguments (HelperFunction here)?

EDIT

Its not really a duplicate of this:

Is there a way to automatically avoiding stepping into certain functions in Visual Studio?

as I'd like to decide on the spot if I want to step into the arguments or not, but it's interesting anyway though.

like image 633
Jabberwocky Avatar asked Nov 20 '17 16:11

Jabberwocky


People also ask

What is step into and step over in debugging?

Ans: Step Into: Step Into is used for debugging the test steps line by line. When the procedure gets called, Step Into enables you to get inside the procedure and debugs the procedure steps line by line. Step Over: Step Over will enable, only after the debugging is started with Step Into / Run From Step / Run to Step.

How do I step into a function in Visual Studio?

Begin code stepping by selecting F10 or F11. Doing so allows you to quickly find the entry point of your app. You can then continue to press step commands to navigate through the code. Run to a specific location or function, for example, by setting a breakpoint and starting your app.

How do you pass arguments in Visual Studio debugging?

To set command-line arguments in Visual Studio, right click on the project name, then go to Properties. In the Properties Pane, go to "Debugging", and in this pane is a line for "Command-line arguments." Add the values you would like to use on this line. They will be passed to the program via the argv array.

What is a breakpoint in code?

When a programmer creates code they can add what is known as a breakpoint. A breakpoint is a point in the program where the code will stop executing. For example, if the programmer amended the logic error in the trace table example they may wish to trigger a break point at line 5 in the algorithm.


1 Answers

Yes, but it's well hidden and easy to forget - not in the Debug drop-down menu. Put the cursor on the function call, then

right-click -> Step Into Specific -> [name of function]

I have repeatedly sent suggestions to MS that they add a version of Step Into that steps directly into the outermost function call. I ask you to do the same. It should be listed in the Debug menu along with Step Into, Step Out Of, and Step Over. Nothing is more tedious than stumbling into that maze of twisty passages that is Dinkumware.

like image 57
Jive Dadson Avatar answered Nov 11 '22 01:11

Jive Dadson