with arguments contained within PARSE. */
void invoke (struct mi_parse *parse) const override
{
- mi_parse_argv (parse->args, parse);
+ mi_parse_argv (parse->args (), parse);
if (parse->argv == nullptr)
error (_("Problem parsing arguments: %s %s"), parse->command,
- parse->args);
+ parse->args ());
this->m_argv_function (parse->command, parse->argv, parse->argc);
}
is passed through to the CLI function as its argument string. */
void invoke (struct mi_parse *parse) const override
{
- const char *args = m_args_p ? parse->args : nullptr;
+ const char *args = m_args_p ? parse->args () : nullptr;
mi_execute_cli_command (m_cli_name, m_args_p, args);
}
if (mi_debug_p)
gdb_printf (gdb_stdlog,
" token=`%s' command=`%s' args=`%s'\n",
- context->token, context->command, context->args);
+ context->token, context->command, context->args ());
mi_cmd_execute (context);
{
xfree (command);
xfree (token);
- xfree (args);
freeargv (argv);
}
}
/* Save the rest of the arguments for the command. */
- parse->args = xstrdup (chp);
+ parse->set_args (chp);
/* Fully parsed, flag as an MI command. */
parse->op = MI_COMMAND;
DISABLE_COPY_AND_ASSIGN (mi_parse);
+ /* Return the full argument string, as used by commands which are
+ implemented as CLI commands. */
+ const char *args () const
+ { return m_args.c_str (); }
+
+ void set_args (const char *args)
+ { m_args = args; }
+
enum mi_command_type op = MI_COMMAND;
char *command = nullptr;
char *token = nullptr;
const struct mi_command *cmd = nullptr;
struct mi_timestamp *cmd_start = nullptr;
- char *args = nullptr;
char **argv = nullptr;
int argc = 0;
int all = 0;
/* The language that should be used to evaluate the MI command.
Ignored if set to language_unknown. */
enum language language = language_unknown;
+
+ private:
+
+ std::string m_args;
};
/* Attempts to parse CMD returning a ``struct mi_parse''. If CMD is
pymicmd_debug_printf ("this = %p, name = %s", this, name ());
- mi_parse_argv (parse->args, parse);
+ mi_parse_argv (parse->args (), parse);
if (parse->argv == nullptr)
- error (_("Problem parsing arguments: %s %s"), parse->command, parse->args);
+ error (_("Problem parsing arguments: %s %s"), parse->command,
+ parse->args ());
gdbpy_enter enter_py;