From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6347 invoked by alias); 19 Oct 2012 20:07:43 -0000 Received: (qmail 6259 invoked by uid 22791); 19 Oct 2012 20:07:25 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 19 Oct 2012 20:07:20 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id DD6221C7787; Fri, 19 Oct 2012 16:07:19 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dL6BMJv4rOPb; Fri, 19 Oct 2012 16:07:19 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id AA3081C774B; Fri, 19 Oct 2012 16:07:19 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id CB693C800D; Fri, 19 Oct 2012 13:07:08 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [RFA/commit] Set default target-wide-charset setting to "UTF-16" for x86_64-windows. Date: Fri, 19 Oct 2012 20:07:00 -0000 Message-Id: <1350677219-10668-1-git-send-email-brobecker@adacore.com> 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 X-SW-Source: 2012-10/txt/msg00361.txt.bz2 GDB on x86_64-windows is having trouble printing wide characters. For instance, from gdb.base/wchar.exp: wchar_t narrow = 97; /* This is 'a' */ Without this patch, GDB prints narrow as: $1 = 97 L'\141' This is because the default target wide charset is UTF-32, whereas wchar_t is only 16bits long. gdb/ChangeLog: * amd64-windows-tdep.c (amd64_windows_auto_wide_charset): New function. (amd64_windows_init_abi): Set auto_wide_charset gdbarch method to amd64_windows_auto_wide_charset. Tested on x86_64-windows, using AdaCore's testsuite. It seems to be in line with what's done on x86-windows. I'll commit in a few days unless there are objections. --- gdb/amd64-windows-tdep.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 528fbb6..142e141 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -190,6 +190,14 @@ amd64_windows_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) return destination; } +/* Implement the "auto_wide_charset" gdbarch method. */ + +static const char * +amd64_windows_auto_wide_charset (void) +{ + return "UTF-16"; +} + static void amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { @@ -215,6 +223,8 @@ amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_iterate_over_objfiles_in_search_order (gdbarch, windows_iterate_over_objfiles_in_search_order); + set_gdbarch_auto_wide_charset (gdbarch, amd64_windows_auto_wide_charset); + set_solib_ops (gdbarch, &solib_target_so_ops); } -- 1.7.9.5