Re: RFC: MI output during program execution

Eli Zaretskii
2005-08-08T20:34:54Z

> From: Nick Roberts <nickrob@snap.net.nz>
> Date: Mon, 8 Aug 2005 16:20:43 +1200
>
> --- 241,288 ----
> and then set it back to 0 when we are done. */
> sync_execution = 1;
> {
> ! struct gdb_exception e;
> ! int flag = 0;
> !
> ! if (strcmp (argv[0], "console") == 0)
> ! /* Stick with MI for commands which run the inferior. */
> ! {
> ! struct cmd_list_element *c;
> ! extern struct cmd_list_element *cmdlist;
> ! char *token, *cp;
> !
> ! flag = 1;
> ! cp = xstrdup (argv[i]);
> ! c = lookup_cmd (&cp, cmdlist, "", 0, 0);
> ! if (strcmp (c->name, "run") == 0)
> ! mi_cmd_exec_run (cp, 0);
> ! else if (strcmp (c->name, "next") == 0)
> ! mi_cmd_exec_next (cp, 0);
> ! else if (strcmp (c->name, "nexti") == 0)
> ! mi_cmd_exec_next_instruction (cp, 0);
> ! else if (strcmp (c->name, "step") == 0)
> ! mi_cmd_exec_step (cp, 0);
> ! else if (strcmp (c->name, "stepi") == 0)
> ! mi_cmd_exec_step_instruction (cp, 0);
> ! else if (strcmp (c->name, "finish") == 0)
> ! mi_cmd_exec_finish (cp, 0);
> ! else if (strcmp (c->name, "until") == 0)
> ! mi_cmd_exec_until (cp, 0);
> ! else if (strcmp (c->name, "return") == 0)
> ! mi_cmd_exec_return (cp, 0);
> ! else
> ! flag = 0;

I'm a bit nervous about this literal testing of certain commands: why
not allow _any_ CLI commands to be supported in this way? I
understand that you were trying to mention every command that runs the
inferior, but the implication is that we will need to remember to add
to this list any new command that has similar effects. That sounds
like a PITA; could a more general solution be devised?

But I'm afraid that I'm somehow missing something, so could you please
elaborate on the design of the solution you propose?