Annotation of 43BSDTahoe/ucb/pascal/pdx/process/step.c, revision 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[] = "@(#)step.c     5.2 (Berkeley) 4/7/87";
        !             9: #endif not lint
        !            10: /*
        !            11:  * Continue execution up to the next source line.
        !            12:  *
        !            13:  * We call "nextaddr" from the machine module to figure out
        !            14:  * what the object address is that corresponds to the next source line.
        !            15:  * If nextaddr returns -1, then the end of the program has been reached.
        !            16:  *
        !            17:  * There are two ways to define the next source line depending on what
        !            18:  * is desired when a procedure or function call is encountered.  Step
        !            19:  * stops at the beginning of the procedure or call; next skips over it.
        !            20:  */
        !            21: 
        !            22: #include "defs.h"
        !            23: #include "process.h"
        !            24: #include "machine.h"
        !            25: #include "breakpoint.h"
        !            26: #include "source.h"
        !            27: #include "mappings.h"
        !            28: #include "process.rep"
        !            29: 
        !            30: /*
        !            31:  * Stepc is what is called when the step command is given.
        !            32:  * It has to play with the "isstopped" information.
        !            33:  */
        !            34: 
        !            35: stepc()
        !            36: {
        !            37:     if (!isstopped) {
        !            38:        error("can't continue execution");
        !            39:     }
        !            40:     isstopped = FALSE;
        !            41:     dostep(FALSE);
        !            42:     isstopped = TRUE;
        !            43: }
        !            44: 
        !            45: next()
        !            46: {
        !            47:     if (!isstopped) {
        !            48:        error("can't continue execution");
        !            49:     }
        !            50:     isstopped = FALSE;
        !            51:     dostep(TRUE);
        !            52:     isstopped = TRUE;
        !            53: }
        !            54: 
        !            55: step()
        !            56: {
        !            57:     dostep(FALSE);
        !            58: }
        !            59: 
        !            60: /*
        !            61:  * Resume execution up to the given address.  It is assumed that
        !            62:  * no breakpoints exist between the current address and the one
        !            63:  * we're stepping to.  This saves us from setting all the breakpoints.
        !            64:  */
        !            65: 
        !            66: stepto(addr)
        !            67: ADDRESS addr;
        !            68: {
        !            69:     setbp(addr);
        !            70:     resume();
        !            71:     unsetbp(addr);
        !            72:     if (!isbperr()) {
        !            73:        printstatus();
        !            74:     }
        !            75: }
        !            76: 
        !            77: LOCAL dostep(isnext)
        !            78: BOOLEAN isnext;
        !            79: {
        !            80:     register ADDRESS addr;
        !            81:     register LINENO line;
        !            82: 
        !            83:     addr = pc;
        !            84:     do {
        !            85:        addr = nextaddr(addr, isnext);
        !            86:        line = linelookup(addr);
        !            87:     } while (line == 0 && !ss_instructions);
        !            88:     stepto(addr);
        !            89:     curline = line;
        !            90: }

unix.superglobalmegacorp.com

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