|
From: | Wallace, Brooke T (US 348F-Affiliate) |
Subject: | ddd 3.3.12 eating command line options after --args |
Date: | Fri, 28 Feb 2020 02:21:12 +0000 |
Running ddd from the command line using the –args option starts up ddd to debug the correct application but is consuming arguments intended for the application. For example: $ cat cmdline.cc //============================================================================= // FILE cmdline.cc // // DESCRIPTION: // Simple program that prints its command line args // This was used to test DDD and GDB --args feature // //============================================================================= #include <stdint.h> #include <stdio.h> typedef uint32_t uint32; int main(int argc, char** argv) { int i = 0; printf("command line has %d args:\n", argc); while(i < argc) { printf(" arg[%d] %s\n", i, argv[i]); i++; } return 0; } $ ddd --args ./a.out -session abcd -a -b –c Produces: GNU DDD 3.3.12 (x86_64-redhat-linux-gnu), by Dorothea Lwarning: could not set baud rate to `-c'. Reading symbols from /home/bwallace/workspace/examples/cmdline/a.out...done. (gdb) run Starting program: /home/bwallace/workspace/examples/cmdline/./a.out -a command line has 2 args: arg[0] /home/bwallace/workspace/examples/cmdline/./a.out arg[1] -a [Inferior 1 (process 6341) exited normally] The –session option and its argument is mysteriously eaten, the –b option is interpreted as ddd’s baud rate option, -c is interpreted as the baudrate This command lines work as expected if I use gdb: $ gdb --args ./a.out -session abcd -a -b -c GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7 Copyright (C) 2013 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 "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/bwallace/workspace/examples/cmdline/a.out...done. (gdb) run Starting program: /home/bwallace/workspace/examples/cmdline/./a.out -session abcd -a -b -c command line has 6 args: arg[0] /home/bwallace/workspace/examples/cmdline/./a.out arg[1] -session arg[2] abcd arg[3] -a arg[4] -b arg[5] -c [Inferior 1 (process 6357) exited normally] I’m running DDD version 3.3.12 (x86_64-unknown-linux-gnu) Compiled with GCC 4.8.5 20150623 (Red Hat 4.8.5-11), GNU libc 2.17 |
[Prev in Thread] | Current Thread | [Next in Thread] |