cdbug
1
If an executalbe file has several parameters, gdb can not pass parameters correctly. Let us see:
run:
./executablefile1 agr1 arg2 arg3
debug:
gdb executablefile1
run executalbefile1 arg1 arg2 arg3
then argv[0] : executablefile1
argv[1] : executablefile
argv[2] : arg1
argv[3] : arg2
argv[4] : arg3
When we use argv[x] many times, it is unconvenient to change each to argv[x+1].
May we fix it in a tricky way?
Thanks
vino
2
Run it as
gdb executablefile
run arg1 arg2 arg3
cdbug
3
I tried and it can work well.
Thanks
cdbug
4
Let me ask a related question.
If an exe file has several commands without argument, such as 'source', 'compile', 'run', it would be a trouble in gdb.
How to debug the exe with gdb? I tried and it shows that 'run source', 'source' , 'run compile' ..., can not work correctly