Thread: Skipping loops in step-by-step debug without skipping rest of function

  1. #1
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582

    Skipping loops in step-by-step debug without skipping rest of function

    I have Visual C++ 2008 Express. For a long time, I've been wondering how I can skip over loops (while and for loops) without skipping to the end of that function. What do I mean? Here's a quick example:

    Code:
    void TestFunction()
    {
       // locals
       // stuff I want to test beforehand - I need to test this
       
       for (LongLoop = 0; LongLoop < 65536; LongLoop++)
       {
          // lots of stuff to do - holding F10 for hours is not worth it
       }
       
       // aftermath stuff I must check as well - I must skip the loop to do it
    }
    Any ideas how this can be done? There is Shift+F11 for "step out", but this causes everything after this function to be skipped and I can't have that. Holding the F10 key down for hours is not worth it for such long loops. F11 seems to have the same properties as F11, except that you can go into a function (doesn't always happen due to the annoying "no source code" error that comes up, even for my own functions). Any ideas on how to skip the loop without skipping the rest of the function?
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Put the cursor on the line you want to stop at, then press "run to cursor"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582
    That helped a lot. One last question now - there is no "run to cursor" icon on the toolbar or in the menus - I had to use right-click in order to do it. Is there an equivalent keyboard shortcut?
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Perhaps - have you read the manual?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why does the memory increase step by step?
    By zcrself in forum C Programming
    Replies: 9
    Last Post: 07-14-2010, 12:04 AM
  2. Skipping An Iteration in Loops
    By joxerjen in forum C++ Programming
    Replies: 8
    Last Post: 11-08-2005, 12:41 PM
  3. 2 for loops...dunno why its skipping loop 2
    By Axolotl in forum C Programming
    Replies: 3
    Last Post: 04-03-2003, 02:07 PM
  4. Skipping the rest of the line while doing file input
    By Shadow12345 in forum C++ Programming
    Replies: 2
    Last Post: 09-30-2002, 09:25 AM
  5. step by step debug != run debug
    By bonkey in forum Windows Programming
    Replies: 8
    Last Post: 09-09-2002, 12:55 PM

Tags for this Thread