Skip to contentSkip to conversation

xen: stringify assertion condition for printing sooner

PATCH In review Ian Campbell 3 participants 3 messages Jan 17, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: stringify assertion condition for printing sooner

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1295273568 0
# Node ID 711cbaa038cae8c03cf825165d2e07b0a3c94f89 # Parent 92e51f0053b5f5c05aa0e4948f6c35be364be11c
xen: stringify assertion condition for printing sooner.

So that:
(XEN) Assertion '!(((*({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"(&per_cpu____preempt_count)); (typeof(&per_cpu____preempt_count)) (__ptr + (get_cpu_info()->per_cpu_offset)); }))) || ((irq_stat[(((get_cpu_info()->processor_id)1... becomes:
(XEN) Assertion '"!in_atomic()"' failed at softirq.c:61

xen/include/xen/lib.h +1 -1
diff -r 92e51f0053b5 -r 711cbaa038ca xen/include/xen/lib.h
@@ -35,7 +35,7 @@ do {                                    
 
 #ifndef NDEBUG
 #define ASSERT(p) \
-    do { if ( unlikely(!(p)) ) assert_failed(p); } while (0)
+    do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)
 #else
 #define ASSERT(p) ((void)0)
 #endif
#1 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1295273568 0
# Node ID 711cbaa038cae8c03cf825165d2e07b0a3c94f89 # Parent 92e51f0053b5f5c05aa0e4948f6c35be364be11c
xen: stringify assertion condition for printing sooner.

So that:
(XEN) Assertion '!(((*({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) :
"0"(&per_cpu____preempt_count)); (typeof(&per_cpu____preempt_count)) (__ptr + (get_cpu_info()->per_cpu_offset)); }))) || ((irq_stat[(((get_cpu_info()->processor_id)1...
becomes:
(XEN) Assertion '"!in_atomic()"' failed at softirq.c:61

Quoted 1 line

I was about to put together something similar after I saw this ugly beast.

xen/include/xen/lib.h do { · line 41

Quoted 12 lines

diff -r 92e51f0053b5 -r 711cbaa038ca xen/include/xen/lib.h

xen/include/xen/lib.h +1 -1
@@ -35,7 +35,7 @@ do {                                    
 
 #ifndef NDEBUG
 #define ASSERT(p) \
-    do { if ( unlikely(!(p)) ) assert_failed(p); } while (0)
+    do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)
 #else
 #define ASSERT(p) ((void)0)
 #endif

But then you should also remove the second stringification in include/asm-x86/bug.h:assert_failed(), so that it becomes

(XEN) Assertion '!in_atomic()' failed at softirq.c:61

Jan

#2 lore raw
Quoted 17 lines · Jan Beulich

xen/include/xen/lib.h Mon Jan 17 14:12:48 2011 +0000 do { · line 41

Quoted 13 lines

diff -r 92e51f0053b5 -r 711cbaa038ca xen/include/xen/lib.h

xen/include/xen/lib.h Mon Jan 17 14:12:48 2011 +0000 renamed from xen/include/xen/lib.h Mon Jan 17 11:43:46 2011 +0000 +1 -1
@@ -35,7 +35,7 @@ do {
 
 #ifndef NDEBUG
 #define ASSERT(p) \
-    do { if ( unlikely(!(p)) ) assert_failed(p); } while (0)
+    do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)
 #else
 #define ASSERT(p) ((void)0)
 #endif

But then you should also remove the second stringification in include/asm-x86/bug.h:assert_failed(), so that it becomes

Quoted 1 line

(XEN) Assertion '!in_atomic()' failed at softirq.c:61

I'll give the patch a spin and modify as necessary before I check it in.

-- Keir

Quoted 7 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel