From patchwork Mon Oct 27 03:16:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Kamensky X-Patchwork-Id: 3390 Received: (qmail 11495 invoked by alias); 27 Oct 2014 03:16:33 -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 11318 invoked by uid 89); 27 Oct 2014 03:16:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f181.google.com Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 27 Oct 2014 03:16:31 +0000 Received: by mail-pd0-f181.google.com with SMTP id y10so430971pdj.40 for ; Sun, 26 Oct 2014 20:16:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5b6ImZWOYU80yisVo4JPWJejEOw+IgtKsMhqdfHyHQY=; b=JyBE+IKhwGNxi9XVSAF+cHjZcDz7pgEoq77iV7UXxMbOhyezbmGRjRd32FYguHMMUa CShydTS8R+3HQ+JwTHcuKl88nUamsGS8ewe/d3nNC9DvLK5XEsskIbDmujn8jPvEy0XI YyZFqQ8eUhaU3CebqLudT85aWANKI3Myt9Fc0f7EFQYd+5Bkz7+rV1yP/9cj4+eb90Bv tuylwDG+1N/SCKZj5/v/bN9Wql1X4ZJ0JUi1/dOfyp7pi07LCbd0nI8ELvQHY0LRu6fR PjDXi7y0jd0Jp678MSiH98JhTe50Ab7FRzNE2wKlyqPBqgS59MqwzeyDhTWxX24gwL8O 4UYw== X-Gm-Message-State: ALoCoQlV/mNZU5ag2yFlf98bnrABXWwKzIdlZgu5NpZtYWAfo2R5MmzcMuZH5n2NLWgGpgvbNjqf X-Received: by 10.68.65.10 with SMTP id t10mr24452pbs.156.1414379789764; Sun, 26 Oct 2014 20:16:29 -0700 (PDT) Received: from kamensky-w530.cisco.com (128-107-239-233.cisco.com. [128.107.239.233]) by mx.google.com with ESMTPSA id sq2sm2509238pbc.73.2014.10.26.20.16.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Oct 2014 20:16:29 -0700 (PDT) From: Victor Kamensky To: gdb-patches@sourceware.org, Yao Qi Cc: Andrew Pinski , victor.kamensky@linaro.org Subject: [RFC PATCH 1/2] fix implptrpiece.exp test for big endian target Date: Sun, 26 Oct 2014 20:16:17 -0700 Message-Id: <1414379778-5478-2-git-send-email-victor.kamensky@linaro.org> In-Reply-To: <1414379778-5478-1-git-send-email-victor.kamensky@linaro.org> References: <1414379778-5478-1-git-send-email-victor.kamensky@linaro.org> Currently on any big endian target implptrpiece.exp test fails like this: FAIL: gdb.dwarf2/implptrpiece.exp: print/d p[-1] (gdb) print/d p[-1] $1 = 1 (gdb) FAIL: gdb.dwarf2/implptrpiece.exp: print/d p[-1] Test expects that value of p[-1] should be 0. This test creates special DWARF construct with DW_OP_GNU_implicit_pointer: <1><25c>: Abbrev Number: 10 (DW_TAG_variable) <25d> DW_AT_name : s <25f> DW_AT_type : <0x21d> <263> DW_AT_location : 15 byte block: 8 1 9f 93 2 8 2 9f 93 1 8 3 9f 93 1 (DW_OP_const1u: 1; DW_OP_stack_value; DW_OP_piece: 2; DW_OP_const1u: 2; DW_OP_stack_value ; DW_OP_piece: 1; DW_OP_const1u: 3; DW_OP_stack_value; DW_OP_piece: 1) <1><273>: Abbrev Number: 11 (DW_TAG_variable) <274> DW_AT_name : p <276> DW_AT_type : <0x256> <27a> DW_AT_location : 6 byte block: f2 0 0 2 5c 2 (DW_OP_GNU_implicit_pointer: <0x25c> 2) In description of 's' variable note byte constant value of 1, that will be used as first piece of size 2 bytes, followed by 1 byte piece with 2, and 1 byte piece with 3. Variable 'p' is implicit pointer with offset 2 within 's', i.e it points right in the middle of s. Test looks at p[-1] and expects to get most significant byte of short type of value 1, which is 0. But in big endian case such index points to least significant byte which is 1. So test fails. Fix the test by checking endianity of the target and selecting proper index to get most significant byte of first piece. gdb/testsuite/ChangeLog: 2014-10-24 Victor Kamensky * gdb.dwarf2/implptrpiece.exp: Fix handling of big endian target. --- gdb/testsuite/gdb.dwarf2/implptrpiece.exp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp index 60a3d9f..5dcc6ea 100644 --- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp +++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp @@ -119,4 +119,15 @@ if ![runto_main] { return -1 } -gdb_test "print/d p\[-1\]" " = 0" +gdb_test_multiple "show endian" "getting target endian" { + -re ".*little endian.*$gdb_prompt $" { + set check_index "-1" + # pass silently + } + -re ".*big endian.*$gdb_prompt $" { + set check_index "-2" + # pass silently + } +} + +gdb_test "print/d p\[$check_index\]" " = 0"