This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c
index 2cde3d9..48d5caf 100644
--- a/coregrind/m_debuglog.c
+++ b/coregrind/m_debuglog.c
@@ -48,6 +48,7 @@
 
 #include "pub_core_basics.h"     /* basic types */
 #include "pub_core_debuglog.h"   /* our own iface */
+#include "valgrind.h"            /* for RUNNING_ON_VALGRIND */
 
 /*------------------------------------------------------------*/
 /*--- 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 = __NR_write */
-      "movl  $2, %%edi\n"    /* %edi = stderr */
+      "movl  $1, %%ebx\n"    /* %ebx = stderr */
       "movl  %1, %%ecx\n"    /* %ecx = buf */
       "movl  %2, %%edx\n"    /* %edx = n */
-      "pushl %%ebx\n"
-      "movl  %%edi, %%ebx\n"
       "int   $0x80\n"        /* write(stderr, buf, n) */
-      "popl  %%ebx\n"
       "movl  %%eax, %0\n"    /* __res = eax */
+      "popl  %%ebx\n"        // restore ebx
       : "=mr" (__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;
 
-   
    if (level > loglevel)
       return;
 
@@ -600,6 +599,14 @@
    buf.n = 0;
    buf.buf[0] = 0;
    pid = local_sys_getpid();
+
+   // Print one '>' in front of the messages for each level of self-hosting
+   // being performed.
+   depth = RUNNING_ON_VALGRIND;
+   for (i = 0; i < depth; i++) {
+      (void)myvprintf_str ( add_to_buf, &buf, 0, 1, ">", False );
+   }
+   
    (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 );