Changeset 11623


Ignore:
Timestamp:
Jan 17, 2009, 10:06:12 AM (11 years ago)
Author:
gb
Message:

Write debugging/diagnostic output to the FILE* "dbgout", which is
initialized to stderr.

Add a function that re-opens "dbgout" on a specified fd, add
that function to the imports table. (This is intended to allow I/O
redirection mechanisms - like AltConsole? in the IDE - to persuade
the kernel to do output to a specified FILE*/fd without having
that mechanism capture random diagnostic output to stderr, which
would still go to syslog.)

Lisp code needs to update the import table definitions and the
IDE startup code has to use the new 'open_debug_output()' mechanism.

Location:
trunk/source/lisp-kernel
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/gc-common.c

    r11166 r11623  
    10881088    comma_output_decimal(buf,16,area_dnode(oldfree,a->low) << dnode_shift);
    10891089    if (GCephemeral_low) {
    1090       fprintf(stderr,
     1090      fprintf(dbgout,
    10911091              "\n\n;;; Starting Ephemeral GC of generation %d",
    10921092              (from == g2_area) ? 2 : (from == g1_area) ? 1 : 0);
    10931093    } else {
    1094       fprintf(stderr,"\n\n;;; Starting full GC");
    1095     }
    1096     fprintf(stderr, ", %s bytes allocated.\n", buf);
     1094      fprintf(dbgout,"\n\n;;; Starting full GC");
     1095    }
     1096    fprintf(dbgout, ", %s bytes allocated.\n", buf);
    10971097  }
    10981098
     
    13971397        comma_output_decimal(buf,16,justfreed);
    13981398        if (note == tenured_area) {
    1399           fprintf(stderr,";;; Finished full GC. %s bytes freed in %d.%06d s\n\n", buf, elapsed.tv_sec, elapsed.tv_usec);
     1399          fprintf(dbgout,";;; Finished full GC. %s bytes freed in %d.%06d s\n\n", buf, elapsed.tv_sec, elapsed.tv_usec);
    14001400        } else {
    1401           fprintf(stderr,";;; Finished EGC of generation %d. %s bytes freed in %d.%06d s\n\n",
     1401          fprintf(dbgout,";;; Finished EGC of generation %d. %s bytes freed in %d.%06d s\n\n",
    14021402                  (from == g2_area) ? 2 : (from == g1_area) ? 1 : 0,
    14031403                  buf,
    14041404                  elapsed.tv_sec, elapsed.tv_usec);
    14051405        }
    1406         report_paging_info_delta(stderr, &paging_info_start, &paging_info_stop);
    1407       }
    1408     }
    1409   }
    1410 }
     1406        report_paging_info_delta(dbgout, &paging_info_start, &paging_info_stop);
     1407      }
     1408    }
     1409  }
     1410}
  • trunk/source/lisp-kernel/image.c

    r11551 r11623  
    154154  version = (header->abi_version) & 0xffff;
    155155  if (version < ABI_VERSION_MIN) {
    156     fprintf(stderr, "Heap image is too old for this kernel.\n");
     156    fprintf(dbgout, "Heap image is too old for this kernel.\n");
    157157    return false;
    158158  }
    159159  if (version > ABI_VERSION_MAX) {
    160     fprintf(stderr, "Heap image is too new for this kernel.\n");
     160    fprintf(dbgout, "Heap image is too new for this kernel.\n");
    161161    return false;
    162162  }
    163163  flags = header->flags;
    164164  if (flags != PLATFORM) {
    165     fprintf(stderr, "Heap image was saved for another platform.\n");
     165    fprintf(dbgout, "Heap image was saved for another platform.\n");
    166166    return false;
    167167  }
  • trunk/source/lisp-kernel/imports.s

    r11380 r11623  
    5151        defimport(allocate_vstack_holding_area_lock)
    5252        defimport(register_cstack_holding_area_lock)
    53         defimport(raise_thread_interrupt)
     53        defimport(open_debug_output)
    5454        defimport(get_r_debug)
    5555        defimport(restore_soft_stack_limit)
  • trunk/source/lisp-kernel/lisp-debug.c

    r11617 r11623  
    3434#include <sys/stat.h>
    3535
     36FILE *dbgout = stderr;
    3637
    3738typedef enum {
     
    4243} debug_command_return;
    4344
     45
     46Boolean
     47open_debug_output(int fd)
     48{
     49  FILE *f = fdopen(fd, "w");
     50 
     51  if (f) {
     52    if (setvbuf(f, NULL, _IONBF, 0) == 0) {
     53      dbgout = f;
     54      return true;
     55    }
     56    fclose(f);
     57  }
     58  return false;
     59}
    4460
    4561
     
    222238
    223239#ifdef PPC
    224   fprintf(stderr, "r%02d (%s) = %s\n", r, label, print_lisp_object(val));
     240  fprintf(dbgout, "r%02d (%s) = %s\n", r, label, print_lisp_object(val));
    225241#endif
    226242#ifdef X8664
    227   fprintf(stderr, "%%%s (%s) = %s\n",Iregnames[r], label, print_lisp_object(val));
     243  fprintf(dbgout, "%%%s (%s) = %s\n",Iregnames[r], label, print_lisp_object(val));
    228244#endif
    229245#ifdef X8632
     
    239255      s = print_lisp_object(val);
    240256
    241     fprintf(stderr, "%%%s (%s) = %s\n", Iregnames[r], label, s);
     257    fprintf(dbgout, "%%%s (%s) = %s\n", Iregnames[r], label, s);
    242258  }
    243259#endif
     
    253269  natural dsisr = xpDSISR(xp);
    254270
    255   fprintf(stderr, "%s operation to %s address 0x%lx\n",
     271  fprintf(dbgout, "%s operation to %s address 0x%lx\n",
    256272          dsisr & (1<<25) ? "Write" : "Read",
    257273          dsisr & (1<<27) ? "protected" : "unmapped",
     
    277293      switch (errnum) {
    278294      case error_udf_call:
    279         fprintf(stderr, "ERROR: undefined function call: %s\n",
     295        fprintf(dbgout, "ERROR: undefined function call: %s\n",
    280296                print_lisp_object(xpGPR(xp,fname)));
    281297        described = true;
     
    283299       
    284300      default:
    285         fprintf(stderr, "ERROR: lisp error %d\n", errnum);
     301        fprintf(dbgout, "ERROR: lisp error %d\n", errnum);
    286302        described = true;
    287303        break;
     
    294310  }
    295311  if (!described) {
    296     fprintf(stderr, "Illegal instruction (0x%08x) at 0x%lx\n",
     312    fprintf(dbgout, "Illegal instruction (0x%08x) at 0x%lx\n",
    297313            the_uuo, where);
    298314  }
     
    319335      case TO_NE:
    320336        if (xpGPR(xp, nargs) < D_field(the_trap)) {
    321           fprintf(stderr, "Too few arguments (no opt/rest)\n");
     337          fprintf(dbgout, "Too few arguments (no opt/rest)\n");
    322338        } else {
    323           fprintf(stderr, "Too many arguments (no opt/rest)\n");
     339          fprintf(dbgout, "Too many arguments (no opt/rest)\n");
    324340        }
    325341        identified = true;
     
    327343       
    328344      case TO_GT:
    329         fprintf(stderr, "Event poll !\n");
     345        fprintf(dbgout, "Event poll !\n");
    330346        identified = true;
    331347        break;
    332348       
    333349      case TO_HI:
    334         fprintf(stderr, "Too many arguments (with opt)\n");
     350        fprintf(dbgout, "Too many arguments (with opt)\n");
    335351        identified = true;
    336352        break;
    337353       
    338354      case TO_LT:
    339         fprintf(stderr, "Too few arguments (with opt/rest/key)\n");
     355        fprintf(dbgout, "Too few arguments (with opt/rest/key)\n");
    340356        identified = true;
    341357        break;
     
    372388            ra = RA_field(instr);
    373389            if (lisp_reg_p(ra)) {
    374               fprintf(stderr, "Unbound variable: %s\n",
     390              fprintf(dbgout, "Unbound variable: %s\n",
    375391                      print_lisp_object(xpGPR(xp,ra)));
    376392              identified = true;       
     
    400416            ra = RA_field(instr);
    401417            if (lisp_reg_p(ra)) {
    402               fprintf(stderr, "value 0x%lX is not of the expected header type 0x%02X\n", xpGPR(xp, ra), err_arg2);
     418              fprintf(dbgout, "value 0x%lX is not of the expected header type 0x%02X\n", xpGPR(xp, ra), err_arg2);
    403419              identified = true;
    404420            }
     
    412428            rs = RS_field(instr);
    413429            if (lisp_reg_p(rs)) {
    414               fprintf(stderr, "value 0x%lX is not of the expected type 0x%02X\n",
     430              fprintf(dbgout, "value 0x%lX is not of the expected type 0x%02X\n",
    415431                      xpGPR(xp, rs), err_arg2);
    416432              identified = true;
     
    431447    case TO_LO:
    432448      if (RA_field(the_trap) == sp) {
    433         fprintf(stderr, "Stack overflow! Run away! Run away!\n");
     449        fprintf(dbgout, "Stack overflow! Run away! Run away!\n");
    434450        identified = true;
    435451      }
     
    443459        ra = RA_field(instr);
    444460        if (lisp_reg_p(ra)) {
    445           fprintf(stderr, "Bad index %d for vector %lX length %d\n",
     461          fprintf(dbgout, "Bad index %d for vector %lX length %d\n",
    446462                  unbox_fixnum(xpGPR(xp, RA_field(the_trap))),
    447463                  xpGPR(xp, ra),
     
    455471
    456472  if (!identified) {
    457     fprintf(stderr, "Unknown trap: 0x%08x\n", the_trap);
     473    fprintf(dbgout, "Unknown trap: 0x%08x\n", the_trap);
    458474  }
    459475
     
    469485    TCR *xpcontext = (TCR *)ptr_from_lispobj(xpGPR(xp, rcontext));
    470486
    471     fprintf(stderr, "rcontext = 0x%lX ", xpcontext);
     487    fprintf(dbgout, "rcontext = 0x%lX ", xpcontext);
    472488    if (!active_tcr_p(xpcontext)) {
    473       fprintf(stderr, "(INVALID)\n");
     489      fprintf(dbgout, "(INVALID)\n");
    474490    } else {
    475       fprintf(stderr, "\nnargs = %d\n", xpGPR(xp, nargs) >> fixnumshift);
     491      fprintf(dbgout, "\nnargs = %d\n", xpGPR(xp, nargs) >> fixnumshift);
    476492      show_lisp_register(xp, "fn", fn);
    477493      show_lisp_register(xp, "arg_z", arg_z);
     
    498514    show_lisp_register(xp, "arg_y", Iarg_y);
    499515    show_lisp_register(xp, "arg_x", Iarg_x);
    500     fprintf(stderr,"------\n");
     516    fprintf(dbgout,"------\n");
    501517    show_lisp_register(xp, "fn", Ifn);
    502     fprintf(stderr,"------\n");
     518    fprintf(dbgout,"------\n");
    503519    show_lisp_register(xp, "save0", Isave0);
    504520    show_lisp_register(xp, "save1", Isave1);
    505521    show_lisp_register(xp, "save2", Isave2);
    506522    show_lisp_register(xp, "save3", Isave3);
    507     fprintf(stderr,"------\n");
     523    fprintf(dbgout,"------\n");
    508524    show_lisp_register(xp, "temp0", Itemp0);
    509525    show_lisp_register(xp, "temp1", Itemp1);
    510526    show_lisp_register(xp, "temp2", Itemp2);
    511     fprintf(stderr,"------\n");
     527    fprintf(dbgout,"------\n");
    512528    if (tag_of(xpGPR(xp,Inargs)) == tag_fixnum) {
    513       fprintf(stderr,"%%rcx (nargs) = %ld (maybe)\n", unbox_fixnum(xpGPR(xp,Inargs)&0xffff));
     529      fprintf(dbgout,"%%rcx (nargs) = %ld (maybe)\n", unbox_fixnum(xpGPR(xp,Inargs)&0xffff));
    514530    }
    515531#endif
     
    519535  show_lisp_register(xp, "arg_z", Iarg_z);
    520536  show_lisp_register(xp, "arg_y", Iarg_y);
    521   fprintf(stderr,"------\n");
     537  fprintf(dbgout,"------\n");
    522538  show_lisp_register(xp, "fn", Ifn);
    523   fprintf(stderr,"------\n");
     539  fprintf(dbgout,"------\n");
    524540  show_lisp_register(xp, "temp0", Itemp0);
    525541  show_lisp_register(xp, "temp1", Itemp1);
    526   fprintf(stderr,"------\n");
     542  fprintf(dbgout,"------\n");
    527543  if (tag_of(xpGPR(xp,Inargs)) == tag_fixnum) {
    528     fprintf(stderr,"%%edx (nargs) = %d (maybe)\n", unbox_fixnum(xpGPR(xp,Inargs)));
     544    fprintf(dbgout,"%%edx (nargs) = %d (maybe)\n", unbox_fixnum(xpGPR(xp,Inargs)));
    529545  }
    530546#endif
     
    579595  do {
    580596    fpurge(stdin);
    581     fprintf(stderr, "\n %s :",prompt);
     597    fprintf(dbgout, "\n %s :",prompt);
    582598    buf[0] = 0;
    583599    res = fgets(buf, sizeof(buf), stdin);
     
    600616  do {
    601617    fpurge(stdin);
    602     fprintf(stderr, "\n  %s :", prompt);
     618    fprintf(dbgout, "\n  %s :", prompt);
    603619    s[0]=0;
    604620    res = fgets(s, 24, stdin);
     
    617633  do {
    618634    fpurge(stdin);
    619     fprintf(stderr, "\n  %s :", prompt);
     635    fprintf(dbgout, "\n  %s :", prompt);
    620636    res = fgets(s, 24, stdin);
    621637    n = sscanf(res, "%i", &val);
     
    644660    area *vs_area = tcr->vs_area, *cs_area = tcr->cs_area;
    645661
    646     fprintf(stderr, "Current Thread Context Record (tcr) = 0x" LISP "\n", tcr);
    647     fprintf(stderr, "Control (C) stack area:  low = 0x" LISP ", high = 0x" LISP "\n",
     662    fprintf(dbgout, "Current Thread Context Record (tcr) = 0x" LISP "\n", tcr);
     663    fprintf(dbgout, "Control (C) stack area:  low = 0x" LISP ", high = 0x" LISP "\n",
    648664            (cs_area->low), (cs_area->high));
    649     fprintf(stderr, "Value (lisp) stack area: low = 0x" LISP ", high = 0x" LISP "\n",
     665    fprintf(dbgout, "Value (lisp) stack area: low = 0x" LISP ", high = 0x" LISP "\n",
    650666            (u64_t)(natural)(vs_area->low), (u64_t)(natural)vs_area->high);
    651     fprintf(stderr, "Exception stack pointer = 0x" LISP "\n",
     667    fprintf(dbgout, "Exception stack pointer = 0x" LISP "\n",
    652668#ifdef PPC
    653669            (u64_t) (natural)(xpGPR(xp,1))
     
    682698  int a, b;
    683699  for (a = 0, b = 16; a < 16; a++, b++) {
    684     fprintf(stderr,"r%02d = 0x%016lX    r%02d = 0x%016lX\n",
     700    fprintf(dbgout,"r%02d = 0x%016lX    r%02d = 0x%016lX\n",
    685701            a, xpGPR(xp, a),
    686702            b, xpGPR(xp, b));
    687703  }
    688704 
    689   fprintf(stderr, "\n PC = 0x%016lX     LR = 0x%016lX\n",
     705  fprintf(dbgout, "\n PC = 0x%016lX     LR = 0x%016lX\n",
    690706          xpPC(xp), xpLR(xp));
    691   fprintf(stderr, "CTR = 0x%016lX    CCR = 0x%08X\n",
     707  fprintf(dbgout, "CTR = 0x%016lX    CCR = 0x%08X\n",
    692708          xpCTR(xp), xpCCR(xp));
    693   fprintf(stderr, "XER = 0x%08X            MSR = 0x%016lX\n",
     709  fprintf(dbgout, "XER = 0x%08X            MSR = 0x%016lX\n",
    694710          xpXER(xp), xpMSR(xp));
    695   fprintf(stderr,"DAR = 0x%016lX  DSISR = 0x%08X\n",
     711  fprintf(dbgout,"DAR = 0x%016lX  DSISR = 0x%08X\n",
    696712          xpDAR(xp), xpDSISR(xp));
    697713#else
    698714  int a, b, c, d;;
    699715  for (a = 0, b = 8, c = 16, d = 24; a < 8; a++, b++, c++, d++) {
    700     fprintf(stderr,"r%02d = 0x%08X  r%02d = 0x%08X  r%02d = 0x%08X  r%02d = 0x%08X\n",
     716    fprintf(dbgout,"r%02d = 0x%08X  r%02d = 0x%08X  r%02d = 0x%08X  r%02d = 0x%08X\n",
    701717            a, xpGPR(xp, a),
    702718            b, xpGPR(xp, b),
     
    704720            d, xpGPR(xp, d));
    705721  }
    706   fprintf(stderr, "\n PC = 0x%08X   LR = 0x%08X  CTR = 0x%08X  CCR = 0x%08X\n",
     722  fprintf(dbgout, "\n PC = 0x%08X   LR = 0x%08X  CTR = 0x%08X  CCR = 0x%08X\n",
    707723          xpPC(xp), xpLR(xp), xpCTR(xp), xpCCR(xp));
    708   fprintf(stderr, "XER = 0x%08X  MSR = 0x%08X  DAR = 0x%08X  DSISR = 0x%08X\n",
     724  fprintf(dbgout, "XER = 0x%08X  MSR = 0x%08X  DAR = 0x%08X  DSISR = 0x%08X\n",
    709725          xpXER(xp), xpMSR(xp), xpDAR(xp), xpDSISR(xp));
    710726#endif
     
    712728
    713729#ifdef X8664
    714   fprintf(stderr,"%%rax = 0x" ZLISP "      %%r8  = 0x" ZLISP "\n", xpGPR(xp,REG_RAX),xpGPR(xp,REG_R8));
    715   fprintf(stderr,"%%rcx = 0x" ZLISP "      %%r9  = 0x" ZLISP "\n", xpGPR(xp,REG_RCX),xpGPR(xp,REG_R9));
    716   fprintf(stderr,"%%rdx = 0x" ZLISP "      %%r10 = 0x" ZLISP "\n", xpGPR(xp,REG_RDX),xpGPR(xp,REG_R10));
    717   fprintf(stderr,"%%rbx = 0x" ZLISP "      %%r11 = 0x" ZLISP "\n", xpGPR(xp,REG_RBX),xpGPR(xp,REG_R11));
    718   fprintf(stderr,"%%rsp = 0x" ZLISP "      %%r12 = 0x" ZLISP "\n", xpGPR(xp,REG_RSP),xpGPR(xp,REG_R12));
    719   fprintf(stderr,"%%rbp = 0x" ZLISP "      %%r13 = 0x" ZLISP "\n", xpGPR(xp,REG_RBP),xpGPR(xp,REG_R13));
    720   fprintf(stderr,"%%rsi = 0x" ZLISP "      %%r14 = 0x" ZLISP "\n", xpGPR(xp,REG_RSI),xpGPR(xp,REG_R14));
    721   fprintf(stderr,"%%rdi = 0x" ZLISP "      %%r15 = 0x" ZLISP "\n", xpGPR(xp,REG_RDI),xpGPR(xp,REG_R15));
    722   fprintf(stderr,"%%rip = 0x" ZLISP "   %%rflags = 0x%08lx\n",
     730  fprintf(dbgout,"%%rax = 0x" ZLISP "      %%r8  = 0x" ZLISP "\n", xpGPR(xp,REG_RAX),xpGPR(xp,REG_R8));
     731  fprintf(dbgout,"%%rcx = 0x" ZLISP "      %%r9  = 0x" ZLISP "\n", xpGPR(xp,REG_RCX),xpGPR(xp,REG_R9));
     732  fprintf(dbgout,"%%rdx = 0x" ZLISP "      %%r10 = 0x" ZLISP "\n", xpGPR(xp,REG_RDX),xpGPR(xp,REG_R10));
     733  fprintf(dbgout,"%%rbx = 0x" ZLISP "      %%r11 = 0x" ZLISP "\n", xpGPR(xp,REG_RBX),xpGPR(xp,REG_R11));
     734  fprintf(dbgout,"%%rsp = 0x" ZLISP "      %%r12 = 0x" ZLISP "\n", xpGPR(xp,REG_RSP),xpGPR(xp,REG_R12));
     735  fprintf(dbgout,"%%rbp = 0x" ZLISP "      %%r13 = 0x" ZLISP "\n", xpGPR(xp,REG_RBP),xpGPR(xp,REG_R13));
     736  fprintf(dbgout,"%%rsi = 0x" ZLISP "      %%r14 = 0x" ZLISP "\n", xpGPR(xp,REG_RSI),xpGPR(xp,REG_R14));
     737  fprintf(dbgout,"%%rdi = 0x" ZLISP "      %%r15 = 0x" ZLISP "\n", xpGPR(xp,REG_RDI),xpGPR(xp,REG_R15));
     738  fprintf(dbgout,"%%rip = 0x" ZLISP "   %%rflags = 0x%08lx\n",
    723739          xpGPR(xp, Iip), eflags_register(xp));
    724740#endif
     
    774790
    775791
    776   fprintf(stderr, "%%eax = 0x" ZLISP "\n", xpGPR(xp, REG_EAX));
    777   fprintf(stderr, "%%ecx = 0x" ZLISP "\n", xpGPR(xp, REG_ECX));
    778   fprintf(stderr, "%%edx = 0x" ZLISP "\n", xpGPR(xp, REG_EDX));
    779   fprintf(stderr, "%%ebx = 0x" ZLISP "\n", xpGPR(xp, REG_EBX));
    780   fprintf(stderr, "%%esp = 0x" ZLISP "\n", xpGPR(xp, REG_ESP));
    781   fprintf(stderr, "%%ebp = 0x" ZLISP "\n", xpGPR(xp, REG_EBP));
    782   fprintf(stderr, "%%esi = 0x" ZLISP "\n", xpGPR(xp, REG_ESI));
    783   fprintf(stderr, "%%edi = 0x" ZLISP "\n", xpGPR(xp, REG_EDI));
    784   fprintf(stderr, "%%eip = 0x" ZLISP "\n", xpGPR(xp, REG_EIP));
    785   fprintf(stderr, "%%eflags = 0x" ZLISP "\n", xpGPR(xp, REG_EFL));
     792  fprintf(dbgout, "%%eax = 0x" ZLISP "\n", xpGPR(xp, REG_EAX));
     793  fprintf(dbgout, "%%ecx = 0x" ZLISP "\n", xpGPR(xp, REG_ECX));
     794  fprintf(dbgout, "%%edx = 0x" ZLISP "\n", xpGPR(xp, REG_EDX));
     795  fprintf(dbgout, "%%ebx = 0x" ZLISP "\n", xpGPR(xp, REG_EBX));
     796  fprintf(dbgout, "%%esp = 0x" ZLISP "\n", xpGPR(xp, REG_ESP));
     797  fprintf(dbgout, "%%ebp = 0x" ZLISP "\n", xpGPR(xp, REG_EBP));
     798  fprintf(dbgout, "%%esi = 0x" ZLISP "\n", xpGPR(xp, REG_ESI));
     799  fprintf(dbgout, "%%edi = 0x" ZLISP "\n", xpGPR(xp, REG_EDI));
     800  fprintf(dbgout, "%%eip = 0x" ZLISP "\n", xpGPR(xp, REG_EIP));
     801  fprintf(dbgout, "%%eflags = 0x" ZLISP "\n", xpGPR(xp, REG_EFL));
    786802#ifdef DEBUG_SHOW_X86_SEGMENT_REGISTERS
    787   fprintf(stderr,"\n");
    788   fprintf(stderr, "%%cs = 0x%04x\n", rcs);
    789   fprintf(stderr, "%%ds = 0x%04x\n", rds);
    790   fprintf(stderr, "%%ss = 0x%04x\n", rss);
    791   fprintf(stderr, "%%es = 0x%04x\n", res);
    792   fprintf(stderr, "%%fs = 0x%04x\n", rfs);
    793   fprintf(stderr, "%%gs = 0x%04x\n", rgs);
     803  fprintf(dbgout,"\n");
     804  fprintf(dbgout, "%%cs = 0x%04x\n", rcs);
     805  fprintf(dbgout, "%%ds = 0x%04x\n", rds);
     806  fprintf(dbgout, "%%ss = 0x%04x\n", rss);
     807  fprintf(dbgout, "%%es = 0x%04x\n", res);
     808  fprintf(dbgout, "%%fs = 0x%04x\n", rfs);
     809  fprintf(dbgout, "%%gs = 0x%04x\n", rgs);
    794810
    795811#endif
     
    810826 
    811827  for (i = 0; i < 32; i++, np+=2) {
    812     fprintf(stderr, "f%02d : 0x%08X%08X (%f)\n", i,  np[0], np[1], *dp++);
    813   }
    814   fprintf(stderr, "FPSCR = %08X\n", xpFPSCR(xp));
     828    fprintf(dbgout, "f%02d : 0x%08X%08X (%f)\n", i,  np[0], np[1], *dp++);
     829  }
     830  fprintf(dbgout, "FPSCR = %08X\n", xpFPSCR(xp));
    815831#endif
    816832#ifdef X8664
     
    843859    dp = (double *) xmmp;
    844860    np = (int *) xmmp;
    845     fprintf(stderr, "f%02d: 0x%08x (%e), 0x%08x%08x (%e)\n", i, *np, (double)(*sp), np[1], np[0], *dp);
    846   }
    847   fprintf(stderr, "mxcsr = 0x%08x\n",
     861    fprintf(dbgout, "f%02d: 0x%08x (%e), 0x%08x%08x (%e)\n", i, *np, (double)(*sp), np[1], np[0], *dp);
     862  }
     863  fprintf(dbgout, "mxcsr = 0x%08x\n",
    848864#ifdef LINUX
    849865          xp->uc_mcontext.fpregs->mxcsr
     
    874890    dp = (double *)xmmp;
    875891    np = (int *)xmmp;
    876     fprintf(stderr, "f%1d: 0x%08x (%e), 0x%08x%08x (%e)\n", i, *np,
     892    fprintf(dbgout, "f%1d: 0x%08x (%e), 0x%08x%08x (%e)\n", i, *np,
    877893            (double)(*sp), np[1], np[0], *dp);
    878894  }
    879   fprintf(stderr, "mxcsr = 0x%08x\n", UC_MCONTEXT(xp)->__fs.__fpu_mxcsr);
     895  fprintf(dbgout, "mxcsr = 0x%08x\n", UC_MCONTEXT(xp)->__fs.__fpu_mxcsr);
    880896#endif
    881897#endif
     
    906922    /* If we have an XP or don't need one, call the function */
    907923    if (xp || !(entry->flags & DEBUG_COMMAND_FLAG_REQUIRE_XP)) {
    908       fprintf(stderr, "(%c)  %s\n", entry->c, entry->help_text);
     924      fprintf(dbgout, "(%c)  %s\n", entry->c, entry->help_text);
    909925    }
    910926  }
     
    10711087      }
    10721088      if (codev) {
    1073         fprintf(stderr, " While executing: %s\n", print_lisp_object(f));
     1089        fprintf(dbgout, " While executing: %s\n", print_lisp_object(f));
    10741090      }
    10751091    } else {
     
    10781094      natural where = (natural)xpPC(xp);
    10791095
    1080       fprintf(stderr, " In foreign code at address 0x" ZLISP "\n", where);
     1096      fprintf(dbgout, " In foreign code at address 0x" ZLISP "\n", where);
    10811097      foreign_name = foreign_name_and_offset(where, &disp);
    10821098      if (foreign_name) {
    1083         fprintf(stderr, "  [%s + %d]\n", foreign_name, disp);
     1099        fprintf(dbgout, "  [%s + %d]\n", foreign_name, disp);
    10841100      }
    10851101    }
     
    11051121
    11061122  va_start(args,message);
    1107   vfprintf(stderr, message, args);
    1108   fprintf(stderr, "\n");
     1123  vfprintf(dbgout, message, args);
     1124  fprintf(dbgout, "\n");
    11091125  va_end(args);
    11101126 
     
    11231139    char *foreign_name;
    11241140    int disp;
    1125     fprintf(stderr, "Exception occurred while executing foreign code\n");
     1141    fprintf(dbgout, "Exception occurred while executing foreign code\n");
    11261142    foreign_name = foreign_name_and_offset((natural)xpPC(xp), &disp);
    11271143    if (foreign_name) {
    1128       fprintf(stderr, " at %s + %d\n", foreign_name, disp);
     1144      fprintf(dbgout, " at %s + %d\n", foreign_name, disp);
    11291145    }
    11301146  }
     
    11391155    debug_identify_function(xp, info);
    11401156  }
    1141   fprintf(stderr, "? for help\n");
     1157  fprintf(dbgout, "? for help\n");
    11421158  while (state == debug_continue) {
    11431159#ifdef WINDOWS
    1144     fprintf(stderr, "[%d] Clozure CL kernel debugger: ", (int)GetCurrentProcessId());
     1160    fprintf(dbgout, "[%d] Clozure CL kernel debugger: ", (int)GetCurrentProcessId());
    11451161#else
    1146     fprintf(stderr, "[%d] Clozure CL kernel debugger: ", main_thread_pid);
     1162    fprintf(dbgout, "[%d] Clozure CL kernel debugger: ", main_thread_pid);
    11471163#endif
    11481164    state = apply_debug_command(xp, readc(), info, why);
  • trunk/source/lisp-kernel/lisp.h

    r10969 r11623  
    126126void wperror(char *);
    127127#endif
     128
     129#include <stdio.h>
     130
     131extern FILE *dbgout;
  • trunk/source/lisp-kernel/lispdcmd.c

    r137 r11623  
    2727display_buffer(char *buf)
    2828{
    29   fprintf(stderr, "%s\n", buf);
     29  fprintf(dbgout, "%s\n", buf);
    3030}
    3131
  • trunk/source/lisp-kernel/memory.c

    r10956 r11623  
    178178                       PAGE_NOACCESS);
    179179  if (!start) {
    180     fprintf(stderr, "Can't get desired heap address at 0x" LISP "\n", want);
     180    fprintf(dbgout, "Can't get desired heap address at 0x" LISP "\n", want);
    181181    start = VirtualAlloc(0,
    182182                         totalsize + heap_segment_size,
     
    210210#endif
    211211#if DEBUG_MEMORY
    212   fprintf(stderr, "Reserving heap at 0x" LISP ", size 0x" LISP "\n", start, totalsize);
     212  fprintf(dbgout, "Reserving heap at 0x" LISP ", size 0x" LISP "\n", start, totalsize);
    213213#endif
    214214  return start;
     
    220220  LogicalAddress rc;
    221221#if DEBUG_MEMORY
    222   fprintf(stderr, "Committing memory at 0x" LISP ", size 0x" LISP "\n", start, len);
     222  fprintf(dbgout, "Committing memory at 0x" LISP ", size 0x" LISP "\n", start, len);
    223223#endif
    224224#ifdef WINDOWS
     
    258258UnCommitMemory (LogicalAddress start, natural len) {
    259259#if DEBUG_MEMORY
    260   fprintf(stderr, "Uncommitting memory at 0x" LISP ", size 0x" LISP "\n", start, len);
     260  fprintf(dbgout, "Uncommitting memory at 0x" LISP ", size 0x" LISP "\n", start, len);
    261261#endif
    262262#ifdef WINDOWS
     
    274274      int err = errno;
    275275      Fatal("mmap error", "");
    276       fprintf(stderr, "errno = %d", err);
     276      fprintf(dbgout, "errno = %d", err);
    277277    }
    278278  }
     
    285285{
    286286#if DEBUG_MEMORY
    287   fprintf(stderr, "Mapping memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
     287  fprintf(dbgout, "Mapping memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
    288288#endif
    289289#ifdef WINDOWS
     
    298298{
    299299#if DEBUG_MEMORY
    300   fprintf(stderr, "Mapping stack of size 0x" LISP "\n", nbytes);
     300  fprintf(dbgout, "Mapping stack of size 0x" LISP "\n", nbytes);
    301301#endif
    302302#ifdef WINDOWS
     
    311311{
    312312#if DEBUG_MEMORY
    313   fprintf(stderr, "Unmapping memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
     313  fprintf(dbgout, "Unmapping memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
    314314#endif
    315315#ifdef WINDOWS
     
    325325{
    326326#if DEBUG_MEMORY
    327   fprintf(stderr, "Protecting memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
     327  fprintf(dbgout, "Protecting memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
    328328#endif
    329329#ifdef WINDOWS
     
    351351{
    352352#if DEBUG_MEMORY
    353   fprintf(stderr, "Unprotecting memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
     353  fprintf(dbgout, "Unprotecting memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
    354354#endif
    355355#ifdef WINDOWS
     
    404404    count = read(fd, addr + total, nbytes - total);
    405405    total += count;
    406     // fprintf(stderr, "read " DECIMAL " bytes, for a total of " DECIMAL " out of " DECIMAL " so far\n", count, total, nbytes);
     406    // fprintf(dbgout, "read " DECIMAL " bytes, for a total of " DECIMAL " out of " DECIMAL " so far\n", count, total, nbytes);
    407407    if (!(count > 0))
    408408      return false;
  • trunk/source/lisp-kernel/plbt.c

    r10888 r11623  
    105105      unsigned long strtable = (unsigned long)(((struct symtab_command *)lc)->stroff + table_off);
    106106      for (i = 0; i < numsyms; i++) {
    107         /* fprintf(stderr,"%s : 0x%08x, 0x%x\n",(char *)(strtable + symtable->n_un.n_strx) ,symtable->n_value, symtable->n_type); */
     107        /* fprintf(dbgout,"%s : 0x%08x, 0x%x\n",(char *)(strtable + symtable->n_un.n_strx) ,symtable->n_value, symtable->n_type); */
    108108        /* Ignore the following kinds of Symbols */
    109109        if ((!symtable->n_value)        /* Undefined */
     
    254254    }
    255255    if (next < start) {
    256       fprintf(stderr, "Bad frame! (%x < %x)\n", next, start);
     256      fprintf(dbgout, "Bad frame! (%x < %x)\n", next, start);
    257257      break;
    258258    }
     
    304304      Dprintf("\nStack pointer [#x%lX] in unknown area.", currentSP);
    305305    } else {
    306       fprintf(stderr, "current thread: tcr = 0x%lx, native thread ID = 0x%lx, interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
     306      fprintf(dbgout, "current thread: tcr = 0x%lx, native thread ID = 0x%lx, interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
    307307      walk_stack_frames((lisp_frame *) ptr_from_lispobj(currentSP), (lisp_frame *) (cs_area->high));
    308308      walk_other_areas();
  • trunk/source/lisp-kernel/plprint.c

    r6 r11623  
    2222{
    2323  if (lisp_nil == (LispObj) NULL) {
    24     fprintf(stderr,"can't find lisp NIL; lisp process not active process ?\n");
     24    fprintf(dbgout,"can't find lisp NIL; lisp process not active process ?\n");
    2525  } else {
    2626    Dprintf("\n%s", print_lisp_object(obj));
  • trunk/source/lisp-kernel/plsym.c

    r10565 r11623  
    121121    describe_symbol(address);
    122122  } else {
    123     fprintf(stderr, "Not a symbol.\n");
     123    fprintf(dbgout, "Not a symbol.\n");
    124124  }
    125125  return;
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r11576 r11623  
    139139                (LPTSTR)&buffer,
    140140                0, NULL);
    141   fprintf(stderr, "%s: 0x%x %s\n", message, (unsigned) last_error, buffer);
     141  fprintf(dbgout, "%s: 0x%x %s\n", message, (unsigned) last_error, buffer);
    142142  LocalFree(buffer);
    143143}
     
    205205    if (setrlimit(RLIMIT_STACK, &limits)) {
    206206      int e = errno;
    207       fprintf(stderr, "errno = %d\n", e);
     207      fprintf(dbgout, "errno = %d\n", e);
    208208      Fatal(": Stack resource limit too small", "");
    209209    }
     
    791791    fatal_spare_ptr = NULL;
    792792  }
    793   fprintf(stderr, "Fatal error: %s\n%s\n", param0, param1);
     793  fprintf(dbgout, "Fatal error: %s\n%s\n", param0, param1);
    794794  _exit(-1);
    795795}
     
    956956{
    957957  if (herald && *herald) {
    958     fprintf(stderr, "%s\n", herald);
    959   }
    960   fprintf(stderr, "usage: %s <options>\n", program_name);
    961   fprintf(stderr, "\t or %s <image-name>\n", program_name);
    962   fprintf(stderr, "\t where <options> are one or more of:\n");
     958    fprintf(dbgout, "%s\n", herald);
     959  }
     960  fprintf(dbgout, "usage: %s <options>\n", program_name);
     961  fprintf(dbgout, "\t or %s <image-name>\n", program_name);
     962  fprintf(dbgout, "\t where <options> are one or more of:\n");
    963963  if (other_args && *other_args) {
    964     fputs(other_args, stderr);
    965   }
    966   fprintf(stderr, "\t-R, --heap-reserve <n>: reserve <n> (default: %lld)\n",
     964    fputs(other_args, dbgout);
     965  }
     966  fprintf(dbgout, "\t-R, --heap-reserve <n>: reserve <n> (default: %lld)\n",
    967967          (u64_t) reserved_area_size);
    968   fprintf(stderr, "\t\t bytes for heap expansion\n");
    969   fprintf(stderr, "\t-S, --stack-size <n>: set  size of initial thread's control stack to <n>\n");
    970   fprintf(stderr, "\t-Z, --thread-stack-size <n>: set default size of first (listener)  thread's stacks based on <n>\n");
    971   fprintf(stderr, "\t-b, --batch: exit when EOF on *STANDARD-INPUT*\n");
    972   fprintf(stderr, "\t--no-sigtrap : obscure option for running under GDB\n");
    973   fprintf(stderr, "\t-I, --image-name <image-name>\n");
    974   fprintf(stderr, "\t and <image-name> defaults to %s\n",
     968  fprintf(dbgout, "\t\t bytes for heap expansion\n");
     969  fprintf(dbgout, "\t-S, --stack-size <n>: set  size of initial thread's control stack to <n>\n");
     970  fprintf(dbgout, "\t-Z, --thread-stack-size <n>: set default size of first (listener)  thread's stacks based on <n>\n");
     971  fprintf(dbgout, "\t-b, --batch: exit when EOF on *STANDARD-INPUT*\n");
     972  fprintf(dbgout, "\t--no-sigtrap : obscure option for running under GDB\n");
     973  fprintf(dbgout, "\t-I, --image-name <image-name>\n");
     974  fprintf(dbgout, "\t and <image-name> defaults to %s\n",
    975975          default_image_name(program_name));
    976   fprintf(stderr, "\n");
     976  fprintf(dbgout, "\n");
    977977  _exit(exit_status);
    978978}
     
    10101010   
    10111011  default:
    1012     fprintf(stderr, "couldn't parse %s argument %s", argname, arg);
     1012    fprintf(dbgout, "couldn't parse %s argument %s", argname, arg);
    10131013    val = default_val;
    10141014    break;
     
    13391339
    13401340  if (got < want) {
    1341     fprintf(stderr, "\n%s requires %s version %s or later; the current version is %s.\n", progname, uts.sysname, min_os_version, uts.release);
     1341    fprintf(dbgout, "\n%s requires %s version %s or later; the current version is %s.\n", progname, uts.sysname, min_os_version, uts.release);
    13421342    exit(1);
    13431343  }
     
    14221422  arch_prctl(ARCH_GET_FS, &fs_addr);
    14231423  if ((gs_addr == cur_thread) && (fs_addr != cur_thread)) {
    1424     fprintf(stderr, "The installed C library - version %s - seems to be using the %%gs register for thread storage.\n\"%s\" cannot run, since it expects to be\nable to use that register for its own purposes.\n", gnu_get_libc_version(),progname);
     1424    fprintf(dbgout, "The installed C library - version %s - seems to be using the %%gs register for thread storage.\n\"%s\" cannot run, since it expects to be\nable to use that register for its own purposes.\n", gnu_get_libc_version(),progname);
    14251425    _exit(1);
    14261426  }
     
    14981498  _setmode(1, O_BINARY);
    14991499  _setmode(2, O_BINARY);
    1500   setvbuf(stderr, NULL, _IONBF, 0);
     1500  setvbuf(dbgout, NULL, _IONBF, 0);
    15011501  init_winsock();
    15021502  init_windows_io();
     
    15711571#ifdef X86
    15721572  if (!check_x86_cpu()) {
    1573     fprintf(stderr, "CPU doesn't support required features\n");
     1573    fprintf(dbgout, "CPU doesn't support required features\n");
    15741574    exit(1);
    15751575  }
     
    19801980  if (image_nil == 0) {
    19811981    if (err == 0) {
    1982       fprintf(stderr, "Couldn't load lisp heap image from %s\n", path);
     1982      fprintf(dbgout, "Couldn't load lisp heap image from %s\n", path);
    19831983    } else {
    1984       fprintf(stderr, "Couldn't load lisp heap image from %s:\n%s\n", path, strerror(err));
     1984      fprintf(dbgout, "Couldn't load lisp heap image from %s:\n%s\n", path, strerror(err));
    19851985    }
    19861986    exit(-1);
  • trunk/source/lisp-kernel/ppc-exceptions.c

    r11551 r11623  
    252252    xpGPR(xp, allocptr) += disp_from_allocptr;
    253253#ifdef DEBUG
    254     fprintf(stderr, "New heap segment for #x%x, no GC: #x%x/#x%x, vsp = #x%x\n",
     254    fprintf(dbgout, "New heap segment for #x%x, no GC: #x%x/#x%x, vsp = #x%x\n",
    255255            tcr,xpGPR(xp,allocbase),tcr->last_allocptr, xpGPR(xp,vsp));
    256256#endif
     
    271271    xpGPR(xp, allocptr) += disp_from_allocptr;
    272272#ifdef DEBUG
    273     fprintf(stderr, "New heap segment for #x%x after GC: #x%x/#x%x\n",
     273    fprintf(dbgout, "New heap segment for #x%x after GC: #x%x/#x%x\n",
    274274            tcr,xpGPR(xp,allocbase),tcr->last_allocptr);
    275275#endif
     
    400400    if (allocate_object(xp, bytes_needed, disp, tcr)) {
    401401#if 0
    402       fprintf(stderr, "alloc_trap in 0x%lx, new allocptr = 0x%lx\n",
     402      fprintf(dbgout, "alloc_trap in 0x%lx, new allocptr = 0x%lx\n",
    403403              tcr, xpGPR(xp, allocptr));
    404404#endif
     
    706706    update_area_active((area **)&tcr->ts_area, (BytePtr) ptr_from_lispobj(xpGPR(xp, tsp)));
    707707#ifdef DEBUG
    708     fprintf(stderr, "TCR 0x%x in lisp code, vsp = 0x%lx, tsp = 0x%lx\n",
     708    fprintf(dbgout, "TCR 0x%x in lisp code, vsp = 0x%lx, tsp = 0x%lx\n",
    709709            tcr, xpGPR(xp, vsp), xpGPR(xp, tsp));
    710     fprintf(stderr, "TCR 0x%x, allocbase/allocptr were 0x%x/0x%x at #x%x\n",
     710    fprintf(dbgout, "TCR 0x%x, allocbase/allocptr were 0x%x/0x%x at #x%x\n",
    711711            tcr,
    712712            xpGPR(xp, allocbase),
    713713            xpGPR(xp, allocptr),
    714714            xpPC(xp));
    715     fprintf(stderr, "TCR 0x%x, exception context = 0x%x\n",
     715    fprintf(dbgout, "TCR 0x%x, exception context = 0x%x\n",
    716716            tcr,
    717717            tcr->pending_exception_context);
     
    721721    cur_allocptr = (void *) (tcr->save_allocptr);
    722722#ifdef DEBUG
    723     fprintf(stderr, "TCR 0x%x in foreign code, vsp = 0x%lx, tsp = 0x%lx\n",
     723    fprintf(dbgout, "TCR 0x%x in foreign code, vsp = 0x%lx, tsp = 0x%lx\n",
    724724            tcr, tcr->save_vsp, tcr->save_tsp);
    725     fprintf(stderr, "TCR 0x%x, save_allocbase/save_allocptr were 0x%x/0x%x at #x%x\n",
     725    fprintf(dbgout, "TCR 0x%x, save_allocbase/save_allocptr were 0x%x/0x%x at #x%x\n",
    726726            tcr,
    727727            tcr->save_allocbase,
     
    824824
    825825#ifdef DEBUG
    826   fprintf(stderr, "Start GC  in 0x%lx\n", tcr);
     826  fprintf(dbgout, "Start GC  in 0x%lx\n", tcr);
    827827#endif
    828828  a = active_dynamic_area;
     
    833833  newend = a->high;
    834834#if 0
    835   fprintf(stderr, "End GC  in 0x%lx\n", tcr);
     835  fprintf(dbgout, "End GC  in 0x%lx\n", tcr);
    836836#endif
    837837  return ((oldfree-newfree)+(newend-oldend));
     
    15281528  callback_ptr = ((macptr *)ptr_from_lispobj(untag(callback_macptr)))->address;
    15291529#ifdef DEBUG
    1530   fprintf(stderr, "0x%x releasing exception lock for callback\n", tcr);
     1530  fprintf(dbgout, "0x%x releasing exception lock for callback\n", tcr);
    15311531#endif
    15321532  UNLOCK(lisp_global(EXCEPTION_LOCK), tcr);
     
    15341534  LOCK(lisp_global(EXCEPTION_LOCK), tcr);
    15351535#ifdef DEBUG
    1536   fprintf(stderr, "0x%x acquired exception lock after callback\n", tcr);
     1536  fprintf(dbgout, "0x%x acquired exception lock after callback\n", tcr);
    15371537#endif
    15381538
     
    16721672      }
    16731673#if 0
    1674       fprintf(stderr, "About to do trap callback in 0x%x\n",tcr);
     1674      fprintf(dbgout, "About to do trap callback in 0x%x\n",tcr);
    16751675#endif
    16761676      callback_for_trap(cmain, xp,  where, (natural) the_trap,  0, 0);
     
    17041704void non_fatal_error( char *msg )
    17051705{
    1706   fprintf( stderr, "Non-fatal error: %s.\n", msg );
    1707   fflush( stderr );
     1706  fprintf( dbgout, "Non-fatal error: %s.\n", msg );
     1707  fflush( dbgout );
    17081708}
    17091709
     
    17851785  LOCK(lisp_global(EXCEPTION_LOCK), tcr);
    17861786#ifdef DEBUG
    1787   fprintf(stderr, "0x%x has exception lock\n", tcr);
     1787  fprintf(dbgout, "0x%x has exception lock\n", tcr);
    17881788#endif
    17891789  xf->curr = context;
     
    18011801  tcr->valence = TCR_STATE_EXCEPTION_RETURN;
    18021802#ifdef DEBUG
    1803   fprintf(stderr, "0x%x releasing exception lock\n", tcr);
     1803  fprintf(dbgout, "0x%x releasing exception lock\n", tcr);
    18041804#endif
    18051805  UNLOCK(lisp_global(EXCEPTION_LOCK),tcr);
     
    18371837#ifdef DARWIN
    18381838  if (running_under_rosetta) {
    1839     fprintf(stderr, "signal handler: signal = %d, pc = 0x%08x\n", signum, xpPC(context));
     1839    fprintf(dbgout, "signal handler: signal = %d, pc = 0x%08x\n", signum, xpPC(context));
    18401840  }
    18411841#endif
     
    20272027      if (disp < (4*node_size)) {
    20282028#if 0
    2029         fprintf(stderr, "pc-luser: finish SP frame in 0x%x, disp = %d\n",tcr, disp);
     2029        fprintf(dbgout, "pc-luser: finish SP frame in 0x%x, disp = %d\n",tcr, disp);
    20302030#endif
    20312031        frame->savevsp = 0;
     
    20822082    } else {
    20832083#ifdef DEBUG
    2084       fprintf(stderr, "tcr 0x%x is past alloc trap, finishing alloc at 0x%x\n", tcr, xpGPR(xp,allocptr));
     2084      fprintf(dbgout, "tcr 0x%x is past alloc trap, finishing alloc at 0x%x\n", tcr, xpGPR(xp,allocptr));
    20852085#endif
    20862086      /* If we're already past the alloc_trap, finish allocating
     
    20892089        finish_allocating_cons(xp);
    20902090#ifdef DEBUG
    2091           fprintf(stderr, "finish allocating cons in TCR = #x%x\n",
     2091          fprintf(dbgout, "finish allocating cons in TCR = #x%x\n",
    20922092                  tcr);
    20932093#endif
     
    20952095        if (allocptr_tag == fulltag_misc) {
    20962096#ifdef DEBUG
    2097           fprintf(stderr, "finish allocating uvector in TCR = #x%x\n",
     2097          fprintf(dbgout, "finish allocating uvector in TCR = #x%x\n",
    20982098                  tcr);
    20992099#endif
     
    21142114    int idx = ((int)((short)(D_field(instr))+fulltag_misc))>>fixnumshift;
    21152115#if 0
    2116         fprintf(stderr, "pc-luser: CATCH frame in 0x%x, idx = %d\n",tcr, idx);
     2116        fprintf(dbgout, "pc-luser: CATCH frame in 0x%x, idx = %d\n",tcr, idx);
    21172117#endif
    21182118
     
    21702170          wait_for_exception_lock_in_handler(tcr, context, &xframe_link);
    21712171#ifdef DEBUG
    2172           fprintf(stderr, "[0x%x acquired exception lock for interrupt]\n",tcr);
     2172          fprintf(dbgout, "[0x%x acquired exception lock for interrupt]\n",tcr);
    21732173#endif
    21742174          PMCL_exception_handler(signum, context, tcr, info, old_valence);
     
    21782178          unlock_exception_lock_in_handler(tcr);
    21792179#ifdef DEBUG
    2180           fprintf(stderr, "[0x%x released exception lock for interrupt]\n",tcr);
     2180          fprintf(dbgout, "[0x%x released exception lock for interrupt]\n",tcr);
    21812181#endif
    21822182          exit_signal_handler(tcr, old_valence);
     
    24962496
    24972497#ifdef DEBUG_MACH_EXCEPTIONS
    2498   fprintf(stderr, "doing pseudo_sigreturn for 0x%x\n",tcr);
     2498  fprintf(dbgout, "doing pseudo_sigreturn for 0x%x\n",tcr);
    24992499#endif
    25002500  xp = tcr->pending_exception_context;
     
    25082508  }
    25092509#ifdef DEBUG_MACH_EXCEPTIONS
    2510   fprintf(stderr, "did pseudo_sigreturn for 0x%x\n",tcr);
     2510  fprintf(dbgout, "did pseudo_sigreturn for 0x%x\n",tcr);
    25112511#endif
    25122512  return KERN_SUCCESS;
     
    26222622
    26232623#ifdef DEBUG_MACH_EXCEPTIONS
    2624   fprintf(stderr,"Setting up exception handling for 0x%x\n", tcr);
     2624  fprintf(dbgout,"Setting up exception handling for 0x%x\n", tcr);
    26252625#endif
    26262626  pseudosigcontext = create_thread_context_frame(thread, &stackp);
     
    26602660#endif
    26612661#ifdef DEBUG_MACH_EXCEPTIONS
    2662   fprintf(stderr,"Set up exception context for 0x%x at 0x%x\n", tcr, tcr->pending_exception_context);
     2662  fprintf(dbgout,"Set up exception context for 0x%x at 0x%x\n", tcr, tcr->pending_exception_context);
    26632663#endif
    26642664  return 0;
     
    27752775
    27762776#ifdef DEBUG_MACH_EXCEPTIONS
    2777   fprintf(stderr, "obtaining Mach exception lock in exception thread\n");
     2777  fprintf(dbgout, "obtaining Mach exception lock in exception thread\n");
    27782778#endif
    27792779
     
    27892789      kret = do_pseudo_sigreturn(thread, tcr);
    27902790#if 0
    2791       fprintf(stderr, "Exception return in 0x%x\n",tcr);
     2791      fprintf(dbgout, "Exception return in 0x%x\n",tcr);
    27922792#endif
    27932793       
     
    28282828                                tcr);
    28292829#if 0
    2830       fprintf(stderr, "Setup pseudosignal handling in 0x%x\n",tcr);
     2830      fprintf(dbgout, "Setup pseudosignal handling in 0x%x\n",tcr);
    28312831#endif
    28322832
     
    30583058  if ((kret = setup_mach_exception_handling(tcr))
    30593059      != KERN_SUCCESS) {
    3060     fprintf(stderr, "Couldn't setup exception handler - error = %d\n", kret);
     3060    fprintf(dbgout, "Couldn't setup exception handler - error = %d\n", kret);
    30613061    terminate_lisp();
    30623062  }
     
    31013101        aborted = true;
    31023102      } else {
    3103         fprintf(stderr, "abort failed on thread = 0x%x\n",mach_thread);
     3103        fprintf(dbgout, "abort failed on thread = 0x%x\n",mach_thread);
    31043104        thread_resume(mach_thread);
    31053105      }
     
    31423142  xp = tcr->suspend_context;
    31433143#ifdef DEBUG_MACH_EXCEPTIONS
    3144   fprintf(stderr, "resuming TCR 0x%x, pending_exception_context = 0x%x\n",
     3144  fprintf(dbgout, "resuming TCR 0x%x, pending_exception_context = 0x%x\n",
    31453145          tcr, tcr->pending_exception_context);
    31463146#endif
     
    31483148  restore_mach_thread_state(mach_thread, xp);
    31493149#ifdef DEBUG_MACH_EXCEPTIONS
    3150   fprintf(stderr, "restored state in TCR 0x%x, pending_exception_context = 0x%x\n",
     3150  fprintf(dbgout, "restored state in TCR 0x%x, pending_exception_context = 0x%x\n",
    31513151          tcr, tcr->pending_exception_context);
    31523152#endif
  • trunk/source/lisp-kernel/ppc-gc.c

    r11522 r11623  
    10731073
    10741074#if 0
    1075   fprintf(stderr, "mark VSP range: 0x%lx:0x%lx\n", start, end);
     1075  fprintf(dbgout, "mark VSP range: 0x%lx:0x%lx\n", start, end);
    10761076#endif
    10771077  if (((natural)start) & (sizeof(natural))) {
     
    14241424
    14251425#ifdef DEBUG
    1426   fprintf(stderr,"Forward range 0x%x/0x%x (owner 0x%x)\n",p,q,a->owner);
     1426  fprintf(dbgout,"Forward range 0x%x/0x%x (owner 0x%x)\n",p,q,a->owner);
    14271427#endif
    14281428  if (((natural)p) & sizeof(natural)) {
  • trunk/source/lisp-kernel/thread_manager.c

    r11609 r11623  
    957957  if (i == LDT_ENTRIES) {
    958958    pthread_mutex_unlock(&ldt_lock);
    959     fprintf(stderr, "All 8192 ldt entries in use ?\n");
     959    fprintf(dbgout, "All 8192 ldt entries in use ?\n");
    960960    _exit(1);
    961961  }
     
    966966  if (modify_ldt(1,&u,sizeof(struct user_desc)) != 0) {
    967967    pthread_mutex_unlock(&ldt_lock);
    968     fprintf(stderr,"Can't assign LDT entry\n");
     968    fprintf(dbgout,"Can't assign LDT entry\n");
    969969    _exit(1);
    970970  }
     
    10291029
    10301030  if (status) {
    1031     fprintf(stderr, "This application can't run under this OS version\n");
     1031    fprintf(dbgout, "This application can't run under this OS version\n");
    10321032    _exit(1);
    10331033  }
     
    10631063  if (i == 8192) {
    10641064    ReleaseMutex(ldt_lock);
    1065     fprintf(stderr, "All 8192 ldt entries in use ?\n");
     1065    fprintf(dbgout, "All 8192 ldt entries in use ?\n");
    10661066    _exit(1);
    10671067  }
     
    12431243  }
    12441244  pthread_mutex_unlock(&ldt_lock);
    1245   fprintf(stderr, "All 8192 LDT descriptors in use\n");
     1245  fprintf(dbgout, "All 8192 LDT descriptors in use\n");
    12461246  _exit(1);
    12471247
     
    18411841#ifdef DEBUG_TCR_CREATION
    18421842#ifndef WINDOWS
    1843     fprintf(stderr, "\ncreating TCR for pthread 0x%x", pthread_self());
     1843    fprintf(dbgout, "\ncreating TCR for pthread 0x%x", pthread_self());
    18441844#endif
    18451845#endif
     
    19141914          *pcontext = * (CONTEXT *)(pcontext->Rcx);
    19151915#else
    1916           fprintf(stderr, "missing win32 suspend code, case (1)\n");
     1916          fprintf(dbgout, "missing win32 suspend code, case (1)\n");
    19171917#endif
    19181918        } else {
     
    19311931#else
    19321932#warning need context setup for win32
    1933           fprintf(stderr, "missing win32 suspend code, case (2)\n");
     1933          fprintf(dbgout, "missing win32 suspend code, case (2)\n");
    19341934#endif
    19351935        }
  • trunk/source/lisp-kernel/x86-exceptions.c

    r11595 r11623  
    12331233  LOCK(lisp_global(EXCEPTION_LOCK), tcr);
    12341234#if 0
    1235   fprintf(stderr, "0x" LISP " has exception lock\n", tcr);
     1235  fprintf(dbgout, "0x" LISP " has exception lock\n", tcr);
    12361236#endif
    12371237  xf->curr = context;
     
    12561256  UNLOCK(lisp_global(EXCEPTION_LOCK),tcr);
    12571257#if 0
    1258   fprintf(stderr, "0x" LISP " released exception lock\n", tcr);
     1258  fprintf(dbgout, "0x" LISP " released exception lock\n", tcr);
    12591259#endif
    12601260}
     
    26892689
    26902690#if 0
    2691   fprintf(stderr, "Start GC  in 0x" LISP "\n", tcr);
     2691  fprintf(dbgout, "Start GC  in 0x" LISP "\n", tcr);
    26922692#endif
    26932693  a = active_dynamic_area;
     
    26982698  newend = a->high;
    26992699#if 0
    2700   fprintf(stderr, "End GC  in 0x" LISP "\n", tcr);
     2700  fprintf(dbgout, "End GC  in 0x" LISP "\n", tcr);
    27012701#endif
    27022702  return ((oldfree-newfree)+(newend-oldend));
     
    28712871
    28722872#ifdef DEBUG_MACH_EXCEPTIONS
    2873   fprintf(stderr, "doing pseudo_sigreturn for 0x%x\n",tcr);
     2873  fprintf(dbgout, "doing pseudo_sigreturn for 0x%x\n",tcr);
    28742874#endif
    28752875  xp = tcr->pending_exception_context;
     
    28832883  }
    28842884#ifdef DEBUG_MACH_EXCEPTIONS
    2885   fprintf(stderr, "did pseudo_sigreturn for 0x%x\n",tcr);
     2885  fprintf(dbgout, "did pseudo_sigreturn for 0x%x\n",tcr);
    28862886#endif
    28872887  return KERN_SUCCESS;
     
    30023002
    30033003#ifdef DEBUG_MACH_EXCEPTIONS
    3004   fprintf(stderr,"Setting up exception handling for 0x%x\n", tcr);
     3004  fprintf(dbgout,"Setting up exception handling for 0x%x\n", tcr);
    30053005#endif
    30063006  pseudosigcontext = create_thread_context_frame(thread, &stackp, &info, tcr,  ts);
     
    30773077#endif
    30783078#ifdef DEBUG_MACH_EXCEPTIONS
    3079   fprintf(stderr,"Set up exception context for 0x%x at 0x%x\n", tcr, tcr->pending_exception_context);
     3079  fprintf(dbgout,"Set up exception context for 0x%x at 0x%x\n", tcr, tcr->pending_exception_context);
    30803080#endif
    30813081  return 0;
     
    31443144
    31453145#ifdef DEBUG_MACH_EXCEPTIONS
    3146   fprintf(stderr, "obtaining Mach exception lock in exception thread\n");
     3146  fprintf(dbgout, "obtaining Mach exception lock in exception thread\n");
    31473147#endif
    31483148
     
    31733173      kret = do_pseudo_sigreturn(thread, tcr);
    31743174#if 0
    3175       fprintf(stderr, "Exception return in 0x%x\n",tcr);
     3175      fprintf(dbgout, "Exception return in 0x%x\n",tcr);
    31763176#endif
    31773177    } else if (tcr->flags & (1<<TCR_FLAG_BIT_PROPAGATE_EXCEPTION)) {
     
    32153215                                  &ts);
    32163216#if 0
    3217         fprintf(stderr, "Setup pseudosignal handling in 0x%x\n",tcr);
     3217        fprintf(dbgout, "Setup pseudosignal handling in 0x%x\n",tcr);
    32183218#endif
    32193219       
     
    32553255  kern_return_t kret;
    32563256
    3257   fprintf(stderr, "terminating Mach exception thread, 'cause exit can't\n");
     3257  fprintf(dbgout, "terminating Mach exception thread, 'cause exit can't\n");
    32583258  kret = thread_terminate(mach_exception_thread);
    32593259  if (kret != KERN_SUCCESS) {
    3260     fprintf(stderr, "Couldn't terminate exception thread, kret = %d\n",kret);
     3260    fprintf(dbgout, "Couldn't terminate exception thread, kret = %d\n",kret);
    32613261  }
    32623262}
     
    34163416  if ((kret = setup_mach_exception_handling(tcr))
    34173417      != KERN_SUCCESS) {
    3418     fprintf(stderr, "Couldn't setup exception handler - error = %d\n", kret);
     3418    fprintf(dbgout, "Couldn't setup exception handler - error = %d\n", kret);
    34193419    terminate_lisp();
    34203420  }
     
    34593459        aborted = true;
    34603460      } else {
    3461         fprintf(stderr, "abort failed on thread = 0x%x\n",mach_thread);
     3461        fprintf(dbgout, "abort failed on thread = 0x%x\n",mach_thread);
    34623462        thread_resume(mach_thread);
    34633463      }
     
    35173517  xp = tcr->suspend_context;
    35183518#ifdef DEBUG_MACH_EXCEPTIONS
    3519   fprintf(stderr, "resuming TCR 0x%x, pending_exception_context = 0x%x\n",
     3519  fprintf(dbgout, "resuming TCR 0x%x, pending_exception_context = 0x%x\n",
    35203520          tcr, tcr->pending_exception_context);
    35213521#endif
     
    35233523  restore_mach_thread_state(mach_thread, xp);
    35243524#ifdef DEBUG_MACH_EXCEPTIONS
    3525   fprintf(stderr, "restored state in TCR 0x%x, pending_exception_context = 0x%x\n",
     3525  fprintf(dbgout, "restored state in TCR 0x%x, pending_exception_context = 0x%x\n",
    35263526          tcr, tcr->pending_exception_context);
    35273527#endif
  • trunk/source/lisp-kernel/x86-gc.c

    r11523 r11623  
    13691369
    13701370#if 0
    1371   fprintf(stderr, "mark VSP range: 0x" LISP ":0x" LISP "\n", start, end);
     1371  fprintf(dbgout, "mark VSP range: 0x" LISP ":0x" LISP "\n", start, end);
    13721372#endif
    13731373  mark_headerless_area_range(start, end);
  • trunk/source/lisp-kernel/xlbt.c

    r10095 r11623  
    105105    } else {
    106106      if (start->backlink) {
    107         fprintf(stderr, "Bogus  frame %lx\n", start);
     107        fprintf(dbgout, "Bogus  frame %lx\n", start);
    108108      }
    109109      return;
     
    115115    }
    116116    if (next < start) {
    117       fprintf(stderr, "Bad frame! (%x < %x)\n", next, start);
     117      fprintf(dbgout, "Bad frame! (%x < %x)\n", next, start);
    118118      break;
    119119    }
     
    159159      Dprintf("\nFramepointer [#x%lX] in unknown area.", currentRBP);
    160160    } else {
    161       fprintf(stderr, "current thread: tcr = 0x%lx, native thread ID = 0x%lx, interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
     161      fprintf(dbgout, "current thread: tcr = 0x%lx, native thread ID = 0x%lx, interrupts %s\n", tcr, tcr->native_thread_id, ilevel);
    162162      walk_stack_frames((lisp_frame *) ptr_from_lispobj(currentRBP), (lisp_frame *) (vs_area->high));
    163163      /*      walk_other_areas();*/
Note: See TracChangeset for help on using the changeset viewer.