This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[pushed 2/2] gdbserver/libthread_db: Don't ignore memory reading failures
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 29 Sep 2017 13:12:26 +0100
- Subject: [pushed 2/2] gdbserver/libthread_db: Don't ignore memory reading failures
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CF0514E047
If we had this in place before, then the regression fixed by the
previous commit would have been been visible is all test runs. E.g.:
Running src/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp ...
FAIL: gdb.threads/multi-create-ns-info-thr.exp: continue to breakpoint 6
Debugging manually we'd see this:
gdbserver: Cannot get thread handle for LWP 1467: generic error
Instead of:
gdbserver: PID mismatch! Expected 27472, got 27471
which is misleading - gdbserver didn't 27471, that was stale stack
data from previous function invocations.
gdb/gdbserver/ChangeLog:
2017-09-29 Pedro Alves <palves@redhat.com>
* proc-service.c (ps_pdread): Return PS_ERR if reading memory
fails.
---
gdb/gdbserver/ChangeLog | 5 +++++
gdb/gdbserver/proc-service.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index f27451d..0dbcae2 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
2017-09-29 Pedro Alves <palves@redhat.com>
+ * proc-service.c (ps_pdread): Return PS_ERR if reading memory
+ fails.
+
+2017-09-29 Pedro Alves <palves@redhat.com>
+
* linux-low.c (handle_extended_wait): Pass parent thread instead
of process to thread_db_notice_clone.
* linux-low.h (thread_db_notice_clone): Replace parent process
diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c
index 98d6acd..5b058fd 100644
--- a/gdb/gdbserver/proc-service.c
+++ b/gdb/gdbserver/proc-service.c
@@ -80,7 +80,8 @@ ps_err_e
ps_pdread (gdb_ps_prochandle_t ph, psaddr_t addr,
gdb_ps_read_buf_t buf, gdb_ps_size_t size)
{
- read_inferior_memory ((uintptr_t) addr, (gdb_byte *) buf, size);
+ if (read_inferior_memory ((uintptr_t) addr, (gdb_byte *) buf, size) != 0)
+ return PS_ERR;
return PS_OK;
}
--
2.5.5