From: "Yifan Wang" <heavenstar@gmail.com>
To: tromey@redhat.com
Cc: gdb@sourceware.org
Subject: Re: gdb support for wide char
Date: Mon, 13 Oct 2008 08:56:00 -0000 [thread overview]
Message-ID: <fdbd509e0810130155o421c4f7bvbf5eb2c45c8851c8@mail.gmail.com> (raw)
In-Reply-To: <m3hc7wl4l5.fsf@fleche.redhat.com>
Thanks Tom.
I already have wrote a patch to make c/c++ support fixed length
characters(u8, u16, u32).
and now i am working on utf8 which is not fixed length character.
The solution rely on the glibc functions, eg.mbstowcs(), iconv(), to
support wide character.
I dont know whether this solution is good enough, because it does not
support other programming language
and it rely on the glibc functions.
Regards
Yifan
2008/10/1 Tom Tromey <tromey@redhat.com>:
>>>>>> "Yifan" == Yifan Wang <heavenstar@gmail.com> writes:
>
> Yifan> in gdb, i usually use "p" or "x /s" to print strings in my
> Yifan> program. But the problem is, when i write some program for
> Yifan> non-english user, i usually use utf-8 or utf-16 strings. gdb
> Yifan> can not print those string properly. so i want to write a
> Yifan> patch to gdb so that gdb can support printing utf strings.
>
> Yifan> I am not familar with the gdb source files, can someone give
> Yifan> some ideas about where i should start and which part of the
> Yifan> source files cover the topic? Any hints or ideas are great
>
> gdb has an idea about the host and target charsets. Unfortunately it
> does not understand very many encodings.
>
> You could start by looking at charset.c. I think it needs an API
> overhaul to work with "more complicated" character set encodings,
> though offhand I don't recall whether UTF-8 fits into that category.
>
> If you are on a system with a nice iconv (anything using glibc at
> least), you could make charset.c handle just about anything. This
> would let you do:
>
> set target-charset UTF-8
> print str
>
> If your host isn't using glibc, I would suggest investigating the use
> of libiconv, rather than continuing down the current path of
> charset.c.
>
> There are actually a few other missing features in this area. I think
> gdb should probably also have a "wide target charset", for programs
> using wchar_t. And, with the new UTF strings stuff in GCC, perhaps a
> "/u" format to "p" would be appropriate.
>
> Tom
>
next prev parent reply other threads:[~2008-10-13 8:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-01 10:29 Yifan Wang
2008-10-01 15:28 ` Tom Tromey
2008-10-13 8:56 ` Yifan Wang [this message]
2008-10-13 18:48 ` Tom Tromey
[not found] <1224016294.17588.ezmlm@sourceware.org>
2008-10-15 0:14 ` Duane Ellis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fdbd509e0810130155o421c4f7bvbf5eb2c45c8851c8@mail.gmail.com \
--to=heavenstar@gmail.com \
--cc=gdb@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox