Re: -inferior-tty-show and -inferior-tty-set

Nick Roberts
2005-07-13T22:55:58Z

> OK. There could be a problem here. Not sure. A valid MI option is,
> mi-command ==>
> [ token ] "-" operation ( " " option )* [ " --" ] ( " " parameter )* nl
> basically, arguments to an mi function begin with a '-'.
>
> So,
> (gdb)
> -file-list-exec-source-file a
> ^done,line="1",file="test.c",fullname="/home/bob/cvs/gdb/original/objdir/gdb/test.c"
> (gdb)
> -file-list-exec-source-file -a
> &"mi_cmd_file_list_exec_source_file: Unknown option ``a''\n"
> ^error,msg="mi_cmd_file_list_exec_source_file: Unknown option ``a''"
> (gdb)
>
> Should we make mi_valid_noargs take care of the case when invalid
> arguments are passed to the MI command? or should mi_getopt return an
> error? I'll have to think a little about this.

Instead of

if ( !mi_valid_noargs("mi_cmd_file_list_exec_source_file", argc, argv) )
error (_("mi_cmd_file_list_exec_source_file: Usage: No args"));

why not just use:

if (argc > 0)
error (_("mi_cmd_file_list_exec_source_file: Usage: No args"));

Incidentally there is no mention of mi_valid_noargs in the ChangeLogs. If
the above suggestion works, perhaps its not needed and it could be removed.

Nick