This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 14/16 v2] Suppress spurious warnings with extended-remote follow exec
- From: Don Breazeal <donb at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 20 Aug 2014 17:29:22 -0700
- Subject: [PATCH 14/16 v2] Suppress spurious warnings with extended-remote follow exec
- Authentication-results: sourceware.org; auth=none
- References: <1407434395-19089-1-git-send-email-donb at codesourcery dot com>
This patch eliminates some spurious gdbserver warnings that occur when
following an exec on an extended-remote Linux target.
When gdbserver on Linux sets up the hook for shared library load
detection, an initial step is to read the version number from the
r_debug structure in memory. In the current implementation, if the
version number is not equal to one, a warning was printed by gdbserver.
However, the number can be zero if the structure has not been
initialized yet.
To suppress the warnings the error check was changed so that if
the version number is not equal to one the function silently returns
-1. Subsequent calls to the routine find an initialized r_debug
structure.
Tested on x64 Ubuntu, both GDB tests and manual testing of following
an exec, then debugging a shared library loaded by the exec'd program
to ensure that there were no warnings and that debugging shared libs
was not adversely affected.
Thanks
--Don
gdb/gdbserver/
2014-08-20 Don Breazeal <donb@codesourcery.com>
* linux-low.c (linux_qxfer_libraries_svr4): Change
handling of r_debug version mismatch.
---
gdb/gdbserver/linux-low.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index f8bab6c..6be78a7 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6226,10 +6226,15 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
{
if (linux_read_memory (priv->r_debug + lmo->r_version_offset,
(unsigned char *) &r_version,
- sizeof (r_version)) != 0
- || r_version != 1)
+ sizeof (r_version)) != 0)
+ warning ("error reading r_debug version from memory");
+ else if (r_version != 1)
{
- warning ("unexpected r_debug version %d", r_version);
+ /* If the version is incorrect, it probably means that
+ r_debug hasn't been initialized yet. Just silently
+ return an error. We will read it in a subsequent pass
+ through here. */
+ return -1;
}
else if (read_one_ptr (priv->r_debug + lmo->r_map_offset,
&lm_addr, ptr_size) != 0)
--
1.7.0.4