From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54381 invoked by alias); 2 Jun 2015 14:11:33 -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 54357 invoked by uid 89); 2 Jun 2015 14:11:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wg0-f53.google.com Received: from mail-wg0-f53.google.com (HELO mail-wg0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 02 Jun 2015 14:11:26 +0000 Received: by wgbgq6 with SMTP id gq6so141386791wgb.3 for ; Tue, 02 Jun 2015 07:11:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=3pcSyW8umAyHMH/XRWxhYaDIOmkAHk9yduscZ3Kp8Oo=; b=V4lxg2/6WApSMm6BrbPvh3EHo7jbWn7lwyPpbxAco12twVL83jf3V6MJq/pPhmMUqo j66b67UVVszJW+QSCQ/Oqy5MR9EXRL+JB6w5vYMX8T839upsOxj7zGPMsT5Z75WJrvGG ogh6K7Um4TsiTKZOc//3aXoNqdhFkXWcaL7tBh/LkLl+ao6qfaE/g6zHir5UpPOY7MET MaCehMiAk5/dGwHhKNjDQly2qj7hVgQ7lPxRbQRd7csfcqof5ejhl1FOHlbPsu/Kc8Fb r9VX4zCs6ZgFNtMYlronWEb3u9mFlY3wPdrgbY4Oclf27Ukh5mz44XyHBNMf/HclgdYx AgrQ== X-Gm-Message-State: ALoCoQmhc1IeDzj37WTFobYIDHsBrvJRgAZkgdfN1DfaZDoMV3hWsLzTgnsdaBEx4bJwIZTGF5/p X-Received: by 10.194.95.2 with SMTP id dg2mr6830905wjb.53.1433254283690; Tue, 02 Jun 2015 07:11:23 -0700 (PDT) Received: from localhost (cust64-dsl91-135-5.idnet.net. [91.135.5.64]) by mx.google.com with ESMTPSA id bh7sm27079396wjb.8.2015.06.02.07.11.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 07:11:23 -0700 (PDT) Date: Tue, 02 Jun 2015 14:11:00 -0000 From: Andrew Burgess To: Patrick Palka Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Call target_terminal_ours() before refreshing TUI's frame info Message-ID: <20150602141121.GP17330@embecosm.com> References: <1433210261-18328-1-git-send-email-patrick@parcs.ath.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433210261-18328-1-git-send-email-patrick@parcs.ath.cx> X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00024.txt.bz2 * Patrick Palka [2015-06-01 21:57:41 -0400]: > Here is an example backtrace for when tui_show_frame_info() gets called > while target_terminal_is_inferior() == 1: > > #1 0x00000000004988ee in tui_selected_frame_level_changed_hook (level=0) > #2 0x0000000000617b99 in select_frame (fi=0x18c9820) > #3 0x0000000000617c3f in get_selected_frame (message=message@entry=0x0) > #4 0x00000000004ce534 in update_watchpoint (b=b@entry=0x2d9a760, > reparse=reparse@entry=0) > #5 0x00000000004d625e in insert_breakpoints () > #6 0x0000000000531cfe in keep_going (ecs=ecs@entry=0x7ffea7884ac0) > #7 0x00000000005326d7 in process_event_stop_test (ecs=ecs@entry=0x7ffea7884ac0) > #8 0x000000000053596e in handle_inferior_event_1 (ecs=0x7ffea7884ac0) > > The fix is simple: call target_terminal_ours() before calling > tui_show_frame_info() in TUI's frame-changed hook. If we assume that somewhere down the call stack the terminal is supposed to belong to the inferior, then does your patch not leave gdb in the wrong state, where the terminal now belongs to gdb? It feels like the terminal should probably have been claimed back by gdb as soon as the inferior stopped, and should only be passed back to the inferior just before it is resumed. As an experiment, I replaced your call to target_terminal_ours with: gdb_assert (!target_terminal_is_inferior ()); in tui_selected_frame_level_changed_hook, this triggers frequently, for example: file ~/hello.exe tui enable start Thanks, Andrew > > gdb/ChangeLog: > > * tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Call > target_terminal_ours() before calling tui_show_frame_info(). > --- > gdb/tui/tui-hooks.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c > index e53f526..1eb5300 100644 > --- a/gdb/tui/tui-hooks.c > +++ b/gdb/tui/tui-hooks.c > @@ -132,6 +132,8 @@ tui_selected_frame_level_changed_hook (int level) > if (level < 0) > return; > > + target_terminal_ours (); > + > fi = get_selected_frame (NULL); > /* Ensure that symbols for this frame are read in. Also, determine > the source language of this frame, and switch to it if > -- > 2.4.2.387.gf86f31a.dirty >