From patchwork Fri Sep 29 12:12:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 23228 Received: (qmail 108112 invoked by alias); 29 Sep 2017 12:21:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 106824 invoked by uid 89); 29 Sep 2017 12:21:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1873 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Sep 2017 12:21:23 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF0514E047 for ; Fri, 29 Sep 2017 12:12:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CF0514E047 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@redhat.com Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CFE8627D9 for ; Fri, 29 Sep 2017 12:12:28 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed 2/2] gdbserver/libthread_db: Don't ignore memory reading failures Date: Fri, 29 Sep 2017 13:12:26 +0100 Message-Id: <1506687146-31225-2-git-send-email-palves@redhat.com> 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 * 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 + * proc-service.c (ps_pdread): Return PS_ERR if reading memory + fails. + +2017-09-29 Pedro Alves + * 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; }