Commit | Line | Data |
---|---|---|
f644bb55 DF |
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 | */ | |
a7c3e568 | 6 | |
f644bb55 DF |
7 | #ifndef lint |
8 | static char sccsid[] = "@(#)wheredump.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
a7c3e568 ML |
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 | { | |
3011a4b9 ML |
25 | FRAME *frp; |
26 | ADDRESS prevpc; | |
27 | LINENO line; | |
28 | SYM *f; | |
a7c3e568 | 29 | |
3011a4b9 ML |
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)); | |
a7c3e568 | 36 | line = srcline(prevpc); |
3011a4b9 ML |
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"); | |
a7c3e568 ML |
48 | } |
49 | ||
50 | /* | |
51 | * Dump the world to the given file. | |
52 | * Like "where", but variables are dumped also. | |
53 | */ | |
54 | ||
55 | dump() | |
56 | { | |
3011a4b9 ML |
57 | FRAME *frp; |
58 | ADDRESS prevpc; | |
59 | LINENO line; | |
60 | SYM *f; | |
a7c3e568 | 61 | |
3011a4b9 ML |
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)); | |
a7c3e568 | 68 | line = srcline(prevpc); |
3011a4b9 ML |
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); | |
a7c3e568 | 83 | } |