The hint given by Valgrind gdbserver when enabling host visibility
in gdbserver was wrongly giving the file load address,
instead of the text segment address start.
This means that GDB was then showing wrong symbols for an address
(typically, symbols slightly before the address being printed).

This patch ensures the hint given is using the text start address.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15045 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c
index ecf3b42..9b30e67 100644
--- a/coregrind/m_gdbserver/server.c
+++ b/coregrind/m_gdbserver/server.c
@@ -331,7 +331,12 @@
          if (hostvisibility) {
             const DebugInfo *tooldi 
                = VG_(find_DebugInfo) ((Addr)handle_gdb_valgrind_command);
-            const NSegment *toolseg 
+            /* Normally, we should always find the tooldi. In case we
+               do not, suggest a 'likely somewhat working' address: */
+            const Addr tool_text_start
+               = tooldi ?
+               VG_(DebugInfo_get_text_avma) (tooldi) : 0x38000000;
+            const NSegment *toolseg
                = tooldi ?
                  VG_(am_find_nsegment) (VG_(DebugInfo_get_text_avma) (tooldi))
                  : NULL;
@@ -342,7 +347,7 @@
                 "add-symbol-file %s %p\n", 
                 toolseg ? VG_(am_get_filename)(toolseg)
                 : "<toolfile> <address> e.g.",
-                toolseg ? (void*)toolseg->start : (void*)0x38000000);
+                (void*)tool_text_start);
          } else
             VG_(gdb_printf)
                ("Disabled access to Valgrind memory/status by GDB\n");