From patchwork Tue Oct 1 12:59:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 34762 Received: (qmail 46923 invoked by alias); 1 Oct 2019 12:59:10 -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 46897 invoked by uid 89); 1 Oct 2019 12:59:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS, UNSUBSCRIBE_BODY autolearn=ham version=3.3.1 spammy=accompanied, redirect, screen, console X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Oct 2019 12:59:08 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C4A75AE87; Tue, 1 Oct 2019 12:59:05 +0000 (UTC) Subject: Re: [PATCH][gdb] Make INTERP_TUI's default ui_out the INTERP_CONSOLE ui_out To: Andrew Burgess Cc: gdb-patches@sourceware.org, Tom Tromey , Simon Marchi References: <20190905095815.GA27717@delia> <20190924173122.GN4962@embecosm.com> <20190925083642.GO4962@embecosm.com> From: Tom de Vries Openpgp: preference=signencrypt Message-ID: <6a13b015-6b46-a2a3-0d6b-89a01ef3ab16@suse.de> Date: Tue, 1 Oct 2019 14:59:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190925083642.GO4962@embecosm.com> X-IsSubscribed: yes On 25-09-19 10:36, Andrew Burgess wrote: > * Tom de Vries [2019-09-25 01:20:22 +0200]: > >> On 24-09-19 19:31, Andrew Burgess wrote: >>> With this patch applied I see the fixed behaviour you describe at the >>> CLI, however, if I do: >>> >>> (gdb) define mybt >>> bt >>> end >>> (gdb) start >>> (gdb) set logging redirect on >>> (gdb) tui enable >>> (gdb) set logging on >>> (gdb) mybt >>> >>> The I see output appear on both the console and in the log file. >> >> I can't reproduce this. Are you sure you removed the gdb.txt file before >> starting gdb? > > You're absolutely right, nothing goes to the log for `mybt`, this was > a silly mistake on my side. Apologies. However... > > With tui enabled and logging on and redirect on, the 'bt' __does__ > write to the log, while 'mybt' writes to the screen. This is the same > bug you're fixing for non-tui mode, correct? From user perspective, yes. > Any solution should > ideally address both cases, or at least be accompanied with an > explanation for why these problems are distinct and should be solved > separately. > Ideally yes, agreed. This tentative patch fixes both cases, by limiting the fix of commit 3a87ae656c28 "Use console uiout when executing breakpoint commands" to the case for which the corresponding problem was reported: INTERP_MI. [ Adding CC simark ] At this point I don't understand yet why special-casing INTERP_MI would be the correct thing to do here. Thanks, - Tom diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 4fc9c70259c..c8a837bf0f5 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -699,9 +699,14 @@ execute_control_command (struct command_line *cmd, int from_tty) { /* Make sure we use the console uiout. It's possible that we are executing breakpoint commands while running the MI interpreter. */ - interp *console = interp_lookup (current_ui, INTERP_CONSOLE); - scoped_restore save_uiout - = make_scoped_restore (¤t_uiout, console->interp_ui_out ()); + if (current_interp_named_p (INTERP_MI)) + { + interp *console = interp_lookup (current_ui, INTERP_CONSOLE); + scoped_restore save_uiout + = make_scoped_restore (¤t_uiout, console->interp_ui_out ()); + + return execute_control_command_1 (cmd, from_tty); + } return execute_control_command_1 (cmd, from_tty); }