11

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.

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • Well, you cat use step out immediately after entering `HelperFunction`. – klutt Nov 20 '17 at 16:57
  • 1
    Possible duplicate of [Is there a way to automatically avoiding stepping into certain functions in Visual Studio?](https://stackoverflow.com/questions/626744/is-there-a-way-to-automatically-avoiding-stepping-into-certain-functions-in-visu) – frslm Nov 20 '17 at 16:58
  • I usually do: step-into -> step-out-of -> step-into And sometimes drop a breakpoint on to the start of `FunctionToDebug` if I think I might need another debug run. – Richard Critten Nov 20 '17 at 16:58
  • @RichardCritten: Can be annoying with multiple parameters. Netbans Java has this functionality (you click the function with your mouse), but I don't think dev studio does: would be tricky to implement the C++ analogue due to templates &c. – Bathsheba Nov 20 '17 at 17:00
  • You could add a breakpoint to the start of `FunctionToDebug` and then skip to it (and then remove the breakpoint). – Kevin Nov 20 '17 at 17:01
  • @Bathsheba you can drop a breakpoint on the 1st `{` of `FunctionToDebug` and just run-to-breapoint. – Richard Critten Nov 20 '17 at 17:02
  • @RichardCritten: Indeed, that's what I do. – Bathsheba Nov 20 '17 at 17:02
  • @Kevin depending of the circumstances that's what I'm doing now, but it can be rather painful. – Jabberwocky Nov 20 '17 at 17:02
  • @RichardCritten that's what I do also, but it's rather tedious. – Jabberwocky Nov 20 '17 at 17:03
  • You can "Step into specific" in VS2017 –  Nov 20 '17 at 17:05
  • @manni66 "Step into specific" sounds interesting, but I wasn't able to spot this command. You you be more specific? – Jabberwocky Nov 20 '17 at 17:08
  • @Michael - I answered. Do you know about the green check mark? – Jive Dadson Nov 29 '17 at 04:57

2 Answers2

10

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.

Jive Dadson
  • 16,680
  • 9
  • 52
  • 65
  • What to name it? "Step Deep Into"? – Jive Dadson Nov 20 '17 at 17:26
  • You can also customize Just My Code as described here https://msdn.microsoft.com/en-us/library/dn457346.aspx – Mihayl Nov 20 '17 at 17:26
  • @AA Thanks. Added to answer. – Jive Dadson Nov 20 '17 at 17:31
  • @AA -- Aaaaand removed. I tried it. I still get Dinkumed hard. – Jive Dadson Nov 20 '17 at 17:36
  • 1
    I red few days ago they have improved it in the latest update of vc2017 by annotating the standard library. https://blogs.msdn.microsoft.com/vcblog/2017/11/16/improving-the-debugging-experience-for-stdfunction/ – Mihayl Nov 20 '17 at 17:41
  • I think I have the latest-and-greatest. I am searching for the bazillionth time for the button for getting the L and G. I know it's here somewhere. – Jive Dadson Nov 20 '17 at 17:45
  • 1
    It is good to see that they recognize the problem. Bad to see that they are going about solving it in a desperately foolish way. I left comments. (Still looking for that update button.) – Jive Dadson Nov 20 '17 at 18:02
0

What about setting a one shot (if available) breakpoint into FunctionToDebug and letting the code run?