From: Luis Machado <lgustavo@codesourcery.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH,v2] Make gdb.arch/i386-biarch-core.exp more robust
Date: Tue, 07 Feb 2017 11:18:00 -0000 [thread overview]
Message-ID: <0669f385-4807-3ee6-a2d7-a28406a48ca4@codesourcery.com> (raw)
In-Reply-To: <1700b740-dc19-5d7e-5737-4e0313dba2fb@redhat.com>
On 02/07/2017 04:51 AM, Pedro Alves wrote:
> On 02/07/2017 10:11 AM, Luis Machado wrote:
>> This test attempts to load a x86 core file no matter what target
>> architectures the tested GDB supports. If GDB doesn't know how to handle
>> a i386 target, it is very likely the core file will not be recognized.
>>
>> In this case we should still attempt to load a core file to make sure GDB
>> doesn't crash or throws an internal error. But we should not proceed to
>> try to read memory unconditionally.
>>
>> This patch makes the test check for proper i386 arch support in GDB and bails
>> out if i386 is not supported and the core file format is not recognized.
>>
>> This addresses the spurious aarch64-elf failures i'm seeing for this test.
>>
>> gdb/testsuite/ChangeLog:
>>
>> YYYY-MM-DD Luis Machado <lgustavo@codesourcery.com>
>>
>> * gdb.arch/i386-biarch-core.exp: Check for i386 arch support and
>> return if core file is not recognized
>> ---
>> gdb/testsuite/gdb.arch/i386-biarch-core.exp | 30 ++++++++++++++++++++++++++++-
>> 1 file changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
>> index 4c5f450..a05096c 100644
>> --- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp
>> +++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
>> @@ -54,6 +54,18 @@ if {$corestat(size) != 102400} {
>> return -1
>> }
>>
>> +# First check if this particular GDB supports i386, otherwise we should not
>> +# expect the i386 core file to be loaded successfully.
>> +set supports_arch_i386 1
>> +set test "complete set architecture i386"
>> +gdb_test_multiple $test $test {
>> + -re ".*\r\nset architecture i386\r\n(.*\r\n)?$gdb_prompt $" {
>
> ".*" at the start of a -re is implicit/redundant.
>
Thanks. Good to know.
>> + }
>> + -re "\r\n$gdb_prompt $" {
>> + set supports_arch_i386 0
>> + }
>> +}
>> +
>> # 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.
>> @@ -62,7 +74,23 @@ if {$corestat(size) != 102400} {
>> # objcopy as it corrupts the core file beyond all recognition.
>> # The output therefore does not matter much, just we should not get GDB
>> # internal error.
>> -gdb_test "core-file ${corefile}" ".*" "core-file"
>> +#
>> +# If this particular GDB does not support i386, it is expected GDB will not
>> +# recognize the core file. If it does anyway, it should not crash.
>> +set test "load core file"
>> +gdb_test_multiple "core-file ${corefile}" $test {
>> + -re ".* no core file handler recognizes format(.*\r\n)?$gdb_prompt $" {
>
> Ditto. Also, why the "(....)?" in "(.*\r\n)?" ?
>
I think this was from a copy/paste.
>> + if { $supports_arch_i386 } {
>> + fail $test
>> + } else {
>> + untested $test
>
> The "load core file" test was a pass, this "else" outcome is expected.
> What's untested is the next test. Either write something like:
>
> pass $test
> untested ".text is readable (core file unrecognized)"
> return
>
> or here write only:
>
> pass $test
>
> and put the untested after the gdb_test_multiple, close to
> the following gdb_test.
>
>> + return
>> + }
>> + }
>> + -re "\r\n$gdb_prompt $" {
>> + pass $test
>> + }
>> +}
>>
I'll address the above in a new version.
Thanks,
Luis
next prev parent reply other threads:[~2017-02-07 11:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 13:55 [PATCH] " Luis Machado
2017-02-06 17:28 ` Pedro Alves
2017-02-06 17:59 ` Luis Machado
2017-02-06 18:03 ` Pedro Alves
2017-02-07 10:11 ` [PATCH,v2] " Luis Machado
2017-02-07 10:51 ` Pedro Alves
2017-02-07 11:18 ` Luis Machado [this message]
2017-02-07 11:26 ` [PATCH, v3] " Luis Machado
2017-02-07 11:29 ` Pedro Alves
2017-02-13 13:15 ` Luis Machado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0669f385-4807-3ee6-a2d7-a28406a48ca4@codesourcery.com \
--to=lgustavo@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox