Re: Is corefile support for missing on Win32?
Pedro Alves <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On 2022-06-07 20:30, Simon Sobisch via Gdb wrote: > Testing with MSYS2 generated mingw64 gcc 12.1 + gdb 12.1 resulted in "everything working" ...until I needed to create a core file. > > (gdb) show arch > The target architecture is set to "auto" (currently "i386:x86-64"). > (gdb) gcore test.core > warning: cannot close "test.core": invalid operation > Can't create a corefile > > (with gnutarget auto, pei-x86-64 and pe-x86-64) > > I see that the first error message comes from > gdb/gdb_bfd.c (gdb_bfd_close_warning) > and the second from the default implementation > gdb/exec.c (make_corefile_notes) > > > This issue seems to exists for longer as some SO question [1] asked about this over 5 years ago. > > Further testing showed the same issue with same tools in MinGW x86 and with "good old MinGW" using GDB 7.6.1 / GCC 9.2. > > Testing with cygwin-x64 (GDB 11.2) shows the same result. > Native Windows GDB was never able to generate cores. Basically because cores are ELF objects, while Windows is PE, so it's kind of a foreign thing. However, Cygwin comes with a separate utility that is able to dump cores in ELF format, and Windows GDB is actually able to read those. This utility is called "dumper". See here: https://www.cygwin.com/cygwin-ug-net/dumper.html Sources are here: https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/utils/dumper.cc If someone wanted to work on it, I don't see any obstacle to GDB's gcore command itself generating an ELF core in the exact same format. > I guess the system's minidump format cannot be processed with GDB, can it? Unfortunately not. Christian Biesinger did write a patch to add support for it while ago, though: https://sourceware.org/git/?p=binutils-gdb.git;a=shortlog;h=refs/heads/users/cbiesinger/minidump AFAIK, this was never finished/contributed for proper inclusion, and I don't know how far that is to being complete.