BSD 3 development
authorHoward Katseff <hpk@ucbvax.Berkeley.EDU>
Mon, 10 Dec 1979 15:59:49 +0000 (07:59 -0800)
committerHoward Katseff <hpk@ucbvax.Berkeley.EDU>
Mon, 10 Dec 1979 15:59:49 +0000 (07:59 -0800)
Work on file usr/src/cmd/sdb/err
Work on file usr/src/cmd/sdb/mac.h
Work on file usr/src/cmd/sdb/makefile.prod
Work on file usr/src/cmd/sdb/message.c
Work on file usr/src/cmd/sdb/mode.h
Work on file usr/src/cmd/sdb/pcs.c

Synthesized-from: 3bsd

usr/src/cmd/sdb/err [new file with mode: 0644]
usr/src/cmd/sdb/mac.h [new file with mode: 0644]
usr/src/cmd/sdb/makefile.prod [new file with mode: 0644]
usr/src/cmd/sdb/message.c [new file with mode: 0644]
usr/src/cmd/sdb/mode.h [new file with mode: 0644]
usr/src/cmd/sdb/pcs.c [new file with mode: 0644]

diff --git a/usr/src/cmd/sdb/err b/usr/src/cmd/sdb/err
new file mode 100644 (file)
index 0000000..7e97b2b
--- /dev/null
@@ -0,0 +1,4 @@
+cp sdb sdb.temp
+install -s sdb /usr/bin
+chmod: can't change /usr/bin/sdb
+mv sdb.temp sdb
diff --git a/usr/src/cmd/sdb/mac.h b/usr/src/cmd/sdb/mac.h
new file mode 100644 (file)
index 0000000..26d91e6
--- /dev/null
@@ -0,0 +1,48 @@
+#
+/*
+ *     UNIX debugger
+ */
+
+#define TYPE   typedef
+#define STRUCT struct
+#define UNION  union
+#define REG    register
+
+#define BEGIN  {
+#define END    }
+
+#define IF     if(
+#define THEN   ){
+#define ELSE   } else {
+#define ELIF   } else if (
+#define FI     }
+
+#define FOR    for(
+#define WHILE  while(
+#define DO     ){
+#define OD     }
+#define REP    do{
+#define PER    }while(
+#define DONE   );
+#define LOOP   for(;;){
+#define POOL   }
+
+#define SKIP   ;
+#define DIV    /
+#define REM    %
+#define NEQ    ^
+#define ANDF   &&
+#define ORF    ||
+
+#define TRUE    (-1)
+#define FALSE  0
+#define LOBYTE 0377
+#define HIBYTE 0177400
+#define STRIP  0177
+#define HEXMSK 017
+
+#define SP     ' '
+#define TB     '\t'
+#define NL     '\n'
+
+#define SCCSID(arg) static char Sccsid[] = "arg"
diff --git a/usr/src/cmd/sdb/makefile.prod b/usr/src/cmd/sdb/makefile.prod
new file mode 100644 (file)
index 0000000..3583768
--- /dev/null
@@ -0,0 +1,38 @@
+CFLAGS = -O -DVAX135
+#                       VAX135 - Department 1353; Bell Labs
+#                       UCBVAX - Ernie Co-Vax; CS Division, UC Berkeley
+#                       STD - Distribution system 
+
+sdb:   main.o re.o fio.o bio.o decode.o docomm.o sub.o head.h \
+       access.o pcs.o runpcs.o setup.o message.o udef.o \
+       symt.o display.o xeq.o mktemp.o version.o
+       cc -o sdb *.o
+       echo DONE
+
+decode.o:      head.h decode.c
+docomm.o:      head.h docomm.c
+main.o:                head.h main.c
+sub.o:         head.h sub.c
+re.o:          head.h re.c
+fio.o:         head.h fio.c
+bio.o:         bio.h bio.c
+access.o:      defs.h mac.h machine.h mode.h access.c
+pcs.o:         head.h defs.h mac.h machine.h mode.h pcs.c
+runpcs.o:      head.h defs.h mac.h machine.h mode.h runpcs.c
+xeq.o:         head.h xeq.c
+setup.o:       head.h defs.h mac.h machine.h mode.h setup.c
+message.o:     defs.h mac.h machine.h mode.h message.c
+udef.o:                udef.c
+symt.o:                bio.h head.h defs.h symt.c
+display.o:     bio.h head.h defs.h cdefs.h display.c
+
+install :
+       cp sdb sdb.temp
+       install -s sdb $(DESTDIR)/usr/bin
+       mv sdb.temp sdb
+
+clean :
+       rm *.o  sdb
+
+print:
+       pr *.h *.c
diff --git a/usr/src/cmd/sdb/message.c b/usr/src/cmd/sdb/message.c
new file mode 100644 (file)
index 0000000..6b39d42
--- /dev/null
@@ -0,0 +1,24 @@
+#
+/*
+ *
+ *     UNIX debugger
+ *
+ */
+
+
+
+#include       "mac.h"
+#include       "mode.h"
+
+
+MSG            BADMOD  =  "bad modifier";
+MSG            NOBKPT  =  "no breakpoint set";
+MSG            NOPCS   =  "no process";
+MSG            BADTXT  =  "text address not found";
+MSG            BADDAT  =  "data address not found";
+MSG            EXBKPT  =  "too many breakpoints";
+MSG            BADWAIT =  "wait error: process disappeared!";
+MSG            ENDPCS  =  "process terminated";
+MSG            NOFORK  =  "try again";
+MSG            SZBKPT  =  "bkpt: command too long";
+MSG            BADMAG  =  "bad core magic number";
diff --git a/usr/src/cmd/sdb/mode.h b/usr/src/cmd/sdb/mode.h
new file mode 100644 (file)
index 0000000..65036ce
--- /dev/null
@@ -0,0 +1,79 @@
+#include "machine.h"
+/*
+ *     UNIX debugger
+ */
+
+#define MAXCOM 64
+#define MAXARG 32
+#define LINSIZ 256
+TYPE   long    ADDR;
+#ifndef vax
+TYPE   int             INT;
+#else
+TYPE   short   INT;
+#endif
+TYPE   int             VOID;
+TYPE   long int        L_INT;
+TYPE   float           REAL;
+TYPE   double          L_REAL;
+TYPE   unsigned        POS;
+TYPE   char            BOOL;
+TYPE   char            CHAR;
+TYPE   char            *STRING;
+TYPE   char            MSG[];
+TYPE   struct map      MAP;
+TYPE   MAP             *MAPPTR;
+TYPE   struct symtab   SYMTAB;
+TYPE   SYMTAB          *SYMPTR;
+TYPE   struct symslave SYMSLAVE;
+TYPE   struct bkpt     BKPT;
+TYPE   BKPT            *BKPTR;
+
+
+/* file address maps */
+struct map {
+       L_INT   b1;
+       L_INT   e1;
+       L_INT   f1;
+       L_INT   b2;
+       L_INT   e2;
+       L_INT   f2;
+       INT     ufd;
+};
+
+
+/* slave table for symbols */
+struct symslave {
+       SYMV    valslave;
+       INT     typslave;
+};
+
+struct bkpt {
+       ADDR    loc;
+       ADDR    ins;
+       INT     count;
+       INT     initcnt;
+       INT     flag;
+       CHAR    comm[MAXCOM];
+       BKPT    *nxtbkpt;
+};
+
+TYPE   struct reglist  REGLIST;
+TYPE   REGLIST         *REGPTR;
+struct reglist {
+       STRING  rname;
+       INT     roffs;
+};
+
+struct {
+       INT     junk[2];
+       INT     fpsr;
+       REAL    Sfr[6];
+};
+
+struct {
+       INT     junk[2];
+       INT     fpsr;
+       L_REAL  Lfr[6];
+};
+
diff --git a/usr/src/cmd/sdb/pcs.c b/usr/src/cmd/sdb/pcs.c
new file mode 100644 (file)
index 0000000..a85f970
--- /dev/null
@@ -0,0 +1,113 @@
+#
+/*
+ *
+ *     UNIX debugger
+ *
+ */
+
+#include "defs.h"
+
+
+MSG            NOBKPT;
+MSG            SZBKPT;
+MSG            EXBKPT;
+MSG            NOPCS;
+MSG            BADMOD;
+
+/* breakpoints */
+BKPTR          bkpthead;
+
+CHAR           lastc;
+struct user u;
+
+INT            signo;
+L_INT          dot;
+INT            pid;
+L_INT          cntval;
+L_INT          loopcnt;
+
+
+
+/* sub process control */
+
+subpcs(modif)
+{
+       REG INT         check;
+       INT             execsig,runmode;
+       REG BKPTR       bkptr;
+       STRING          comptr;
+       execsig=0; loopcnt=cntval;
+
+       switch (modif) {
+
+           /* delete breakpoint */
+           case 'd': case 'D':
+               IF (bkptr=scanbkpt(dot))
+               THEN bkptr->flag=0; return;
+               ELSE error(NOBKPT);
+               FI
+
+           /* set breakpoint */
+           case 'b': case 'B':
+               IF (bkptr=scanbkpt(dot))
+               THEN bkptr->flag=0;
+               FI
+               FOR bkptr=bkpthead; bkptr; bkptr=bkptr->nxtbkpt
+               DO IF bkptr->flag == 0
+                  THEN break;
+                  FI
+               OD
+               IF bkptr==0
+               THEN IF (bkptr=(BKPTR) sbrk(sizeof *bkptr)) == (BKPTR) -1
+                    THEN error(SZBKPT);
+                    ELSE bkptr->nxtbkpt=bkpthead;
+                         bkpthead=bkptr;
+                    FI
+               FI
+               bkptr->loc = dot;
+               bkptr->initcnt = bkptr->count = cntval;
+               bkptr->flag = BKPTSET;
+               check=MAXCOM-1; comptr=bkptr->comm; /* rdc(); */
+               REP *comptr++ = readchar();
+               PER check-- ANDF lastc!=EOR DONE
+               *comptr=0;
+               IF check
+               THEN return;
+               ELSE error(EXBKPT);
+               FI
+
+           /* exit */
+           case 'k' :case 'K':
+               IF pid
+               THEN printf("%d: killed", pid); endpcs(); return;
+               FI
+               error(NOPCS);
+
+           /* run program */
+           case 'r': case 'R':
+               endpcs();
+               setup(); runmode=CONTIN;
+               break;
+
+           /* single step */
+           case 's': case 'S':
+               IF pid
+               THEN
+                       runmode=SINGLE; execsig=getsig(signo);
+               ELSE setup(); loopcnt--;
+               FI
+               break;
+
+           /* continue with optional signal */
+           case 'c': case 'C': case 0:
+               IF pid==0 THEN error(NOPCS); FI
+               runmode=CONTIN; execsig=getsig(signo);
+               break;
+
+           default: error(BADMOD);
+       }
+
+       runpcs(runmode,execsig);
+       delbp();
+}
+