#include <ctype.h>
#include "gdb_string.h"
#include "cli/cli-utils.h"
+#include "language.h"
static const char mi_no_values[] = "--no-values";
static const char mi_simple_values[] = "--simple-values";
parse->thread_group = -1;
parse->thread = -1;
parse->frame = -1;
+ parse->language = language_unknown;
cleanup = make_cleanup (mi_parse_cleanup, parse);
some important commands, like '-break-*' are implemented by
forwarding to the CLI layer directly. We want to parse --thread
and --frame here, so as not to leave those option in the string
- that will be passed to CLI. */
+ that will be passed to CLI.
+
+ Same for the --language option. */
+
for (;;)
{
const char *option;
size_t tgs = sizeof ("--thread-group ") - 1;
size_t ts = sizeof ("--thread ") - 1;
size_t fs = sizeof ("--frame ") - 1;
+ size_t ls = sizeof ("--language ") - 1;
if (strncmp (chp, "--all ", as) == 0)
{
parse->frame = strtol (chp, &endp, 10);
chp = endp;
}
+ else if (strncmp (chp, "--language ", ls) == 0)
+ {
+ char *lang_name;
+ struct cleanup *old_chain;
+
+ option = "--language";
+ chp += ls;
+ lang_name = extract_arg_const (&chp);
+ old_chain = make_cleanup (xfree, lang_name);
+
+ parse->language = language_enum (lang_name);
+ if (parse->language == language_unknown
+ || parse->language == language_auto)
+ error (_("Invalid --language argument: %s"), lang_name);
+
+ do_cleanups (old_chain);
+ }
else
break;