gdb cli to be parsed for option "--args" instead of "--arg". $ gdb -v GNU gdb (GDB) 7.4 [GDB v7.4 for FreeBSD] Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i386-portbld-freebsd9.0". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. $ gdb --help This is the GNU debugger. Usage: gdb [options] [executable-file [core-file or process-id]] gdb [options] --args executable-file [inferior-arguments ...] Options: --args Arguments after executable-file are passed to inferior $ gdb --arg prog1 1 2 GNU gdb (GDB) 7.4 [GDB v7.4 for FreeBSD] Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i386-portbld-freebsd9.0". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/home/jb/prog1...done. (gdb) b main Breakpoint 1 at 0x8048474: file prog1.c, line 13. (gdb) r Starting program: /usr/home/jb/prog1 1 2 Breakpoint 1, main (argc=3, argv=0xbfbfea50) at prog1.c:13 13 printf("argc=%d\n",argc); (gdb) c Continuing. argc=3 argv[0]=/usr/home/jb/prog1 argv[1]=1 argv[2]=2 [Inferior 1 (process 14899) exited normally] (gdb)
I'm afraid I don't understand what you're claiming is wrong. Can you please clarify?
(In reply to comment #1) > I'm afraid I don't understand what you're claiming is wrong. Can you please > clarify? Well, the format of gdb entry contains option keyword "--args", not "--arg". It is important to parse any input properly. The entry should be rejected with error msg like "Invalid format: --arg option". I documented it for you.
That's not a bug, it's a feature. For long options (--foo), GNU getopt figures out what you wanted as long as its not ambiguous. E.g., try "ls --hel".