While debugging, I am currently at this (next) statement :-
system<System_Body>()->executeFracture(calculateFracture(data));
^^1 ^^2
How to step into executeFracture()
or calculateFracture()
directly and easily (without changing the code)?
Hotkey? Extension? Plugin?
My poor solutions
- With
F11
, I have to step intosystem<System_Body>()
first. - I can also jump to the source of
executeFracture()
and pressctrl+F10
from there, but it is not convenient.
Edit
MotKohn and TheUndeadFish advised using step into specific, thank!
Another similar thread (I just found later) tells that its hotkey is Shift+Alt+F11
.
The hotkey make the choices popup, nice.
Edit 2 (Bounty Reason)
The existing answer (TheUndeadFish's) requires me to move mouse to a correct choice on the popup.
(or press up/down to select choice)
I wish for a more convenient approach, e.g. :-
- I click at the word
calculateFracture
, so the caret (blinking |) move to it. - Then, I press some certain hotkey using keyboard,
VS will step intocalculateFracture()
immediately.
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.
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:
- C/C++ expressions are mixed in as well as symbols for addresses.
- The assembler command for function calls is simply
call
. - 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:
- Source code and disassembly may be displayed side by side.
- 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.
- Ctrl+F10 works in assembly too (the important fact concerning the question). Thus, every individual function call in a statement may be addressed.
- Clicking into source view (i.e. focus in source view) activates source level debugging, clicking into disassembly activates disassembly.
- Clicking into disassembly changes "Auto" to display registers but "Local" displays local variables even when disassembly active.
- 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.
- 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.
来源:https://stackoverflow.com/questions/41605080/visual-studio-hotkey-way-to-step-into-f-in-statement-a-fb-c-d-dir