Annotation of 42BSD/ucb/pascal/pdx/runtime/wheredump.c, revision 1.1.1.1

1.1       root        1: /* Copyright (c) 1982 Regents of the University of California */
                      2: 
                      3: static char sccsid[] = "@(#)wheredump.c 1.2 2/11/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(", ");
                     34:        printwhere(line, srcfilename(prevpc));
                     35:        printf("\n");
                     36:        prevpc = frp->save_pc;
                     37:     }
                     38:     line = srcline(prevpc);
                     39:     printf("%s, ", name(program));
                     40:     printwhere(line, srcfilename(prevpc));
                     41:     printf("\n");
                     42: }
                     43: 
                     44: /*
                     45:  * Dump the world to the given file.
                     46:  * Like "where", but variables are dumped also.
                     47:  */
                     48: 
                     49: dump()
                     50: {
                     51:     FRAME *frp;
                     52:     ADDRESS prevpc;
                     53:     LINENO line;
                     54:     SYM *f;
                     55: 
                     56:     if (pc == 0) {
                     57:        error("program is not active");
                     58:     }
                     59:     prevpc = pc;
                     60:     for (frp = curframe(); frp != NIL; frp = nextframe(frp)) {
                     61:        f = whatblock(entry(frp));
                     62:        line = srcline(prevpc);
                     63:        printf("%s", name(f));
                     64:        printparams(f, frp);
                     65:        printf(", ");
                     66:        printwhere(line, srcfilename(prevpc));
                     67:        printf("\n");
                     68:        dumpvars(f, frp);
                     69:        putchar('\n');
                     70:        prevpc = frp->save_pc;
                     71:     }
                     72:     line = srcline(prevpc);
                     73:     printf("%s, ", name(program));
                     74:     printwhere(line, srcfilename(prevpc));
                     75:     printf("\n");
                     76:     dumpvars(program, NIL);
                     77: }

unix.superglobalmegacorp.com

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