Index: gdb/interps.c =================================================================== RCS file: /cvs/src/src/gdb/interps.c,v retrieving revision 1.16 diff -u -r1.16 interps.c --- gdb/interps.c 17 Dec 2005 22:34:01 -0000 1.16 +++ gdb/interps.c 4 Jun 2006 23:54:14 -0000 @@ -216,16 +216,28 @@ interp_lookup (const char *name) { struct interp *interp; + char *nname = xstrdup (name); + char *token = strtok (nname, ","); - if (name == NULL || strlen (name) == 0) - return NULL; - - for (interp = interp_list; interp != NULL; interp = interp->next) + while (token) { - if (strcmp (interp->name, name) == 0) - return interp; + if (token == NULL || strlen (token) == 0) + return NULL; + + for (interp = interp_list; interp != NULL; interp = interp->next) + { + if (strcmp (interp->name, token) == 0) + { + xfree (nname); + nname = NULL; + return interp; + } + } + token = strtok (NULL, ","); } + xfree (nname); + nname = NULL; return NULL; } Index: gdb/main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.58 diff -u -r1.58 main.c --- gdb/main.c 21 Feb 2006 19:46:48 -0000 1.58 +++ gdb/main.c 4 Jun 2006 23:54:15 -0000 @@ -598,6 +598,7 @@ { /* Find it. */ + int multiple_interps = (strchr (interpreter_p, ',') != 0); struct interp *interp = interp_lookup (interpreter_p); if (interp == NULL) error (_("Interpreter `%s' unrecognized"), interpreter_p); @@ -609,6 +610,17 @@ interpreter_p); exit (1); } + + /* Print the mi version chosen by GDB if the user supplied multiple + options. Note that the interp_set call above replaces interpreter_p + with the value of the chosen interpreter. */ + if (multiple_interps) + { + struct ui_file *raw_stdout = stdio_fileopen (stdout); + + fprintf_unfiltered (raw_stdout, "mi_protocol_version=%s\n", interpreter_p); + } + } /* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets