This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-nowindows (-nw) option cancels MI interpreter


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
	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;
          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;
          case 'f':
Marc Khouzam

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]