- The option "--vgdb-stop-at=event1,event2,..." allows the user
  to ask GDB server to stop before program execution, at the end
  of the program execution and on Valgrind internal errors.

- A new monitor command "v.set hostvisibility" that allows GDB server
  to provide access to Valgrind internal host status/memory.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13900 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c
index 3027a8c..45498d6 100644
--- a/coregrind/m_gdbserver/server.c
+++ b/coregrind/m_gdbserver/server.c
@@ -119,7 +119,6 @@
 void kill_request (const char *msg)
 {
    VG_(umsg) ("%s", msg);
-   remote_close();
    VG_(exit) (0);
 }
 
@@ -243,6 +242,8 @@
 "  v.info scheduler        : show valgrind thread state and stacktrace\n"
 "  v.info stats            : show various valgrind and tool stats\n"
 "  v.set debuglog <level>  : set valgrind debug log level to <level>\n"
+"  v.set hostvisibility [yes*|no] : (en/dis)ables access by gdb/gdbserver to\n"
+"    Valgrind internal host status/memory\n"
 "  v.translate <addr> [<traceflags>]  : debug translation of <addr> with <traceflags>\n"
 "    (default traceflags 0b00100000 : show after instrumentation)\n"
 "   An additional flag  0b100000000 allows to show gdbserver instrumentation\n");
@@ -253,7 +254,7 @@
       wcmd = strtok_r (NULL, " ", &ssaveptr);
       switch (kwdid = VG_(keyword_id) 
               ("vgdb-error debuglog merge-recursive-frames"
-               " gdb_output log_output mixed_output",
+               " gdb_output log_output mixed_output hostvisibility ",
                wcmd, kwd_report_all)) {
       case -2:
       case -1: 
@@ -305,6 +306,32 @@
          VG_(gdb_printf)
             ("valgrind output will go to log, interactive output will go to gdb\n");
          break;
+      case 6: /* hostvisibility */
+         wcmd = strtok_r (NULL, " ", &ssaveptr);
+         if (wcmd != NULL) {
+            switch (VG_(keyword_id) ("yes no", wcmd, kwd_report_all)) {
+            case -2:
+            case -1: break;
+            case  0: 
+               hostvisibility = True;
+               break;
+            case 1:
+               hostvisibility = False;
+               break;
+            default: tl_assert (0);
+            }
+         } else {
+            hostvisibility = True;
+         }
+         if (hostvisibility)
+            VG_(gdb_printf) 
+               ("Enabled access to Valgrind memory/status by GDB\n"
+                "If not yet done, tell GDB which valgrind file(s) to use:\n"
+                "add-symbol-file <tool or preloaded file> <loadaddr>\n");
+         else
+            VG_(gdb_printf)
+               ("Disabled access to Valgrind memory/status by GDB\n");
+         break;
       default:
          vg_assert (0);
       }