Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tom@tromey.com>,
	Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [PATCH][gdb] Make INTERP_TUI's default ui_out the INTERP_CONSOLE ui_out
Date: Tue, 01 Oct 2019 12:59:00 -0000	[thread overview]
Message-ID: <6a13b015-6b46-a2a3-0d6b-89a01ef3ab16@suse.de> (raw)
In-Reply-To: <20190925083642.GO4962@embecosm.com>

[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]

On 25-09-19 10:36, Andrew Burgess wrote:
> * Tom de Vries <tdevries@suse.de> [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

[-- Attachment #2: tmp.patch --]
[-- Type: text/x-patch, Size: 892 bytes --]

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 (&current_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 (&current_uiout, console->interp_ui_out ());
+
+      return execute_control_command_1 (cmd, from_tty);
+    }
 
   return execute_control_command_1 (cmd, from_tty);
 }

  reply	other threads:[~2019-10-01 12:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05  9:58 Tom de Vries
2019-09-05 12:50 ` Tom de Vries
2019-09-24 15:24 ` [PING][PATCH][gdb] " Tom de Vries
2019-09-24 17:31 ` [PATCH][gdb] " Andrew Burgess
2019-09-24 23:20   ` Tom de Vries
2019-09-25  8:36     ` Andrew Burgess
2019-10-01 12:59       ` Tom de Vries [this message]
2019-10-03 10:01         ` [PATCH][gdb] Only force INTERP_CONSOLE ui_out for breakpoint commands in MI mode Tom de Vries
2019-10-03 12:11           ` Pedro Alves
2019-10-03 13:51             ` Tom de Vries
2019-10-03 14:02               ` Pedro Alves
2019-11-11 16:27                 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a13b015-6b46-a2a3-0d6b-89a01ef3ab16@suse.de \
    --to=tdevries@suse.de \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox