aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-parse.c
diff options
context:
space:
mode:
authorJan Vrany <jan.vrany@labware.com>2020-06-23 14:45:38 +0100
committerAndrew Burgess <aburgess@redhat.com>2021-12-14 11:28:00 +0000
commit1f6c8c3317e5692e9994c18f427b45093863d572 (patch)
treebec5656e39509e778ead182d9fff1388945b4ef9 /gdb/mi/mi-parse.c
parent3be0fed62e0dfb36d674944fe85eaebbf70b9029 (diff)
downloadgdb-1f6c8c3317e5692e9994c18f427b45093863d572.zip
gdb-1f6c8c3317e5692e9994c18f427b45093863d572.tar.gz
gdb-1f6c8c3317e5692e9994c18f427b45093863d572.tar.bz2
gdb/mi: use separate classes for different types of MI command
This commit changes the infrastructure in mi-cmds.{c,h} to add new sub-classes for the different types of MI command. Instances of these sub-classes are then created and added into mi_cmd_table. The existing mi_cmd class becomes the abstract base class, this has an invoke method and takes care of the suppress notifications handling, before calling a do_invoke virtual method which is implemented by all of the sub-classes. There's currently two different sub-classes, one of pure MI commands, and a second for MI commands that delegate to CLI commands. There should be no user visible changes after this commit.
Diffstat (limited to 'gdb/mi/mi-parse.c')
-rw-r--r--gdb/mi/mi-parse.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index b5b01cf..203024f 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -106,7 +106,7 @@ mi_parse_escape (const char **string_ptr)
return c;
}
-static void
+void
mi_parse_argv (const char *args, struct mi_parse *parse)
{
const char *chp = args;
@@ -363,20 +363,8 @@ mi_parse (const char *cmd, char **token)
chp = skip_spaces (chp);
}
- /* For new argv commands, attempt to return the parsed argument
- list. */
- if (parse->cmd->argv_func != NULL)
- {
- mi_parse_argv (chp, parse.get ());
- if (parse->argv == NULL)
- error (_("Problem parsing arguments: %s %s"), parse->command, chp);
- }
-
- /* FIXME: DELETE THIS */
- /* For CLI commands, also return the remainder of the
- command line as a single string. */
- if (parse->cmd->cli.cmd != NULL)
- parse->args = xstrdup (chp);
+ /* Save the rest of the arguments for the command. */
+ parse->args = xstrdup (chp);
/* Fully parsed, flag as an MI command. */
parse->op = MI_COMMAND;