From 7b640433e488bc78b84b2dd06b5f0e0526b79cf8 Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland@gnu.org>
Date: Mon, 8 Nov 1999 21:59:49 +0000
Subject: 1999-11-08  Roland McGrath  <roland@baalperazim.frob.com>

	* disk-pager.c (fault_handler): Put more detail in assert failures.
---
 libdiskfs/disk-pager.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/libdiskfs/disk-pager.c b/libdiskfs/disk-pager.c
index 283be7f1..b5ae53a1 100644
--- a/libdiskfs/disk-pager.c
+++ b/libdiskfs/disk-pager.c
@@ -1,5 +1,5 @@
 /* Map the disk image and handle faults accessing it.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
    Written by Roland McGrath.
 
    This program is free software; you can redistribute it and/or
@@ -40,7 +40,7 @@ service_paging_requests (any_t arg)
   for (;;)
     ports_manage_port_operations_multithread (pager_bucket,
 					      pager_demuxer,
-					      1000 * 60 * 2, 
+					      1000 * 60 * 2,
 					      1000 * 60 * 10, 0);
 }
 
@@ -90,7 +90,21 @@ fault_handler (int sig, long int sigcode, struct sigcontext *scp)
   jmp_buf *env = cthread_data (cthread_self ());
   error_t err;
 
-  assert (env && "unexpected fault on disk image");
+#ifndef NDEBUG
+  if (!env)
+    {
+      error (0, 0,
+	     "BUG: unexpected fault on disk image (%d, %#lx) in [%#lx,%#lx)"
+	     " eip %#x err %#x",
+	     sig, sigcode,
+	     preemptor.first, preemptor.last,
+	     scp->sc_eip, scp->sc_error);
+      assert (scp->sc_error == EKERN_MEMORY_ERROR);
+      err = pager_get_error (diskfs_disk_pager, sigcode);
+      assert (err);
+      assert_perror (err);
+    }
+#endif
 
   /* Clear the record, since the faulting thread will not.  */
   cthread_set_data (cthread_self (), 0);
-- 
cgit v1.2.3