1: # 2: /* 3: * 4: * UNIX debugger - common definitions 5: * 6: */ 7: 8: 9: 10: /* Layout of a.out file (fsym): 11: * 12: * header of 8 words magic number 405, 407, 410, 411, 430, 431 13: * text size ) 14: * data size ) in bytes but even 15: * bss size ) 16: * symbol table size 17: * entry point 18: * {unused} 19: * flag set if no relocation 20: * overlay header (if type 430, 431), 21: * 8 words long: maximum overlay segement size ) 22: * overlay 1 size ) 23: * overlay 2 size ) 24: * overlay 3 size ) 25: * overlay 4 size ) size 26: * overlay 5 size ) in 27: * overlay 6 size ) even 28: * overlay 7 size ) bytes 29: * 30: * header: 0 31: * text: 16 (32 if type 430,431) 32: * overlays (if 430, 431 only): 33: * 32+textsize 34: * overlaysize: ov1+ov2+...+ov7 35: * data: 16+textsize (+overlaysize+16 if type 431, 431) 36: * relocation: 16+textsize+datasize (should not be present in 430,431) 37: * symbol table: 16+2*(textsize+datasize) or 16+textsize+datasize 38: * (if 430, 431): 32+(textsize+overlaysize+datasize) 39: * 40: */ 41: 42: 43: #include <whoami.h> 44: #include <sys/param.h> 45: #include <sys/dir.h> 46: #include <sys/user.h> 47: #include <sgtty.h> 48: #include "mac.h" 49: #include "mode.h" 50: 51: 52: /* 53: * Internal variables --- 54: * They are addressed by name. (e.g. (`0'-`9', `a'-`b')) 55: * thus there can only be 36 of them. 56: */ 57: 58: #define VARB 11 59: #define VARC 12 /* current overlay number */ 60: #define VARD 13 61: #define VARE 14 62: #define VARM 22 63: #define VARO 24 /* overlay text segment addition */ 64: #define VARS 28 65: #define VART 29 66: 67: 68: #define RD 0 69: #define WT 1 70: #define NSP 0 71: #define ISP 1 72: #define DSP 2 73: #define STAR 4 74: #define STARCOM 0200 75: #define DSYM 7 76: #define ISYM 2 77: #define ASYM 1 78: #define NSYM 0 79: #define ESYM 0177 80: #define BKPTSET 1 81: #define BKPTEXEC 2 82: #define SYMSIZ 100 83: #define MAXSIG 20 84: 85: #define BPT 03 86: #define FD 0200 87: #define SETTRC 0 88: #define RDUSER 2 89: #define RIUSER 1 90: #define WDUSER 5 91: #define WIUSER 4 92: #define RUREGS 3 93: #define WUREGS 6 94: #define CONTIN 7 95: #define SINGLE 9 96: #define EXIT 8 97: 98: #ifndef NONFP 99: #define FROFF (&(0->u_fpsr)) 100: #define FRLEN 25 101: #define FRMAX 6 102: #endif 103: 104: #include <sys/reg.h> 105: #define NOREG 32767 /* impossible return from getreg() */ 106: #define NREG 9 /* 8 regs + PS from kernel stack */ 107: /* 108: * UAR0 is the value used for subprocesses when there is no core file. 109: * If it doesn't correspond to reality, use pstat -u on a core file to get uar0, 110: * subtract 0140000, and divide by 2 (sizeof int). 111: */ 112: #define UAR0 (&corhdr[509]) /* default address of r0 (u.u_ar0) */ 113: 114: #define KR0 2 /* location of r0 in kernel dump */ 115: #define KR1 3 116: #define KR2 4 117: #define KR3 5 118: #define KR4 6 119: #define KR5 7 120: #define KSP 8 121: #define KA6 9 /* saved ka6 in kernel dump */ 122: 123: #define MAXOFF 255 124: #define MAXPOS 80 125: #define MAXLIN 128 126: #define EOF 0 127: #define EOR '\n' 128: #define TB '\t' 129: #define QUOTE 0200 130: #define STRIP 0177 131: #define LOBYTE 0377 132: #define EVEN -2 133: 134: 135: /* long to ints and back (puns) */ 136: union { 137: INT I[2]; 138: L_INT L; 139: } itolws; 140: 141: #define leng(a) ((long)((unsigned)(a))) 142: #define shorten(a) ((int)(a)) 143: #define itol(a,b) (itolws.I[0]=(a), itolws.I[1]=(b), itolws.L) 144: 145: 146: 147: /* result type declarations */ 148: L_INT inkdot(); 149: SYMPTR lookupsym(); 150: SYMPTR symget(); 151: POS get(); 152: POS chkget(); 153: STRING exform(); 154: L_INT round(); 155: BKPTR scanbkpt(); 156: VOID fault(); 157: 158: typedef struct sgttyb TTY; 159: TTY adbtty, usrtty; 160: #include <setjmp.h> 161: jmp_buf erradb;