return;
}
-
-/* Publically visible from here onwards. */
-
-int
-VG_(add_to_msg) ( const Char *format, ... )
+int add_to_msg ( const Char *format, ... )
{
int count;
va_list vargs;
return count;
}
-int VG_(vmessage) ( VgMsgKind kind, const Char* format, va_list vargs )
-{
- int count;
- count = VG_(start_msg) ( kind );
- count += VG_(vprintf) ( add_to_buf, format, vargs, 0 );
- count += VG_(end_msg)();
- return count;
-}
-
-/* Send a simple single-part message. */
-int VG_(message) ( VgMsgKind kind, const Char* format, ... )
-{
- int count;
- va_list vargs;
- va_start(vargs,format);
- count = VG_(vmessage) ( kind, format, vargs );
- va_end(vargs);
- return count;
-}
-
-int VG_(start_msg) ( VgMsgKind kind )
+int start_msg ( VgMsgKind kind )
{
Char ts[32];
Char c;
static const Char pfx[] = ">>>>>>>>>>>>>>>>";
vg_n_mbuf = 0;
vg_mbuf[vg_n_mbuf] = 0;
+
if (VG_(clo_time_stamp))
add_timestamp(ts);
else
case Vg_ClientMsg: c = '*'; break;
default: c = '?'; break;
}
- return VG_(add_to_msg)( "%s%c%c%s%d%c%c ",
- &pfx[sizeof(pfx)-1-RUNNING_ON_VALGRIND],
- c,c, ts, VG_(getpid)(), c,c );
+ // The pfx trick prints one or more '>' characters in front of the
+ // messages when running Valgrind under Valgrind, one per level of
+ // self-hosting.
+ return add_to_msg( "%s%c%c%s%d%c%c ",
+ &pfx[sizeof(pfx)-1-RUNNING_ON_VALGRIND],
+ c,c, ts, VG_(getpid)(), c,c );
}
-
-int VG_(end_msg) ( void )
+int end_msg ( void )
{
int count = 0;
if (VG_(clo_log_fd) >= 0) {
add_to_buf('\n',0);
- VG_(send_bytes_to_logging_sink) (
- vg_mbuf, VG_(strlen)(vg_mbuf) );
+ VG_(send_bytes_to_logging_sink) ( vg_mbuf, VG_(strlen)(vg_mbuf) );
count = 1;
}
return count;
}
+int VG_(vmessage) ( VgMsgKind kind, const Char* format, va_list vargs )
+{
+ int count;
+ count = start_msg ( kind );
+ count += VG_(vprintf) ( add_to_buf, format, vargs, 0 );
+ count += end_msg();
+ return count;
+}
+
+/* Send a simple single-part message. */
+int VG_(message) ( VgMsgKind kind, const Char* format, ... )
+{
+ int count;
+ va_list vargs;
+ va_start(vargs,format);
+ count = VG_(vmessage) ( kind, format, vargs );
+ va_end(vargs);
+ return count;
+}
/* Do the low-level send of a message to the logging sink. */
void VG_(send_bytes_to_logging_sink) ( Char* msg, Int nbytes )
}
VgMsgKind;
-/* Functions for building a message from multiple parts. */
-extern int VG_(start_msg) ( VgMsgKind kind );
-extern int VG_(add_to_msg) ( const Char* format, ... );
-/* Ends and prints the message. Appends a newline. */
-extern int VG_(end_msg) ( void );
-
/* Send a single-part message. Appends a newline. */
extern int VG_(message) ( VgMsgKind kind, const Char* format, ... );
extern int VG_(vmessage) ( VgMsgKind kind, const Char* format, va_list vargs );