new version from Chris Torek
[unix-history] / usr / src / old / adb / adb.vax / runpcs.c
index 11ed405..79fb5c6 100644 (file)
@@ -1,4 +1,6 @@
-#
+#ifndef lint
+static char sccsid[] = "@(#)runpcs.c   4.6 %G%";
+#endif
 /*
  *
  *     UNIX debugger
 /*
  *
  *     UNIX debugger
@@ -6,7 +8,6 @@
  */
 
 #include "defs.h"
  */
 
 #include "defs.h"
-static char sccsid[] = "@(#)runpcs.c 4.2 %G%";
 
 extern MAP     txtmap;
 
 
 extern MAP     txtmap;
 
@@ -104,7 +105,7 @@ endpcs()
 {
        REG BKPTR       bkptr;
        IF pid
 {
        REG BKPTR       bkptr;
        IF pid
-       THEN ptrace(EXIT,pid,0,0); pid=0; userpc=1;
+       THEN ptrace(PT_KILL,pid,0,0); pid=0; userpc=1;
             FOR bkptr=bkpthead; bkptr; bkptr=bkptr->nxtbkpt
             DO IF bkptr->flag
                THEN bkptr->flag=BKPTSET;
             FOR bkptr=bkpthead; bkptr; bkptr=bkptr->nxtbkpt
             DO IF bkptr->flag
                THEN bkptr->flag=BKPTSET;
@@ -129,7 +130,7 @@ setup()
 #else
        IF (pid = vfork()) == 0
 #endif
 #else
        IF (pid = vfork()) == 0
 #endif
-       THEN ptrace(SETTRC,0,0,0);
+       THEN ptrace(PT_TRACE_ME,0,0,0);
 #ifdef VFORK
             signal(SIGTRAP,nullsig);
 #endif
 #ifdef VFORK
             signal(SIGTRAP,nullsig);
 #endif
@@ -154,7 +155,7 @@ BKPTR       bkptr;
        printf("exbkpt: %d\n",bkptr->count);
 #endif
        delbp();
        printf("exbkpt: %d\n",bkptr->count);
 #endif
        delbp();
-       ptrace(SINGLE,pid,bkptr->loc,execsig);
+       ptrace(PT_STEP,pid,bkptr->loc,execsig);
        bkptr->flag=BKPTSET;
        bpwait(); chkerr(); readregs();
 }
        bkptr->flag=BKPTSET;
        bpwait(); chkerr(); readregs();
 }
@@ -203,8 +204,6 @@ doexec()
                        *p++ = '\0';
                        ap++;
                FI
                        *p++ = '\0';
                        ap++;
                FI
-               WHILE lastc==SP ORF lastc==TB DO readchar(); OD
-
        PER lastc!=EOR DONE
        *ap++=0;
        exect(symfil, argl, environ);
        PER lastc!=EOR DONE
        *ap++=0;
        exect(symfil, argl, environ);
@@ -233,11 +232,9 @@ delbp()
                DO      IF bkptr->flag
                        THEN a=bkptr->loc;
                                IF a < txtmap.e1 THEN
                DO      IF bkptr->flag
                        THEN a=bkptr->loc;
                                IF a < txtmap.e1 THEN
-                               ptrace(WIUSER,pid,a,
-                                       (bkptr->ins&0xFF)|(ptrace(RIUSER,pid,a,0)&~0xFF));
+                                       ptrace(PT_WRITE_I,pid,a,bkptr->ins);
                                ELSE
                                ELSE
-                               ptrace(WDUSER,pid,a,
-                                       (bkptr->ins&0xFF)|(ptrace(RDUSER,pid,a,0)&~0xFF));
+                                       ptrace(PT_WRITE_D,pid,a,bkptr->ins);
                                FI
                        FI
                OD
                                FI
                        FI
                OD
@@ -245,6 +242,10 @@ delbp()
        FI
 }
 
        FI
 }
 
+#ifdef vax
+#define        SETBP(ins)      (BPT | ((ins) &~ 0xFF))
+#endif
+
 setbp()
 {
        REG ADDR                a;
 setbp()
 {
        REG ADDR                a;
@@ -256,11 +257,11 @@ setbp()
                DO IF bkptr->flag
                   THEN a = bkptr->loc;
                        IF a < txtmap.e1 THEN
                DO IF bkptr->flag
                   THEN a = bkptr->loc;
                        IF a < txtmap.e1 THEN
-                               bkptr->ins = ptrace(RIUSER, pid, a, 0);
-                               ptrace(WIUSER, pid, a, BPT | (bkptr->ins&~0xFF));
+                               bkptr->ins = ptrace(PT_READ_I, pid, a, 0);
+                               ptrace(PT_WRITE_I, pid, a, SETBP(bkptr->ins));
                        ELSE
                        ELSE
-                               bkptr->ins = ptrace(RDUSER, pid, a, 0);
-                               ptrace(WDUSER, pid, a, BPT | (bkptr->ins&~0xFF));
+                               bkptr->ins = ptrace(PT_READ_D, pid, a, 0);
+                               ptrace(PT_WRITE_D, pid, a, SETBP(bkptr->ins));
                        FI
                        IF errno
                        THEN prints("cannot set breakpoint: ");
                        FI
                        IF errno
                        THEN prints("cannot set breakpoint: ");
@@ -296,7 +297,7 @@ bpwait()
             pid=0;
             errflg=ENDPCS;
        ELSE signo = stat>>8;
             pid=0;
             errflg=ENDPCS;
        ELSE signo = stat>>8;
-            sigcode = ptrace(RUREGS, pid, &((struct user *)0)->u_code, 0);
+            sigcode = ptrace(PT_READ_U, pid, &((struct user *)0)->u_code, 0);
             IF signo!=SIGTRAP
             THEN sigprint();
             ELSE signo=0;
             IF signo!=SIGTRAP
             THEN sigprint();
             ELSE signo=0;
@@ -311,7 +312,7 @@ readregs()
        REG i;
        FOR i=24; --i>=0; 
        DO *(ADDR *)(((ADDR)&u)+reglist[i].roffs) =
        REG i;
        FOR i=24; --i>=0; 
        DO *(ADDR *)(((ADDR)&u)+reglist[i].roffs) =
-                   ptrace(RUREGS, pid, reglist[i].roffs, 0);
+                   ptrace(PT_READ_U, pid, reglist[i].roffs, 0);
        OD
        userpc= *(ADDR *)(((ADDR)&u)+PC);
 }
        OD
        userpc= *(ADDR *)(((ADDR)&u)+PC);
 }