From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20330 invoked by alias); 11 Nov 2013 19:46:55 -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 20299 invoked by uid 89); 11 Nov 2013 19:46:54 -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 19:46:54 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rABJkkjE029844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 11 Nov 2013 14:46:46 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rABJkjZP032708; Mon, 11 Nov 2013 14:46:46 -0500 Message-ID: <52813425.6020709@redhat.com> Date: Mon, 11 Nov 2013 19:51: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 8/9] fix py-finish-breakpoint.exp with always-async References: <1382464769-2465-1-git-send-email-tromey@redhat.com> <1382464769-2465-9-git-send-email-tromey@redhat.com> In-Reply-To: <1382464769-2465-9-git-send-email-tromey@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-11/txt/msg00299.txt.bz2 On 10/22/2013 06:59 PM, Tom Tromey wrote: > With target async enabled, py-finish-breakpoint.exp will trigger an > assertion failure. > > The failure occurs because execute_command re-enters the event loop in > some circumstances, and in this case resets the sync_execution flag. > Then later gdb reaches this assertion in normal_stop: > > gdb_assert (sync_execution || !target_can_async_p ()); > > execute_command has a comment explaining why it dispatches events: > > /* If the interpreter is in sync mode (we're running a user > command's list, running command hooks or similars), and we > just ran a synchronous command that started the target, wait > for that command to end. */ > > However, the code did not follow this comment -- it didn't check to > see if the command started the target, just whether the target was > executing a sync command at this point. Can you explain this a little better, please? IIUC (I haven't really stepped through the code): - A synchronous execution command is run. sync_execution is set. - A python breakpoint is hit, and the corresponding stop method is executed. While python commands are executed, interpreter_async is forced to 0. - The Python stop method happens to execute a not-execution-related gdb command ("where 1"). - Seeing that sync_execution is set, GDB nests a new event loop, although that wasn't necessary. - Some event that causes a stop triggers in the inferior, and normal_stop is called. - the nested event loop unwinds/ends, and normal_stop is called again. (IOW, normal_stop was called twice for the same event.) The assertion triggers. Is that accurate? What happens if the Python stop method actually does run an execution command? -- Pedro Alves