Annotation of 43BSDTahoe/ucb/pascal/pdx/runtime/wheredump.c, revision 1.1.1.1

1.1       root        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[] = "@(#)wheredump.c        5.1 (Berkeley) 6/6/85";
                      9: #endif not lint
                     10: 
                     11: /*
                     12:  * Print a list of currently active blocks starting with most recent.
                     13:  */
                     14: 
                     15: #include "defs.h"
                     16: #include "runtime.h"
                     17: #include "frame.rep"
                     18: #include "sym.h"
                     19: #include "machine.h"
                     20: #include "object.h"
                     21: #include "mappings.h"
                     22: 
                     23: where()
                     24: {
                     25:     FRAME *frp;
                     26:     ADDRESS prevpc;
                     27:     LINENO line;
                     28:     SYM *f;
                     29: 
                     30:     if (pc == 0) {
                     31:        error("program is not active");
                     32:     }
                     33:     prevpc = pc;
                     34:     for (frp = curframe(); frp != NIL; frp = nextframe(frp)) {
                     35:        f = whatblock(entry(frp));
                     36:        line = srcline(prevpc);
                     37:        printf("%s", name(f));
                     38:        printparams(f, frp);
                     39:        printf(", ");
                     40:        printwhere(line, srcfilename(prevpc));
                     41:        printf("\n");
                     42:        prevpc = frp->save_pc;
                     43:     }
                     44:     line = srcline(prevpc);
                     45:     printf("%s, ", name(program));
                     46:     printwhere(line, srcfilename(prevpc));
                     47:     printf("\n");
                     48: }
                     49: 
                     50: /*
                     51:  * Dump the world to the given file.
                     52:  * Like "where", but variables are dumped also.
                     53:  */
                     54: 
                     55: dump()
                     56: {
                     57:     FRAME *frp;
                     58:     ADDRESS prevpc;
                     59:     LINENO line;
                     60:     SYM *f;
                     61: 
                     62:     if (pc == 0) {
                     63:        error("program is not active");
                     64:     }
                     65:     prevpc = pc;
                     66:     for (frp = curframe(); frp != NIL; frp = nextframe(frp)) {
                     67:        f = whatblock(entry(frp));
                     68:        line = srcline(prevpc);
                     69:        printf("%s", name(f));
                     70:        printparams(f, frp);
                     71:        printf(", ");
                     72:        printwhere(line, srcfilename(prevpc));
                     73:        printf("\n");
                     74:        dumpvars(f, frp);
                     75:        putchar('\n');
                     76:        prevpc = frp->save_pc;
                     77:     }
                     78:     line = srcline(prevpc);
                     79:     printf("%s, ", name(program));
                     80:     printwhere(line, srcfilename(prevpc));
                     81:     printf("\n");
                     82:     dumpvars(program, NIL);
                     83: }

unix.superglobalmegacorp.com

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