My program operates like this:
exe -p param1 -i param2 -o param3
It crashed and generated a core dump file, core.pid
.
I want to analyze the core dump file by
gdb ./exe -p param1 -i param2 -o param3 core.pid
But GDB recognizes the parameters of the EXE file as GDB's input.
How do I analyze a core dump file in this situation?
Best Answer
You can use the core with GDB in many ways, but passing parameters which is to be passed to the executable to GDB is not the way to use the core file. This could also be the reason you got that error. You can use the core file in the following ways:
gdb <executable> <core-file>
orgdb <executable> -c <core-file>
orWhen using the core file you don't have to pass arguments. The crash scenario is shown in GDB (checked with GDB version 7.1 on Ubuntu).
For example:
If you want to pass parameters to the executable to be debugged in GDB, use
--args
.For example:
Man pages will be helpful to see other GDB options.