Skip to content
Advertisement

Getting a crashed program’s command-line invocation from a core dump

i start a progress like

./game config1 config2

then i get i core.xxx for example,i want to get complete path and args

gdb game core.xxx
core was gengerte by '/xx/xx/game config'.

the path is too long , i want to get the info like

   '/xx/xx/game config1 config2'

how can i do that ?

Advertisement

Answer

how can i do that ?

You can’t.

GDB displays info recorded in the PRPSINFO note, which has these members:

    char pr_fname[16];
    char pr_psargs[80];

Anything that doesn’t fit into 80 characters gets truncated, and you can only recover it by examining argv[] (requires the code to be built with debug info — -g flag) or by looking at the stack contents (requires understanding of platform-specific argument passing conventions).

Advertisement