]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Put VALGRIND_INTERNAL_PRINTF and VALGRIND_INTERNAL_PRINTF_BACKTRACE back in
authorNicholas Nethercote <n.nethercote@gmail.com>
Mon, 9 Aug 2004 11:15:10 +0000 (11:15 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Mon, 9 Aug 2004 11:15:10 +0000 (11:15 +0000)
vg_include.h, where they must be otherwise vg_libtpthread.c has problems.
Added a comment explaining why they must be in vg_include.h.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2576

coregrind/vg_include.h
coregrind/vg_messages.c

index 6e13616ab891dbc728c1589d44f1149fd3241373..9bcafac14bbc5d36c41e6c6cc41a5a5db333b81f 100644 (file)
@@ -1075,9 +1075,37 @@ extern void   VG_(env_remove_valgrind_env_stuff) ( Char** env );
 extern void VG_(send_bytes_to_logging_sink) ( Char* msg, Int nbytes );
 
 // Functions for printing from code within Valgrind, but which runs on the
-// sim'd CPU.
-int VALGRIND_INTERNAL_PRINTF           ( char *format, ... );
-int VALGRIND_INTERNAL_PRINTF_BACKTRACE ( char *format, ... );
+// sim'd CPU.  Defined here because needed for vg_libpthread.c,
+// vg_replace_malloc.c, plus the rest of the core.  The weak attribute
+// ensures the multiple definitions are not a problem.  They must be functions
+// rather than macros so that va_list can be used.
+
+__attribute__((weak))
+int
+VALGRIND_INTERNAL_PRINTF(char *format, ...)
+{
+   unsigned int _qzz_res = 0;
+   va_list vargs;
+   va_start(vargs, format);
+   VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF,
+                           (unsigned int)format, (unsigned int)vargs, 0, 0);
+   va_end(vargs);
+   return _qzz_res;
+}
+
+__attribute__((weak))
+int
+VALGRIND_INTERNAL_PRINTF_BACKTRACE(char *format, ...)
+{
+   unsigned int _qzz_res = 0;
+   va_list vargs;
+   va_start(vargs, format);
+   VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF_BACKTRACE,
+                           (unsigned int)format, (unsigned int)vargs, 0, 0);
+   va_end(vargs);
+   return _qzz_res;
+}
+
 
 
 /* ---------------------------------------------------------------------
index 948cdca1dc207f589def3571539f3d8b54b5be8d..5a19b0780fe326f656d4fe5e723c7d806b865b21 100644 (file)
@@ -126,29 +126,6 @@ void VG_(send_bytes_to_logging_sink) ( Char* msg, Int nbytes )
    }
 }
 
-int VALGRIND_INTERNAL_PRINTF(char *format, ...)
-{
-   unsigned int _qzz_res = 0;
-   va_list vargs;
-   va_start(vargs, format);
-   VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF,
-                           (unsigned int)format, (unsigned int)vargs, 0, 0);
-   va_end(vargs);
-   return _qzz_res;
-}
-
-int VALGRIND_INTERNAL_PRINTF_BACKTRACE(char *format, ...)
-{
-   unsigned int _qzz_res = 0;
-   va_list vargs;
-   va_start(vargs, format);
-   VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF_BACKTRACE,
-                           (unsigned int)format, (unsigned int)vargs, 0, 0);
-   va_end(vargs);
-   return _qzz_res;
-}
-
-
 /*--------------------------------------------------------------------*/
-/*--- end                                            vg_messages.c ---*/
+/*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/