Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Jeff Diewald <diewald@zko.dec.com>
Cc: diewald
Subject: Re: Debugger and stopping in a loop?
Date: 1996/09/06	[thread overview]
Message-ID: <323033BD.41C6@zko.dec.com> (raw)
In-Reply-To: 503afs$jbt@optional.cts.com


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 <linenumber> if <expression>

   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 <iostream.h>
      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.



      reply	other threads:[~1996-09-06  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-29  4:00 Debugger and stopping in a loop? Stanley Phan
1996-09-06  4:00 ` Jeff Diewald [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox