]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Support core dumping testcases with Cygwin's dumper
authorPedro Alves <pedro@palves.net>
Mon, 26 Jun 2023 12:56:26 +0000 (13:56 +0100)
committerPedro Alves <pedro@palves.net>
Mon, 9 Jun 2025 16:47:12 +0000 (17:47 +0100)
Cygwin supports dumping ELF cores via a dumper.exe utility, see
https://www.cygwin.com/cygwin-ug-net/dumper.html.

When I run a testcase that has the "kernel" generate a corefile, like
gdb.base/corefile.exp, Cygwin invokes dumper.exe correctly and
generates an ELF core file, however, the testsuite doesn't find the
generated core:

 Running /home/alves/gdb/src/gdb/testsuite/gdb.base/corefile.exp ...
 WARNING: can't generate a core file - core tests suppressed - check ulimit -c

The file is correctly put under $coredir, e.g., like so:

  outputs/gdb.base/corefile/coredir.8926/corefile.exe.core

The problem is in this line in core_find:

  foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {

Note that that isn't looking for "${binfile}.core" inside
${coredir}...  That is fixed in this patch.

However, that still isn't sufficient for Cygwin + dumper, as in that
case the core is going to be called foo.exe.core, not foo.core.  Fix
that by looking for foo.exe.core in the core dir as well.

With this, gdb.base/corefile.exp and other tests that use core_find
now run.  They don't pass cleanly, but at least now they're exercised.

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: Ic807dd2d7f22c5df291360a18c1d4fbbbb9b993e

gdb/testsuite/lib/gdb.exp

index 838e5d69ddb6f983c2752c86538de27411609b34..5cc7e11287b244b49b959fe015154a8344347d30 100644 (file)
@@ -9312,7 +9312,12 @@ proc core_find {binfile {deletefiles {}} {arg ""}} {
     file mkdir $coredir
     catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile} ${arg}; true) >/dev/null 2>&1\""
     #      remote_exec host "${binfile}"
-    foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
+    set binfile_basename [file tail $binfile]
+    foreach i [list \
+                  ${coredir}/core \
+                  ${coredir}/core.coremaker.c \
+                  ${coredir}/${binfile_basename}.core \
+                  ${coredir}/${binfile_basename}.exe.core] {
        if [remote_file build exists $i] {
            remote_exec build "mv $i $destcore"
            set found 1