PDA

View Full Version : Is there a way to make the debugger loop?




larswik
Jun 28, 2011, 07:38 PM
I am finalizing my dice program and I have a NSTextField that show the value of the most rolled dice number. I use a for loop to iterate from 0 to 99 and if the number rolled is 28 I do basically 'array[i]++;' which increments index 28 to a value of 1 and so on. There is something in the code that is wrong and no matter what the next number will be 29, 30 and so on.

I turned on the break points but I need to go through many rolls of the dice to see what is happening. 1 pass is not enough.

Can I set up the debugger to loop?

-Lars



Hansr
Jun 28, 2011, 07:41 PM
Set the breakpoint in the loop and hit continue to iterate.

larswik
Jun 28, 2011, 07:54 PM
Never mind, lars = stupid. I just had to hit the dice roll button again. I was pressing the continue and never even thought of pressing the roll button again.

Sorry.

-Lars

jiminaus
Jun 28, 2011, 08:18 PM
Never mind, lars = stupid. I just had to hit the dice roll button again. I was pressing the continue and never even thought of pressing the roll button again.

Sorry.

-Lars

In this kind of situation, setting up a condition on the break point can useful. You can have the break point only trigger under certain conditions, such as a variable have a particular value.

larswik
Jun 28, 2011, 08:56 PM
I did set up break points to stop at certain conditions. I also found out with the debugger that I can insert numbers into the int values so I don;t have to keep hitting the roll button. I could change the value of die number at index 74 to have a value of 6. That sped things up.

Now the last thing is to fix the PopUpButton that you helped me with yesterday.

Tahnks!

-Lars