ping: [testsuite patch] for: [PATCH] [PR corefiles/17808] i386: Fix internal error when prstatus in core file is too big
Message ID | 20150714180748.GA13461@host1.jankratochvil.net |
---|---|
State | New, archived |
Headers |
Received: (qmail 4001 invoked by alias); 14 Jul 2015 18:07:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3990 invoked by uid 89); 14 Jul 2015 18:07:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 14 Jul 2015 18:07:54 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 421DE2B784F; Tue, 14 Jul 2015 18:07:53 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6EI7n8U021170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 14 Jul 2015 14:07:51 -0400 Date: Tue, 14 Jul 2015 20:07:48 +0200 From: Jan Kratochvil <jan.kratochvil@redhat.com> To: Yao Qi <qiyaoltc@gmail.com> Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org, Andreas Arnez <arnez@linux.vnet.ibm.com> Subject: Re: ping: [testsuite patch] for: [PATCH] [PR corefiles/17808] i386: Fix internal error when prstatus in core file is too big Message-ID: <20150714180748.GA13461@host1.jankratochvil.net> References: <874ms18cyz.fsf@br87z6lw.de.ibm.com> <20150108164327.GA29029@host2.jankratochvil.net> <20150205073758.GA25305@host1.jankratochvil.net> <54D33C45.4010706@redhat.com> <20150214151231.GA29106@host1.jankratochvil.net> <54E33A8D.80504@redhat.com> <20150217165629.GA24936@host1.jankratochvil.net> <55A4CDD1.6060907@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline In-Reply-To: <55A4CDD1.6060907@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes |
Commit Message
Jan Kratochvil
July 14, 2015, 6:07 p.m. UTC
Hi Yao, On Tue, 14 Jul 2015 10:52:33 +0200, Yao Qi wrote: > 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 OK for check-in a fix for (1) and (2) in this patch? Jan 2015-07-14 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.
Comments
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.
On Wed, 15 Jul 2015 18:14:01 +0200, Yao Qi wrote: > 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 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. > I thought we still check istarget "x86_64-*-*", no? 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. > > (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? Yes. > and the purpose of following test "x/i $address" > is to verify this (internal error not triggered)? I did not think specifically about internal error but I agree. After all the core file should be loaded which is tested by readability of a core file's segment. > > # 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. I think the comments above are useful to understand why it does not behave as sanely as one would expect (=the real world case for loading kdump i386 kernel core files). So to add another part of the comment? # The output therefore does not matter much, just we should not get # GDB internal error. Although this whole feature is becoming marginal as i386 kernels in enterprise usage (=kdump) have AFAIK mostly disappeared. > > -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. Such a comment? # Test readability of a core file segment memory. Jan
Jan Kratochvil <jan.kratochvil@redhat.com> writes: > I think the comments above are useful to understand why it does not behave as > sanely as one would expect (=the real world case for loading kdump i386 kernel > core files). > > So to add another part of the comment? > # The output therefore does not matter much, just we should not get > # GDB internal error. It looks good to me. > > Although this whole feature is becoming marginal as i386 kernels in enterprise > usage (=kdump) have AFAIK mostly disappeared. > > >> > -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. > > Such a comment? > # Test readability of a core file segment memory. Sorry, I should be more clear. Let me ask in another way, why do we need "x/i $address" test? Without the patch fixing PR 17808, GDB should crash on loading core-file, and we tested that. Why do we do this test and test whether ".text" is readable or not?
On Thu, 16 Jul 2015 16:15:00 +0200, Yao Qi wrote: > Sorry, I should be more clear. Let me ask in another way, why do we > need "x/i $address" test? Without the patch fixing PR 17808, GDB should > crash on loading core-file, and we tested that. Why do we do this test > and test whether ".text" is readable or not? Because 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/i $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/i $address" test. But we could be upstreaming much more Fedora testcases which I do not plan to. Fedora contains many testcases - 49 grep '^#=' gdb.spec|sed 's/[:+].*//'|sort|uniq -c 49 #=fedoratest for various bugs already fixed upstream. But given there isn't enough work resources to upstream even Fedora fixes (hacks) I have never much attempted to upstream all the testcases there. http://pkgs.fedoraproject.org/cgit/gdb.git/tree/ (Some/few of the testcases are also a different form of the upstreamed variant of the same testcase kept to be really sure no regressions are needlessly missed in Fedora/RHEL.) Jan
Jan Kratochvil <jan.kratochvil@redhat.com> writes: > Because 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. I see, that is clear to me now. > > We can remove the "x/i $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/i $address" test. > Yeah, I agree it is useful to keep this test there, but we need comments on the purpose of such test, for example, # Test bug https://bugzilla.redhat.com/show_bug.cgi?id=457187 gdb_test "x/i $address" "\r\n\[ \t\]*$address:\[ \t\]*hlt\[ \t\]*" ".text is readable" > > But we could be upstreaming much more Fedora testcases which I do not plan to. > Fedora contains many testcases - 49 > grep '^#=' gdb.spec|sed 's/[:+].*//'|sort|uniq -c > 49 #=fedoratest > for various bugs already fixed upstream. But given there isn't enough work > resources to upstream even Fedora fixes (hacks) I have never much attempted to > upstream all the testcases there. > http://pkgs.fedoraproject.org/cgit/gdb.git/tree/ > (Some/few of the testcases are also a different form of the upstreamed variant > of the same testcase kept to be really sure no regressions are needlessly > missed in Fedora/RHEL.) I don't work on any distribution, so I don't know.
diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp index 60d049b..9e05869 100644 --- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp +++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp @@ -23,9 +23,20 @@ standard_testfile -if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { - verbose "Skipping i386-biarch-core test." - return +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +set test "complete set gnutarget" +gdb_test_multiple "complete set gnutarget " $test { + -re "set gnutarget elf64-little\r\n(.*\r\n)?$gdb_prompt $" { + pass $test + } + -re "\r\n$gdb_prompt $" { + pass $test + untested ".text is readable" + return + } } set corebz2file ${srcdir}/${subdir}/${testfile}.core.bz2 @@ -43,16 +54,12 @@ if {$corestat(size) != 102400} { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir - # 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. -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"