Annotation of 43BSDReno/pgrm/pascal/pdx/process/resume.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  */
                      6: 
                      7: #ifndef lint
                      8: static char sccsid[] = "@(#)resume.c   5.3 (Berkeley) 1/9/89";
                      9: #endif not lint
                     10: 
                     11: /*
                     12:  * Resume execution, first setting appropriate registers.
                     13:  */
                     14: 
                     15: #include "defs.h"
                     16: #include <signal.h>
                     17: #include "process.h"
                     18: #include "machine.h"
                     19: #include "main.h"
                     20: #include "process.rep"
                     21: #include "runtime/frame.rep"
                     22: 
                     23: #include "machine/pxerrors.h"
                     24: #include "pxinfo.h"
                     25: 
                     26: /*
                     27:  * Resume execution, set (get) pcode location counter before (after) resuming.
                     28:  */
                     29: 
                     30: resume()
                     31: {
                     32:     register PROCESS *p;
                     33: 
                     34:     p = process;
                     35:     do {
                     36:        if (option('e')) {
                     37:            printf("execution resumes at pc 0x%x, lc %d\n", process->pc, pc);
                     38:            fflush(stdout);
                     39:        }
                     40:        pcont(p);
                     41:        dread(&pc, PCADDR, sizeof(pc));         /* Get pcode pc */
                     42:        if (option('e')) {
                     43:            printf("execution stops at pc 0x%x, lc %d on sig %d\n",
                     44:                process->pc, pc, p->signo);
                     45:            fflush(stdout);
                     46:        }
                     47:     } while (p->signo == SIGCONT);
                     48:     if (option('r') && p->signo != 0) {
                     49:        choose();
                     50:     }
                     51: 
                     52:     /*
                     53:      * If px implements a breakpoint by executing a halt instruction
                     54:      * the real pc must be incremented to skip over it.
                     55:      *
                     56:      * Currently, px sends itself a signal so no incrementing is needed.
                     57:      *
                     58:        if (isbperr()) {
                     59:            p->pc++;
                     60:        }
                     61:      */
                     62: }
                     63: 
                     64: /*
                     65:  * Under the -r option, we offer the opportunity to just get
                     66:  * the px traceback and not actually enter the debugger.
                     67:  *
                     68:  * If the standard input is not a tty but standard error is,
                     69:  * change standard input to be /dev/tty.
                     70:  */
                     71: 
                     72: LOCAL choose()
                     73: {
                     74:     register int c;
                     75: 
                     76:     if (!isterm(stdin)) {
                     77:        if (!isterm(stderr) || freopen("/dev/tty", "r", stdin) == NIL) {
                     78:            unsetsigtraces(process);
                     79:            pcont(process);
                     80:            quit(process->exitval);
                     81:            /* NOTREACHED */
                     82:        }
                     83:     }
                     84:     fprintf(stderr, "\nProgram error");
                     85:     fprintf(stderr, "\nDo you wish to enter the debugger? ");
                     86:     c = getchar();
                     87:     if (c == 'n') {
                     88:        unsetsigtraces(process);
                     89:        pcont(process);
                     90:        quit(process->exitval);
                     91:     }
                     92:     while (c != '\n' && c != EOF) {
                     93:        c = getchar();
                     94:     }
                     95:     fprintf(stderr, "\nEntering debugger ...");
                     96:     init();
                     97:     option('r') = FALSE;
                     98:     fprintf(stderr, " type 'help' for help.\n");
                     99: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.