Created attachment 14780 [details] Sample core dump I'm unable to open a core file with recent versions of gdb. The problem showed up in Debian's gdb 13.1 build and I then reproduced the same failure in the 14.0.50.20230318 snapshot. The core file itself (attached) appears to be fine as I was able to open it with a previous gdb release (Gentoo vanilla 10.2). I did a little investigation and found that gdbarch->iterate_over_regset_sections == NULL for some reason. But that's as far as I got. Please see, https://lists.debian.org/debian-68k/2023/03/msg00012.html # # /opt/gdb-14.0.50.20230318/bin/gdb --core core.0 GNU gdb (GDB) 14.0.50.20230318-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "m68k-unknown-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". "/root/core.0": Core file format not supported (gdb) (gdb) quit # /opt/gdb-14.0.50.20230318/bin/gdb --configuration This GDB was configured as follows: configure --host=m68k-unknown-linux-gnu --target=m68k-unknown-linux-gnu --with-auto-load-dir=$debugdir:$datadir/auto-load --with-auto-load-safe-path=$debugdir:$datadir/auto-load --with-expat --with-gdb-datadir=/opt/gdb-14.0.50.20230318/share/gdb (relocatable) --with-jit-reader-dir=/opt/gdb-14.0.50.20230318/lib/gdb (relocatable) --without-libunwind-ia64 --with-lzma --with-babeltrace --without-intel-pt --with-xxhash --without-python --without-python-libdir --with-debuginfod --with-curses --without-guile --without-amd-dbgapi --disable-source-highlight --enable-threading --enable-tui --with-separate-debug-dir=/usr/lib/debug ("Relocatable" means the directory can be moved with the GDB installation tree, and GDB will still find it.) # gdb --core core.0 GNU gdb (Debian 13.1-2) 13.1 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "m68k-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". "/root/core.0": Core file format not supported (gdb) quit # # gdb --configuration This GDB was configured as follows: configure --host=m68k-linux-gnu --target=m68k-linux-gnu --with-auto-load-dir=$debugdir:$datadir/auto-load --with-auto-load-safe-path=$debugdir:$datadir/auto-load --with-expat --with-gdb-datadir=/usr/share/gdb (relocatable) --with-jit-reader-dir=/usr/lib/gdb (relocatable) --without-libunwind-ia64 --with-lzma --with-babeltrace --without-intel-pt --with-mpfr --with-xxhash --with-python=/usr (relocatable) --with-python-libdir=/usr/lib (relocatable) --with-debuginfod --without-guile --enable-source-highlight --enable-threading --with-separate-debug-dir=/usr/lib/debug (relocatable) --with-system-gdbinit=/etc/gdb/gdbinit --with-system-gdbinit-dir=/etc/gdb/gdbinit.d ("Relocatable" means the directory can be moved with the GDB installation tree, and GDB will still find it.) # gcc --version gcc (Debian 12.2.0-12) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This is probably a regression due to this patch: commit 3eba3a011a89c75c10bd1860eee4589e65697165 Author: Tom Tromey <tromey@adacore.com> Date: Mon Sep 14 08:30:10 2020 -0600 Various m68k fixes for gdb When I debug gdb I see it decides this core file is GDB_OSABI_SVR4, not GDB_OSABI_LINUX. This happens because m68k_osabi_sniffer takes this branch: if (elfosabi == ELFOSABI_NONE) return GDB_OSABI_SVR4; From elf/common.h: #define ELFOSABI_NONE 0 /* UNIX System V ABI */ #define ELFOSABI_HPUX 1 /* HP-UX operating system */ #define ELFOSABI_NETBSD 2 /* NetBSD */ #define ELFOSABI_GNU 3 /* GNU */ #define ELFOSABI_LINUX 3 /* Alias for ELFOSABI_GNU */ So I guess one question is why this core file isn't marked as ELFOSABI_LINUX.
I think using "--target=m68k-linux-gnu" sets gdb_osabi=GDB_OSABI_LINUX (in configure.tgt) and so that explains why this worked before the osabi sniffer was added. I wonder if the m68k sniffer could use generic_elf_osabi_sniff_abi_tag_sections to detect that this is a Linux core file. I do see: prentzel. objdump -x /tmp/core.0 |grep linux 1 .note.linuxcore.siginfo/1845559296 00000080 00000000 00000000 00000388 2**2 2 .note.linuxcore.siginfo 00000080 00000000 00000000 00000388 2**2 4 .note.linuxcore.file/1845559296 00000192 00000000 00000000 000004b8 2**2 5 .note.linuxcore.file 00000192 00000000 00000000 000004b8 2**2
> generic_elf_osabi_sniff_abi_tag_sections Nope, that didn't work, that function looks for specific notes. Still, for BSD it does: if (strcmp (name, ".note.netbsdcore.procinfo") == 0) i.e., just checking the section name. So maybe this could be done for the above as well. I just wonder if it's really ok.
Here is a workaround for this issue. (gdb) set osabi GNU/Linux (gdb) core core.0 [New LWP 366] Core was generated by `/bin/sh /etc/init.d/mountkernfs.sh reload'. Program terminated with signal SIGABRT, Aborted. #0 0xc00a7034 in ?? () (gdb)