From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,4c1e3eb65da769bd X-Google-Attributes: gidfee84,public From: Jeff Diewald Subject: Re: Debugger and stopping in a loop? Date: 1996/09/06 Message-ID: <323033BD.41C6@zko.dec.com>#1/1 X-Deja-AN: 178888859 references: <503afs$jbt@optional.cts.com> cc: diewald content-type: text/plain; charset=us-ascii organization: Ladebug Group, Digital Equipment Corporation mime-version: 1.0 newsgroups: comp.unix.osf.osf1 x-mailer: Mozilla 3.0b5a (X11; I; OSF1 V4.0 alpha) Stanley Phan wrote: > > I know this may be simple for some, but I can't seem to have > Ladebug/Dxladebug stop on a certain iteration of a loop...i.e. > the 10th loop of say 50. > > I tried a few things, but they didn't seem to work. The compiler > has bugs in it, so I would be surprised if it is not outputting > the prober debugging executable. > > If this helps, I'm using DU4.0 with the Dec C++ v5.4 > and dxladebug 4.0-19. > > Can someone please tell me the proper commands to stop on > a certain loop iteration? Stanley, The easiest way to do it is simply by using an if clause on the stop command. That is: stop at if Here's an example: virrus[jeff 34]> ladebug loop Welcome to the Ladebug Debugger Version 4.0-21 ------------------ object file name: loop Reading symbolic information ...done Directory search path for source files: . /usr/users/diewald/ladebug/ladebug (ladebug) list 1 1 // 2 // Simple looping program 3 // 4 #include 5 6 void main (void) 7 { 8 for (int i = 0; i < 10; i++) 9 { 10 cout << "Loop at [" << i << "]" << endl; 11 } // for loop 12 } (ladebug) stop at 10 if i == 3 [#1: stop at "loop.C":10 if i==3 ] (ladebug) run Loop at [0] Loop at [1] Loop at [2] [1] stopped at [void main(void):10 0x120002298] 10 cout << "Loop at [" << i << "]" << endl; (ladebug) print i 3 (ladebug) quit virrus[jeff 35]> Which version of the 5.4 compiler are you using? What does cxx -V tell you? Here's how I compiled this test program to show the version number: virrus[jeff 35]> cxx -V -g -O0 -o loop loop.C cxx (cxx) DEC C++ V5.4-009 on Digital UNIX (Alpha) /usr/bin/ld version 3.11 virrus[jeff 36]> Note that optimizations may cause some loop variables to be inaccessible to the debugger. Compiling with -O0 may "fix" some of your problems. Also, make sure that you're using -g, and not one of the "lesser" g levels. (e.g. -g0) ------------------------------------------------------------------------- Jeff Diewald EASYNET: VIRRUS::DIEWALD Ladebug group INTERNET: diewald@zko.dec.com Digital Equipment Corp. Note: I don't read every article in this group. If you have debugger questions, I may be able to get you an answer. You're much more likely to get an answer if you put "Ladebug" somewhere in your subject line.