Newsgroups: comp.sys.mac.programmer
Subject: Re: Best Debugger for MPW/C++?
From: Bruce.Hoult@bbs.actrix.gen.nz
Date: Fri, 2 Oct 1992 02:28:49 GMT
Organization: Actrix Information Exchange

In article <1992Sep28.233906.26728@cs.aukuni.ac.nz> David Gladstone <D_Gladstone@cs.aukuni.ac.nz> writes:
> I am soon to be embarking on a project that will require the use of C++.
> Currently we have MPW C++ v3.1 and Zortech C++ v2.1 for MPW.  The question
> I have is about debuggers.  From what I've read in the August APDA
> catalogue, there are two options:
> 
> SADE 1.3.2 : Good scripting, but does not appear to have support for class
>              browsing etc.
> 
> SOURCEBUG v1.0.1 : "Special support for debugging MacApp and object
>                    oriented code."
> 
>                    "A browser interface to display the classes and methods
> 	                  of MacApp or an object oriented program."


I use both daily.  I wouldn't want to be without either, although if I
had to choose only one I think, uuuuuuhhhh, when you need SADE you
*need* it.

SourceBug is better for general noodling around.  It's marginally
better for tracing control-flow type problems.  It's much better than
SADE for checking the match between source code and machine code -- you
can display two windows of the same function, one in source the other
in ASM and you can set breakpoints or singlestep in either view at
will.  You can have continuously updated windows containing the values
in registers *and* in high-level program variables at the same time.
It's easier to drop down into MACSBUG and come back again than in SADE
(actually I 've never figured out how to do that in SADE...).
SourceBug is immeasurably better than SADE at tracing around the data
of PascalObjects -- you can click on the name of a class and a list of
all currently instantiated objects of that class appears.  Clicking on
an object shows the fields of that object.


Like MPW itself, SADE is programmable.  That means SADE vs SourceBug
is a bit like MPW vs THINK.  SADE has less built in than SourceBug,
but you can probably add everything I listed in the previous paragraph
to it if you take the time to write the necesary scripts.  I use SADE
less than SourceBug, but when I do use it it's for its repeatability,
its non-object data examining ability or its memory-stomper catching.

Ever have a bug that only shows up after you go through two dozen
steps, then crashes the Mac?  Get sick of manually steering your
program through those steps time after time?  With SADE you can write
a little script that starts your program and runs it to a breakpoint,
changes the values of a couple of variables or sets the PC to a
different line (to simulate the effects of getting an event from the
user, or otherwise guide the program), runs to another breakpoint etc
etc until you get to the problem situation.  OK, that takes a while to
set up (especially with a certain misfeature added in SADE 1.3 (?)
that makes you chain actions wiht onEntry actions instead of using a
straight line script), but sometimes the alternatives are worse.

SADE is also good for examining data that the .SYM file doesn't
properly describe.  My main example of that is a pseudo-template type
(done using macros) I use extensively that stores a dynamic array of
xxxx's in a handle.  SourceBug just shows the whole array as a handle,
but SADE can be convinced to show it as an array of xxxx's.

The latest SADE (but you need ETO to get it) has the ability to use the MMU
to protect areas of memory to catch memory stomping bugs.  This can save
lots of aggro sometimes.


If you've got MPW and  C++ (and therefore C) and are getting SADE and
SourceBug you should probably consider getting the full ETO package instead.
It's a tad expensive but it's pretty good.

-- Bruce
-- 
Bruce.Hoult@bbs.actrix.gen.nz   Twisted pair: +64 4 477 2116
BIX: brucehoult                 Last Resort:  PO Box 4145 Wellington, NZ
"Cray's producing a 500 MIPS personal computer with 256MB RAM and 8 GB
hard disk that fits in your pocket!"   "Great!  Is it PC compatible?"