X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/2b84abb596f52ab2068d52108adc96838ad4340a..31cef89cb428866f787983e68246030321893df4:/usr/src/cmd/sdb/runpcs.c diff --git a/usr/src/cmd/sdb/runpcs.c b/usr/src/cmd/sdb/runpcs.c index 70c1a13637..970ff045e6 100644 --- a/usr/src/cmd/sdb/runpcs.c +++ b/usr/src/cmd/sdb/runpcs.c @@ -1,3 +1,4 @@ +static char sccsid[] = "@(#)runpcs.c 4.1 10/9/80"; # /* * @@ -7,9 +8,13 @@ #include "head.h" #include +#include struct user u; #include +#ifndef SIGTRAP +#define SIGTRAP SIGTRC +#endif MSG NOFORK; MSG ENDPCS; @@ -17,39 +22,11 @@ MSG BADWAIT; ADDR sigint; ADDR sigqit; +ADDR userpc; /* breakpoints */ BKPTR bkpthead; - -REGLIST reglist [] = { - "p1lr", P1LR, - "p1br",P1BR, - "p0lr", P0LR, - "p0br",P0BR, - "ksp",KSP, - "esp",ESP, - "ssp",SSP, - "psl", PSL, - "pc", PC, - "usp",USP, - "fp", FP, - "ap", AP, - "r11", R11, - "r10", R10, - "r9", R9, - "r8", R8, - "r7", R7, - "r6", R6, - "r5", R5, - "r4", R4, - "r3", R3, - "r2", R2, - "r1", R1, - "r0", R0, -}; - - CHAR lastc; INT fcor; @@ -74,8 +51,6 @@ getsig(sig) { return(sig); } -ADDR userpc = 1; - runpcs(runmode,execsig) { REG BKPTR bkpt; @@ -107,7 +82,7 @@ runpcs(runmode,execsig) ANDF bkpt->comm[0]!=EOR) THEN execbkpt(bkpt,execsig); execsig=0; loopcnt++; goto loop1; - ELSE bkpt->count=bkpt->initcnt; + ELSE bkpt->flag=BKPTSET; bkpt->count=bkpt->initcnt; FI ELSE execsig=signo; if (execsig) break; @@ -118,7 +93,7 @@ runpcs(runmode,execsig) #define BPOUT 0 #define BPIN 1 -INT bpstate = BPOUT; +INT bpstate; endpcs() { @@ -153,14 +128,10 @@ setup() THEN ptrace(SETTRC,0,0,0); signal(SIGINT,sigint); signal(SIGQUIT,sigqit); #ifdef VFORK - signal(SIGTRC,nullsig); + signal(SIGTRAP,nullsig); #endif if (debug) printf("About to doexec pid=%d\n",pid); -#ifdef UCBVAX doexec(); _exit(0); -#else - doexec(); exit(0); -#endif ELIF pid == -1 THEN error(NOFORK); ELSE bpwait(); readregs(); @@ -216,21 +187,15 @@ doexec() close(0); if (open(filnam,0) < 0) { printf("%s: cannot open\n",filnam); -#ifdef UCBVAX - _exit(0); -#else - exit(0); -#endif + fflush(stdout); + _exit(0); } } else { close(1); if (creat(filnam,0666) < 0) { printf("%s: cannot create\n",filnam); -#ifdef UCBVAX + fflush(stdout); _exit(0); -#else - exit(0); -#endif } } } else if (c != '\n') { @@ -334,7 +299,7 @@ bpwait() ELSE signo = stat>>8; if (debug) printf("PC = %d, dbsubn = %d\n", ptrace(RUREGS, pid, PC, 0), extaddr("_dbsubn")); - IF signo!=SIGTRC ANDF + IF signo!=SIGTRAP ANDF ptrace(RUREGS, pid, PC, 0) != extaddr("_dbsubn") THEN sigprint(); ELSE signo=0; @@ -342,6 +307,7 @@ bpwait() FI } +REGLIST reglist[]; readregs() { /*get REG values from pcs*/