Message ID | 1456867658-10937-5-git-send-email-pfeiner@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
subject should be "[kvm-unit-tests 4/5] lib: dump stack on failed assert()" On Tue, Mar 1, 2016 at 1:27 PM, Peter Feiner <pfeiner@google.com> wrote: > Signed-off-by: Peter Feiner <pfeiner@google.com> > --- > lib/libcflat.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lib/libcflat.h b/lib/libcflat.h > index 42c94df..1798716 100644 > --- a/lib/libcflat.h > +++ b/lib/libcflat.h > @@ -77,10 +77,12 @@ void dump_current_stack(void); > > #define assert(cond) \ > do { \ > - if (!(cond)) \ > + if (!(cond)) { \ > printf("%s:%d: assert failed: %s\n", \ > - __FILE__, __LINE__, #cond), \ > + __FILE__, __LINE__, #cond); \ > + dump_current_stack(); \ > abort(); \ > + } \ > } while (0) > > #endif > -- > 2.7.0.rc3.207.g0ac5344 > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/lib/libcflat.h b/lib/libcflat.h index 42c94df..1798716 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -77,10 +77,12 @@ void dump_current_stack(void); #define assert(cond) \ do { \ - if (!(cond)) \ + if (!(cond)) { \ printf("%s:%d: assert failed: %s\n", \ - __FILE__, __LINE__, #cond), \ + __FILE__, __LINE__, #cond); \ + dump_current_stack(); \ abort(); \ + } \ } while (0) #endif
Signed-off-by: Peter Feiner <pfeiner@google.com> --- lib/libcflat.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)