This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ping: [testsuite patch] for: [PATCH] [PR corefiles/17808] i386: Fix internal error when prstatus in core file is too big


Jan Kratochvil <jan.kratochvil@redhat.com> writes:

> (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

Hi Jan,
Why can't we use istarget here?  I thought we still check
istarget "x86_64-*-*", no?

>
> (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.

"that does not matter much" mean if internal error isn't triggered, any
output is acceptable, right?  and the purpose of following test "x/i $address"
is to verify this (internal error not triggered)?

Bug 17808 describes that GDB gets internal error when it loads in
i386-biarch-core.core.

> 	./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
>


>  # Wrongly built GDB complains by:
>  # "..." is not a core dump: File format not recognized
>  # As the provided test core has 64bit PRSTATUS i386 built GDB cannot parse it.
>  # This is just a problem of the test case, real-world elf64-i386 file will have
>  # 32bit PRSTATUS.  One cannot prepare elf64-i386 core file from elf32-i386 by
>  # objcopy as it corrupts the core file beyond all recognition.

As you said, the output of command "core-file" doesn't matter much, we
need to update the comments here.

> -gdb_test "core-file ${corefile}" "\r\nwarning: Unexpected size of section `\\.reg/6901' in core file\\.\r\n.*Core was generated by `\[^\r\n\]*'\\.\r\nProgram terminated with signal SIGSEGV, Segmentation fault\\.\r\n.*" "core-file"
> +gdb_test "core-file ${corefile}" ".*" "core-file"

>  
>  gdb_test "x/i $address" "\r\n\[ \t\]*$address:\[ \t\]*hlt\[ \t\]*" ".text is readable"

We also need comment here to explain the purpose this "x/i $address" test.

-- 
Yao (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]