core.c 1.7 KB

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