Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!ames!ucbcad!ucbvax!hplabs!tektronix!tekgen!tekigm!phils From: phils@tekigm.UUCP (Phil Staub) Newsgroups: comp.sys.amiga Subject: Manx debugger Message-ID: <1064@tekigm.UUCP> Date: Fri, 12-Dec-86 13:17:42 EST Article-I.D.: tekigm.1064 Posted: Fri Dec 12 13:17:42 1986 Date-Received: Mon, 15-Dec-86 21:30:22 EST Organization: Tektronix Inc., Beaverton, Or. Lines: 71 Keywords: patch for WB 1.2/Manx 3.20a ----------------- 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...