diff mbox

[kvm-unit-tests,v5,3/5] lib: dump stack on failed assert()

Message ID 844e4178b18ab775ab00f45cfa2740d645d0ee6c.1457372594.git.pfeiner@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Feiner March 7, 2016, 5:46 p.m. UTC
Signed-off-by: Peter Feiner <pfeiner@google.com>
---
 lib/libcflat.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/lib/libcflat.h b/lib/libcflat.h
index 55bddca..df50615 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -92,10 +92,12 @@  extern void dump_frame_stack(const void *instruction, const void *frame);
 
 #define assert(cond)							\
 do {									\
-	if (!(cond))							\
+	if (!(cond)) {							\
 		printf("%s:%d: assert failed: %s\n",			\
-		       __FILE__, __LINE__, #cond),			\
+		       __FILE__, __LINE__, #cond);			\
+		dump_stack();						\
 		abort();						\
+	}								\
 } while (0)
 
 #endif