[comp.sys.amiga] Manx debugger

phils@tekigm.UUCP (Phil Staub) (12/12/86)

-----------------

In case anyone is still using Manx 3.20a, (more specifically the debugger),
here is a quickie program to patch it (db, that is) to run on 1.2:


main()
{
	int fd;

	fd = open("db", 2);
	lseek(fd, 0x67a9L, 0);
	write(fd, "\xa8", 1);
	close(fd);
}

In case this looks familiar, it was inspired by the patch a while ago for
the compiler and "make". 

How did I determine the address to patch? First of all, I wrote a short 
program to dump a file in a hex and ascii format, as shown below. 
(Mail me if you want a copy, or I can post it to the net if there is
sufficient interest, or maybe there has even been a similar thing floating
around on the net before. My dumper can be made to run on just about anything. 
Or you can use "od" on Unix.) Then search for the sequence "D6BC 0000 01AC", 
which translates into a "ADD.L #000001AC,D3" instruction. This will be found 
in any program which calls fexec or derivatives. For you commercial package 
owners with library sources, it is in fexecv(), where the offset to 
the pr_ReturnAddr field of the process structure is being generated.

Since the offset to this field changed in WB 1.2, the generation of the
offset by the add instruction must be changed. When you find this sequence,
determine the address of the "AC". In this example, it is 67a9. This becomes
the second parameter to the lseek.

The before and after dumps would look like this:

Before:
0006780  CD8A 4AAB 00AC 6766 262B 00AC E583 2A03    ..J...gf&+....*.
0006790  2C6C ACBE 226E 0008 2C69 0004 226E FFF4    ,l.."n..,i.."n..
00067a0  2629 FFF4 D6BC 0000 01AC 2B43 FFFC 2C6D    &)........+C..,m
                   ^^^^^^^^^^^^^^
00067b0  FFFC 2C16 2C45 BCAE 003C 670A 3F3C 0064    ..,.,E...<g.?<.d
00067c0  4EBA 2164 544F 2C6D FFFC 2245 42A9 003C    N.!dTO,m.."EB..<

After:
0006780  CD8A 4AAB 00AC 6766 262B 00AC E583 2A03    ..J...gf&+....*.
0006790  2C6C ACBE 226E 0008 2C69 0004 226E FFF4    ,l.."n..,i.."n..
00067a0  2629 FFF4 D6BC 0000 01A8 2B43 FFFC 2C6D    &)........+C..,m
                   ^^^^^^^^^^^^^^
00067b0  FFFC 2C16 2C45 BCAE 003C 670A 3F3C 0064    ..,.,E...<g.?<.d
00067c0  4EBA 2164 544F 2C6D FFFC 2245 42A9 003C    N.!dTO,m.."EB..<

Of course, this little exercise may well not be of use for long, when
everybody gets WB 1.2 and Manx 3.4, but for the time being, it got me going.

(Now if somebody could just tell me why I get a "Software error, task
suspended" when "make" is about ready to finish, I'd almost be satisfied
to wait until the "real thing" (Manx 3.40) comes out.)

Hope this has been of some use to someone.

-------------------------------------------------------------------------------
"I'm sure you think you understand what you thought I said, but I hope you
realize that what you heard is not what I meant."

Phil Staub                       P.O. Box 3500
Tektronix, Inc.                  Vancouver, Washington 98668
ISI Engineering                  M/S C1-904, (206) 253-5634
..tektronix!tekigm!phils
-------------------------------------------------------------------------------

Ata@RADC-MULTICS.ARPA (John G. Ata) (01/05/87)

Thanks very much for your message on how to get the debugger to work.
Since I have just acquired a Manx C compiler (3.20a), I didn't know how
to get the compiler and make to work properly.  With a little dumping
and searching, the addresses I found are the following:

          cc:       D51F
          make:     1D37

Are there any other changes that have to be made to get everything
working with 1.2?  After preliminary experimentation, they all seem to
be working properly, even "make".  I was able to make a large file with no
problems at all.

Just got off the phone with the Manx people who tell me that 3.4 will be
out int 3 weeks...hopefull, this version will contain double precision
floating point numbers.  Also, hopefully, linking standard Metecomco
object format will not be "twice as slow as Alink" as Goodnow was
reported to have said in Amazing Computing.

Finally, is there a trick to get the Aztec BB to talk?  When I dial, I
get a carrier, but now response at both 300 and 1200.  

                    Thanks,
                    John G. Ata