Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* -nowindows (-nw)  option cancels MI interpreter
@ 2008-04-09 17:41 Marc Khouzam
  2008-04-09 17:48 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Khouzam @ 2008-04-09 17:41 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-09 17:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-09 17:41 -nowindows (-nw) option cancels MI interpreter Marc Khouzam
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox