public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Victor Kamensky <victor.kamensky@linaro.org>
Cc: <gdb-patches@sourceware.org>, Andrew Pinski <pinskia@gmail.com>
Subject: Re: [RFC PATCH 2/2] fix py-value-cc.exp test for big endian target
Date: Wed, 29 Oct 2014 06:40:00 -0000	[thread overview]
Message-ID: <87oasvtmax.fsf@codesourcery.com> (raw)
In-Reply-To: <1414379778-5478-3-git-send-email-victor.kamensky@linaro.org>	(Victor Kamensky's message of "Sun, 26 Oct 2014 20:16:18 -0700")

Victor Kamensky <victor.kamensky@linaro.org> writes:

> The reason is that test case is not endian agnostic.
> Test program variable 'u' has type of 'union U { int a;
> char c; };'. Test program writes 99 into u.a and expects to see
> it in field 'u.c'. But it would only work on little endian
> system where 'c' field of U union conicide with least
> significant byte of 'a' field.

Yes, that make senses to me, and we've seen this fail on powerpc too.

> diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.python/py-value-cc.cc
> index 7ea4f5d..d6d4d35 100644
> --- a/gdb/testsuite/gdb.python/py-value-cc.cc
> +++ b/gdb/testsuite/gdb.python/py-value-cc.cc
> @@ -77,7 +77,7 @@ func (const A &a)
>    Btd &b_td = b1;
>  
>    U u;
> -  u.a = 99;
> +  u.a = 0x55000055; /* c is the same for big and little endian */

I'd like c is shown differently on big endian and little endian, and
check c's value in different endianness.  It can be something like,

 u.a = 0x55000056 or u.a = 0x55565758

>  
>    X x;
>    x.x = 101;
> diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp
> index 949f04f..56003c3 100644
> --- a/gdb/testsuite/gdb.python/py-value-cc.exp
> +++ b/gdb/testsuite/gdb.python/py-value-cc.exp
> @@ -85,8 +85,8 @@ gdb_test "python print(b_td\[b_fields\[0\]\].type.target())" "A" \
>  gdb_test "python print(b_td\[b_fields\[0\]\]\['a'\])" "100" \
>    "b_td.A::a via field"
>  
> -gdb_test "python print(u\[u_fields\[0\]\])" "99.*" "u's first field via field"
> -gdb_test "python print(u\[u_fields\[1\]\])" "99.*" "u's second field via field"
> +gdb_test "python print(u\[u_fields\[0\]\])" "1426063445.*" "u's first field via field"

The ".*" in the pattern can be removed.

> +gdb_test "python print(u\[u_fields\[1\]\])" "85.*" "u's second field via field"

This pattern can be stricter by adding space between 85 and ".*".

-- 
Yao (齐尧)

  reply	other threads:[~2014-10-29  6:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  3:16 [RFC PATCH 0/2] couple big endian fixes in testsuites Victor Kamensky
2014-10-27  3:16 ` [RFC PATCH 2/2] fix py-value-cc.exp test for big endian target Victor Kamensky
2014-10-29  6:40   ` Yao Qi [this message]
2014-10-29  9:13     ` Pedro Alves
2014-10-27  3:16 ` [RFC PATCH 1/2] fix implptrpiece.exp " Victor Kamensky
2014-10-29  8:15   ` Yao Qi

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=87oasvtmax.fsf@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pinskia@gmail.com \
    --cc=victor.kamensky@linaro.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).