From patchwork Sat Jan 23 12:34:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marcin_Ko=C5=9Bcielnicki?= X-Patchwork-Id: 10529 Received: (qmail 107960 invoked by alias); 23 Jan 2016 12:34:20 -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 107943 invoked by uid 89); 23 Jan 2016 12:34:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=marks, tfind, bitfields, HContent-Transfer-Encoding:8bit X-HELO: xyzzy.0x04.net Received: from xyzzy.0x04.net (HELO xyzzy.0x04.net) (109.74.193.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 23 Jan 2016 12:34:18 +0000 Received: from hogfather.0x04.net (89-65-66-135.dynamic.chello.pl [89.65.66.135]) by xyzzy.0x04.net (Postfix) with ESMTPS id C6F8D3FE68 for ; Sat, 23 Jan 2016 13:34:59 +0100 (CET) Received: by hogfather.0x04.net (Postfix, from userid 1000) id 92460580092; Sat, 23 Jan 2016 13:34:15 +0100 (CET) From: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= To: gdb-patches@sourceware.org Cc: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= Subject: [PATCH] gdb.trace: Fix unavailable-dwarf-piece.exp on big endian targets Date: Sat, 23 Jan 2016 13:34:14 +0100 Message-Id: <1453552454-18078-1-git-send-email-koriakin@0x04.net> MIME-Version: 1.0 X-IsSubscribed: yes The test constructs fake DWARF info for a C structure involving bitfields. DWARF bitfields are always counted from LSB, while the order in which bitfields are allocated in a C struct depends on the target endianness - thus the generated DWARF marks different bitfields as unavailable when target is big endian. Accordingly, we need different expected outputs. Tested on s390 and s390x, no regression on x86_64. gdb/testsuite/ChangeLog: * gdb.trace/unavailable-dwarf-piece.exp: Fix bitfield handling on big endian targets. --- Not sure if that's the kosher way to get target endianness. I looked for an endian function in the test library, but didn't find one. gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8f7dc6d..8ee2efa 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-23 Marcin Kościelnicki + + * gdb.trace/unavailable-dwarf-piece.exp: Fix bitfield handling on big + endian targets. + 2016-01-22 Jan Kratochvil Pedro Alves diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp index 60820dd..e511915 100644 --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp @@ -325,10 +325,23 @@ with_test_prefix "tracing bar" { gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" gdb_test_no_output "tstop" + gdb_test_multiple "show endian" "show endian" { + -re ".* (big|little) endian.*$gdb_prompt $" { + set endian $expect_out(1,string) + pass "endianness: $endian" + } + } + gdb_test "tfind 0" "Found trace frame 0, tracepoint .*" - gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = , c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}" - gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = , f = 0, g = 0, h = 0, i = 0, j = 0}" - gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = , j = 0}" + if { $endian == "little" } { + gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = , c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}" + gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = , f = 0, g = 0, h = 0, i = 0, j = 0}" + gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = , j = 0}" + } else { + gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = , j = 0}" + gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = , g = 0, h = 0, i = 0, j = 0}" + gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = , c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}" + } gdb_test "tfind none" "No longer looking at any trace frame.*" }