* -inferior-tty-show and -inferior-tty-set @ 2005-07-13 2:57 Nick Roberts 2005-07-13 3:59 ` Daniel Jacobowitz 2005-07-13 22:46 ` Bob Rossi 0 siblings, 2 replies; 6+ messages in thread From: Nick Roberts @ 2005-07-13 2:57 UTC (permalink / raw) To: gdb -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 `-'). Since mi_cmd_file_list_exec_source_file and mi_cmd_file_list_exec_source_files also use mi_valid_noargs, their associated MI commands also accept any number of arguments. Nick ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: -inferior-tty-show and -inferior-tty-set 2005-07-13 2:57 -inferior-tty-show and -inferior-tty-set Nick Roberts @ 2005-07-13 3:59 ` Daniel Jacobowitz 2005-07-13 22:46 ` Bob Rossi 1 sibling, 0 replies; 6+ messages in thread From: Daniel Jacobowitz @ 2005-07-13 3:59 UTC (permalink / raw) To: Nick Roberts; +Cc: gdb 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) These we need to rediscuss whether to have at all - I'm still inclined to yes, you're still inclined to no, I haven't had time to sit down and write about it. > 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 `-'). > > Since mi_cmd_file_list_exec_source_file and mi_cmd_file_list_exec_source_files > also use mi_valid_noargs, their associated MI commands also accept any number > of arguments. Ouch. That definitely ought to be fixed... -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: -inferior-tty-show and -inferior-tty-set 2005-07-13 2:57 -inferior-tty-show and -inferior-tty-set Nick Roberts 2005-07-13 3:59 ` Daniel Jacobowitz @ 2005-07-13 22:46 ` Bob Rossi 2005-07-13 22:55 ` Nick Roberts 1 sibling, 1 reply; 6+ messages in thread From: Bob Rossi @ 2005-07-13 22:46 UTC (permalink / raw) To: Nick Roberts; +Cc: gdb 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: -inferior-tty-show and -inferior-tty-set 2005-07-13 22:46 ` Bob Rossi @ 2005-07-13 22:55 ` Nick Roberts 2005-07-13 23:39 ` Bob Rossi 0 siblings, 1 reply; 6+ messages in thread From: Nick Roberts @ 2005-07-13 22:55 UTC (permalink / raw) To: Bob Rossi; +Cc: gdb > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: -inferior-tty-show and -inferior-tty-set 2005-07-13 22:55 ` Nick Roberts @ 2005-07-13 23:39 ` Bob Rossi 2005-07-14 6:36 ` Nick Roberts 0 siblings, 1 reply; 6+ messages in thread From: Bob Rossi @ 2005-07-13 23:39 UTC (permalink / raw) To: Nick Roberts; +Cc: gdb 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: -inferior-tty-show and -inferior-tty-set 2005-07-13 23:39 ` Bob Rossi @ 2005-07-14 6:36 ` Nick Roberts 0 siblings, 0 replies; 6+ messages in thread From: Nick Roberts @ 2005-07-14 6:36 UTC (permalink / raw) To: Bob Rossi; +Cc: gdb > 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 It looks to me that the intention is to make: -file-list-exec-source-file -- legitimate. Perhaps we could use the condition"(argc > 0)" for now and worry about such pathological cases later, when we could also improve mi_getopt to other things like long options (as Daniel has suggested). In fact I would like to add an argument to -file-list-exec-source-file to find the fullname of a file i.e (gdb) -file-list-exec-source-file myprint.c ^done,line="16",file="myprint.c",fullname="/home/nick/myprint.c" (gdb) where myprog.c is not necessarily the current source file. At the moment, I do: (gdb) list myprint.c:1 &"list myprint.c:1\n" ~"1\t/* -*- compile-command: \"cc -g3 -c myprint.c\"; -*- */\n" ~"2\t\n" ~"3\tint i22;\n" ~"4\t\n" ~"5\tstruct values;\n" ~"6\tstruct values1;\n" ~"7\t\n" ~"8\t#define GOTCHA 9\n" ~"9\t\n" ~"10\tmyprint (int i,int j) {\n" ^done (gdb) -file-list-exec-source-file ^done,line="11",file="myprint.c",fullname="/home/nick/myprint.c" (gdb) to make the file that I'm interested in current first (I'm thinking of a situation where user the adds to the search path for source files *after* the start of the debug session). Nick ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-07-14 6:36 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-07-13 2:57 -inferior-tty-show and -inferior-tty-set Nick Roberts 2005-07-13 3:59 ` Daniel Jacobowitz 2005-07-13 22:46 ` Bob Rossi 2005-07-13 22:55 ` Nick Roberts 2005-07-13 23:39 ` Bob Rossi 2005-07-14 6:36 ` Nick Roberts
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).