From: Pedro Alves Date: Mon, 26 Jun 2023 12:56:26 +0000 (+0100) Subject: Support core dumping testcases with Cygwin's dumper X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88c4b5533e097279e5e3a596d78d7c0111c35a67;p=thirdparty%2Fbinutils-gdb.git Support core dumping testcases with Cygwin's dumper 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 Change-Id: Ic807dd2d7f22c5df291360a18c1d4fbbbb9b993e --- diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 838e5d69ddb..5cc7e11287b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -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