WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [PATCH] Print backtrace on BUG

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [PATCH] Print backtrace on BUG
From: Amos Waterland <apw@xxxxxxxxxx>
Date: Wed, 20 Sep 2006 23:41:54 -0400
Delivery-date: Wed, 20 Sep 2006 20:42:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
This makes Xen/PPC dump a backtrace when a BUG() is triggered.

Signed-off-by: Amos Waterland <apw@xxxxxxxxxx>

---

 config.h |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff -r 5418062d2da8 xen/include/asm-powerpc/powerpc64/config.h
--- a/xen/include/asm-powerpc/powerpc64/config.h
+++ b/xen/include/asm-powerpc/powerpc64/config.h
@@ -38,7 +38,15 @@
 
 #ifndef __ASSEMBLY__
 
-#define FORCE_CRASH() __asm__ __volatile__ ( "trap" )
+#define FORCE_CRASH()                                                     \
+do {                                                                      \
+    unsigned long sp, lr, pc, tp;                                         \
+    asm("mr %0, 1" : "=r" (sp));                                          \
+    asm("mflr %0" : "=r" (lr));                                           \
+    asm("mflr %0; bl 1f; 1: mflr %1; mtlr %0" : "=r" (tp), "=r" (pc));    \
+    show_backtrace(sp, lr, pc);                                           \
+    __asm__ __volatile__ ( "trap" );                                      \
+} while ( 0 )
 
 #endif /* __ASSEMBLY__ */
 

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>