Reputation: 884
The test code below produces a breakpad minidump, and GDB cannot display the stack from the dmp
converted to core
using minidump-2-core
.
Why does minidump-2-core
need debug symbols in order to recreate the core dump ? Shouldn't GDB extract the debug symbols from the actual ELF binaries (and if needed locate separate debug symbol files by reading the ELF headers of the binaries) ?
#include <filesystem>
#include <client/linux/handler/exception_handler.h>
#include <client/linux/handler/minidump_descriptor.h>
int main(int argc, char *argv[])
{
google_breakpad::MinidumpDescriptor descriptor(std::filesystem::current_path());
auto handler = new google_breakpad::ExceptionHandler{descriptor,
NULL, NULL, NULL, true, -1}; // filterCb, dumpCb, cbCtx, install, clientFd
*(char *)(size_t)argc = 0;
delete handler;
return 0;
}
$ g++ -I ~/breakpad/src -std=c++2a -Wall -ggdb -pthread -o test test.cc ~/breakpad/src/client/linux/libbreakpad_client.a
$ minidump-2-core -v *.dmp > minicore 2> info
$ gdb ./test ./minicore
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000558c55693f94 in ?? ()
(gdb) info shared
No shared libraries loaded at this time.
(gdb) info proc map
(gdb) quit
$ minidump-2-core -h
The shared library list will by default have filenames as the runtime expects.
Default: /lib64/libpthread.so.0
-f: /lib64/libpthread-2.19.so
-i: /lib64/<module id>-libpthread.so.0
-f -i: /lib64/<module id>-libpthread-2.19.so
-S /foo/: /foo/libpthread.so.0
Options:
-v Enable verbose output
-o <file> Write coredump to specified file (otherwise use stdout).
-f Use the filename rather than the soname in the sharedlib list.
The soname is what the runtime system uses, but the filename is
how it's stored on disk.
-i Prefix sharedlib names with ID (when available). This makes it
easier to have a single directory full of symbols.
-S <dir> Set soname base directory. This will force all debug/symbol
lookups to be done in this directory rather than the filesystem
layout as it exists in the crashing image. This path should end
with a slash if it's a directory. e.g. /var/lib/breakpad/
Upvotes: 0
Views: 259
Reputation: 884
GDB 8 on some distros includes a workaround from 2007 linked below which enables it to read mini-core files generated with md2core
correctly:
https://sourceware.org/legacy-ml/binutils/2007-08/msg00047.html
The workaround was removed in newer GDB releases, and also in some GDB distro binaries, which no longer read mini-core files correctly: https://sourceware.org/legacy-ml/gdb-patches/2020-03/msg00106.html
A fix has just been committed on 2024.05.13 to the breakpad repo, and core files produced by md2core
binaries which include this commit should be handled correctly by (all) GDB versions:
https://github.com/google/breakpad/commit/417f5dbd0af9f96ca3e5faa99f41c064b89b40fd
Upvotes: 0