Ignore:
Timestamp:
Jun 21, 2010, 7:24:08 PM (9 years ago)
Author:
rme
Message:

From trunk:

  • new kernel debugger command "M" to show lisp memory areas; if in batch mode, run it before aborting
  • when we get a surprise memory fault, try to show the faulting address
Location:
branches/qres/ccl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/qres/ccl

  • branches/qres/ccl/lisp-kernel/lisp-debug.c

    r13096 r13867  
    300300          dsisr & (1<<27) ? "protected" : "unmapped",
    301301          addr);
     302#elif defined(WINDOWS)
     303#else
     304  fprintf(dbgout, "received signal %d; faulting address: %p\n",
     305          info->si_signo, info->si_addr);
     306  if (info->si_code > 0) {
     307    if (info->si_signo == SIGSEGV) {
     308      switch (info->si_code) {
     309      case SEGV_MAPERR:
     310        fprintf(dbgout, "address not mapped to object\n");
     311        break;
     312      case SEGV_ACCERR:
     313        fprintf(dbgout, "invalid permissions for mapped object\n");
     314        break;
     315      default:
     316        fprintf(dbgout, "unexpected si_code value: %d\n", info->si_code);
     317        break;
     318      }
     319    } else if (info->si_signo == SIGBUS) {
     320      switch (info->si_code) {
     321      case BUS_ADRALN:
     322        fprintf(dbgout, "invalid address alignment\n");
     323        break;
     324      case BUS_ADRERR:
     325        fprintf(dbgout, "non-existent physical address");
     326        break;
     327      case BUS_OBJERR:
     328        fprintf(dbgout, "object-specific hardware error");
     329        break;
     330      default:
     331        fprintf(dbgout, "unexpected si_code value: %d\n", info->si_code);
     332      }
     333    }
     334  }
    302335#endif
    303336}
     
    505538#endif
    506539
     540char *
     541area_code_name(int code)
     542{
     543  switch (code) {
     544    case AREA_VOID: return "void";
     545    case AREA_CSTACK: return "cstack";
     546    case AREA_VSTACK: return "vstack";
     547    case AREA_TSTACK: return "tstack";
     548    case AREA_READONLY: return "readonly";
     549    case AREA_WATCHED: return "watched";
     550#if 0
     551    /* not in qres branch yet */
     552    case AREA_STATIC_CONS: return "static cons";
     553#endif
     554    case AREA_MANAGED_STATIC: return "managed static";
     555    case AREA_STATIC: return "static";
     556    case AREA_DYNAMIC: return "dynamic";
     557    default: return "unknown";
     558  }
     559}
     560
     561debug_command_return
     562debug_memory_areas(ExceptionInformation *xp, siginfo_t *info, int arg)
     563{
     564  int i;
     565  area *a, *header = all_areas;
     566  char label[100];
     567
     568  fprintf(dbgout, "Lisp memory areas:\n");
     569  fprintf(dbgout, "%20s %20s %20s\n", "code", "low", "high");
     570  for (a = header->succ; a != header; a = a->succ) {
     571    snprintf(label, sizeof(label), "%s (%d)", area_code_name(a->code),
     572             a->code >> fixnumshift);
     573    fprintf(dbgout, "%20s %20p %20p\n", label, a->low, a->high);
     574  }
     575  return debug_continue;
     576}
     577
    507578debug_command_return
    508579debug_lisp_registers(ExceptionInformation *xp, siginfo_t *info, int arg)
     
    610681    break;
    611682  }
     683#else
     684  switch (arg) {
     685  case SIGSEGV:
     686  case SIGBUS:
     687    describe_memfault(xp, info);
     688    break;
     689  default:
     690    break;
     691  }
    612692#endif
    613693  return debug_continue;
     
    9951075   NULL,
    9961076   'A'},
     1077#endif
    9971078  {debug_identify_exception,
    9981079   "Describe the current exception in greater detail",
     
    10011082   NULL,
    10021083   'D'},
    1003 #endif
    10041084  {debug_show_registers,
    10051085   "Show raw GPR/SPR register values",
     
    10321112   NULL,
    10331113   'T'},
     1114  {debug_memory_areas,
     1115   "Show memory areas",
     1116   0,
     1117   NULL,
     1118   'M'},
    10341119  {debug_win,
    10351120   "Exit from this debugger, asserting that any exception was handled",
     
    11911276      debug_show_fpu(xp, info, 0);
    11921277    }
     1278    debug_memory_areas(xp, info, 0);
    11931279    debug_backtrace(xp, info, 0);
    11941280    abort();
     
    12461332  va_end(args);
    12471333  lisp_Debugger(xp, NULL, debug_entry_bug, true, s);
    1248 
    12491334}
    12501335
  • branches/qres/ccl/lisp-kernel/x86-exceptions.c

    r13070 r13867  
    15491549#if 1
    15501550  if (tcr->valence != TCR_STATE_LISP) {
    1551     FBug(context, "exception in foreign context");
     1551    lisp_Debugger(context, info, signum, true, "exception in foreign context");
    15521552  }
    15531553#endif
     
    15831583#if 1
    15841584  if (tcr->valence != TCR_STATE_LISP) {
    1585     FBug(context, "exception in foreign context");
     1585    lisp_Debugger(context, info, signum, true, "exception in foreign context");
    15861586  }
    15871587#endif
Note: See TracChangeset for help on using the changeset viewer.