Changeset 7779


Ignore:
Timestamp:
Nov 29, 2007, 1:27:23 PM (13 years ago)
Author:
gb
Message:

lisp_Debugger() takes an extra Boolean "in foreign context" arg, rather
than trying to set a bit in the exception code (which might be negative.)

Add a (T)hread info command to kernel debugger.

Location:
trunk/ccl/lisp-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/lisp-debug.c

    r7282 r7779  
    503503}
    504504
     505debug_command_return
     506debug_thread_info(ExceptionInformation *xp, siginfo_t *info, int arg)
     507{
     508  TCR * tcr = get_tcr(false);
     509 
     510  if (tcr) {
     511    area *vs_area = tcr->vs_area, *cs_area = tcr->cs_area;
     512
     513    fprintf(stderr, "Current Thread Context Record (tcr) = 0x%lx\n", tcr);
     514    fprintf(stderr, "Control (C) stack area:  low = 0x%lx, high = 0x%lx\n",
     515            cs_area->low, cs_area->high);
     516    fprintf(stderr, "Value (lisp) stack area: low = 0x%lx, high = 0x%lx\n",
     517            vs_area->low, vs_area->high);
     518    if (xp) {
     519      fprintf(stderr, "Exception stack pointer = 0x%lx\n",
     520#ifdef PPC
     521              xpGPR(xp,1)
     522#endif
     523#ifdef X86
     524              xpGPR(xp,Isp)
     525#endif
     526              );
     527    }
     528  }
     529  return debug_continue;
     530}
    505531     
    506532
     
    719745   NULL,
    720746   'B'},
     747  {debug_thread_info,
     748   "Show info about current thread",
     749   0,
     750   NULL,
     751   'T'},
    721752  {debug_win,
    722753   "Exit from this debugger, asserting that any exception was handled",
     
    817848              siginfo_t *info,
    818849              int why,
     850              Boolean in_foreign_code,
    819851              char *message,
    820852              ...)
     
    822854  va_list args;
    823855  debug_command_return state = debug_continue;
    824   int in_foreign_code = (why & debug_foreign_exception);
    825856
    826857  if (threads_initialized) {
     
    834865  if (in_foreign_code) {
    835866    fprintf(stderr, "Exception occurred while executing foreign code\n");
    836     why = (why & ~debug_foreign_exception);
    837867  }
    838868
     
    876906  vsnprintf(s, sizeof(s),format, args);
    877907  va_end(args);
    878   lisp_Debugger(xp, NULL, debug_entry_bug, s);
     908  lisp_Debugger(xp, NULL, debug_entry_bug, false, s);
    879909
    880910}
     
    889919  vsnprintf(s, sizeof(s),format, args);
    890920  va_end(args);
    891   lisp_Debugger(xp, NULL, debug_entry_bug | debug_foreign_exception , s);
     921  lisp_Debugger(xp, NULL, debug_entry_bug, true, s);
    892922
    893923}
  • trunk/ccl/lisp-kernel/lisp-exceptions.h

    r7282 r7779  
    4242
    4343OSStatus
    44 lisp_Debugger(ExceptionInformation *, siginfo_t *, int, char *, ...);
     44lisp_Debugger(ExceptionInformation *, siginfo_t *, int, Boolean, char *, ...);
    4545
    4646OSStatus
  • trunk/ccl/lisp-kernel/ppc-exceptions.c

    r7137 r7779  
    15491549        message = "Lisp Breakpoint";
    15501550      }
    1551       lisp_Debugger(xp, info, debug_entry_dbg, message);
     1551      lisp_Debugger(xp, info, debug_entry_dbg, false, message);
    15521552      return noErr;
    15531553    }
    15541554    if (the_trap == QUIET_LISP_BREAK_INSTRUCTION) {
    15551555      adjust_exception_pc(xp,4);
    1556       lisp_Debugger(xp, info, debug_entry_dbg, "Lisp Breakpoint");
     1556      lisp_Debugger(xp, info, debug_entry_dbg, false, "Lisp Breakpoint");
    15571557      return noErr;
    15581558    }
     
    17621762  wait_for_exception_lock_in_handler(tcr, context, &xframe_link);
    17631763  if ((noErr != PMCL_exception_handler(signum, context, tcr, info, old_valence))) {
     1764    Boolean foreign = (old_valence != TCR_STATE_LISP);
    17641765    char msg[512];
    17651766    snprintf(msg, sizeof(msg), "Unhandled exception %d at 0x%lx, context->regs at #x%lx", signum, xpPC(context), (natural)xpGPRvector(context));
    1766     if (lisp_Debugger(context, info, signum, msg)) {
     1767    if (lisp_Debugger(context, info, signum, foreign, msg)) {
    17671768      SET_TCR_FLAG(tcr,TCR_FLAG_BIT_PROPAGATE_EXCEPTION);
    17681769    }
  • trunk/ccl/lisp-kernel/x86-exceptions.c

    r7457 r7779  
    786786        case UUO_DEBUG_TRAP:
    787787          xpPC(context) = (natural) (program_counter+1);
    788           lisp_Debugger(context, info, debug_entry_dbg, "Lisp Breakpoint");
     788          lisp_Debugger(context, info, debug_entry_dbg, false, "Lisp Breakpoint");
    789789          return true;
    790790
     
    795795
    796796            get_lisp_string(xpGPR(context,Iarg_z),msg, sizeof(msg)-1);
    797             lisp_Debugger(context, info, debug_entry_dbg, msg);
     797            lisp_Debugger(context, info, debug_entry_dbg, false,  msg);
    798798          }
    799799          return true;
     
    963963  if (! handle_exception(signum, info, context, tcr, old_valence)) {
    964964    char msg[512];
    965     int foreign = (old_valence == TCR_STATE_LISP) ? 0 : debug_foreign_exception;
     965    Boolean foreign = (old_valence != TCR_STATE_LISP);
    966966
    967967    snprintf(msg, sizeof(msg), "Unhandled exception %d at 0x%lx, context->regs at #x%lx", signum, xpPC(context), (natural)xpGPRvector(context));
    968968   
    969     if (lisp_Debugger(context, info, signum | foreign, msg)) {
     969    if (lisp_Debugger(context, info, signum, foreign, msg)) {
    970970      SET_TCR_FLAG(tcr,TCR_FLAG_BIT_PROPAGATE_EXCEPTION);
    971971    }
Note: See TracChangeset for help on using the changeset viewer.