From patchwork Tue Mar 1 16:45:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11157 Received: (qmail 14038 invoked by alias); 1 Mar 2016 16:45:21 -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 13962 invoked by uid 89); 1 Mar 2016 16:45:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=phdr, at_entry, AT_ENTRY, Hx-languages-length:2319 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 01 Mar 2016 16:45:17 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 9F0CD201 for ; Tue, 1 Mar 2016 16:45:15 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u21GjDK1004565 for ; Tue, 1 Mar 2016 11:45:15 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 1/2] Fix PR gdb/19676: Disable displaced stepping if /proc not mounted Date: Tue, 1 Mar 2016 16:45:12 +0000 Message-Id: <1456850713-5745-2-git-send-email-palves@redhat.com> In-Reply-To: <1456850713-5745-1-git-send-email-palves@redhat.com> References: <1456850713-5745-1-git-send-email-palves@redhat.com> On GNU/Linux archs that support displaced stepping, if /proc is not mounted, GDB gets stuck not able to step past breakpoints: (gdb) c Continuing. dl_main (phdr=, phnum=, user_entry=, auxv=) at rtld.c:2163 2163 LIBC_PROBE (init_complete, 2, LM_ID_BASE, r); Cannot find AT_ENTRY auxiliary vector entry. (gdb) c Continuing. dl_main (phdr=, phnum=, user_entry=, auxv=) at rtld.c:2163 2163 LIBC_PROBE (init_complete, 2, LM_ID_BASE, r); Cannot find AT_ENTRY auxiliary vector entry. (gdb) That's because GDB can't figure out where the scratch pad is. This is a regression introduced by the earlier changes to make the Linux native target always work in non-stop mode. This commit makes GDB detect the case and fallback to stepping over breakpoints in-line. gdb/ChangeLog: 2016-03-01 Pedro Alves PR gdb/19676 * infrun.c (displaced_step_prepare): Also disable displaced stepping on NOT_SUPPORTED_ERROR. * linux-tdep.c (linux_displaced_step_location): If reading auxv fails, throw NOT_SUPPORTED_ERROR instead of generic error. --- gdb/infrun.c | 3 ++- gdb/linux-tdep.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 3e8c9e0..696105d 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1894,7 +1894,8 @@ displaced_step_prepare (ptid_t ptid) { struct displaced_step_inferior_state *displaced_state; - if (ex.error != MEMORY_ERROR) + if (ex.error != MEMORY_ERROR + && ex.error != NOT_SUPPORTED_ERROR) throw_exception (ex); if (debug_infrun) diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 555c302..f197aa7 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -2426,7 +2426,8 @@ linux_displaced_step_location (struct gdbarch *gdbarch) location. The auxiliary vector gets us the PowerPC-side entry point address instead. */ if (target_auxv_search (¤t_target, AT_ENTRY, &addr) <= 0) - error (_("Cannot find AT_ENTRY auxiliary vector entry.")); + throw_error (NOT_SUPPORTED_ERROR, + _("Cannot find AT_ENTRY auxiliary vector entry.")); /* Make certain that the address points at real code, and not a function descriptor. */