This is a subtle problem I find today. The ps
command can show command arguments for a process, but I find the feature crippled.
For a shell command line like this:
gdbserver localhost:5050 testg "hello world" 123
We know that gdbserver
's main()
will see:
argv[] | C string |
---|---|
argv[1] | localhost:5050 |
argv[2] | testg |
argv[3] | hello world |
argv[4] | 123 |
However, ps -ef
shows
gdbserver localhost:5050 testg hello world 123
So it looks like argv[3]
is hello
, which is so misleading.
So may question is clear, is there way to have ps show genuine argv[]
values? man ps
does not seem to refer to this issue. If it can't, any alternative tools?