Just wanted to share a quick hint for GDB users. When you want to debug a program that takes command-line arguments, the “traditional” way looks something like this:

% gdb a.out
GNU gdb 6.3.50-20050815...

(gdb) set args x y z
(gdb) run

But you can do even better. GDB itself has the command-line flag --args, which means that the rest of the arguments go to the program you’re debugging!

% gdb --args a.out x y z

Possibly Related Tags