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

Bob Rossi
2005-07-13T22:46:01Z

On Wed, Jul 13, 2005 at 02:58:09PM +1200, Nick Roberts wrote:
>
> -inferior-tty-show and -inferior-tty-set seem to accept any number of
> arguments:
>
> (gdb)
> -inferior-tty-show asdf
> ^done
> (gdb)
>
> (gdb)
> -inferior-tty-set asdf qwert
> ^done
> (gdb)
>
> With mi_cmd_inferior_tty_set there is no test. mi_cmd_inferior_tty_show
> uses mi_valid_noargs which returns 1 even with arguments (mi_getopt
> only returns something other than -1 if it finds an option i.e an argument
> starting with `-').

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.

Bob Rossi