|
From: <sv...@va...> - 2015-03-28 12:23:15
|
Author: philippe
Date: Sat Mar 28 12:23:07 2015
New Revision: 15045
Log:
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.
Modified:
trunk/coregrind/m_gdbserver/server.c
Modified: trunk/coregrind/m_gdbserver/server.c
==============================================================================
--- trunk/coregrind/m_gdbserver/server.c (original)
+++ trunk/coregrind/m_gdbserver/server.c Sat Mar 28 12:23:07 2015
@@ -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");
|