ack/util/int/core.c

75 lines
1.7 KiB
C
Raw Permalink Normal View History

2019-03-17 14:42:00 +00:00
/** @file
1988-06-22 16:57:09 +00:00
Core dumping routines
*/
#include "logging.h"
#include "global.h"
2019-03-17 14:42:00 +00:00
#include "warn.h"
1988-06-22 16:57:09 +00:00
#include "shadow.h"
#include "fra.h"
#include <stdio.h>
2019-03-17 14:42:00 +00:00
void core_dump(void)
1988-06-22 16:57:09 +00:00
{
FILE *core_file;
2022-07-18 17:36:44 +00:00
core_file = fopen("int.core", "wb");
1988-06-22 16:57:09 +00:00
if (!core_file) {
/* no point in giving a fatal error again! */
return;
}
/******** EM Machine capacity parameters ********/
fprintf(core_file, "wsize=%ld\n", wsize);
fprintf(core_file, "psize=%ld\n", psize);
/******** EM program parameters ********/
fprintf(core_file, "ML=%lu\n", ML);
fprintf(core_file, "HB=%lu\n", HB);
fprintf(core_file, "DB=%lu\n", DB);
fprintf(core_file, "NProc=%ld\n", NProc);
/******** EM machine registers ********/
fprintf(core_file, "PI=%ld\n", PI);
fprintf(core_file, "PC=%lu\n", PC);
fprintf(core_file, "HP=%lu\n", HP);
fprintf(core_file, "SP=%lu\n", SP);
fprintf(core_file, "LB=%lu\n", LB);
fprintf(core_file, "AB=%lu\n", AB);
fprintf(core_file, "ES=%ld\n", ES);
fprintf(core_file, "ES_def=%d\n", ES_def);
fprintf(core_file, "OnTrap=%d\n", OnTrap);
fprintf(core_file, "IgnMask=%ld\n", IgnMask);
1989-04-17 10:10:59 +00:00
fprintf(core_file, "TrapPI=%ld\n", TrapPI);
1988-06-22 16:57:09 +00:00
fprintf(core_file, "FRASize=%ld\n", FRASize);
fprintf(core_file, "FRA_def=%d\n", FRA_def);
fprintf(core_file, "HL=%lu\n", HL);
fprintf(core_file, "SL=%lu\n", SL);
/******** The EM machine memory ********/
fwrite(text, 1, (int)(DB), core_file);
fwrite(data, 1, (int)(HL), core_file);
fwrite(stack, 1, (int)(ML+1-SL), core_file);
fwrite(FRA, 1, (int)(FRALimit), core_file);
#ifdef LOGGING
fwrite(FRA_sh, 1, (int)(FRALimit), core_file);
fwrite(data_sh, 1, (int)(HL), core_file);
fwrite(stack_sh, 1, (int)(ML+1-SL), core_file);
#endif /* LOGGING */
1988-06-22 16:57:09 +00:00
fclose(core_file);
core_file = 0;
}