From patchwork Thu Dec 3 15:49:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 9867 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-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@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 X-IsSubscribed: yes Pedro Alves writes: > I think we can replace that like you did for sizeof. > > value = (int) (char) -1; > > etc., and then check "p value = ${val}", just like you did for > the sizeof checks. OK, how about this? diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeof.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]; struct { @@ -100,28 +96,26 @@ fill_structs (void) int main () { - gdb_unbuffer_output (); + int size, value; fill_structs (); - printf ("sizeof (char) == %d\n", (int) sizeof (char)); - printf ("sizeof (short) == %d\n", (int) sizeof (short)); - printf ("sizeof (int) == %d\n", (int) sizeof (int)); - printf ("sizeof (long) == %d\n", (int) sizeof (long)); - printf ("sizeof (long long) == %d\n", (int) sizeof (long long)); - - printf ("sizeof (void *) == %d\n", (int) sizeof (void*)); - printf ("sizeof (void (*)(void)) == %d\n", (int) sizeof (void (*)(void))); - - printf ("sizeof (float) == %d\n", (int) sizeof (float)); - printf ("sizeof (double) == %d\n", (int) sizeof (double)); - printf ("sizeof (long double) == %d\n", (int) sizeof (long double)); + size = (int) sizeof (char); + size = (int) sizeof (short); + size = (int) sizeof (int); + size = (int) sizeof (long); + size = (int) sizeof (long long); + size = (int) sizeof (void*); + size = (int) sizeof (void (*)(void)); + size = (int) sizeof (float); + size = (int) sizeof (double); + size = (int) sizeof (long double); /* Signed char? */ - printf ("valueof ('\\377') == %d\n", '\377'); - printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1); - printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1); - printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1); + value = '\377'; + value = (int) (char) -1; + value = (int) (signed char) -1; + value = (int) (unsigned char) -1; return 0; } diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.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 . -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 # -gdb_test "next 2" +gdb_test "next" 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] # proc check_sizeof { type size } { - global gdb_prompt - - set pat [string_to_regexp "sizeof (${type}) == ${size}\r\n"] - gdb_test_stdio "next" "${pat}" \ - "\[0-9\].*" \ - "check sizeof \"$type\"" + gdb_test "next" "" "" + gdb_test "p size" " = ${size}" "check sizeof \"$type\"" } check_sizeof "char" ${sizeof_char} @@ -90,12 +81,8 @@ check_sizeof "double" ${sizeof_double} check_sizeof "long double" ${sizeof_long_double} proc check_valueof { exp val } { - global gdb_prompt - - set pat [string_to_regexp "valueof (${exp}) == ${val}\r\n"] - gdb_test_stdio "next" "${pat}" \ - "\[0-9\].*" \ - "check valueof \"$exp\"" + gdb_test "next" "" "" + gdb_test "p value" " = ${val}" "check valueof \"$exp\"" } # Check that GDB and the target agree over the sign of a character.