Visual Studio : Hotkey/way to step into f() in statement a()->f(b(),c(),d()) directly

◇◆丶佛笑我妖孽 提交于 2019-11-29 09:19:46

Not a hotkey, but the closest thing I know of can be found on the right-click menu when your debugger is stopped on a line of code line that. You should be able to find an entry to "Step Into Specific" with a sub-menu giving the choice of all the functions from that line.

https://msdn.microsoft.com/library/7ad07721(v=vs.100).aspx

Shift+Alt+F11 is the default global shortcut for "Step Into Specific", which will bring up a context menu of all the methods you can step into from the current instruction.

Of course, you can change the shortcut via Tools->Options->Customize...->Keyboard dialog.

Otherwise, there is no feature that allows you to step into the specific method under the editor caret. Sounds like a nice idea that you should put up on uservoice for Visual Studio.

Encouraged by the positive feed-back, I show another possibility using the disassembly.

Once the debugging has been started, the disassembly can be opened by context menu in source file view. Although, the disassembly is hard to read (at least for the unexperienced) some facts are helpful:

  1. C/C++ expressions are mixed in as well as symbols for addresses.
  2. The assembler command for function calls is simply call.
  3. The function arguments are evaluated in reverse order (beginning with last argument) regarding their notation in source code.

Playing around with this I observed the following behavior:

  1. Source code and disassembly may be displayed side by side.
  2. Once disassembly has been opened while debugging, it will be closed at end of debugging but will re-open in the next debug session automatically.
  3. Ctrl+F10 works in assembly too (the important fact concerning the question). Thus, every individual function call in a statement may be addressed.
  4. Clicking into source view (i.e. focus in source view) activates source level debugging, clicking into disassembly activates disassembly.
  5. Clicking into disassembly changes "Auto" to display registers but "Local" displays local variables even when disassembly active.
  6. Placing break-points into disassembly is not a good idea. They seem to refer the op-code address and thus probably become worthless as soon as source code is changed and (re-)compiled.
  7. When debugging in disassembly reaches code compiled of another source code file, the source code view is not updated automatically. However, there is a command "Go To Source Code" at top of context menu of the disassembly.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!