Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Marc Khouzam" <marc.khouzam@ericsson.com>
To: <gdb@sourceware.org>
Subject: -nowindows (-nw)  option cancels MI interpreter
Date: Wed, 09 Apr 2008 17:41:00 -0000	[thread overview]
Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA04291048@ecamlmw720.eamcs.ericsson.se> (raw)

Hi,

the -nowindows option to GDB caused the interpreter to be forced to be CONSOLE.
This means that something like
	gdb -i=mi -nw 
is equivalent to 
	gdb -i=console -nw

I would expect that the MI interpreter would not be affected by the -nw option...

It is also confusing (although a quick workaround)
that, because of the order options are read does matters
	gdb -nw -i=mi
will work.

From what I gather, there are two GUI interpreters: Insight and TUI.
Is that correct?

I was thinking that the -nw option should force the console
interpreter only if the current interpreter is one of the two GUI ones.

This problem is not of great impact, but it did cause me to waste
some time figuring out why DSF was suddently broken (once I added the -nw)

The patch below explains.
It does not fix the fact that:
	gdb -nw -i=tui
and
	gdb -i=tui -nw
don't behave the same (same for insight).


diff -u -r1.67 main.c
--- gdb/main.c  14 Mar 2008 17:21:07 -0000      1.67
+++ gdb/main.c  9 Apr 2008 16:47:19 -0000
@@ -160,6 +160,7 @@
   char *homedir;
 
   int i;
+  size_t len;
 
   long time_at_startup = get_run_time ();
 
@@ -410,9 +411,25 @@
            use_windows = 1;
            break;
          case OPT_NOWINDOWS:
-           /* -nw is equivalent to -i=console.  */
-           xfree (interpreter_p);
-           interpreter_p = xstrdup (INTERP_CONSOLE);
+           /* -nw is equivalent to -i=console, but only replace the
+              interpreter in the case it was a GUI interpreter.  */
+           len = sizeof(interpreter_p) < sizeof(INTERP_INSIGHT) ? 
+                 sizeof(interpreter_p) : sizeof(INTERP_INSIGHT);
+           if (memcmp (interpreter_p, INTERP_INSIGHT, len) == 0)
+             {
+               xfree (interpreter_p);
+               interpreter_p = xstrdup (INTERP_CONSOLE);
+             }
+           else
+             {
+               len = sizeof(interpreter_p) < sizeof(INTERP_TUI) ? 
+                   sizeof(interpreter_p) : sizeof(INTERP_TUI);
+               if (memcmp (interpreter_p, INTERP_TUI, len) == 0)
+                 {
+                   xfree (interpreter_p);
+                   interpreter_p = xstrdup (INTERP_CONSOLE);
+                 }
+             }
            use_windows = 0;
            break;
          case 'f':
== 
Marc Khouzam


             reply	other threads:[~2008-04-09 17:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09 17:41 Marc Khouzam [this message]
2008-04-09 17:48 ` Daniel Jacobowitz
2008-04-09 17:54   ` Bob Rossi
2008-04-09 21:04     ` Daniel Jacobowitz
2008-04-09 20:29   ` Michael Snyder

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=6D19CA8D71C89C43A057926FE0D4ADAA04291048@ecamlmw720.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=gdb@sourceware.org \
    /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