From patchwork Wed Apr 22 20:04:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 6390 Received: (qmail 110608 invoked by alias); 22 Apr 2015 20:04:11 -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 110589 invoked by uid 89); 22 Apr 2015 20:04:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Wed, 22 Apr 2015 20:04:09 +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 (8.14.4/8.14.4) with ESMTP id t3MK47BU016289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 22 Apr 2015 16:04:07 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3MK45OE009986; Wed, 22 Apr 2015 16:04:06 -0400 Message-ID: <5537FEB5.60501@redhat.com> Date: Wed, 22 Apr 2015 21:04:05 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH v3 15/17] PPC64: Fix gdb.arch/ppc64-atomic-inst.exp with displaced stepping References: <1429267521-21047-1-git-send-email-palves@redhat.com> <1429267521-21047-16-git-send-email-palves@redhat.com> <86618pzq04.fsf@gmail.com> In-Reply-To: <86618pzq04.fsf@gmail.com> On 04/21/2015 12:20 PM, Yao Qi wrote: > Pedro Alves writes: > >> The ppc64 displaced step code can't handle atomic sequences. Fallback >> to stepping over the breakpoint in-line if we detect one. > > Probably arm atom sequences instructions can't be executed out-of-line > either, I'll write a test for this. Thanks. > >> >> gdb/ChangeLog: >> 2015-04-17 Pedro Alves >> >> * infrun.c (displaced_step_prepare): Return -1 if >> gdbarch_displaced_step_copy_insn returns NULL. >> (resume): When displaced stepping doesn't work, try software >> single-stepping. > > This chunk isn't shown in the patch below, has been committed already? Sorry about that. Double snafu. It was supposed to be "try stepping over the breakpoint in-line", not software single-step. And then, that "resume" change ended up moved to the previous patch. > >> diff --git a/gdb/infrun.c b/gdb/infrun.c >> index be186a7..a89eefc 100644 >> --- a/gdb/infrun.c >> +++ b/gdb/infrun.c >> @@ -1797,9 +1797,14 @@ displaced_step_prepare_throw (ptid_t ptid) >> >> closure = gdbarch_displaced_step_copy_insn (gdbarch, >> original, copy, regcache); >> - >> - /* We don't support the fully-simulated case at present. */ >> - gdb_assert (closure); >> + if (closure == NULL) >> + { >> + /* The architecture doesn't know how or want to displaced step >> + this instruction or instruction sequence. Fallback to >> + stepping over the breakpoint in-line. */ >> + do_cleanups (old_cleanups); >> + return -1; >> + } >> >> /* Save the information we need to fix things up if the step >> succeeds. */ > > We need to update the comments to displaced_step_prepare_throw about > return value -1. > I've added this to the patch: Thanks, Pedro Alves diff --git i/gdb/infrun.c w/gdb/infrun.c index f627094..aaa543b 100644 --- i/gdb/infrun.c +++ w/gdb/infrun.c @@ -1713,7 +1713,9 @@ displaced_step_dump_bytes (struct ui_file *file, explain how we handle this case instead. Returns 1 if preparing was successful -- this thread is going to be - stepped now; or 0 if displaced stepping this thread got queued. */ + stepped now; 0 if displaced stepping this thread got queued; or -1 + if this instruction can't be displaced stepped. */ + static int displaced_step_prepare_throw (ptid_t ptid) {