From patchwork Thu May 29 16:33:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 1196 Received: (qmail 27804 invoked by alias); 29 May 2014 16:33:30 -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 27795 invoked by uid 89); 29 May 2014 16:33:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS 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 ESMTP; Thu, 29 May 2014 16:33:28 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4TGXQg7022910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 May 2014 12:33:26 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4TGXPxW021572 for ; Thu, 29 May 2014 12:33:26 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] unbreak infcalls Date: Thu, 29 May 2014 17:33:24 +0100 Message-Id: <1401381204-19522-1-git-send-email-palves@redhat.com> I managed to miss an interaction between the recent *running patch, and target-async, which resulted in infcalls being completely broken on GNU/Linux and remote targets (that is, the async-capable targets). Temporary breakpoint 1, main () at threads.c:35 35 long i = 0; (gdb) p malloc (0) The program being debugged stopped while in a function called from GDB. Evaluation of the expression containing the function (malloc) will be abandoned. When the function is done executing, GDB will silently stop. (gdb) p malloc (0) Program received signal SIGSEGV, Segmentation fault. 0x000000000058d7e8 in get_regcache_aspace (regcache=0x0) at ../../src/gdb/regcache.c:281 281 return regcache->aspace; (top-gdb) The issue is that when running an infcall, the thread is no longer marked as running, so run_inferior_call is not calling wait_for_inferior anymore. Fix this by doing what the comment actually says we do: "Do here what `proceed' itself does in sync mode." And proceed doesn't check whether the target is running. I notice this is broken in case of the early return in proceed, but we were broken before in that case anyway, because run_inferior_call will think the call actually ran. Seems like we should make proceed have a boolean return, and go through all callers making use of it, if necessary. But for now, just fix the regression. Tested on x86_64 Fedora 20. gdb/ 2014-05-29 Pedro Alves * infcall.c (run_inferior_call): Don't check whether the current thread is running after the proceed call. --- gdb/ChangeLog | 5 +++++ gdb/infcall.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 341698b..3225ceb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,9 @@ 2014-05-29 Pedro Alves + + * infcall.c (run_inferior_call): Don't check whether the current + thread is running after the proceed call. + +2014-05-29 Pedro Alves Tom Tromey * NEWS: Mention "maint set target-async", "set mi-async", and that diff --git a/gdb/infcall.c b/gdb/infcall.c index 9a85958..685b8a4 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -407,7 +407,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc) /* Inferior function calls are always synchronous, even if the target supports asynchronous execution. Do here what `proceed' itself does in sync mode. */ - if (target_can_async_p () && is_running (inferior_ptid)) + if (target_can_async_p ()) { wait_for_inferior (); normal_stop ();