Added new assert macros vg_assert2 and tl_assert2 which allow you to print a
string explaining more detail if the assertion fails (eg. the value of the
bogus variable) using printf-style format arguments.

One consequence of this is that you can do something like
 
  vg_assert2(0, "bad bad bad");

instead of calling VG_(core_panic).  The advantage of the new approach is
that it shows the file/function/line info for the failing code, whereas
VG_(core_panic)() does not.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3528 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/core.h b/coregrind/core.h
index 0d4da65..40d65a4 100644
--- a/coregrind/core.h
+++ b/coregrind/core.h
@@ -782,18 +782,25 @@
 
 // Useful for making failing stubs, when certain things haven't yet been
 // implemented.
-#define I_die_here                                                    \
-   VG_(core_assert_fail) ("Unimplemented functionality",              \
-                           __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define I_die_here                                             \
+   VG_(assert_fail) ("Unimplemented functionality",            \
+                     __FILE__, __LINE__, __PRETTY_FUNCTION__,  \
+                     "valgrind", VG_BUGS_TO, "")
 
-#define vg_assert(expr)                                               \
-  ((void) ((expr) ? 0 :						      \
-	   (VG_(core_assert_fail) (VG_STRINGIFY(expr),	              \
-			           __FILE__, __LINE__,                \
-                                   __PRETTY_FUNCTION__), 0)))
-__attribute__ ((__noreturn__))
-extern void VG_(core_assert_fail) ( const Char* expr, const Char* file, 
-                                    Int line, const Char* fn );
+#define vg_assert(expr)                                                 \
+  ((void) ((expr) ? 0 :                                                 \
+           (VG_(assert_fail) (/*isCore*/True, VG_STRINGIFY(expr),       \
+                              __FILE__, __LINE__, __PRETTY_FUNCTION__,  \
+                              ""),                                      \
+                              0)))
+
+#define vg_assert2(expr, format, args...)                               \
+  ((void) ((expr) ? 0 :                                                 \
+           (VG_(assert_fail) (/*isCore*/True, VG_STRINGIFY(expr),       \
+                              __FILE__, __LINE__, __PRETTY_FUNCTION__,  \
+                              format, ##args),                          \
+                              0)))
+
 __attribute__ ((__noreturn__))
 extern void  VG_(core_panic)      ( Char* str );
 __attribute__ ((__noreturn__))