new copyright; att/bsd/shared
[unix-history] / usr / src / usr.bin / pascal / pdx / runtime / wheredump.c
CommitLineData
505bf312
KB
1/*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
f644bb55 6 */
a7c3e568 7
f644bb55 8#ifndef lint
505bf312
KB
9static char sccsid[] = "@(#)wheredump.c 5.2 (Berkeley) %G%";
10#endif /* not lint */
a7c3e568
ML
11
12/*
13 * Print a list of currently active blocks starting with most recent.
14 */
15
16#include "defs.h"
17#include "runtime.h"
18#include "frame.rep"
19#include "sym.h"
20#include "machine.h"
21#include "object.h"
22#include "mappings.h"
23
24where()
25{
3011a4b9
ML
26 FRAME *frp;
27 ADDRESS prevpc;
28 LINENO line;
29 SYM *f;
a7c3e568 30
3011a4b9
ML
31 if (pc == 0) {
32 error("program is not active");
33 }
34 prevpc = pc;
35 for (frp = curframe(); frp != NIL; frp = nextframe(frp)) {
36 f = whatblock(entry(frp));
a7c3e568 37 line = srcline(prevpc);
3011a4b9
ML
38 printf("%s", name(f));
39 printparams(f, frp);
40 printf(", ");
41 printwhere(line, srcfilename(prevpc));
42 printf("\n");
43 prevpc = frp->save_pc;
44 }
45 line = srcline(prevpc);
46 printf("%s, ", name(program));
47 printwhere(line, srcfilename(prevpc));
48 printf("\n");
a7c3e568
ML
49}
50
51/*
52 * Dump the world to the given file.
53 * Like "where", but variables are dumped also.
54 */
55
56dump()
57{
3011a4b9
ML
58 FRAME *frp;
59 ADDRESS prevpc;
60 LINENO line;
61 SYM *f;
a7c3e568 62
3011a4b9
ML
63 if (pc == 0) {
64 error("program is not active");
65 }
66 prevpc = pc;
67 for (frp = curframe(); frp != NIL; frp = nextframe(frp)) {
68 f = whatblock(entry(frp));
a7c3e568 69 line = srcline(prevpc);
3011a4b9
ML
70 printf("%s", name(f));
71 printparams(f, frp);
72 printf(", ");
73 printwhere(line, srcfilename(prevpc));
74 printf("\n");
75 dumpvars(f, frp);
76 putchar('\n');
77 prevpc = frp->save_pc;
78 }
79 line = srcline(prevpc);
80 printf("%s, ", name(program));
81 printwhere(line, srcfilename(prevpc));
82 printf("\n");
83 dumpvars(program, NIL);
a7c3e568 84}