From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14621 invoked by alias); 11 Nov 2013 21:03:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14590 invoked by uid 89); 11 Nov 2013 21:03:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2013 21:03:38 +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 rABGTsLO028986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 11 Nov 2013 11:29:54 -0500 Received: from [127.0.0.1] (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 rABGTq3B019655; Mon, 11 Nov 2013 11:29:53 -0500 Message-ID: <52810600.9020406@redhat.com> Date: Tue, 12 Nov 2013 00:05:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: [PATCH v4 7/9] make dprintf.exp pass in always-async mode References: <1382464769-2465-1-git-send-email-tromey@redhat.com> <1382464769-2465-8-git-send-email-tromey@redhat.com> In-Reply-To: <1382464769-2465-8-git-send-email-tromey@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-11/txt/msg00302.txt.bz2 On 10/22/2013 06:59 PM, Tom Tromey wrote: > When target-async is enabled, dprintf.exp fails. > > This happens because run_inferior_call causes gdb to forget that it is > running in sync_execution mode, so something like a breakpoint > condition that makes an inferior call causes gdb to enter fully async > mode. It'd be great if we had a test that exercised this without relying on how dprintf is implemented behind the scenes. > This patch fixes the problem by noticing when gdb was in > sync_execution mode in run_inferior_call, and taking care to restore > this state afterward. > > Built and regtested on x86-64 Fedora 18. > > PR cli/15718: > * infcall.c: Include event-top.h. > (run_inferior_call): Call async_disable_stdin if needed. > --- > gdb/infcall.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/gdb/infcall.c b/gdb/infcall.c > index 19af044..7398913 100644 > --- a/gdb/infcall.c > +++ b/gdb/infcall.c > @@ -36,6 +36,7 @@ > #include "ada-lang.h" > #include "gdbthread.h" > #include "exceptions.h" > +#include "event-top.h" > > /* If we can't find a function's name from its address, > we print this instead. */ > @@ -398,6 +399,8 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc) > > TRY_CATCH (e, RETURN_MASK_ALL) > { > + int was_sync = sync_execution; > + > proceed (real_pc, GDB_SIGNAL_0, 0); > > /* Inferior function calls are always synchronous, even if the > @@ -407,6 +410,11 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc) > { > wait_for_inferior (); > normal_stop (); > + /* If gdb was previously in sync execution mode, then ensure > + that it remains so. normal_stop calls > + async_enable_stdin, so reset it again here. */ > + if (was_sync) > + async_disable_stdin (); > } > } Hmm, I was a worried about what would happen if the inferior exits, or some other thread hits a breakpoint, or something else like that. Like, what enables back stdin in that case? So an error is always thrown, and we'll hit the INF_REG_EVENT error handling inf-loop.c:inferior_event_handler, which re-enables back stdin and the prompt. So the change is OK with me, but I'd like to have this mentioned in the comment. Thanks, -- Pedro Alves