How to retrieve memory content from a process core file?

1k Views Asked by At

i want to analyse each memory block content produced by a particular process. So what i did was using "gcore pid" to get a core dump of the process, but i do not know how to retrieve the content out, can anyone help?

1

There are 1 best solutions below

0
Basile Starynkevitch On

In general, the good tool to analyze a core dump is the gdb debugger.

So you should compile all your code with the -g flag passed to gcc or g++ or clang (to have DWARF debug information inside your ELF executable).

Then, you can analyze the (post-mortem or not) core dump of your program myprog with the command gdb myprog core. Learn how to use gdb. Notice that gdb is scriptable and extensible (in Python and Guile).

You could (but probably should not) analyze the core file otherwise (without gdb). Then you need to understand its detailed format (and that could require months of work). See elf(5) and core(5).

BTW, valgrind could also be useful.

You could even use gdb to analyze a core dump from a program compiled without -g but that is much less useful.