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

Bob Rossi
2005-07-13T23:39:36Z

On Thu, Jul 14, 2005 at 10:57:13AM +1200, Nick Roberts wrote:
> > 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.

Hmmm, I added the mi_valid_noargs as one of my first GDB commits. Don't
know how it didn't get in the change log.

I think everywhere that does "if (argc >0)" is broke. I could be wrong
about this though. Here is the reason that Andrew asked me to create
this function,
http://sourceware.org/ml/gdb-patches/2003-04/msg00030.html

Thanks,
Bob Rossi