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

前端 未结 3 2292
孤街浪徒
孤街浪徒 2021-02-19 07:54

While debugging, I am currently at this (next) statement :-

system()->executeFracture(calculateFracture(data));
                       ^^1          


        
相关标签:
3条回答
  • 2021-02-19 08:07

    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

    0 讨论(0)
  • 2021-02-19 08:18

    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.
    0 讨论(0)
  • 2021-02-19 08:31

    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.

    0 讨论(0)
提交回复
热议问题