Author Topic: stepping out of loop in debug mode  (Read 3896 times)

Offline mahaju

  • Multiple posting newcomer
  • *
  • Posts: 25
stepping out of loop in debug mode
« on: September 04, 2012, 08:01:28 am »
Hi
I have a long loop inside a function call
If I want to just complete  the loop in one step but continue single stepping the other instructions inside the function call, how do I do it in CodeBlocks?
Also, how to do the same thing for an inner loop in a nested loop?


Code
Eg:

void fnc ( ...){

   for (....)
     {
            // how to complete this loop immediately but single step through the other instructions in fnc()
     }
 
   for (.....)
    {   
           .
           .
           .
           for( ..... )
            {
                // how to complete this loop immediately but single step through the other instructions in the outer loop
               }
           .
           .
           .
     }


Please help
Thank you

CodeBlocks: 10.05

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: stepping out of loop in debug mode
« Reply #1 on: September 04, 2012, 09:00:24 am »
Code
void fnc ( ...){

   for (....)
     {
            // how to complete this loop immediately but single step through the other instructions in fnc()
     }
 
   for (.....)
When debugging, click on the line of second "for", and context menu-> Run to cursor.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.