Pristine Ack-5.5
[Ack-5.5.git] / util / int / core.c
1 /*
2         Core dumping routines
3 */
4
5 /* $Id: core.c,v 2.4 1994/06/24 10:45:44 ceriel Exp $ */
6
7 #include        "logging.h"
8 #include        "global.h"
9 #include        "shadow.h"
10 #include        "fra.h"
11
12 #include        <stdio.h>
13
14 core_dump()
15 {
16         FILE *core_file;
17         
18         core_file = fopen("int.core", "w");
19         if (!core_file) {
20                 /* no point in giving a fatal error again! */
21                 return;
22         }
23
24 /******** EM Machine capacity parameters ********/
25
26         fprintf(core_file, "wsize=%ld\n", wsize);
27         fprintf(core_file, "psize=%ld\n", psize);
28
29 /******** EM program parameters ********/
30
31         fprintf(core_file, "ML=%lu\n", ML);
32         fprintf(core_file, "HB=%lu\n", HB);
33         fprintf(core_file, "DB=%lu\n", DB);
34         fprintf(core_file, "NProc=%ld\n", NProc);
35
36 /******** EM machine registers ********/
37
38         fprintf(core_file, "PI=%ld\n", PI);
39         fprintf(core_file, "PC=%lu\n", PC);
40
41         fprintf(core_file, "HP=%lu\n", HP);
42         fprintf(core_file, "SP=%lu\n", SP);
43         fprintf(core_file, "LB=%lu\n", LB);
44         fprintf(core_file, "AB=%lu\n", AB);
45
46         fprintf(core_file, "ES=%ld\n", ES);
47         fprintf(core_file, "ES_def=%d\n", ES_def);
48
49         fprintf(core_file, "OnTrap=%d\n", OnTrap);
50         fprintf(core_file, "IgnMask=%ld\n", IgnMask);
51         fprintf(core_file, "TrapPI=%ld\n", TrapPI);
52
53         fprintf(core_file, "FRASize=%ld\n", FRASize);
54         fprintf(core_file, "FRA_def=%d\n", FRA_def);
55
56         fprintf(core_file, "HL=%lu\n", HL);
57         fprintf(core_file, "SL=%lu\n", SL);
58
59 /******** The EM machine memory ********/
60
61         fwrite(text, 1, (int)(DB), core_file);
62         fwrite(data, 1, (int)(HL), core_file);
63         fwrite(stack, 1, (int)(ML+1-SL), core_file);
64         fwrite(FRA, 1, (int)(FRALimit), core_file);
65
66 #ifdef  LOGGING
67         fwrite(FRA_sh, 1, (int)(FRALimit), core_file);
68         fwrite(data_sh, 1, (int)(HL), core_file);
69         fwrite(stack_sh, 1, (int)(ML+1-SL), core_file);
70 #endif  /* LOGGING */
71         
72         fclose(core_file);
73         core_file = 0;
74 }
75