From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122845 invoked by alias); 3 Dec 2015 15:49:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 122809 invoked by uid 89); 3 Dec 2015 15:49:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pf0-f181.google.com Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 03 Dec 2015 15:49:09 +0000 Received: by pfdd184 with SMTP id d184so10369070pfd.3 for ; Thu, 03 Dec 2015 07:49:08 -0800 (PST) X-Received: by 10.98.15.68 with SMTP id x65mr14324736pfi.146.1449157747948; Thu, 03 Dec 2015 07:49:07 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id c79sm11552408pfj.71.2015.12.03.07.49.03 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 03 Dec 2015 07:49:06 -0800 (PST) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] Run gdb.base/sizeof.exp with board having gdb,noinferiorio References: <1448977402-9487-1-git-send-email-yao.qi@linaro.org> <56603F3E.6040703@redhat.com> Date: Thu, 03 Dec 2015 15:49:00 -0000 In-Reply-To: <56603F3E.6040703@redhat.com> (Pedro Alves's message of "Thu, 03 Dec 2015 13:10:22 +0000") Message-ID: <86si3jsfbn.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00052.txt.bz2 Pedro Alves writes: > I think we can replace that like you did for sizeof. > > value =3D (int) (char) -1; > > etc., and then check "p value =3D ${val}", just like you did for > the sizeof checks. OK, how about this? --=20 Yao (=E9=BD=90=E5=B0=A7) =46rom bc000d9874eb1275c837e50043bc31d3ebe6fed4 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Fri, 20 Nov 2015 12:29:12 +0000 Subject: [PATCH] Run gdb.base/sizeof.exp with board having gdb,noinferiorio In my remote cross testing (x86_64 host and aarch64 target), the test gdb.base/sizeof.exp is skipped because gdb,noinferiorio is defined in my gdbserver board file. Tests are skipped because the test checks the expected value from the program's output, but I don't see why must do it this way. With my patch applied, we can save the result in variable in the program, and check the variable then. Then, the test doesn't rely on inferiorio. gdb/testsuite: 2015-12-03 Yao Qi * gdb.base/sizeof.c: Don't include stdio.h and ../lib/unbuffer_output.c. (main): New variable 'size' and 'value'. Remove printf and gdb_unbuffer_output. Assign return value to size and value. * gdb.base/sizeof.exp: Remove the checking to gdb,noinferiorio at the beginning. (check_sizeof): Check the result by printing variable 'size'. (check_valueof): Check the result by printing variable 'value'. diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeo= f.c index eb21f22..fde5213 100644 --- a/gdb/testsuite/gdb.base/sizeof.c +++ b/gdb/testsuite/gdb.base/sizeof.c @@ -1,7 +1,3 @@ -#include - -#include "../lib/unbuffer_output.c" - typedef char padding[16]; =20 struct { @@ -100,28 +96,26 @@ fill_structs (void) int main () { - gdb_unbuffer_output (); + int size, value; =20 fill_structs (); =20 - printf ("sizeof (char) =3D=3D %d\n", (int) sizeof (char)); - printf ("sizeof (short) =3D=3D %d\n", (int) sizeof (short)); - printf ("sizeof (int) =3D=3D %d\n", (int) sizeof (int)); - printf ("sizeof (long) =3D=3D %d\n", (int) sizeof (long)); - printf ("sizeof (long long) =3D=3D %d\n", (int) sizeof (long long)); - - printf ("sizeof (void *) =3D=3D %d\n", (int) sizeof (void*)); - printf ("sizeof (void (*)(void)) =3D=3D %d\n", (int) sizeof (void (*)(vo= id))); - - printf ("sizeof (float) =3D=3D %d\n", (int) sizeof (float)); - printf ("sizeof (double) =3D=3D %d\n", (int) sizeof (double)); - printf ("sizeof (long double) =3D=3D %d\n", (int) sizeof (long double)); + size =3D (int) sizeof (char); + size =3D (int) sizeof (short); + size =3D (int) sizeof (int); + size =3D (int) sizeof (long); + size =3D (int) sizeof (long long); + size =3D (int) sizeof (void*); + size =3D (int) sizeof (void (*)(void)); + size =3D (int) sizeof (float); + size =3D (int) sizeof (double); + size =3D (int) sizeof (long double); =20 /* Signed char? */ - printf ("valueof ('\\377') =3D=3D %d\n", '\377'); - printf ("valueof ((int) (char) -1) =3D=3D %d\n", (int) (char) -1); - printf ("valueof ((int) (signed char) -1) =3D=3D %d\n", (int) (signed ch= ar) -1); - printf ("valueof ((int) (unsigned char) -1) =3D=3D %d\n", (int) (unsigne= d char) -1); + value =3D '\377'; + value =3D (int) (char) -1; + value =3D (int) (signed char) -1; + value =3D (int) (unsigned char) -1; =20 return 0; } diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/siz= eof.exp index ce6b7ed..550f80d 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -15,11 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . =20 -if [target_info exists gdb,noinferiorio] { - verbose "Skipping sizeof.exp because of no fileio capabilities." - continue -} - # # test running programs # @@ -48,7 +43,7 @@ if ![runto_main] then { # Query GDB for the size of various types # =20 -gdb_test "next 2" +gdb_test "next" =20 set sizeof_char [get_sizeof "char" 1] set sizeof_short [get_sizeof "short" 2] @@ -68,12 +63,8 @@ set sizeof_long_double [get_sizeof "long double" 8] # =20 proc check_sizeof { type size } { - global gdb_prompt - - set pat [string_to_regexp "sizeof (${type}) =3D=3D ${size}\r\n"] - gdb_test_stdio "next" "${pat}" \ - "\[0-9\].*" \ - "check sizeof \"$type\"" + gdb_test "next" "" "" + gdb_test "p size" " =3D ${size}" "check sizeof \"$type\"" } =20 check_sizeof "char" ${sizeof_char} @@ -90,12 +81,8 @@ check_sizeof "double" ${sizeof_double} check_sizeof "long double" ${sizeof_long_double} =20 proc check_valueof { exp val } { - global gdb_prompt - - set pat [string_to_regexp "valueof (${exp}) =3D=3D ${val}\r\n"] - gdb_test_stdio "next" "${pat}" \ - "\[0-9\].*" \ - "check valueof \"$exp\"" + gdb_test "next" "" "" + gdb_test "p value" " =3D ${val}" "check valueof \"$exp\"" } =20 # Check that GDB and the target agree over the sign of a character.