|
From: <sv...@va...> - 2005-09-25 21:03:10
|
Author: njn
Date: 2005-09-25 22:03:07 +0100 (Sun, 25 Sep 2005)
New Revision: 4773
Log:
various tweaks
Modified:
branches/ASPACEM/coregrind/m_debuglog.c
branches/ASPACEM/coregrind/m_libcprint.c
Modified: branches/ASPACEM/coregrind/m_debuglog.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_debuglog.c 2005-09-25 19:53:15 UTC (rev =
4772)
+++ branches/ASPACEM/coregrind/m_debuglog.c 2005-09-25 21:03:07 UTC (rev =
4773)
@@ -48,6 +48,7 @@
=20
#include "pub_core_basics.h" /* basic types */
#include "pub_core_debuglog.h" /* our own iface */
+#include "valgrind.h" /* for RUNNING_ON_VALGRIND */
=20
/*------------------------------------------------------------*/
/*--- Stuff to make us completely independent. ---*/
@@ -61,15 +62,14 @@
{
UInt __res;
__asm__ volatile (
+ "pushl %%ebx\n" // ebx is callee-save
"movl $4, %%eax\n" /* %eax =3D __NR_write */
- "movl $2, %%edi\n" /* %edi =3D stderr */
+ "movl $1, %%ebx\n" /* %ebx =3D stderr */
"movl %1, %%ecx\n" /* %ecx =3D buf */
"movl %2, %%edx\n" /* %edx =3D n */
- "pushl %%ebx\n"
- "movl %%edi, %%ebx\n"
"int $0x80\n" /* write(stderr, buf, n) */
- "popl %%ebx\n"
"movl %%eax, %0\n" /* __res =3D eax */
+ "popl %%ebx\n" // restore ebx
: "=3Dmr" (__res)
: "g" (buf), "g" (n)
: "eax", "edi", "ecx", "edx"
@@ -586,11 +586,10 @@
const HChar* format, ... )
{
UInt ret, pid;
- Int indent;
+ Int indent, depth, i;
va_list vargs;
printf_buf buf;
=20
- =20
if (level > loglevel)
return;
=20
@@ -600,9 +599,14 @@
buf.n =3D 0;
buf.buf[0] =3D 0;
pid =3D local_sys_getpid();
-# ifdef ENABLE_INNER
- (void)myvprintf_str ( add_to_buf, &buf, 0, 1, ">", False );
-# endif
+
+ // Print one '>' in front of the messages for each level of self-host=
ing
+ // being performed.
+ depth =3D RUNNING_ON_VALGRIND;
+ for (i =3D 0; i < depth; i++) {
+ (void)myvprintf_str ( add_to_buf, &buf, 0, 1, ">", False );
+ }
+ =20
(void)myvprintf_str ( add_to_buf, &buf, 0, 2, "--", False );
(void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, (ULong)pid );
(void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False );
Modified: branches/ASPACEM/coregrind/m_libcprint.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_libcprint.c 2005-09-25 19:53:15 UTC (rev=
4772)
+++ branches/ASPACEM/coregrind/m_libcprint.c 2005-09-25 21:03:07 UTC (rev=
4773)
@@ -283,10 +283,9 @@
=20
UInt VG_(vmessage) ( VgMsgKind kind, const HChar* format, va_list vargs =
)
{
- UInt count =3D 0;
- Char c;
- const Char* pfx_s;
- static const Char pfx[] =3D ">>>>>>>>>>>>>>>>";
+ UInt count =3D 0;
+ Char c;
+ Int i, depth;
=20
switch (kind) {
case Vg_UserMsg: c =3D '=3D'; break;
@@ -296,16 +295,15 @@
default: c =3D '?'; break;
}
=20
- // The pfx trick prints one or more '>' characters in front of the
- // messages when running Valgrind under Valgrind, one per level of
- // self-hosting.
- pfx_s =3D &pfx[sizeof(pfx)-1-RUNNING_ON_VALGRIND],
-
- // Print the message
- count =3D 0;
-
+ // Print one '>' in front of the messages for each level of self-host=
ing
+ // being performed.
+ depth =3D RUNNING_ON_VALGRIND;
+ for (i =3D 0; i < depth; i++) {
+ count +=3D VG_(printf) (">");
+ }
+ =20
if (!VG_(clo_xml))
- count +=3D VG_(printf) ("%s%c%c", pfx_s, c,c);
+ count +=3D VG_(printf) ("%c%c", c,c);
=20
if (VG_(clo_time_stamp)) {
HChar buf[50];
|