Is there any case that param1 and param2 are passed to gdb, and some cases passed to a.out, and some cases, 1 for each?
How does linux shell parse and decide which param for which program? Thanks.
Advertisement
Answer
How does linux shell parse and decide which param for which program?
Linux shell simply passes all params to gdb. It’s gdb which decides how to interpret these params.
When you invoke gdb like gdb a.out param1 param2
you want to debug program a.out
either loading core dump param1
or attaching to pid param1
. See Invoking gdb doc.
If you want to pass params to a program you should use --args
gdb option. For example this will pass param1
, param2
to a program:
gdb --args a.out param1 param2 (gdb) run
Alternatively:
gdb a.out (gdb) run param1 param2