- while (*++argv != NULL)
- {
- if (strcmp (*argv, "-ex") == 0 && argv[1] != NULL)
- ex[ex_count++] = *++argv;
- else if (strcmp (*argv, "-c") == 0 && argv[1] != NULL)
- arg_core = *++argv;
- else if (strncmp (*argv, "--core=", strlen ("--core=")) == 0)
- arg_core = xstrdup (&(*argv)[strlen ("--core=")]);
- else if (strcmp (*argv, "-p") == 0 && argv[1] != NULL)
- arg_pid = *++argv;
- else if (strncmp (*argv, "--pid=", strlen ("--pid=")) == 0)
- arg_pid = xstrdup (&(*argv)[strlen ("--pid=")]);
- else if (arg_file == NULL)
- arg_file = *argv;
- else if (arg_core == NULL && arg_pid == NULL)
- {
- char *end = NULL;
-
- strtol (*argv, &end, 0);
- if (isdigit ((*argv)[0]) && (end == NULL || *end == '\0'))
- arg_pid = *argv;
- else
- arg_core = *argv;
- }
- else
- fatal (_("Excess command line argument: %s"), *argv);
- }
- if (arg_core != NULL && arg_pid != NULL)
- fatal (_("Can't attach to process and specify a core file "
- "at the same time."));
+ mi_gdb_argv = xmalloc ((argc + 2) * sizeof (*mi_gdb_argv));
+ memcpy (&mi_gdb_argv[2], &argv[1], argc * sizeof (*mi_gdb_argv));
+ mi_gdb_argv[0] = "gdb";
+ mi_gdb_argv[1] = "--interpreter=mi";