GDB and corefiles what causes "Failed to read a valid object file image from memory."

11.9k views Asked by At

On a rather old Linux system, I am unable to get core dumps that the gdb can read afterward. The kernel version is 3.8.13 and the libc version is 2.3.4. ulimit -c is set to unlimited and /proc/sys/kernel/core_pattern points to a valid writable file location. When I abort any process (kill -6 PID) it produces a core file at the location specified. However when trying to read the core file later using gdb -core filename I always get the error message "Failed to read a valid object file image from memory." What is the exact meaning of this message and what causes it? I also set all the bits to 1 in /proc/<pid>/coredump_filter but it did not help.

Further, I figured out that when I attach gdb to a process and then create a core file from gdb using the command generate-core-file it produces a core file that I can read into gdb without getting this warning. I tried to load the core file into gdb version 6.3.50 and version 7.10-1ubuntu.

1

There are 1 answers

3
Employed Russian On

However when trying to read the core file later using gdb -core filename I always get the error message "Failed to read a valid object file image from memory."

You can very likely ignore that warning.

What are you trying to do after gdb -core filename? You probably want gdb ./a.out core (which would produce the same warning, but should give you a usable GDB session).

what causes “Failed to read a valid object file image from memory.”

Some versions of GDB do not understand the VDSO, which appears in the loader list of shared objects, but isn't one, and issue the warning above. This warning is safe to ignore.