From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31678 invoked by alias); 17 Sep 2015 04:31:59 -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 31665 invoked by uid 89); 17 Sep 2015 04:31:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f51.google.com Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 17 Sep 2015 04:31:57 +0000 Received: by pacex6 with SMTP id ex6so8955915pac.0 for ; Wed, 16 Sep 2015 21:31:55 -0700 (PDT) X-Received: by 10.66.189.69 with SMTP id gg5mr68805621pac.28.1442464315472; Wed, 16 Sep 2015 21:31:55 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by smtp.gmail.com with ESMTPSA id bc1sm1081195pbb.66.2015.09.16.21.31.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2015 21:31:55 -0700 (PDT) From: Doug Evans To: Sandra Loosemore Cc: gdb-patches Subject: Re: [patch, testsuite] check for UTF-32 target wide charset support in gdb.base/wchar.exp References: <55FA325D.1020207@codesourcery.com> Date: Thu, 17 Sep 2015 04:31:00 -0000 In-Reply-To: <55FA325D.1020207@codesourcery.com> (Sandra Loosemore's message of "Wed, 16 Sep 2015 21:24:13 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00391.txt.bz2 Sandra Loosemore writes: > 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 > > > 2015-09-16 Sandra Loosemore > > gdb/testsuite/ > * gdb.base/wchar.exp: Require UTF-32 target wide charset support, > otherwise skip this test. > > 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'" Yeah, the default for the !iconv case doesn't seem right: #ifdef PHONY_ICONV /* Provide a phony iconv that does as little as possible. Also, arrange for there to be a single available character set. */ #undef GDB_DEFAULT_HOST_CHARSET #define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1" #define GDB_DEFAULT_TARGET_CHARSET "ISO-8859-1" #define GDB_DEFAULT_TARGET_WIDE_CHARSET "ISO-8859-1" <<<< How reasonable is it to enhance the PHONY_ICONV support so that it handles this better? I see it already tries to provide some minimal functionality: static iconv_t phony_iconv_open (const char *to, const char *from) { /* We allow conversions from UTF-32BE, wchar_t, and the host charset. We allow conversions to wchar_t and the host charset. */ if (strcmp (from, "UTF-32BE") && strcmp (from, "wchar_t") && strcmp (from, GDB_DEFAULT_HOST_CHARSET)) return -1; if (strcmp (to, "wchar_t") && strcmp (to, GDB_DEFAULT_HOST_CHARSET)) return -1; /* Return 1 if we are converting from UTF-32BE, 0 otherwise. This is used as a flag in calls to iconv. */ return !strcmp (from, "UTF-32BE"); } I don't know, off hand, why big endian is supported and not little endian.