From: Philippe Waroquiers Date: Sat, 28 Mar 2015 12:23:07 +0000 (+0000) Subject: The hint given by Valgrind gdbserver when enabling host visibility X-Git-Tag: svn/VALGRIND_3_11_0~547 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9f88907231334d2f2b38f4b8b13cd52ffefd951;p=thirdparty%2Fvalgrind.git 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 --- diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index ecf3b42728..9b30e678a5 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -331,7 +331,12 @@ int handle_gdb_valgrind_command (char *mon, OutputSink *sink_wanted_at_return) 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 @@ int handle_gdb_valgrind_command (char *mon, OutputSink *sink_wanted_at_return) "add-symbol-file %s %p\n", toolseg ? VG_(am_get_filename)(toolseg) : "
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");