aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mi/mi-parse.c')
-rw-r--r--gdb/mi/mi-parse.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index a2dc50d..73e04aa 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -150,6 +150,8 @@ mi_parse (char *cmd)
char *chp;
struct mi_parse *parse = XMALLOC (struct mi_parse);
memset (parse, 0, sizeof (*parse));
+ parse->thread = -1;
+ parse->frame = -1;
/* Before starting, skip leading white space. */
while (isspace (*cmd))
@@ -199,6 +201,40 @@ mi_parse (char *cmd)
while (isspace (*chp))
chp++;
+ /* Parse the --thread and --frame options, if present. At present,
+ 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. */
+ for (;;)
+ {
+ char *start = chp;
+ size_t ts = sizeof ("--thread ") - 1;
+ size_t fs = sizeof ("--frame ") - 1;
+ if (strncmp (chp, "--thread ", ts) == 0)
+ {
+ if (parse->thread != -1)
+ error ("Duplicate '--thread' option");
+ chp += ts;
+ parse->thread = strtol (chp, &chp, 10);
+ }
+ else if (strncmp (chp, "--frame ", fs) == 0)
+ {
+ if (parse->frame != -1)
+ error ("Duplicate '--frame' option");
+ chp += fs;
+ parse->frame = strtol (chp, &chp, 10);
+ }
+ else
+ break;
+
+ if (*chp != '\0' && !isspace (*chp))
+ error ("Invalid value for the '%s' option",
+ start[2] == 't' ? "--thread" : "--frame");
+ while (isspace (*chp))
+ chp++;
+ }
+
/* For new argv commands, attempt to return the parsed argument
list. */
if (parse->cmd->argv_func != NULL)