views:

59

answers:

3

Do I have to go over all the program using F11 and F10 . Can't I just mark where I want to go and start from there ?

+3  A: 

Put a breakpoint to the line of code you're interested in and just start the program. It will run until control passes that line for the first time and the debugger will pause the program at that line and let you debug it.

sharptooth
A: 

Before your main() function is started, the runtime is initialized, constructors of global objects are executed and all objects on the stack are initialized until you reach the point of execution you are intereseted in. Therefore you cannot start at any arbitrary point.

You need to set a breakpoint before the interesting point and start the execution with F5.

harper
+2  A: 

Debugger hot keys that may be of use:

  • F9 - Toggle breakpoint (aka a debugging mark that tells the debugger to pause before executing the marked statement)
  • F10 - Step over current marked statement
  • F11 - Step into current marked statement
  • F5 - Continue running until next breakpoint is encountered
  • CTRL + F10 - Run to cursor. Simply position your cursor on the line in your code that you want to run the application to, and then press the Ctrl + F10 keys together. This will run the application to that line location and then break into the debugger – saving you from having to make multiple F10/F11 keystrokes to get there.

Other neat tips and tricks for debugging:

Henrik
CTRL + F10 is a neat tip too .
Ahmed