This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
-nowindows (-nw) option cancels MI interpreter
- From: "Marc Khouzam" <marc dot khouzam at ericsson dot com>
- To: <gdb at sourceware dot org>
- Date: Wed, 9 Apr 2008 13:24:29 -0400
- Subject: -nowindows (-nw) option cancels MI interpreter
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