[comp.sys.amiga.tech] Help on catch.o & reg. params.

wall@zodiac.rutgers.edu (02/27/90)

Hi folks!
	I was wondering about how to use catch.o in Lattice C to catch Gurus.
I've tried linking this in instead of c.o, but this doesn't quit do the trick.
Any suggestions?  Also, what does 'registerized parameters' mean as far as
Lattice is concerned?  How do I use them?  Any help would be MUCH appreciated!

			Thanks,
			Sean Wall
			(WALL@PISCES) on Bitnet

jjszucs@cbmvax.commodore.com (John J. Szucs) (03/02/90)

In article <613.25e9d861@zodiac.rutgers.edu> wall@zodiac.rutgers.edu writes:
>Hi folks!
>	I was wondering about how to use catch.o in Lattice C to catch Gurus.
>I've tried linking this in instead of c.o, but this doesn't quit do the trick.
>Any suggestions?

catch.o is substituted for c.o as the startup module in the BLink command line,
as you described. For example, to compile and link the program hello.c with
catch.o (assuming use of the standard Lattice math libraries):

LC <options> hello
BLink FROM LIB:catch.o+hello.o TO hello LIB LIB:LCM.lib+LIB:LC.lib+LIB:Amiga.lib
     <other linker flags>

Note: Do not use the -L (link) option of LC to link the file if you are
      attempting to use catch.o, as -L automagically uses LIB:c.o as the
      startup module.

When a program linked with catch.o causes an exception (know and loved as
"a Guru" :-)), a file named Snapshot.TB is created in the current directory.
The Snapshot.TB file contains a description of the state of the system at
the time that the exception occured. After the file is created, the normal
Amiga exception handling continues (and the Guru is still displayed).

After rebooting the system, cd to the directory that the Snapshot.TB file was
created in and execute the command:

TB

to display the contents of the file in the basic format. (The program TB
is part of the Lattice C distribution and should be located in LC:).

To display the Snapshot.TB file in complete format, including the state of
the registers and stack at the time of the exception, execute the command:

TB -l

Note that some programming errors can place the system in such a sorry state
that the catch.o exception handler cannot write the Snapshot.TB file, so this
method is not always effective. However, I've personally found it to be a
useful debugging tool, particularly in highly-interactive programs where using
CodePRobe is inconvenient.

>
>			Thanks,
>			Sean Wall
>			(WALL@PISCES) on Bitnet

================================================================================
|| John J. Szucs                    || The opinions expressed are my own and  ||
|| Systems Evaluation Group         || in no way represent the opinions or    ||
|| Product Assurance Department     || policies of Commodore Technology, Inc. ||
|| Commodore Technology, Inc.       || or any associated entity.              ||
================================================================================
{rutgers|uunet}!cbmvax!jjszucs
jjszucs@cbmvax.commodore.com

riley@batcomputer.tn.cornell.edu (Daniel S. Riley) (03/02/90)

In article <9915@cbmvax.commodore.com> jjszucs@cbmvax.cbm.commodore.com (John J. Szucs) writes:
>Note: Do not use the -L (link) option of LC to link the file if you are
>      attempting to use catch.o, as -L automagically uses LIB:c.o as the
>      startup module.

Undocumented featured in lc, lattice C 5.0[45]:  -t changes the startup
module linked in.  lc -L -tc links with catch.o, lc -L -tr links cres.o,
lc -L -tcr links with catchres.o.

Dunno why it isn't documented.  I saw John Toebes use it somewhere.

-Dan Riley (riley@tcgould.tn.cornell.edu, cornell!batcomputer!riley)
-Wilson Lab, Cornell University