Subject: Object file symbols limited to 8 characters [+FIX] (#161 - #4 of 19) Index: cc,as,ld,ar,ranlib,nm,nlist,adb,... (2.11BSD) Description: For some time now (seem like eons;-)) the object file format used by Unix for the PDP-11 has restricted symbols to 8 significant characters (actually 7 due to the C compiler prefixing symbols with a leading tilde (~) or underscore (_)). Aside from the "creative constraints" this imposes on the programmer there was the continuing problem of 'name collisions', especially when porting applications from machines whose object file format permitted longer symbol names. Numerous workarounds have been employed in the past. The most common one relied on a combination of a name collision detection program ('shortc') and the flexname capability of the C preprocessor ('cpp'). This served to mask the problem while making debugging difficult due to mangled/synthetic symbol names. Repeat-By: Attempt to compile the following program: int this_is_a_long_name; int this_is_a_long_name_too; main() { exit(0)}; Fix: This section is repeated in each of the 19 parts which make up the update kit. You should read it perhaps once or twice, but then skip over it (how to do that is mentioned below). Taking a "hint" from the a.out(5) man page: "The compiler will note name collisions when they occur within a single file... There is really little that can be done about this. Some thought is being given to modifying the loader to flag detectable collisions, but the real solution would be to change over to the 4BSD a.out format. This would involve modifying the compiler, assembler and adb and then simply porting the 4.3BSD ld, nm, ranlib, strip and nlist. Or perhaps simply porting the entire 4.3BSD suite might be best ... Anyone interested in a project?" This I have done. No more volunteers for the project need apply ;-) The new limit on symbol length is 32 characters! There is still a limit (but it is _much_ more reasonable now) simply because of address space constraints - it needs to be possible to hold at least one of the 'symbol' or 'string' tables in memory in many cases (nice to hold both, but - i know, get a 486;-)). It must be noted though that it is almost trivial now to raise the limit if that is desired - the programs which need to know the maximum length of a symbol string all have an easily changed #define statement now (usually MAXSYMLEN but there are a couple exceptions). The 'string table' format itself doesn't care how long the strings are. The actual a.out format won't have to change again to accomodate a higher limit on symbol name length! The "string table" object file format has been ported and all the necessary changes made throughout the entire system. The changes were *massive* and widespread. Programs affected of course included the assembler and compiler. Other programs affected were anything which accessed a symbol table entry either via nlist(3) [ps, pstat, fstat, vmstat, etc] or by reading object files [ld, ranlib, nm, adb, strip, etc]. The actual changes to the compiler and assembler were minor because those programs had already been modified earlier (updates #142, 143, 152, 153). The compiler only needed to have the maximum size of a symbol name raised. The assembler already knew how to generate 'string table' object files - all that needed to be done in 'as' was to flip a bit telling it to generate the new object format instead of the old style. +++++++++++++++ And now for a bit of a narrative about what was done. The detailed instructions for applying this part (#4 of 19) of the update kit follow the 'story' below. This started out as a semi-organized accounting of what was done but then devolved into a semi-rambling tale due to the sheer bulk of the changes. You can skip to the details for applying #161 by searching for the string "=======" below - this header is replicated in all parts of this kit. +++++++++++++++ Alas, the remaining changes were not so simple. Complete replacements for ranlib(1), ar(1), nlist(3) were ported from the Net-2 release. Other programs such as symorder(1) and two new programs 'symcompact' and 'strcompact' (used to compress/compact symbol and string tables) were written from scratch. Perhaps the two hardest parts of the whole effort were rewriting the linker 'ld' and making *large* modifications to the debugger 'adb'. This was a very difficult job. 'ld needed to scan new style ranlib archives, as well as using the "virtual memory" facility (the 'libvmf' routines posted earlier) for symbol table management and so on. 'adb' was a MESS (having been written in a pseudo block structured macro language). Since the new symbol table entry could be so much larger than the old it was no longer possible for adb to hold as much of the symbol table in memory - an alternate method took a while to develope and implement, more on that in the patch which deals with adb (actually the changes to adb are so large there are two substantial parts of this update kit just for adb!). After the basic programs (ar, ld, ranlib, etc) were running the system had to be completely recompiled from sources, beginning with the object libraries. After those were done the process of recompiling the rest of the system could proceed. Guess what happens when you recreate libc.a with a buggy linker? Yep - the system is rendered useless until backup copies of everything can be reloaded. Don't let this happen to you - be sure (and i'll repeat the point later) to back up the system (or at least key executables and .a files) before installing this upgrade. In all there were about 330 files modified during the change of object file format. Some of these were not directly related to the new object file format. There were a number of (obsolete) references to "BSD2_10" lingering in the system. Those have been replaced with "pdp11" and the 'BSD2_10' define has been removed from the C preprocessor (cpp). DO NOT use 'BSD2_10' to #ifdef pdp-11 sensitive code, use "pdp11" instead. During the recompile of the libraries a fairly large number of "shortened" names were lengthened - these included syscall routines such as "gethostname" which no longer had to be munged into "gethname". Also a surprising number of typographical errors were uncovered (mainly in the Fortran libraries) where an extra character (beyond the 7th character) was left off or accidentally added. These were all fixed and eventually, after a couple evenings, the libraries were built and installed. After the libraries were done it was the application programs' turn to be recompiled. This took the better part of a couple weeks to finally make it thru due to (as it turned out) the iterative nature of the task. A symbol would come up undefined and have to be tracked down exactly where the wrong definition/use was coming from. Finally, however, the task was done and it was time to move on to the kernel. The kernel proved to be suprisingly easy - no real complications arose except when it came time to reboot, a bug had been introduced into 'autoconfig' (who uses 'nlist' to scan the kernel symbol table). Ouch! That was another couple late nights. Since the compiler supports unsigned longs now a number of small changes which ifdef'd 'u_long' to 'long' were removed. REMEMBER - you need to recompile 'autoconfig' and install it before rebooting the new kernel ;-) The performance of 'ps' though (and anything else which used nlist(3), 'fstat', 'w' are good examples) was unacceptably slow. So, amidst other delays (real work, the earthquake - which almost tossed the disc drive to the floor, etc) the "symorder" program was written (with ideas borrowed from the Net-2 version). The symorder(1) program rather insists on holding both the symbol and string tables in memory - this was a problem (or could be if the kernel symbol table grows much more) so two new and original programs were written: 'symcompact' and 'strcompact'. The first program compacts the symbol table by removing 'register' local variables (they're of no use to anyone - the debugger doesn't/can't do anything with them) and redundant global text symbols (symbols in an overlaid program which are in the root segment do not need both the '~' and '_' symbols present). The second program 'strcompact' is one that any 'string table' based object file system can use. It implements "shared strings" for symbols - if a program has many references to 'error' as a local symbol, why store the string 'error' more than once? Simply store one instance and then update the symbol table entries to all point to the same string! Using both 'strcompact' and 'symcompact' on the /unix image resulted in a file that was 15kb smaller. Running 'symorder' then puts the most frequently used symbols at the front of the symbol table, the performance of 'w', 'pstat', and other programs which nlist(3) the kernel was now acceptable. Some of the parts of this kit are large. The large patch files have been split into pieces which the 'patch' will handle, other parts (the replacement 'ar' sources) were left as a single 'shar' file rather than split them up. Each part of this kit consists of: a 'patchfile' - this is used with the "patch" program to update files. an optional 'script' - this is run ("sh script") to perform initialization, remove files, create directories and so on. an option 'new.sources' - this is a "shar" file containing complete sources for a program. ALL pathnames are _absolute_ - this way you do not have to "cd" around the system, you should be able to apply all the patches while you are in /tmp (or /usr/tmp - wherever you have the most free space). Be sure that you have at least 40mb free on /usr before rebuilding the system - if you do not then building in stages will be necessary. Part 19 contains the detailed instructions for rebuilding the system _after_ the previous 18 patches have been applied. The patches (#158 thru #175) should be applied in order following the directions in each part. DO NOT recompile anything once the patching has begun until requested to do so in part 19. Many of the system include files are modified and the object file format is being changed - recompilation will not be possible until the transformation of the system and object libraries is complete. AT A MINIMUM you will want to back up the following files (unless you have a known good backup already made) in case you need to recompile something before part 19 is done: /bin/ar /bin/ld /bin/nm /bin/as /usr/bin/ranlib /lib/c0 /lib/crt0.o /lib/mcrt0.o /lib/libc.a /bin/nm /usr/include/*.h /usr/include/sys/*.h In part 19 there is a *complete* list of all files affected (all 336 of them) - you may wish to back those up also. And now the common header ('boilerplate') is over (at last ;-)), let the installation guide begin. As always, the complete 2.11BSD updates are available via anonymous FTP to 'ftp.iipo.gtegsc.com' in the directory /pub/2.11BSD ========== #161 (Part #4 of 19) This part updates the following files. BACK THESE UP if you have any worries about the proceedure or do not have a bootable backup already at hand. /usr/src/bin/adb/* This is the first part of the 'adb' changes. ADB was almost a rewrite! Lots of changes as one would expect for a program with an intimate knowledge of object files and symbol tables. While I was at it I cleaned things up considerably. Parts of 'adb' were (finally) written in C rather than the screwy macro (pseudo Pascal/Cobol/whatever) language it had been written in. The include files were collapsed into a single .h file and redundant/unneeded declarations/typedefs removed. Searching the new 'string table' object format is quite slow compared to the old style. To speed this up a symbol string cache was implemented - the last 50 symbols referenced are cached. 0) Be in a temp directory ("cd /tmp" or "cd /usr/tmp") 1) Save the following shar archive to a file (/tmp/161 for example) 2) Unpack the archive: sh 161 3) Patch the files: patch -p0 < patchfile 4) rm 161 patchfile Part 4 of 19 is done. DO NOT rebuild or compile _anything_ at this point! ============cut here #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # patchfile # This archive created: Fri Feb 4 22:03:29 1994 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'patchfile' then echo shar: "will not over-write existing file 'patchfile'" else sed 's/^X//' << \SHAR_EOF > 'patchfile' Xdiff -r -c /usr/src/bin/adb.old/Makefile /usr/src/bin/adb/Makefile X*** /usr/src/bin/adb.old/Makefile Mon Jan 18 08:45:16 1993 X--- /usr/src/bin/adb/Makefile Thu Jan 13 23:25:06 1994 X*************** X*** 1,47 **** X- # X- # Makefile 4.4 86/06/07 X- # X DESTDIR= X! CFLAGS= -O X LDFLAGS= X SEPFLAG= -i X! CFILES= access.c command.c dummy.c expr.c findfn.c format.c input.c \ X! main.c message.c opset.c output.c pcs.c print.c runpcs.c \ X! setup.c sym.c X! OV1= input.o main.o command.o setup.o expr.o X! OV2= format.o print.o findfn.o X! OV3= output.o opset.o pcs.o X! BASE= access.o sym.o runpcs.o message.o X! OFILES= ${OV1} ${OV2} ${OV3} ${BASE} X X adb: ${OFILES} X! -if [ X${SEPFLAG} = X-i ]; then \ X! ${CC} ${SEPFLAG} ${LDFLAGS} -o adb ${OFILES}; \ X! else \ X! ld -X ${SEPFLAG} ${LDFLAGS} -o adb /lib/crt0.o \ X! -Z ${OV1} -Z ${OV2} -Z ${OV3} -Y ${BASE} -lc; \ X! fi X X install: adb X install -s adb ${DESTDIR}/bin X X clean: X! rm -f adb instrs.adb errs ${OFILES} X X print: X @ls -l | pr X @pr -f Makefile *.h ${CFILES} X X! defs.h: mac.h mode.h X! mode.h: machine.h X X access.o: defs.h access.c X command.o: defs.h command.c X expr.o: defs.h expr.c X findfn.o: defs.h findfn.c X- findrtn.o: defs.h findrtn.c X format.o: defs.h format.c X! input.o: defs.h mode.h input.c X main.o: defs.h main.c X message.o: defs.h message.c X opset.o: defs.h opset.c X--- 1,35 ---- X DESTDIR= X! CFLAGS= -O -DNUM_SYMS_CACHE=50 X LDFLAGS= X SEPFLAG= -i X! CFILES= access.c command.c expr.c findfn.c format.c input.c main.c message.c \ X! opset.c output.c pcs.c print.c runpcs.c setup.c sym.c X X+ OFILES= access.o command.o expr.o findfn.o format.o input.o main.o message.o \ X+ opset.o output.o pcs.o print.o runpcs.o setup.o sym.o X+ X adb: ${OFILES} X! ${CC} ${SEPFLAG} ${LDFLAGS} -o adb ${OFILES} X X install: adb X install -s adb ${DESTDIR}/bin X X clean: X! -rm -f adb ${OFILES} X X print: X @ls -l | pr X @pr -f Makefile *.h ${CFILES} X X! lint: X! lint -haxc -I. ${CFILES} X X access.o: defs.h access.c X command.o: defs.h command.c X expr.o: defs.h expr.c X findfn.o: defs.h findfn.c X format.o: defs.h format.c X! input.o: defs.h input.c X main.o: defs.h main.c X message.o: defs.h message.c X opset.o: defs.h opset.c X*************** X*** 48,53 **** X output.o: defs.h output.c X pcs.o: defs.h pcs.c X print.o: defs.h print.c X! runpcs.o: defs.h mode.h runpcs.c X setup.o: defs.h setup.c X sym.o: defs.h sym.c X--- 36,41 ---- X output.o: defs.h output.c X pcs.o: defs.h pcs.c X print.o: defs.h print.c X! runpcs.o: defs.h runpcs.c X setup.o: defs.h setup.c X sym.o: defs.h sym.c Xdiff -r -c /usr/src/bin/adb.old/READ_ME /usr/src/bin/adb/READ_ME X*** /usr/src/bin/adb.old/READ_ME Sun Feb 8 14:25:45 1987 X--- /usr/src/bin/adb/READ_ME Thu Dec 30 13:18:02 1993 X*************** X*** 1,17 **** X! This version of (ov)adb is a (more or less) finished version of the ovadb X! on 2bsd. It supports both overlaid processes (MENLO_OVLY) and kernels X! (MENLO_KOV). It should work correctly for any combination of these, thus X! it can be installed as adb. X! X! To compile: X! on an 11/70, 44, 45 make adb X! on an 11/40, 34, 60 make 40adb X! The ovmakefile can be used to make an overlaid version of adb for X! nonseparate I/D machines to give additional space for symbols. This is X! needed to examine large programs such as csh and ex. Use X! make -f ovmakefile ovadb X! X! X X Changes for overlaid processes are intended to work in the most obvious way X and are: X--- 1,8 ---- X! The makefile can be adjusted to make a version of adb for X! nonseparate I/D machines. Change the -DNUM_VM_PAGES value to X! something like 6 to 8, this will use less real memory (and cause X! adb to run a bit slower) and allow adb to run on a non-split I/D X! machine. X X Changes for overlaid processes are intended to work in the most obvious way X and are: Xdiff -r -c /usr/src/bin/adb.old/access.c /usr/src/bin/adb/access.c X*** /usr/src/bin/adb.old/access.c Sun Feb 8 14:25:45 1987 X--- /usr/src/bin/adb/access.c Fri Dec 31 11:14:34 1993 X*************** X*** 1,51 **** X- # X- /* X- * X- * UNIX debugger X- * X- */ X- X #include "defs.h" X X X! MSG ODDADR; X! MSG BADDAT; X! MSG BADTXT; X! MAP txtmap; X! MAP datmap; X! INT wtflag; X! STRING errflg; X! INT errno; X X! INT pid; X X- struct ovhead ovlseg; X- L_INT ovloff[]; X- OVTAG curov; X- int overlay; X- X- L_INT var[]; X- X- X- X /* file handling and access routines */ X X put(adr,space,value) X! L_INT adr; X { X! access(WT,adr,space,value); X } X X! POS get(adr, space) X! L_INT adr; X { X! return(access(RD,adr,space,0)); X } X X! POS chkget(n, space) X! L_INT n; X { X! REG INT w; X X w = get(n, space); X chkerr(); X--- 1,43 ---- X #include "defs.h" X X+ MSG ODDADR; X+ MSG BADDAT; X+ MSG BADTXT; X+ MAP txtmap; X+ MAP datmap; X+ int wtflag; X+ char *errflg; X+ int pid; X+ struct ovlhdr ovlseg; X+ long ovloff[]; X+ char curov; X+ int overlay; X+ long var[]; X X! extern int errno; X X! static within(); X X /* file handling and access routines */ X X put(adr,space,value) X! long adr; X { X! acces(WT,adr,space,value); X } X X! u_int X! get(adr, space) X! long adr; X { X! return(acces(RD,adr,space,0)); X } X X! u_int X! chkget(n, space) X! long n; X { X! register int w; X X w = get(n, space); X chkerr(); X*************** X*** 52,70 **** X return(w); X } X X! access(mode,adr,space,value) X! L_INT adr; X { X! INT w, w1, pmode, rd, file; X BKPTR bkptr, scanbkpt(); X- rd = mode==RD; X X IF space == NSP THEN return(0); FI X X IF pid /* tracing on? */ X THEN IF (adr&01) ANDF !rd THEN error(ODDADR); FI X pmode = (space&DSP?(rd?RDUSER:WDUSER):(rd?RIUSER:WIUSER)); X! if (bkptr=scanbkpt((POS)adr)) { X if (rd) { X return(bkptr->ins); X } else { X--- 44,62 ---- X return(w); X } X X! acces(mode,adr,space,value) X! long adr; X { X! int w, w1, pmode, rd, file; X BKPTR bkptr, scanbkpt(); X X+ rd = mode==RD; X IF space == NSP THEN return(0); FI X X IF pid /* tracing on? */ X THEN IF (adr&01) ANDF !rd THEN error(ODDADR); FI X pmode = (space&DSP?(rd?RDUSER:WDUSER):(rd?RIUSER:WIUSER)); X! if (bkptr=scanbkpt((u_int)adr)) { X if (rd) { X return(bkptr->ins); X } else { X*************** X*** 89,108 **** X IF !chkmap(&adr,space) X THEN return(0); X FI X- file=(space&DSP?datmap.ufd:txtmap.ufd); X- IF longseek(file,adr)==0 ORF X- (rd ? read(file,&w,2) : write(file,&value,2)) < 1 X- THEN errflg=(space&DSP?BADDAT:BADTXT); X- FI X- return(w); X X } X X chkmap(adr,space) X! REG L_INT *adr; X! REG INT space; X { X! REG MAPPTR amap; X amap=((space&DSP?&datmap:&txtmap)); X switch(space&(ISP|DSP|STAR)) { X X--- 81,100 ---- X IF !chkmap(&adr,space) X THEN return(0); X FI X X+ file = (space&DSP ? datmap.ufd : txtmap.ufd); X+ if (lseek(file,adr, 0) == -1L || X+ (rd ? read(file,&w,2) : write(file,&value,2)) < 1) X+ errflg = (space & DSP ? BADDAT : BADTXT); X+ return(w); X } X X chkmap(adr,space) X! register long *adr; X! register int space; X { X! register MAPPTR amap; X! X amap=((space&DSP?&datmap:&txtmap)); X switch(space&(ISP|DSP|STAR)) { X X*************** X*** 120,126 **** X IF within(*adr, amap->b2, amap->e2) X THEN *adr += (amap->f2) - (amap->b2); X break; X! ELSE goto error; X FI X X case DSP: X--- 112,118 ---- X IF within(*adr, amap->b2, amap->e2) X THEN *adr += (amap->f2) - (amap->b2); X break; X! ELSE goto err; X FI X X case DSP: X*************** X*** 138,144 **** X /* falls through */ X X default: X! error: X errflg = (space&DSP ? BADDAT: BADTXT); X return(0); X } X--- 130,136 ---- X /* falls through */ X X default: X! err: X errflg = (space&DSP ? BADDAT: BADTXT); X return(0); X } X*************** X*** 146,154 **** X } X X setovmap(ovno) X! OVTAG ovno; X! { X! REG MAPPTR amap; X X if ((!overlay) || (ovno < 0) || (ovno > NOVL)) X return; X--- 138,146 ---- X } X X setovmap(ovno) X! char ovno; X! { X! register MAPPTR amap; X X if ((!overlay) || (ovno < 0) || (ovno > NOVL)) X return; X*************** X*** 156,162 **** X IF ovno == 0 X THEN amap->eo = amap->bo; X amap->fo = 0; X! ELSE amap->eo = amap->bo + ovlseg.ov[ovno-1]; X amap->fo = ovloff[ovno-1]; X FI X var[VARC] = curov = ovno; X--- 148,154 ---- X IF ovno == 0 X THEN amap->eo = amap->bo; X amap->fo = 0; X! ELSE amap->eo = amap->bo + ovlseg.ov_siz[ovno-1]; X amap->fo = ovloff[ovno-1]; X FI X var[VARC] = curov = ovno; X*************** X*** 164,171 **** X choverlay(ovno); X } X X within(adr,lbd,ubd) X! L_INT adr, lbd, ubd; X { X return(adr>=lbd && adr=lbd && adru_ovdata.uo_curov) X! THEN var[VARC]=dot; setovmap((OVTAG)dot); FI X ELIF (modifier=varchk(savc)) != -1 X THEN var[modifier]=dot; X! IF modifier == VARC THEN setovmap((OVTAG)dot); FI X ELSE error(BADVAR); X FI X break; X--- 179,188 ---- X ptrace(WUREGS,pid,(int)&uar0[regptr]-(int)&corhdr, X uar0[regptr]); X IF (uar0+regptr) == &(((U*)corhdr)->u_ovdata.uo_curov) X! THEN var[VARC]=dot; setovmap((char)dot); FI X ELIF (modifier=varchk(savc)) != -1 X THEN var[modifier]=dot; X! IF modifier == VARC THEN setovmap((char)dot); FI X ELSE error(BADVAR); X FI X break; X*************** X*** 216,222 **** X break; X X case 0: X! prints(DBNAME); X break; X X default: error(BADCOM); X--- 205,211 ---- X break; X X case 0: X! printf("%s\n", myname); X break; X X default: error(BADCOM); Xdiff -r -c /usr/src/bin/adb.old/defs.h /usr/src/bin/adb/defs.h X*** /usr/src/bin/adb.old/defs.h Sat Sep 5 12:31:57 1987 X--- /usr/src/bin/adb/defs.h Thu Jan 13 20:28:34 1994 X*************** X*** 1,54 **** X- # X /* X * X * UNIX debugger - common definitions X * X! */ X! X! X! X! /* Layout of a.out file (fsym): X * X! * header of 8 words magic number 405, 407, 410, 411, 430, 431 X! * text size ) X! * data size ) in bytes but even X! * bss size ) X! * symbol table size X! * entry point X! * {unused} X! * flag set if no relocation X! * overlay header (if type 430, 431), X! * NOVL words long: maximum overlay segement size ) X! * overlay 1 size ) X! * overlay 2 size ) X! * overlay 3 size ) X! * overlay 4 size ) size X! * overlay 5 size ) in X! * overlay 6 size ) even X! * overlay 7 size ) bytes X! * ... X! * overlay NOVL size X! * X! * header: 0 X! * text: 16 (16+2+(2*NOVL)=ovlheader if type 430,431) X! * overlays (if 430, 431 only): X! * 16+ovlheader+textsize X! * overlaysize: ov1+ov2+...+ovNOVL X! * data: 16+textsize (+overlaysize+ovlheader if type 431, 431) X! * relocation: 16+textsize+datasize (should not be present in 430,431) X! * symbol table: 16+2*(textsize+datasize) or 16+textsize+datasize X! * (if 430, 431): 16+ovlheader+(textsize+overlaysize+datasize) X! * X */ X X #include X #include X #include X! #include "mac.h" X! #include "mode.h" X X X /* X * Internal variables --- X * They are addressed by name. (e.g. (`0'-`9', `a'-`b')) X * thus there can only be 36 of them. X--- 1,121 ---- X /* X * X * UNIX debugger - common definitions X * X! * Layout of a.out file (fsym): X * X! * This has changed over time - see a.out.h, sys/exec.h and nlist.h X! * for the current a.out definition and format. X */ X X #include X #include X+ #include X #include X! #include X! #include X X+ #define MAXSYMLEN 32 X+ #define MAXCOM 64 X+ #define MAXARG 32 X+ #define LINSIZ 512 X X+ #define BEGIN { X+ #define END } X+ X+ #define IF if( X+ #define THEN ){ X+ #define ELSE } else { X+ #define ELIF } else if ( X+ #define FI } X+ X+ #define FOR for( X+ #define WHILE while( X+ #define DO ){ X+ #define OD } X+ #define REP do{ X+ #define PER }while( X+ #define DONE ); X+ #define LOOP for(;;){ X+ #define POOL } X+ X+ #define ANDF && X+ #define ORF || X+ X+ #define LPRMODE "%Q" X+ #define OFFMODE "+%o" X+ X /* X+ * This is the memory resident portion of a symbol. The only difference X+ * between this and a 'nlist' entry is the size of the string offset By X+ * restricting the string table to be less than 64kb we save 2 bytes per X+ * symbol - approximately 7.5kb of D space in the case of /unix's symbol X+ * table. In practice this restriction is unlikely to be reached since X+ * even the kernel's symbol table of ~28kb only has a strings table of 21kb. X+ */ X+ X+ struct SYMbol X+ { X+ u_short value; X+ char type; X+ char ovno; X+ u_short soff; /* low order of string table offset */ X+ }; X+ X+ #define SYMTYPE(symflag) (( symflag>=041 || (symflag>=02 && symflag<=04))\ X+ ? ((symflag&07)>=3 ? DSYM : (symflag&07))\ X+ : NSYM) X+ X+ typedef char MSG[]; X+ typedef struct map MAP; X+ typedef MAP *MAPPTR; X+ typedef struct bkpt BKPT; X+ typedef BKPT *BKPTR; X+ typedef struct user U; X+ X+ /* file address maps */ X+ struct map { X+ long b1; X+ long e1; X+ long f1; X+ long bo; X+ long eo; X+ long fo; X+ long b2; X+ long e2; X+ long f2; X+ int ufd; X+ }; X+ X+ struct bkpt { X+ int loc; X+ int ins; X+ int count; X+ int initcnt; X+ char flag; X+ char ovly; X+ char comm[MAXCOM]; X+ BKPT *nxtbkpt; X+ }; X+ X+ typedef struct reglist REGLIST; X+ typedef REGLIST *REGPTR; X+ struct reglist { X+ char *rname; X+ int roffs; X+ }; X+ X+ struct Sfp { X+ int fpsr; X+ float Sfr[6]; X+ }; X+ X+ struct Lfp { X+ int fpsr; X+ double Lfr[6]; X+ }; X+ X+ /* X * Internal variables --- X * They are addressed by name. (e.g. (`0'-`9', `a'-`b')) X * thus there can only be 36 of them. X*************** X*** 63,69 **** X #define VARS 28 X #define VART 29 X X- X #define RD 0 X #define WT 1 X #define NSP 0 X--- 130,135 ---- X*************** X*** 70,76 **** X #define ISP 1 X #define DSP 2 X #define STAR 4 X- #define STARCOM 0200 X #define DSYM 7 X #define ISYM 2 X #define ASYM 1 X--- 136,141 ---- X*************** X*** 78,85 **** X #define ESYM 0177 X #define BKPTSET 1 X #define BKPTEXEC 2 X- #define SYMSIZ 100 X- #define MAXSIG 20 X X #define BPT 03 X #define FD 0200 X--- 143,148 ---- X*************** X*** 94,106 **** X #define SINGLE 9 X #define EXIT 8 X X! #ifndef NONFP X! #define FROFF ((INT)&(((U*)0)->u_fps)) X #define FRLEN 25 X #define FRMAX 6 X- #endif X X- #include X #define NOREG 32767 /* impossible return from getreg() */ X #define NREG 9 /* 8 regs + PS from kernel stack */ X /* X--- 157,166 ---- X #define SINGLE 9 X #define EXIT 8 X X! #define FROFF ((int)&(((U*)0)->u_fps)) X #define FRLEN 25 X #define FRMAX 6 X X #define NOREG 32767 /* impossible return from getreg() */ X #define NREG 9 /* 8 regs + PS from kernel stack */ X /* X*************** X*** 108,114 **** X * If it doesn't correspond to reality, use pstat -u on a core file to X * get uar0, subtract 0140000, and divide by 2 (sizeof int). X */ X! #define UAR0 (&corhdr[ctob(USIZE)/sizeof(POS) - 3]) /* default address of r0 (u.u_ar0) */ X X #define KR0 (0300/2) /* location of r0 in kernel dump */ X #define KR1 (KR0+1) X--- 168,174 ---- X * If it doesn't correspond to reality, use pstat -u on a core file to X * get uar0, subtract 0140000, and divide by 2 (sizeof int). X */ X! #define UAR0 (&corhdr[ctob(USIZE)/sizeof(u_int) - 3]) /* default address of r0 (u.u_ar0) */ X X #define KR0 (0300/2) /* location of r0 in kernel dump */ X #define KR1 (KR0+1) X*************** X*** 122,148 **** X #define MAXOFF 255 X #define MAXPOS 80 X #define MAXLIN 128 X! #ifndef EOF X! #define EOF 0 X! #endif EOF X #define EOR '\n' X- #ifndef TB X- #define TB '\t' X- #endif TB X #define QUOTE 0200 X! #ifndef STRIP X! #define STRIP 0177 X! #endif STRIP X! #ifndef LOBYTE X! #define LOBYTE 0377 X! #endif LOBYTE X! #define EVEN -2 X X- X /* long to ints and back (puns) */ X union { X! INT I[2]; X! L_INT L; X } itolws; X X #define leng(a) ((long)((unsigned)(a))) X--- 182,204 ---- X #define MAXOFF 255 X #define MAXPOS 80 X #define MAXLIN 128 X! X! #define TRUE (-1) X! #define FALSE 0 X! #define LOBYTE 0377 X! #define HIBYTE 0177400 X! #define STRIP 0177 X! X! #define SP ' ' X! #define TB '\t' X #define EOR '\n' X #define QUOTE 0200 X! #define EVEN (~1) X X /* long to ints and back (puns) */ X union { X! int I[2]; X! long L; X } itolws; X X #define leng(a) ((long)((unsigned)(a))) X*************** X*** 149,168 **** X #define shorten(a) ((int)(a)) X #define itol(a,b) (itolws.I[0]=(a), itolws.I[1]=(b), itolws.L) X X- X- X /* result type declarations */ X! L_INT inkdot(); X! SYMPTR lookupsym(); X! SYMPTR symget(); X! POS get(); X! POS chkget(); X! STRING exform(); X! L_INT round(); X BKPTR scanbkpt(); X- VOID fault(); X X! typedef struct sgttyb TTY; X! TTY adbtty, usrtty; X! #include X jmp_buf erradb; X--- 205,220 ---- X #define shorten(a) ((int)(a)) X #define itol(a,b) (itolws.I[0]=(a), itolws.I[1]=(b), itolws.L) X X /* result type declarations */ X! long inkdot(); X! struct SYMbol *lookupsym(); X! struct SYMbol *symget(); X! u_int get(), chkget(); X! char *exform(); X! char *cache_sym(), *no_cache_sym(); X! long round(); X BKPTR scanbkpt(); X X! struct sgttyb adbtty, usrtty; X jmp_buf erradb; X+ extern off_t lseek(); Xdiff -r -c /usr/src/bin/adb.old/expr.c /usr/src/bin/adb/expr.c X*** /usr/src/bin/adb.old/expr.c Sun Feb 8 14:25:45 1987 X--- /usr/src/bin/adb/expr.c Thu Jan 13 22:59:27 1994 X*************** X*** 1,58 **** X- # X- /* X- * X- * UNIX debugger X- * X- */ X- X #include "defs.h" X X X! MSG BADSYM; X! MSG BADVAR; X! MSG BADKET; X! MSG BADSYN; X! MSG NOCFN; X! MSG NOADR; X! MSG BADLOC; X X- SYMTAB symbol; X- INT lastframe; X- INT kernel; X- INT savlastf; X- L_INT savframe; X- OVTAG svlastov; X- INT savpc; X- INT callpc; X- X- X- X- CHAR *lp; X- INT octal; X- STRING errflg; X- L_INT localval; X- CHAR isymbol[8]; X- X- CHAR lastc; X- POS *uar0; X- POS corhdr[]; X- OVTAG curov, startov; X- OVTAG lastsymov; X- int overlay; X- X- L_INT dot; X- L_INT ditto; X- INT dotinc; X- L_INT var[]; X- L_INT expv; X- X- X- X- X expr(a) X { /* term | term dyadic expr | */ X! INT rc; X! L_INT lhs; X X lastsymov = 0; X rdc(); lp--; rc=term(a); X--- 1,42 ---- X #include "defs.h" X+ #include X X+ MSG BADSYM; X+ MSG BADVAR; X+ MSG BADKET; X+ MSG BADSYN; X+ MSG NOCFN; X+ MSG NOADR; X+ MSG BADLOC; X X! extern struct SYMbol *symbol, *cache_by_string(); X! int lastframe; X! int kernel; X! int savlastf; X! long savframe; X! char svlastov; X! int savpc; X! int callpc; X! char *lp; X! int octal; X! char *errflg; X! long localval; X! static char isymbol[MAXSYMLEN + 2]; X! char lastc; X! u_int *uar0; X! u_int corhdr[]; X! char curov, startov, lastsymov; X! int overlay; X! long dot; X! long ditto; X! int dotinc; X! long var[]; X! long expv; X X expr(a) X { /* term | term dyadic expr | */ X! int rc; X! long lhs; X X lastsymov = 0; X rdc(); lp--; rc=term(a); X*************** X*** 126,138 **** X X item(a) X { /* name [ . local ] | number | . | ^ | symv; lastsymov=symp->ovnumb; X FI X lp--; X X X! ELIF digit(lastc) ORF (hex=TRUE, lastc=='#' ANDF hexdigit(readchar())) X THEN expv = 0; X base = (lastc == '0' ORF octal ? 8 : (hex ? 16 : 10)); X! WHILE (hex ? hexdigit(lastc) : digit(lastc)) X DO expv *= base; X IF (d=convdig(lastc))>=base THEN error(BADSYN); FI X expv += d; readchar(); X--- 150,164 ---- X if (overlay) X setovmap(savov); X ELIF (symp=lookupsym(isymbol))==0 THEN error(BADSYM); X! ELSE expv = symp->value; lastsymov=symp->ovno; X FI X lp--; X X X! ELIF isdigit(lastc) ORF (hex=TRUE, lastc=='#' ANDF isxdigit(readchar())) X THEN expv = 0; X base = (lastc == '0' ORF octal ? 8 : (hex ? 16 : 10)); X! WHILE (hex ? isxdigit(lastc) : isdigit(lastc)) X DO expv *= base; X IF (d=convdig(lastc))>=base THEN error(BADSYN); FI X expv += d; readchar(); X*************** X*** 185,191 **** X OD X IF lastc=='.' ANDF (base==10 ORF expv==0) ANDF !hex X THEN real.r=expv; frpt=0; base=10; X! WHILE digit(readchar()) X DO real.r *= base; frpt++; X real.r += lastc-'0'; X OD X--- 168,174 ---- X OD X IF lastc=='.' ANDF (base==10 ORF expv==0) ANDF !hex X THEN real.r=expv; frpt=0; base=10; X! WHILE isdigit(readchar()) X DO real.r *= base; frpt++; X real.r += lastc-'0'; X OD X*************** X*** 247,337 **** X X readsym() X { X! REG char *p; X X p = isymbol; X! REP IF p < &isymbol[8] X THEN *p++ = lastc; X FI X readchar(); X PER symchar(1) DONE X! WHILE p < &isymbol[8] DO *p++ = 0; OD X } X X! SYMPTR lookupsym(symstr) X! STRING symstr; X { X! SYMPTR symp; X symset(); X! WHILE (symp=symget()) X! DO IF (symp->symf&SYMCHK)==symp->symf X! THEN IF overlay ANDF (symp->symf&SYMCHK)==ISYM ANDF X! eqsym(symp->symc, symstr,'~') X! THEN return(symp); X! ELIF eqsym(symp->symc, symstr,'_') X! THEN return(symp); X! FI X! FI X! OD X! return(0); X } X X- hexdigit(c) X- CHAR c; X- { return((c>='0' ANDF c<='9') ORF (c>='a' ANDF c<='f')); X- } X- X convdig(c) X! CHAR c; X { X! IF digit(c) X THEN return(c-'0'); X! ELIF hexdigit(c) X THEN return(c-'a'+10); X ELSE return(17); X FI X } X X- digit(c) char c; {return(c>='0' ANDF c<='9');} X- X- letter(c) char c; {return(c>='a' ANDF c<='z' ORF c>='A' ANDF c<='Z');} X- X symchar(dig) X { X IF lastc=='\\' THEN readchar(); return(TRUE); FI X! return( letter(lastc) ORF lastc=='_' ORF dig ANDF digit(lastc) ); X } X X varchk(name) X { X! IF digit(name) THEN return(name-'0'); FI X! IF letter(name) THEN return((name&037)-1+10); FI X return(-1); X } X X chkloc(frame) X! L_INT frame; X { X readsym(); X REP IF localsym(frame)==0 THEN error(BADLOC); FI X expv=localval; X! PER !eqsym(symbol.symc,isymbol,'~') DONE X } X X eqsym(s1, s2, c) X! REG STRING s1, s2; X! CHAR c; X! { X! IF eqstr(s1,s2) X! THEN return(TRUE); X! ELIF *s1==c X! THEN CHAR s3[8]; X! REG INT i; X X! s3[0]=c; X! FOR i=1; i<8; i++ X! DO s3[i] = *s2++; OD X! X! return(eqstr(s1,s3)); X! FI X! } X--- 230,322 ---- X X readsym() X { X! register char *p; X X p = isymbol; X! REP IF p < &isymbol[MAXSYMLEN] X THEN *p++ = lastc; X FI X readchar(); X PER symchar(1) DONE X! *p++ = 0; X } X X! struct SYMbol * X! lookupsym(symstr) X! char *symstr; X { X! register struct SYMbol *symp, *sc; X! X symset(); X! while (symp = symget()) X! { X! if (overlay && (symp->type == ISYM)) X! { X! if (sc = cache_by_string(symstr, 1)) X! return(sc); X! if (eqsym(no_cache_sym(symp), symstr,'~')) X! break; X! } X! else X! { X! if (sc = cache_by_string(symstr, 0)) X! return(sc); X! if (eqsym(no_cache_sym(symp), symstr,'_')) X! break; X! } X! } X! /* X! * We did not enter anything into the cache (no sense inserting hundreds X! * of symbols which didn't match) while examining the (entire) symbol table. X! * Now that we have a match put it into the cache (doing a lookup on it is X! * the easiest way). X! */ X! if (symp) X! (void)cache_sym(symp); X! return(symp); X } X X convdig(c) X! char c; X { X! IF isdigit(c) X THEN return(c-'0'); X! ELIF isxdigit(c) X THEN return(c-'a'+10); X ELSE return(17); X FI X } X X symchar(dig) X { X IF lastc=='\\' THEN readchar(); return(TRUE); FI X! return( isalpha(lastc) ORF lastc=='_' ORF dig ANDF isdigit(lastc) ); X } X X varchk(name) X { X! IF isdigit(name) THEN return(name-'0'); FI X! IF isalpha(name) THEN return((name&037)-1+10); FI X return(-1); X } X X chkloc(frame) X! long frame; X { X readsym(); X REP IF localsym(frame)==0 THEN error(BADLOC); FI X expv=localval; X! PER !eqsym(cache_sym(symbol), isymbol,'~') DONE X } X X eqsym(s1, s2, c) X! register char *s1, *s2; X! char c; X! { X X! if (!strcmp(s1, s2)) X! return(TRUE); X! else if (*s1++ == c) X! return(!strcmp(s1, s2)); X! return(FALSE); X! } Xdiff -r -c /usr/src/bin/adb.old/findfn.c /usr/src/bin/adb/findfn.c X*** /usr/src/bin/adb.old/findfn.c Sun Feb 8 14:25:46 1987 X--- /usr/src/bin/adb/findfn.c Wed Jan 12 19:52:31 1994 X*************** X*** 1,33 **** X- # X- /* X- * X- * UNIX debugger X- * X- */ X- X #include "defs.h" X X! X! MSG NOCFN; X! X! INT callpc; X! BOOL localok; X! SYMTAB symbol; X X- STRING errflg; X- X- OVTAG curov; X- INT overlay; X- L_INT var[36]; X- X- X findroutine(cframe) X! L_INT cframe; X { X! REG INT narg, inst; X! INT lastpc, back2; X! BOOL v; X! OVTAG savov, curovl; X X v=FALSE; localok=FALSE; lastpc=callpc; X if(overlay) { X--- 1,21 ---- X #include "defs.h" X X! MSG NOCFN; X! int callpc; X! char localok; X! extern struct SYMbol *symbol; X! char *errflg; X! char curov; X! int overlay; X! long var[36]; X X findroutine(cframe) X! long cframe; X { X! register int narg, inst; X! int lastpc, back2; X! char v; X! char savov, curovl; X X v=FALSE; localok=FALSE; lastpc=callpc; X if(overlay) { X*************** X*** 53,65 **** X FI X if (overlay) X setovmap(savov); /* previous overlay, for findsym */ X! IF findsym( (v ? lastpc : ((inst==04767?callpc:0) + back2) ),ISYM) == -1 X! ANDF !v X! THEN symbol.symc[0] = '?'; X! symbol.symc[1] = 0; X! symbol.symv = 0; X! ELSE localok=TRUE; X! FI X if (overlay) X setovmap(curovl); X inst = get(leng(callpc), ISP); X--- 41,51 ---- X FI X if (overlay) X setovmap(savov); /* previous overlay, for findsym */ X! if (findsym((v ? lastpc : ((inst==04767?callpc:0) + back2)),ISYM) == -1 X! && !v) X! symbol = NULL; X! else X! localok=TRUE; X if (overlay) X setovmap(curovl); X inst = get(leng(callpc), ISP); X*************** X*** 68,77 **** X narg += get(leng(callpc+2), ISP)/2; X return(narg); X FI X! IF inst == 05726 /* tst (sp)+ */ X! THEN X return(narg+1); X- FI X IF inst == 022626 /* cmp (sp)+,(sp)+ */ X THEN X return(narg+2); X--- 54,61 ---- X narg += get(leng(callpc+2), ISP)/2; X return(narg); X FI X! if (inst == 05726 || inst == 010026) /* tst (sp)+ or mov r0,(sp)+ */ X return(narg+1); X IF inst == 022626 /* cmp (sp)+,(sp)+ */ X THEN X return(narg+2); Xdiff -r -c /usr/src/bin/adb.old/format.c /usr/src/bin/adb/format.c X*** /usr/src/bin/adb.old/format.c Sun Feb 8 14:25:46 1987 X--- /usr/src/bin/adb/format.c Wed Jan 12 19:54:12 1994 X*************** X*** 1,51 **** X- /* X- * X- * UNIX debugger X- * X- */ X- X #include "defs.h" X X X- MSG BADMOD; X- MSG NOFORK; X- MSG ADWRAP; X- X- SYMTAB symbol; X- X- INT mkfault; X- CHAR *lp; X- INT maxoff; X- INT sigint; X- INT sigqit; X- STRING errflg; X- CHAR lastc; X- L_INT dot; X- INT dotinc; X- L_INT var[]; X- X- X scanform(icount,ifp,itype,ptype) X! L_INT icount; X! STRING ifp; X { X! STRING fp; X! CHAR modifier; X! INT fcount, init=1; X! L_INT savdot; X X WHILE icount X DO fp=ifp; X IF init==0 ANDF findsym(shorten(dot),ptype)==0 ANDF maxoff X! THEN printf("\n%.8s:%16t",symbol.symc); X FI X savdot=dot; init=0; X X /*now loop over format*/ X WHILE *fp ANDF errflg==0 X! DO IF digit(modifier = *fp) X THEN fcount=0; X! WHILE digit(modifier = *fp++) X DO fcount *= 10; X fcount += modifier-'0'; X OD X--- 1,43 ---- X #include "defs.h" X+ #include X X+ MSG BADMOD; X+ MSG NOFORK; X+ MSG ADWRAP; X+ extern struct SYMbol *symbol; X+ int mkfault; X+ char *lp; X+ char *printptr, printbuf[]; X+ int maxoff; X+ int sigint; X+ int sigqit; X+ char *errflg; X+ char lastc; X+ long dot; X+ int dotinc; X+ long var[]; X X scanform(icount,ifp,itype,ptype) X! long icount; X! char *ifp; X { X! char *fp; X! char modifier; X! int fcount, init=1; X! long savdot; X X WHILE icount X DO fp=ifp; X IF init==0 ANDF findsym(shorten(dot),ptype)==0 ANDF maxoff X! THEN printf("\n%s:%16t", cache_sym(symbol)); X FI X savdot=dot; init=0; X X /*now loop over format*/ X WHILE *fp ANDF errflg==0 X! DO IF isdigit(modifier = *fp) X THEN fcount=0; X! WHILE isdigit(modifier = *fp++) X DO fcount *= 10; X fcount += modifier-'0'; X OD X*************** X*** 68,94 **** X IF --icount X THEN dot=inkdot(dotinc); X FI X! IF mkfault THEN error(0); FI X OD X } X X! STRING exform(fcount,ifp,itype,ptype) X! INT fcount; X! STRING ifp; X { X /* execute single format item `fcount' times X * sets `dotinc' and moves `dot' X * returns address of next format item X */ X! POS w; X! L_INT savdot, wx; X! STRING fp; X! CHAR c, modifier, longpr; X! struct{ X! L_INT sa; X! INT sb,sc; X! } X! fw; X X WHILE fcount>0 X DO fp = ifp; c = *fp; X--- 60,87 ---- X IF --icount X THEN dot=inkdot(dotinc); X FI X! IF mkfault THEN error((char *)0); FI X OD X } X X! char * X! exform(fcount,ifp,itype,ptype) X! int fcount; X! char *ifp; X! int itype, ptype; X { X /* execute single format item `fcount' times X * sets `dotinc' and moves `dot' X * returns address of next format item X */ X! u_int w; X! long savdot, wx; X! char *fp; X! char c, modifier, longpr; X! struct { X! long sa; X! int sb,sc; X! } fw; X X WHILE fcount>0 X DO fp = ifp; c = *fp; X*************** X*** 106,117 **** X fw.sc=get(inkdot(6),itype); X FI X IF errflg THEN return(fp); FI X! IF mkfault THEN error(0); FI X var[0]=wx; X modifier = *fp++; X dotinc=(longpr?4:2);; X X! IF charpos()==0 ANDF modifier!='a' THEN printf("%16m"); FI X X switch(modifier) { X X--- 99,111 ---- X fw.sc=get(inkdot(6),itype); X FI X IF errflg THEN return(fp); FI X! IF mkfault THEN error((char *)0); FI X var[0]=wx; X modifier = *fp++; X dotinc=(longpr?4:2);; X X! if (!(printptr - printbuf) && modifier != 'a') X! printf("%16m"); X X switch(modifier) { X X*************** X*** 182,188 **** X printf("%-16O", wx); break; X X case 'i': X! printins(0,itype,w); printc(EOR); break; X X case 'd': X printf("%-8d", w); break; X--- 176,182 ---- X printf("%-16O", wx); break; X X case 'i': X! printins(itype,w); printc(EOR); break; X X case 'd': X printf("%-8d", w); break; X*************** X*** 191,204 **** X printf("%-16D", wx); break; X X case 'f': X! *(L_REAL *)&fw = 0.0; X fw.sa = wx; X! printf("%-16.9f", *(L_REAL *)&fw); X dotinc=4; break; X X case 'F': X fw.sa = wx; X! printf("%-32.18F", *(L_REAL *)&fw); X dotinc=8; break; X X case 'n': case 'N': X--- 185,198 ---- X printf("%-16D", wx); break; X X case 'f': X! *(double *)&fw = 0.0; X fw.sa = wx; X! printf("%-16.9f", *(double *)&fw); X dotinc=4; break; X X case 'F': X fw.sa = wx; X! printf("%-32.18F", *(double *)&fw); X dotinc=8; break; X X case 'n': case 'N': X*************** X*** 233,240 **** X X unox() X { X! INT rc, status, unixpid; X! STRING argp = lp; X X WHILE lastc!=EOR DO rdc(); OD X IF (unixpid=fork())==0 X--- 227,234 ---- X X unox() X { X! int rc, status, unixpid; X! char *argp = lp; X X WHILE lastc!=EOR DO rdc(); OD X IF (unixpid=fork())==0 X*************** X*** 246,252 **** X ELSE signal(SIGINT,SIG_IGN); X WHILE (rc = wait(&status)) != unixpid ANDF rc != -1 DONE X signal(SIGINT,sigint); X! prints("!"); lp--; X FI X } X X--- 240,246 ---- X ELSE signal(SIGINT,SIG_IGN); X WHILE (rc = wait(&status)) != unixpid ANDF rc != -1 DONE X signal(SIGINT,sigint); X! printc('!'); lp--; X FI X } X X*************** X*** 260,270 **** X FI X } X X! L_INT inkdot(incr) X { X! L_INT newdot; X X newdot=dot+incr; X! IF (dot NEQ newdot) >> 24 THEN error(ADWRAP); FI X return(newdot); X } X--- 254,265 ---- X FI X } X X! long X! inkdot(incr) X { X! long newdot; X X newdot=dot+incr; X! IF (dot ^ newdot) >> 24 THEN error(ADWRAP); FI X return(newdot); X } Xdiff -r -c /usr/src/bin/adb.old/input.c /usr/src/bin/adb/input.c X*** /usr/src/bin/adb.old/input.c Sun Feb 8 14:25:46 1987 X--- /usr/src/bin/adb/input.c Fri Dec 31 11:16:51 1993 X*************** X*** 1,25 **** X- # X- /* X- * X- * UNIX debugger X- * X- */ X- X #include "defs.h" X X! INT mkfault; X! CHAR line[LINSIZ]; X! INT infile; X! CHAR *lp; X! CHAR lastc = EOR; X! INT eof; X X /* input routines */ X X eol(c) X! CHAR c; X { X! return(c==EOR ORF c==';'); X } X X rdc() X--- 1,18 ---- X #include "defs.h" X X! int mkfault; X! char line[LINSIZ]; X! int infile; X! char *lp; X! char lastc = EOR; X! int eof; X X /* input routines */ X X eol(c) X! char c; X { X! return(c==EOR || c==';'); X } X X rdc() X*************** X*** 32,42 **** X readchar() X { X IF eof X! THEN lastc=EOF; X ELSE IF lp==0 X THEN lp=line; X REP eof = read(infile,lp,1)==0; X! IF mkfault THEN error(0); FI X PER eof==0 ANDF *lp++!=EOR DONE X *lp=0; lp=line; X FI X--- 25,35 ---- X readchar() X { X IF eof X! THEN lastc = '\0'; X ELSE IF lp==0 X THEN lp=line; X REP eof = read(infile,lp,1)==0; X! IF mkfault THEN error((char *)0); FI X PER eof==0 ANDF *lp++!=EOR DONE X *lp=0; lp=line; X FI X*************** X*** 64,73 **** X } X X getformat(deformat) X! STRING deformat; X { X! REG STRING fptr; X! REG BOOL quote; X fptr=deformat; quote=FALSE; X WHILE (quote ? readchar()!=EOR : !eol(readchar())) X DO IF (*fptr++ = lastc)=='"' X--- 57,67 ---- X } X X getformat(deformat) X! char *deformat; X { X! register char *fptr; X! register int quote; X! X fptr=deformat; quote=FALSE; X WHILE (quote ? readchar()!=EOR : !eol(readchar())) X DO IF (*fptr++ = lastc)=='"' X*************** X*** 77,81 **** X lp--; X IF fptr!=deformat THEN *fptr++ = '\0'; FI X } X- X- X--- 71,73 ---- Xdiff -r -c /usr/src/bin/adb.old/main.c /usr/src/bin/adb/main.c X*** /usr/src/bin/adb.old/main.c Mon Aug 3 06:52:52 1987 X--- /usr/src/bin/adb/main.c Wed Jan 12 23:05:21 1994 X*************** X*** 1,53 **** X- /* X- * X- * UNIX debugger X- * X- */ X- X #include "defs.h" X X X! MSG NOEOR; X! X! INT mkfault; X! INT executing; X! INT infile; X! CHAR *lp; X! INT maxoff; X! INT maxpos; X! INT (*sigint)(); X! INT (*sigqit)(); X! INT wtflag; X! INT kernel; X! L_INT maxfile; X! L_INT maxstor; X! L_INT txtsiz; X! L_INT datsiz; X! L_INT datbas; X! L_INT stksiz; X! L_INT ovlsiz; X! int overlay; X! STRING errflg; X! INT exitflg; X! INT magic; X! L_INT entrypt; X! X! CHAR lastc; X! INT eof; X! X! INT lastcom; X! L_INT var[36]; X! STRING symfil; X! STRING corfil; X! CHAR *printptr; X! X! char *Ipath = "/usr/lib/adb"; X! X! X! L_INT round(a,b) X! L_INT a, b; X { X! L_INT w; X w = ((a+b-1)/b)*b; X return(w); X } X--- 1,43 ---- X #include "defs.h" X X+ MSG NOEOR; X+ char *myname; /* program name */ X+ int argcount; X+ int mkfault; X+ int executing; X+ int infile; X+ char *lp; X+ int maxoff; X+ int maxpos; X+ int (*sigint)(); X+ int (*sigqit)(); X+ int wtflag; X+ int kernel; X+ long maxfile; X+ long maxstor; X+ long txtsiz; X+ long datsiz; X+ long datbas; X+ long stksiz; X+ long ovlsiz; X+ int overlay; X+ char *errflg; X+ int exitflg; X+ int magic; X+ long entrypt; X+ char lastc; X+ int eof; X+ int lastcom; X+ long var[36]; X+ char *symfil; X+ char *corfil; X+ char *printptr; X+ char *Ipath = "/usr/lib/adb"; X X! long round(a,b) X! long a, b; X { X! long w; X w = ((a+b-1)/b)*b; X return(w); X } X*************** X*** 62,68 **** X } X X error(n) X! STRING n; X { X errflg=n; X iclose(0, 1); oclose(); X--- 52,58 ---- X } X X error(n) X! char *n; X { X errflg=n; X iclose(0, 1); oclose(); X*************** X*** 77,109 **** X } X X /* set up files and initial address mappings */ X- INT argcount; X X main(argc, argv) X! REG STRING *argv; X! REG INT argc; X { X- static char *myname; /* program name */ X short mynamelen; /* length of program name */ X- char *C, X- *rindex(); X X maxfile = 1L << 24; X maxstor = 1L << 16; X! IF (isatty(0)) X! THEN myname = *argv; X! mynamelen = strlen(myname); X! FI X X gtty(0,&adbtty); X gtty(0,&usrtty); X WHILE argc>1 X! DO IF eqstr("-w",argv[1]) X THEN wtflag=2; argc--; argv++; continue; X! ELIF eqstr("-k",argv[1]) X THEN kernel++; argc--; argv++; continue; X! ELIF eqstr("-I",argv[1]) X! THEN Ipath = argv[1]+2; argc--; argv++; continue; X ELSE break; X FI X OD X--- 67,96 ---- X } X X /* set up files and initial address mappings */ X X main(argc, argv) X! register char **argv; X! int argc; X { X short mynamelen; /* length of program name */ X X maxfile = 1L << 24; X maxstor = 1L << 16; X! if (isatty(0)) X! myname = *argv; X! else X! myname = "adb"; X! mynamelen = strlen(myname); X X gtty(0,&adbtty); X gtty(0,&usrtty); X WHILE argc>1 X! DO IF !strcmp("-w",argv[1]) X THEN wtflag=2; argc--; argv++; continue; X! ELIF !strcmp("-k",argv[1]) X THEN kernel++; argc--; argv++; continue; X! ELIF !strcmp("-I",argv[1]) X! THEN Ipath = argv[2]; argc -= 2; argv += 2; continue; X ELSE break; X FI X OD X*************** X*** 139,152 **** X LOOP flushbuf(); X IF errflg X THEN printf("%s\n",errflg); X! exitflg=(INT)errflg; X errflg=0; X FI X IF mkfault X THEN mkfault=0; printc(EOR); X! IF !myname X! THEN prints(DBNAME); X! FI X FI X IF myname ANDF !infile X THEN write(1,myname,mynamelen); X--- 126,137 ---- X LOOP flushbuf(); X IF errflg X THEN printf("%s\n",errflg); X! exitflg=(int)errflg; X errflg=0; X FI X IF mkfault X THEN mkfault=0; printc(EOR); X! printf("%s\n", myname); X FI X IF myname ANDF !infile X THEN write(1,myname,mynamelen); Xdiff -r -c /usr/src/bin/adb.old/message.c /usr/src/bin/adb/message.c X*** /usr/src/bin/adb.old/message.c Sat Aug 1 14:01:29 1987 X--- /usr/src/bin/adb/message.c Thu Dec 30 21:22:55 1993 X*************** X*** 1,42 **** X- # X- /* X- * X- * UNIX debugger X- * X- */ X- X- X #include "defs.h" X X! MSG version = "\nVERSION menlo01 DATE 1980 Jun 6 11:43:04\n"; X! X! MSG BADMOD = "bad modifier"; X! MSG BADCOM = "bad command"; X! MSG BADSYM = "symbol not found"; X! MSG BADLOC = "automatic variable not found"; X! MSG NOCFN = "c routine not found"; X! MSG NOMATCH = "cannot locate value"; X! MSG NOBKPT = "no breakpoint set"; X! MSG BADKET = "unexpected ')'"; X! MSG NOADR = "address expected"; X! MSG NOPCS = "no process"; X! MSG BADVAR = "bad variable"; X! MSG BADTXT = "text address not found"; X! MSG BADDAT = "data address not found"; X! MSG ODDADR = "odd address"; X! MSG EXBKPT = "too many breakpoints"; X! MSG A68BAD = "bad a68 frame"; X! MSG A68LNK = "bad a68 link"; X! MSG ADWRAP = "address wrap around"; X! MSG BADEQ = "unexpected `='"; X! MSG BADWAIT = "wait error: process disappeared!"; X! MSG ENDPCS = "process terminated"; X! MSG NOFORK = "try again"; X! MSG BADSYN = "syntax error"; X! MSG NOEOR = "newline expected"; X! MSG SZBKPT = "bkpt: command too long"; X! MSG BADFIL = "bad file format"; X! MSG BADNAM = "not enough space for symbols"; X! MSG LONGFIL = "filename too long"; X! MSG NOTOPEN = "cannot open"; X! MSG TOODEEP = "$<< nesting too deep"; X--- 1,30 ---- X #include "defs.h" X X! MSG BADMOD = "bad modifier"; X! MSG BADCOM = "bad command"; X! MSG BADSYM = "symbol not found"; X! MSG BADLOC = "automatic variable not found"; X! MSG NOCFN = "c routine not found"; X! MSG NOMATCH = "cannot locate value"; X! MSG NOBKPT = "no breakpoint set"; X! MSG BADKET = "unexpected ')'"; X! MSG NOADR = "address expected"; X! MSG NOPCS = "no process"; X! MSG BADVAR = "bad variable"; X! MSG BADTXT = "text address not found"; X! MSG BADDAT = "data address not found"; X! MSG ODDADR = "odd address"; X! MSG EXBKPT = "too many breakpoints"; X! MSG A68BAD = "bad a68 frame"; X! MSG A68LNK = "bad a68 link"; X! MSG ADWRAP = "address wrap around"; X! MSG BADEQ = "unexpected `='"; X! MSG BADWAIT = "wait error: process disappeared!"; X! MSG ENDPCS = "process terminated"; X! MSG NOFORK = "try again"; X! MSG BADSYN = "syntax error"; X! MSG NOEOR = "newline expected"; X! MSG SZBKPT = "bkpt: command too long"; X! MSG LONGFIL = "filename too long"; X! MSG NOTOPEN = "cannot open"; X! MSG TOODEEP = "$<< nesting too deep"; Xdiff -r -c /usr/src/bin/adb.old/opset.c /usr/src/bin/adb/opset.c X*** /usr/src/bin/adb.old/opset.c Fri Mar 12 22:57:02 1993 X--- /usr/src/bin/adb/opset.c Wed Jan 12 20:08:48 1994 X*************** X*** 1,16 **** X- /* X- * X- * UNIX debugger X- * X- */ X- X #include "defs.h" X X! STRING errflg; X! L_INT dot; X! INT dotinc; X! L_INT var[]; X! MAP datmap; X X #undef SINGLE X X--- 1,10 ---- X #include "defs.h" X X! char *errflg; X! long dot; X! int dotinc; X! long var[]; X! MAP datmap; X X #undef SINGLE X X*************** X*** 30,37 **** X #define JMP 11 X #define JSR 12 X X- X- TYPE struct optab *OPTAB; X struct optab { X int mask; X int val; X--- 24,29 ---- X*************** X*** 136,142 **** X }; X X char *systab[] = { X! "old indir (illegal)", X "exit", X "fork", X "read", X--- 128,134 ---- X }; X X char *systab[] = { X! "old indir", /* 0 */ X "exit", X "fork", X "read", X*************** X*** 149,198 **** X "unlink", X "execv", X "chdir", X! "old time", X "mknod", X "chmod", X "chown", X! "old sbreak", X! "old stat", X "lseek", X "getpid", X "mount", X "umount", X! "old setuid", X "getuid", X! "old stime", X "ptrace", X "alarm", X! "old fstat", X "pause", X! "old utime", X! "old stty", X! "old gtty", X "access", X! "old nice", X! "old ftime", X "sync", X "kill", X "stat", X! "old setpgrp", X "lstat", X "dup", X "pipe", X "times", X "profil", X! "45 (unused)", X! "old setgid", X "getgid", X "signal", X! "49 (reserved for USG)", X! "50 (reserved for USG)", X "acct", X "phys", X "lock", X "ioctl", X "reboot", X! "old mpxchan", X "symlink", X "readlink", X "execve", X--- 141,190 ---- X "unlink", X "execv", X "chdir", X! NULL, /* 13 - old time */ X "mknod", X "chmod", X "chown", X! NULL, /* 17 - old sbreak */ X! NULL, /* 18 - old stat */ X "lseek", X "getpid", X "mount", X "umount", X! NULL, /* 23 - old setuid */ X "getuid", X! NULL, /* 25 - old stime */ X "ptrace", X "alarm", X! NULL, /* 28 - old fstat */ X "pause", X! NULL, /* 30 - old utime */ X! NULL, /* 31 - old stty */ X! NULL, /* 32 - old gtty */ X "access", X! NULL, /* 34 - old nice */ X! NULL, /* 35 - old ftime */ X "sync", X "kill", X "stat", X! NULL, /* 39 - old setpgrp */ X "lstat", X "dup", X "pipe", X "times", X "profil", X! NULL, /* 45 - unused */ X! NULL, /* 46 - old setgid */ X "getgid", X "signal", X! NULL, /* 49 - unused */ X! NULL, /* 50 - unused */ X "acct", X "phys", X "lock", X "ioctl", X "reboot", X! NULL, /* 56 - old mpxchan */ X "symlink", X "readlink", X "execve", X*************** X*** 199,220 **** X "umask", X "chroot", X "fstat", X! "63 (reserved)", X "getpagesize", X! "mremap", X "vfork", X! "old vread", X! "old vwrite", X "sbrk", X "sstk", X! "mmap", X! "old vadvise", X! "munmap", X! "mprotect", X! "madvise", X "vhangup", X! "old vlimit", X! "mincore", X "getgroups", X "setgroups", X "getpgrp", X--- 191,212 ---- X "umask", X "chroot", X "fstat", X! NULL, /* 63 - unused */ X "getpagesize", X! NULL, /* 65 - mremap */ X "vfork", X! NULL, /* 67 - old vread */ X! NULL, /* 68 - old vwrite */ X "sbrk", X "sstk", X! NULL, /* 71 - mmap */ X! NULL, /* 72 - old vadvise */ X! NULL, /* 73 - munmap */ X! NULL, /* 74 - mprotect */ X! NULL, /* 75 - madvise */ X "vhangup", X! NULL, /* 77 - old vlimit */ X! NULL, /* 78 - mincore */ X "getgroups", X "setgroups", X "getpgrp", X*************** X*** 243,249 **** X "bind", X "setsockopt", X "listen", X! "old vtimes", X "sigvec", X "sigblock", X "sigsetmask", X--- 235,241 ---- X "bind", X "setsockopt", X "listen", X! NULL, /* 107 - old vtimes */ X "sigvec", X "sigblock", X "sigsetmask", X*************** X*** 255,261 **** X "gettimeofday", X "getrusage", X "getsockopt", X! "old (vax) resuba", X "readv", X "writev", X "settimeofday", X--- 247,253 ---- X "gettimeofday", X "getrusage", X "getsockopt", X! NULL, /* 119 - old resuba */ X "readv", X "writev", X "settimeofday", X*************** X*** 268,274 **** X "truncate", X "ftruncate", X "flock", X! "132 (nosys)", X "sendto", X "shutdown", X "socketpair", X--- 260,266 ---- X "truncate", X "ftruncate", X "flock", X! NULL, /* 132 - unused */ X "sendto", X "shutdown", X "socketpair", X*************** X*** 275,281 **** X "mkdir", X "rmdir", X "utimes", X! "139 (4.2 sigreturn)", X "adjtime", X "getpeername", X "gethostid", X--- 267,273 ---- X "mkdir", X "rmdir", X "utimes", X! NULL, /* 139 - 4.2 sigreturn */ X "adjtime", X "getpeername", X "gethostid", X*************** X*** 283,296 **** X "getrlimit", X "setrlimit", X "killpg", X! "147 (nosys)", X "setquota", X "quota", X "getsockname", X /* X! * BSD2.10 special calls X */ X! "rtp", X "nostk", X "fetchi", X "ucall", X--- 275,288 ---- X "getrlimit", X "setrlimit", X "killpg", X! NULL, /* 147 - unused */ X "setquota", X "quota", X "getsockname", X /* X! * 2.11BSD special calls X */ X! NULL, /* 151 - old rtp */ X "nostk", X "fetchi", X "ucall", X*************** X*** 298,312 **** X "gldav", X }; X X! STRING regname[] = { "r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc"}; X X! POS type, space, incp; X X! printins(f,idsp,ins) X! REG INT ins; X { X! INT byte; X! REG OPTAB p; X X type=DSYM; space=idsp; incp=2; X FOR p=optab;; p++ X--- 290,304 ---- X "gldav", X }; X X! char *regname[] = { "r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc"}; X X! u_int type, space, incp; X X! printins(idsp,ins) X! register int ins; X { X! int byte; X! register struct optab *p; X X type=DSYM; space=idsp; incp=2; X FOR p=optab;; p++ X*************** X*** 314,320 **** X THEN break; X FI X OD X! prints(p->iname); byte=ins&0100000; ins &= p->mask; X switch (p->itype) { X X case JMP: X--- 306,315 ---- X THEN break; X FI X OD X! printf(p->iname); X! byte=ins&0100000; X! ins &= p->mask; X! X switch (p->itype) { X X case JMP: X*************** X*** 351,357 **** X break; X X case SYS: X! printf("%8t%s", systab[ins]); X break; X X case TRAP: X--- 346,355 ---- X break; X X case SYS: X! if (systab[ins]) X! printf("%8t%s", systab[ins]); X! else X! printf("%8t%d", ins); X break; X X case TRAP: X*************** X*** 368,375 **** X } X X branch(s,ins) X! STRING s; X! REG INT ins; X { X printf(s); X IF ins&0200 THEN ins |= 0177400; FI X--- 366,373 ---- X } X X branch(s,ins) X! char *s; X! register int ins; X { X printf(s); X IF ins&0200 THEN ins |= 0177400; FI X*************** X*** 378,387 **** X } X X paddr(s, a) X! STRING s; X! REG INT a; X { X! REG INT r; X X var[2]=var[1]; X r = a&07; a &= 070; X--- 376,385 ---- X } X X paddr(s, a) X! char *s; X! register int a; X { X! register int r; X X var[2]=var[1]; X r = a&07; a &= 070; X*************** X*** 405,415 **** X incp += 2; X return; X FI X! r = (INT)regname[r]; X switch (a) { X /* r */ X case 000: X! prints(r); X return; X X /* (r) */ X--- 403,413 ---- X incp += 2; X return; X FI X! r = (int)regname[r]; X switch (a) { X /* r */ X case 000: X! printf(r); X return; X X /* (r) */ SHAR_EOF fi exit 0 # End of shell archive