From patchwork Thu Sep 17 03:24:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 8735 Received: (qmail 26323 invoked by alias); 17 Sep 2015 03:25:11 -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 26298 invoked by uid 89); 17 Sep 2015 03:25:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Sep 2015 03:25:04 +0000 Received: from svr-orw-fem-05.mgc.mentorg.com ([147.34.97.43]) by relay1.mentorg.com with esmtp id 1ZcPoj-0001zS-M0 from Sandra_Loosemore@mentor.com for gdb-patches@sourceware.org; Wed, 16 Sep 2015 20:25:01 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.3.224.2; Wed, 16 Sep 2015 20:25:00 -0700 Message-ID: <55FA325D.1020207@codesourcery.com> Date: Wed, 16 Sep 2015 21:24:13 -0600 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: gdb-patches Subject: [patch, testsuite] check for UTF-32 target wide charset support in gdb.base/wchar.exp This patch is related to the one I posted yesterday to make with_target_charset do something reasonable in the absence of ICONV support: https://sourceware.org/ml/gdb-patches/2015-09/msg00357.html If GDB is configured without ICONV support, the target wide charset defaults to "ISO-8859-1" (which isn't even a wide charset), and all the wide strings in this test print as gibberish. Otherwise, GDB seems to think the default is "auto; currently UTF-32", so let's make the dependency on UTF-32 explicit here and bail out if it's not available. OK to commit? -Sandra diff --git a/gdb/testsuite/gdb.base/wchar.exp b/gdb/testsuite/gdb.base/wchar.exp index 1a5a2d4..171385b 100644 --- a/gdb/testsuite/gdb.base/wchar.exp +++ b/gdb/testsuite/gdb.base/wchar.exp @@ -24,6 +24,19 @@ if ![runto "wchar.c:$bp_location" ] then { return -1 } +# This test requires wide character support in GDB. +# Setting the charset may fail if GDB was configured without +# ICONV support. +gdb_test_multiple "set target-wide-charset UTF-32" "" { + -re "Undefined item.*$gdb_prompt " { + unsupported "Unknown charset UTF-32" + return -1 + } + -re ".*$gdb_prompt " { + pass "set target-wide-charset UTF-32" + } +} + gdb_test "print narrow" "= 97 L'a'" gdb_test "print single" "= 48879 L'\\\\xbeef'"