Fix gdb.arch/i386-biarch-core.exp FAIL on i386.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 16 Jul 2015 16:01:22 +0000 (18:01 +0200)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 16 Jul 2015 16:01:22 +0000 (18:01 +0200)
commit775a3298dca48e76e29045912e08025abacafa94
tree775840583a83e9392fc5573e3c82076d81d7a57d
parent6f1c2142595b1ec203a7da998b2155403a433e89
Fix gdb.arch/i386-biarch-core.exp FAIL on i386.

This new test fails on i686 buildbot slaves,

(gdb) core-file /home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core
"/home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core"
is not a core dump: File format not recognized
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file

There are two problems:

(1) The testcase did not really test if elf64-i386 is supported by GDB (BFD).
That was OK for a Fedora testcase but I forgot about it when submitting it
upstream.

I haven't really verified if the GNU target is elf64-little but it seems so,
no other one seems suitable from:
elf32-x86-64
elf64-big
elf64-k1om
elf64-l1om
elf64-little
elf64-x86-64
pei-x86-64

(2) The output of the "core-file" command itself can be arbitrary as the
elf64-i386 file with x86_64 registers is really broken; but that does not
matter much, important is the following test whether core file memory is
readable.
./configure --enable-64-bit-bfd
(gdb) core-file /home/jkratoch/redhat/gdb-test-build32-plus64/gdb/testsuite/gdb.arch/i386-biarch-core.core^M
warning: Couldn't find general-purpose registers in core file.^M
Failed to read a valid object file image from memory.^M
warning: Couldn't find general-purpose registers in core file.^M
#0  <unavailable> in ?? ()^M
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file
x/i 0x400078^M
   0x400078:    hlt    ^M
(gdb) PASS: gdb.arch/i386-biarch-core.exp: .text is readable

I do not know much dejagnu but I expect 'istarget' tests against the site.exp
'target_triplet' content which is set to the primary GDB target
(--target=...).

GDB is normally never configured for primary target elf64-i386, I think BFD
does not know such explicit target, it gets recognized as elf64-little.

In fact many testfiles of the GDB testsuite are wrong as they require
'istarget' (therefore primary GDB target) even for just loading arch specific
files which would be sufficient with secondary target (--enable-targets=...)
support.

This my new patch removes this 'istarget' check as it is IMO unrelated to what
we need to test.  Although you are right we do 'x/i' and test for 'hlt' so
I think we should test also for available 'set architecture i386'.
We could also test by 'x/bx' instead of 'x/i' to avoid such additional
test/requirement.

This testcase comes from a different bug from 2009:
https://bugzilla.redhat.com/show_bug.cgi?id=457187
http://pkgs.fedoraproject.org/cgit/gdb.git/commit/?id=94cd124608bf0dd359cb48a710800d72c21b30c3

That bug has been fixed in the meantime but the same testcase was reproducing
this new different bug - internal error regression - so I submitted it.

We can remove the "x/bx $address" test but it was useful for the previous bug
from 2009 as that time the internal error regression did not happen, just the
core file was not recognized (which would not be detected by the proposed
ignoring of the "core-file" command output) and so the core file was not
available.  That can be tested by the "x/bx $address" test.

gdb/testsuite/ChangeLog
2015-07-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/i386-biarch-core.exp: Replace istarget
by "complete set gnutarget". Remove expectation for the "core-file"
command.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/i386-biarch-core.exp
This page took 0.028601 seconds and 4 git commands to generate.