1

I am working on recover.c and I need to debug my code by watching the variable states. However, stepping through the program 400 times in a loop is not very easy, how can I set up the debugger so that it will pause the execution of the program only when a variable reaches a certain value?

do
{
  fseek(rawFile, seekValue, SEEK_SET );
  picSizebyChunks++;
  fread(buffer, sizeof(unsigned char),4, rawFile);
  seekValue+=CHUNK_SIZE;


}while( !((signatureMatch(buffer))&&picSizebyChunks>1) );

Like for the above code, I want to start debugging when picSizebyChunks reaches 400. How can I set that?

1

I found it.

On the code editor in C9, right click and click "add conditional breakpoint" or click the line number to create a breakpoint and right click to set a condition for it. It will prompt for a condition, and the debugger will break the execution once the condition is met.

Pretty easy actually :$

1
  • Nice job! Don't forget to hit the green checkmark if you found the answer! Jan 30 '17 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .