DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
dbXtra and dbxtra

Using a breakpoint

One way to test our suspicion is to force the loop to iterate only four times. To do so we first need to stop the loop after it has iterated that many times. dbxtra allows us to do this by letting us set breakpoints within programs using the stop command.

   (dbxtra) stop at 49 if player=3
   [2] stop at "deal.c":49 if deal.deal_hands.player == 3
Line 49 is the last line of the loop after all statements within it have been executed and if player is 3, we know that it has iterated four times. Rerunning the program now produces:
   (dbxtra) rerun
   Dealing 1 hands...
   at 49: cardsleft = 52
   at 49: cardsleft = 39
   at 49: cardsleft = 26
   at 49: cardsleft = 13
   [2] stopped in deal_hands at line 49 in file "deal.c"
To prevent the fifth iteration of the loop, we just need to increment player by one:
   (dbxtra) assign player=player+1
   (dbxtra) print player
   4
The counter has been incremented, so there will not be another pass when you continue the program.

Next topic: Continuing after a breakpoint
Previous topic: Examining a different function

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003