[comp.sys.mac.programmer] LSC debugger. How can you debug code resources/ drivers?

fjo@ttrdf.UUCP (Frank Owen ) (08/12/88)

  I know that the manual specifically mentions that you cannot
debug code resource or driver projects, but I could swear I
read in some article somewhere that Michael Kahl has been
demonstrating some simple techniques to do this. 
  Does anybody out there know what these techniques are, or
am I just nuts?  (My wife is particuliarly interested in the
answer to the second question :-)

Thanks.


-- 
Frank Owen (fjo@ttrdf)  312-982-2182
AT&T Information Systems
Computer Systems Division, 5555 Touhy Ave., Skokie, IL  60077
PATH:  ...!att!ttrdf!fjo

jwhitnell@cup.portal.com (08/15/88)

fjo@ttrdf.UUCP (Frank Owen ) writes...
|  I know that the manual specifically mentions that you cannot
|debug code resource or driver projects, but I could swear I
|read in some article somewhere that Michael Kahl has been
|demonstrating some simple techniques to do this.
|  Does anybody out there know what these techniques are, or 
|am I just nuts? 

I can't comment on whether your nuts (on the other hand, you are a
programmer :-), but it is possible to debug code resources and drivers
(DAs at least) from LSD.   For DAs, look at the files DA main.c and
test DA.c that came on your master disks.  This is a short description
of how to debug DAs by embeding the code in an application and patching
the code resource.  For code resources, the tecnique is similar in
that you make a dummy code resource and patch it with jump to the
real code in your application.  The code looks something like:
	 
typedef struct {
	short jump;
	long  addr;
} Patch;

pascal long yourCDEF( args );

void InitCDEF() {
	Handle cdef;
	Patch *cdefCode;
	
	cdef = GetResource( 'CDEF', OwnedResourceID( 0 ) );
	HNoPurge( cdef );
	SetHandleSize( cdef, 6 );
	cdefCode = (Patch *) *cdef;
	
	cdefCode->jump = 0x4ef9;		/* Long JMP */
	cdefCode->addr = (long) yourCDEF;
}

Jerry
--
Jerry Whitnell
jwhitnell@cup.portal.com
...!sun!cup.portal.com

geoff@sunfs3.camex.uucp (Geoffrey Knauth) (08/15/88)

In article <718@ttrdf.UUCP> fjo@ttrdf.UUCP (Frank Owen ) writes:
>
>  I know that the manual specifically mentions that you cannot
>debug code resource or driver projects, but I could swear I
>read in some article somewhere that Michael Kahl has been
>demonstrating some simple techniques to do this. 

Here is a rough sketch of Mike's demonstration to the BCS MacTechGroup:

1. Create a CDEV resource, that basically contains a jump to 0000 0000.
   One member commented that 0000 0001 is better for debugging.
2. Keep the routines you are testing with your application.
3. Open the resource at run-time, and patch the jump with the address
   of the code you are debugging.  
-- 
Geoffrey S. Knauth    CAMEX, 75 Kneeland St., Boston, MA 02111, 617/426-3577
geoff@sunfs3.uucp                                  I do not speak for Camex.

terranova@vms.macc.wisc.edu (08/16/88)

In article <8142@cup.portal.com>, jwhitnell@cup.portal.com writes...

>fjo@ttrdf.UUCP (Frank Owen ) writes...
>|  I know that the manual specifically mentions that you cannot
>|debug code resource or driver projects, but I could swear I
>|read in some article somewhere that Michael Kahl has been
>|demonstrating some simple techniques to do this.
>|  Does anybody out there know what these techniques are, or 
>|am I just nuts? 
> 
>I can't comment on whether your nuts (on the other hand, you are a
>programmer :-), but it is possible to debug code resources and drivers
>(DAs at least) from LSD.   For DAs, look at the files DA main.c and
                     ^^^
I've never tried debugging from there myself.  Does it help?  :-) 

-----------------------------+----------------+----------------------------
John C. Terranova            |  I said it.    |  I'm not a Computer
  CS, BS to be               |  So, flame me. |  Science Undergraduate,
terranova@vms.macc.wisc.edu  |  No one else.  |  but I play one at school.
-----------------------------+----------------+----------------------------
Where's the orchestra?
        -Billy Joel, "Where's the Orchestra?"

sbb@esquire.UUCP (Stephen B. Baumgarten) (08/16/88)

In article <8142@cup.portal.com> jwhitnell@cup.portal.com writes:
>I can't comment on whether your nuts (on the other hand, you are a
>programmer :-), but it is possible to debug code resources and drivers
>(DAs at least) from LSD.
                     ^^^
In fact, for INITs it actually helps...  :-)

-- 
   Steve Baumgarten             | "New York... when civilization falls apart,
   Davis Polk & Wardwell        |  remember, we were way ahead of you."
   {uunet,cmcl2}!esquire!sbb    |                           - David Letterman

thecloud@dhw68k.cts.com (Ken McLeod) (08/17/88)

In article <8142@cup.portal.com> jwhitnell@cup.portal.com writes:
>I can't comment on whether your nuts (on the other hand, you are a
>programmer :-), but it is possible to debug code resources and drivers
>(DAs at least) from LSD.   For DAs, look at the files DA main.c and...

 I'll bet it is... :-)  It's certainly possible to debug code resources
after a few beers, but I wouldn't know about this method!

(sorry, everyone, but there it was...)



-- 
==========      .......     ==========================================
Ken McLeod     :.     .:    uucp: {trwrb hplabs}!felix!dhw68k!thecloud
==========    :::.. ..:::   InterNet: thecloud@dhw68k.cts.com
                 ////       ==========================================

jwhitnell@cup.portal.com (08/19/88)

Steve Baumgarten writes ...
|In article <8142@cup.portal.com> jwhitnell@cup.portal.com writes:
|>I can't comment on whether your nuts (on the other hand, you are a
|>programmer :-), but it is possible to debug code resources and drivers
|>(DAs at least) from LSD.
|                     ^^^
|In fact, for INITs it actually helps...  :-)

LSD, the acid tester :-).

--
Jerry Whitnell
jwhitnell@cup.portal.com
...!sun!portal!jwhitnell

fjo@ttrdf.UUCP (Frank Owen ) (08/23/88)

> Steve Baumgarten writes ...
> |In article <8142@cup.portal.com> jwhitnell@cup.portal.com writes:
> |>programmer :-), but it is possible to debug code resources and drivers
> |                     ^^^
> 
> --
> Jerry Whitnell
> jwhitnell@cup.portal.com
> ...!sun!portal!jwhitnell

Apparently Jerry has responded to my question on debugging code resources,
but I have failed to receive the responce. (Although I did get the re-responces).
Could somebody (perhaps Jerry himself) please send me the article. I still
need the info. 

Thanks


-- 
Frank Owen (fjo@ttrdf)  312-982-2182
AT&T Information Systems
Computer Systems Division, 5555 Touhy Ave., Skokie, IL  60077
PATH:  ...!att!ttrdf!fjo