This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC PATCH 2/2] fix py-value-cc.exp test for big endian target
- From: Yao Qi <yao at codesourcery dot com>
- To: Victor Kamensky <victor dot kamensky at linaro dot org>
- Cc: <gdb-patches at sourceware dot org>, Andrew Pinski <pinskia at gmail dot com>
- Date: Wed, 29 Oct 2014 14:36:06 +0800
- Subject: Re: [RFC PATCH 2/2] fix py-value-cc.exp test for big endian target
- Authentication-results: sourceware.org; auth=none
- References: <1414379778-5478-1-git-send-email-victor dot kamensky at linaro dot org> <1414379778-5478-3-git-send-email-victor dot kamensky at linaro dot org>
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 (éå)