I am getting this error when GDB reads some of the core files generated using md2core
from minidumps created on linux by Breakpad on amd64, i686 and aarch64 (using breakpad commits from 2024-01-30 as well as 2021):
$ gdb /path/to/binary corefile
...
Failed to read a valid object file image from memory.
After which, running backtrace
results in just:
#0 0x00007fd8f28b9113 in ?? ()
When I encounter a core file like this, symbols like main
are not in the region where the main executable is mapped, instead they look like offsets from the binary’s .text
segment. However, if print &main
does return a valid address inside the region where the executable is mapped, then backtrace
also works. The minidump_stackwalk
tool always resolves the symbols correctly. The binary includes debug symbols. I’ve tested with GDB v8.2 to v14.2.
I can get the .text
file offset for the binary (and libc.so.6
if required depending on the functions on the stack) using objdump -h
, add it to the mapped executable offset which I get from the md2core
output, and add the symbol file manually using add-symbol-file
, and then reload the core using core-file core
. And this results in backtrace
being able to display the stack correctly. In all cases, info proc map
does not print anything, whereas for a true core file it lists regions for the binary, libc, etc.
- Is
Failed to read a valid object file image from memory
a hint
that the minidumps are incomplete and need fixing ? They are
the default format (stack memory from all threads). - How can I get
md2core
to produce core files that have valid mapping info, which GDB needs for resolving the executable’s symbols ?