1 /* Copyright (c) 1982 Regents of the University of California */ 2 3 static char sccsid[] = "@(#)wheredump.c 1.1 01/18/82"; 4 5 /* 6 * Print a list of currently active blocks starting with most recent. 7 */ 8 9 #include "defs.h" 10 #include "runtime.h" 11 #include "frame.rep" 12 #include "sym.h" 13 #include "machine.h" 14 #include "object.h" 15 #include "mappings.h" 16 17 where() 18 { 19 FRAME *frp; 20 ADDRESS prevpc; 21 LINENO line; 22 SYM *f; 23 24 if (pc == 0) { 25 error("program is not active"); 26 } 27 prevpc = pc; 28 for (frp = curframe(); frp != NIL; frp = nextframe(frp)) { 29 f = whatblock(entry(frp)); 30 line = srcline(prevpc); 31 printf("%s", name(f)); 32 printparams(f, frp); 33 printf(", line %d\n", line); 34 prevpc = frp->save_pc; 35 } 36 line = srcline(prevpc); 37 printf("%s, line %d\n", name(program), line); 38 } 39 40 /* 41 * Dump the world to the given file. 42 * Like "where", but variables are dumped also. 43 */ 44 45 dump() 46 { 47 FRAME *frp; 48 ADDRESS prevpc; 49 LINENO line; 50 SYM *f; 51 52 if (pc == 0) { 53 error("program is not active"); 54 } 55 prevpc = pc; 56 for (frp = curframe(); frp != NIL; frp = nextframe(frp)) { 57 f = whatblock(entry(frp)); 58 line = srcline(prevpc); 59 prevpc = frp->save_pc; 60 printf("%s", name(f)); 61 printparams(f, frp); 62 printf(", line %d\n", line); 63 dumpvars(f, frp); 64 putchar('\n'); 65 } 66 line = srcline(prevpc); 67 printf("%s, line %d\n", name(program), line); 68 dumpvars(program, NIL); 69 } 70