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.1 (Berkeley) 6/6/85";
   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: #   if (isvax)
  31: #       include "machine/vaxops.h"
  32: 
  33:     LOCAL ADDRESS getcall();
  34: #   endif
  35: 
  36: /*
  37:  * Stepc is what is called when the step command is given.
  38:  * It has to play with the "isstopped" information.
  39:  */
  40: 
  41: stepc()
  42: {
  43:     if (!isstopped) {
  44:     error("can't continue execution");
  45:     }
  46:     isstopped = FALSE;
  47:     dostep(FALSE);
  48:     isstopped = TRUE;
  49: }
  50: 
  51: next()
  52: {
  53:     if (!isstopped) {
  54:     error("can't continue execution");
  55:     }
  56:     isstopped = FALSE;
  57:     dostep(TRUE);
  58:     isstopped = TRUE;
  59: }
  60: 
  61: step()
  62: {
  63:     dostep(FALSE);
  64: }
  65: 
  66: /*
  67:  * Resume execution up to the given address.  It is assumed that
  68:  * no breakpoints exist between the current address and the one
  69:  * we're stepping to.  This saves us from setting all the breakpoints.
  70:  */
  71: 
  72: stepto(addr)
  73: ADDRESS addr;
  74: {
  75:     setbp(addr);
  76:     resume();
  77:     unsetbp(addr);
  78:     if (!isbperr()) {
  79:     printstatus();
  80:     }
  81: }
  82: 
  83: LOCAL dostep(isnext)
  84: BOOLEAN isnext;
  85: {
  86:     register ADDRESS addr;
  87:     register LINENO line;
  88:     char *filename;
  89: 
  90:     addr = pc;
  91:     do {
  92: #       if (isvaxpx)
  93:         addr = nextaddr(addr, isnext);
  94: #       else
  95:         if (isnext && (addr = getcall(addr)) != 0) {
  96:         stepto(addr);
  97:         } else {
  98:         pstep(process);
  99:         addr = process->pc;
 100:         pc = process->pc;
 101:         errnum = process->signo;
 102:         if (!isbperr()) {
 103:             printstatus();
 104:         }
 105:         }
 106: #       endif
 107:     line = linelookup(addr);
 108:     } while (line == 0 && !ss_instructions);
 109:     stepto(addr);
 110:     curline = line;
 111: }
 112: 
 113: # if (isvax)
 114: 
 115: /*
 116:  * If the current address contains a call instruction, return the
 117:  * address of the instruction where control will return.
 118:  *
 119:  * This function is intentionally dependent on a particular type
 120:  * of calling sequence.
 121:  */
 122: 
 123: LOCAL ADDRESS getcall(addr)
 124: ADDRESS addr;
 125: {
 126:     VAXOP op;
 127: 
 128:     iread(&op, addr, sizeof(addr));
 129:     if (op == O_CALLS) {
 130:     return(addr + 7);
 131:     } else {
 132:     return(0);
 133:     }
 134: }
 135: 
 136: # endif

Defined functions

dostep defined in line 83; used 3 times
getcall defined in line 123; used 2 times
next defined in line 51; never used
step defined in line 61; used 2 times
stepc defined in line 41; never used
stepto defined in line 72; used 2 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-06-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1132
Valid CSS Valid XHTML 1.0 Strict