1*6330Swnj /* "@(#)head.h 4.2 03/27/82" */ 21334Sbill #include <sys/vm.h> 31334Sbill #define PAGSIZ (CLSIZE*NBPG) 41334Sbill #include <stdio.h> 51334Sbill #include <setjmp.h> 61334Sbill #include <sgtty.h> 71334Sbill #include "old.h" 81334Sbill #include "defs.h" 91334Sbill 101334Sbill /* input line decoding */ 111334Sbill char proc[30]; /* procedure name */ 121334Sbill int integ; /* count or number in input */ 131334Sbill char cmd; /* command letter */ 141334Sbill char re[128]; /* regular expression */ 151334Sbill char args[128]; /* arguments */ 161334Sbill char *argsp; /* pointer to args */ 171334Sbill char var[60]; /* variable name */ 181334Sbill int scallf; /* set to 1 iff procedure call */ 191334Sbill int reflag; /* set to 1 iff re */ 201334Sbill int redir; /* set to 1 iff forward search */ 211334Sbill int colonflag; /* set to 1 iff colon typed */ 221334Sbill int ncolonflag; /* set to 1 iff colon typed after number */ 231334Sbill int percentflag; /* set to 1 iff percent symbol typed */ 241334Sbill 251334Sbill /* source file i/o */ 26*6330Swnj char curfile[120]; /* name of file being edited */ 271334Sbill int fline; /* line number in file */ 281334Sbill char fbuf[BUFSIZ]; /* current line from file */ 291334Sbill char filework[128]; /* place to put filename */ 301334Sbill char *fp; /* pointer to it */ 311334Sbill int nolines; /* set to 1 iff no lines in file */ 321334Sbill #ifdef FLEXNAMES 331334Sbill off_t gstart; /* start of string table in a.out */ 341334Sbill char *strtab; /* string table from a.out * (in core!) */ 351334Sbill long ssiz; /* size of string table (for range checks) */ 361334Sbill #endif 371334Sbill 381334Sbill /* returned by slookup */ 391334Sbill #ifndef FLEXNAMES 401334Sbill char sl_name[8]; 411334Sbill #else 421334Sbill char *sl_name; 431334Sbill #endif 441334Sbill char sl_class; 451334Sbill short sl_type; 461334Sbill int sl_size, sl_addr; 471334Sbill int subflag; 481334Sbill 491334Sbill /* procedure call information */ 501334Sbill int scallx; /* procedure call in progress */ 511334Sbill ADDR fps, aps, pcs; /* old stack frame */ 521334Sbill BKPTR bkpts; /* old breakpoint */ 531334Sbill int flagss; /* and its flags */ 541334Sbill char dschar; /* '/' if value should be displayed */ 551334Sbill 561334Sbill /* symbol table info */ 571334Sbill long ststart; /* offset of symbol table in a.out */ 581334Sbill #ifndef VMUNIX 591334Sbill struct brbuf sbuf; /* buffer for symbol table */ 601334Sbill #endif 611334Sbill long extstart; /* offset of first external in a.out */ 621334Sbill 631334Sbill /* address info */ 641334Sbill ADDR dot; /* current address */ 651334Sbill ADDR callpc, frame, argp; /* current stack frame */ 661334Sbill 671334Sbill /* other */ 681334Sbill char odesc[10]; /* descriptor of last displayed variable */ 691334Sbill ADDR oaddr; /* address of last displayed variable */ 701334Sbill char otype; /* type of last displayed variable */ 711334Sbill char oclass; /* class of last displayed variable */ 721334Sbill char oincr; /* size of last displayed variable */ 731334Sbill struct sgttyb sdbttym, userttym; 741334Sbill /* tty modes for sdb and user */ 751334Sbill char oldargs[128]; 761334Sbill char prname[50]; /* print name used by outvar */ 771334Sbill jmp_buf env; /* environment for setjmp, longjmp */ 781334Sbill int debug; /* toggled by Y command */ 791334Sbill time_t symtime; /* modification time of symfil */ 801334Sbill char *symfil; 811334Sbill char *corfil; 821334Sbill ADDR exactaddr, lnfaddr; /* set by adrtolineno() */ 831334Sbill ADDR firstdata; /* lowest address of data */ 841334Sbill 851334Sbill #define STABMASK 0376 861334Sbill #define WINDOW 10 /* window size for display commands */ 871334Sbill #define COMMANDS "\004\"+-=!/BCDMQRSTXabcdegklmpqrstwxzVXY" 881334Sbill /* each sdb command must appear here */ 891334Sbill #define NUMARGS 16 /* number of args allowed in sub call */ 901334Sbill #define SUBSTSP 512 /* length of space for sub args and strings */ 911334Sbill #define WORDSIZE 4 /* wordsize in bytes on this machine */ 921334Sbill 931334Sbill #define BIGNUM 0x7fffffff 941334Sbill #define MAXADDR 1L<<30 951334Sbill 961334Sbill struct filet { 971334Sbill #ifndef FLEXNAMES 981334Sbill char sfilename[31]; /* source file name */ 991334Sbill #else 1001334Sbill char *sfilename; 1011334Sbill #endif 1021334Sbill char lineflag; /* set iff this is a '#line' file */ 1031334Sbill ADDR faddr; /* address in core */ 1041334Sbill long stf_offset; /* offset in a.out */ 1051334Sbill } *files, *badfile; 1061334Sbill 1071334Sbill struct proct { 1081334Sbill #ifndef FLEXNAMES 1091334Sbill char pname[8]; /* procedure name */ 1101334Sbill #else 1111334Sbill char *pname; 1121334Sbill #endif 1131334Sbill ADDR paddr; /* address in core */ 1141334Sbill long st_offset; /* offset in a.out */ 1151334Sbill struct filet *sfptr; /* source file name pointer */ 1161334Sbill int lineno; /* line number in source file */ 1171334Sbill char entrypt; /* 1 iff a F77 entry */ 1181334Sbill } *procs, *badproc; 1191334Sbill 1201334Sbill 1211334Sbill #define PROCINCR 20 1221334Sbill #define FILEINCR 10 1231334Sbill 1241334Sbill #define varchar(x) ((x>='A' && x<='Z') || (x>='a' && x<='z') || x == '_' || x == '.' || x == '[' || x == ']' || x == '-' || x == '>' || x == '*' || x == '?') 1251334Sbill #define number(x) (x >= '0' && x <= '9') 1261334Sbill 1271334Sbill char *readline(), readchar(), rdc(); 1281334Sbill char *cpname(); 1291334Sbill char *cpstr(), *cpall(); 1301334Sbill char *sbrk(); 1311334Sbill char *typetodesc(); 1321334Sbill int octdigit(), decdigit(); hexdigit(); 1331334Sbill int octconv(), decconv(); hexconv(); 1341334Sbill long readint(), rint(); 1351334Sbill long adrtostoffset(); 1361334Sbill long getval(), argvalue(); 1371334Sbill long slookup(), globallookup(); 1381334Sbill ADDR varaddr(), dispvar(); 1391334Sbill ADDR extaddr(), formaddr(), stackreg(); 1401334Sbill struct proct *curproc(); 1411334Sbill struct proct *findproc(); 1421334Sbill struct proct *adrtoprocp(); 1431334Sbill struct proct *initframe(), *nextframe(); 1441334Sbill struct filet *findfile(), *adrtofilep(); 145