Index: /branches/qres/ccl/lisp-kernel/lisp-debug.c
===================================================================
--- /branches/qres/ccl/lisp-kernel/lisp-debug.c	(revision 13866)
+++ /branches/qres/ccl/lisp-kernel/lisp-debug.c	(revision 13867)
@@ -300,4 +300,37 @@
 	  dsisr & (1<<27) ? "protected" : "unmapped",
 	  addr);
+#elif defined(WINDOWS)
+#else
+  fprintf(dbgout, "received signal %d; faulting address: %p\n",
+	  info->si_signo, info->si_addr);
+  if (info->si_code > 0) {
+    if (info->si_signo == SIGSEGV) {
+      switch (info->si_code) {
+      case SEGV_MAPERR:
+	fprintf(dbgout, "address not mapped to object\n");
+	break;
+      case SEGV_ACCERR:
+	fprintf(dbgout, "invalid permissions for mapped object\n");
+	break;
+      default:
+	fprintf(dbgout, "unexpected si_code value: %d\n", info->si_code);
+	break;
+      }
+    } else if (info->si_signo == SIGBUS) {
+      switch (info->si_code) {
+      case BUS_ADRALN:
+	fprintf(dbgout, "invalid address alignment\n");
+	break;
+      case BUS_ADRERR:
+	fprintf(dbgout, "non-existent physical address");
+	break;
+      case BUS_OBJERR:
+	fprintf(dbgout, "object-specific hardware error");
+	break;
+      default:
+	fprintf(dbgout, "unexpected si_code value: %d\n", info->si_code);
+      }
+    }
+  }
 #endif
 }
@@ -505,4 +538,42 @@
 #endif
 
+char *
+area_code_name(int code)
+{
+  switch (code) {
+    case AREA_VOID: return "void";
+    case AREA_CSTACK: return "cstack";
+    case AREA_VSTACK: return "vstack";
+    case AREA_TSTACK: return "tstack";
+    case AREA_READONLY: return "readonly";
+    case AREA_WATCHED: return "watched";
+#if 0
+    /* not in qres branch yet */
+    case AREA_STATIC_CONS: return "static cons";
+#endif
+    case AREA_MANAGED_STATIC: return "managed static";
+    case AREA_STATIC: return "static";
+    case AREA_DYNAMIC: return "dynamic";
+    default: return "unknown";
+  }
+}
+
+debug_command_return
+debug_memory_areas(ExceptionInformation *xp, siginfo_t *info, int arg)
+{
+  int i;
+  area *a, *header = all_areas;
+  char label[100];
+
+  fprintf(dbgout, "Lisp memory areas:\n");
+  fprintf(dbgout, "%20s %20s %20s\n", "code", "low", "high");
+  for (a = header->succ; a != header; a = a->succ) {
+    snprintf(label, sizeof(label), "%s (%d)", area_code_name(a->code),
+	     a->code >> fixnumshift);
+    fprintf(dbgout, "%20s %20p %20p\n", label, a->low, a->high);
+  }
+  return debug_continue;
+}
+
 debug_command_return
 debug_lisp_registers(ExceptionInformation *xp, siginfo_t *info, int arg)
@@ -610,4 +681,13 @@
     break;
   }
+#else
+  switch (arg) {
+  case SIGSEGV:
+  case SIGBUS:
+    describe_memfault(xp, info);
+    break;
+  default:
+    break;
+  }
 #endif
   return debug_continue;
@@ -995,4 +1075,5 @@
    NULL,
    'A'},
+#endif
   {debug_identify_exception,
    "Describe the current exception in greater detail",
@@ -1001,5 +1082,4 @@
    NULL,
    'D'},
-#endif
   {debug_show_registers, 
    "Show raw GPR/SPR register values", 
@@ -1032,4 +1112,9 @@
    NULL,
    'T'},
+  {debug_memory_areas,
+   "Show memory areas",
+   0,
+   NULL,
+   'M'},
   {debug_win,
    "Exit from this debugger, asserting that any exception was handled",
@@ -1191,4 +1276,5 @@
       debug_show_fpu(xp, info, 0);
     }
+    debug_memory_areas(xp, info, 0);
     debug_backtrace(xp, info, 0);
     abort();
@@ -1246,5 +1332,4 @@
   va_end(args);
   lisp_Debugger(xp, NULL, debug_entry_bug, true, s);
-
 }
 
Index: /branches/qres/ccl/lisp-kernel/x86-exceptions.c
===================================================================
--- /branches/qres/ccl/lisp-kernel/x86-exceptions.c	(revision 13866)
+++ /branches/qres/ccl/lisp-kernel/x86-exceptions.c	(revision 13867)
@@ -1549,5 +1549,5 @@
 #if 1
   if (tcr->valence != TCR_STATE_LISP) {
-    FBug(context, "exception in foreign context");
+    lisp_Debugger(context, info, signum, true, "exception in foreign context");
   }
 #endif
@@ -1583,5 +1583,5 @@
 #if 1
   if (tcr->valence != TCR_STATE_LISP) {
-    FBug(context, "exception in foreign context");
+    lisp_Debugger(context, info, signum, true, "exception in foreign context");
   }
 #endif
