Is there a way to make the debugger loop?

Discussion in 'Mac Programming' started by larswik, Jun 28, 2011.

  1. macrumors 68000

    Joined:
    Sep 8, 2006
    #1
    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++;' 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
     
  2. macrumors 6502a

    Joined:
    Apr 1, 2007
    #2
    Set the breakpoint in the loop and hit continue to iterate.
     
  3. thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #3
    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
     
  4. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #4
    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.
     
  5. thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #5
    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
     

Share This Page