From: Tom Tromey <tromey@redhat.com>
To: "Yifan Wang" <heavenstar@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: gdb support for wide char
Date: Wed, 01 Oct 2008 15:28:00 -0000 [thread overview]
Message-ID: <m3hc7wl4l5.fsf@fleche.redhat.com> (raw)
In-Reply-To: <fdbd509e0810010328w5dc56929g64c2e4ae1ca69bd5@mail.gmail.com> (Yifan Wang's message of "Wed\, 1 Oct 2008 12\:28\:36 +0200")
>>>>> "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-01 15:28 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 [this message]
2008-10-13 8:56 ` Yifan Wang
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=m3hc7wl4l5.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb@sourceware.org \
--cc=heavenstar@gmail.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