Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: Klaus-Georg Adams <Klaus-Georg.Adams@sap.com>, gdb@sources.redhat.com
Subject: Re: displaying wchar_t in gdb
Date: Wed, 28 Nov 2001 16:02:00 -0000	[thread overview]
Message-ID: <87u1veigta.fsf@creche.redhat.com> (raw)
Message-ID: <20011128160200.depUixPBSbJvqPec1d51qtn3vYNcfbEJFXwlkAifHRI@z> (raw)
In-Reply-To: <Pine.SUN.3.91.1011126140745.12758B-100000@is>

>>>>> "Eli" == Eli Zaretskii <eliz@is.elta.co.il> writes:

>> What would be a strategy to implement this natively in gdb? Can you
>> tell inside gdb if we are working with wchar_t? Should there be a
>> separate format for this?

Eli> I'm not even sure this is feasible, taking the cross-debugging
Eli> into consideration.  I guess it's possible in native debugging,
Eli> assuming GDB and the debuggee use compatible libraries for wide
Eli> character support, and support the same character sets.

I think it is feasible if you assume first that the host has a
high-powered iconv() implementation (Linux does, other systems are
typically less good -- but there is always libiconv) and second that
the target's wchar_t is a well-known encoding and not some peculiar
thing.

With these assumptions the problem becomes one of telling gdb what
encoding to expect when printing wchar_t strings.  The terminal's
encoding can just come from the current locale.

Eli> If it _is_ possible and feasible, then a special format is
Eli> probably the way to go.

For wchar_t I don't think you need a new `print' format (well maybe to
specify the encoding).  I think a wchar_t string could be printed
based solely on the type, the way we print a char* string right now.

It would also be possible to print multibyte strings this way too.  In
this case you'd want a special format.

This functionality might be mildly useful for Java debugging (for Java
the problem is simpler as the target's encoding is always UCS-2).
Right now I believe we print non-ASCII characters using `\u' escapes.
I haven't yet run into a situation where this is insufficient, but I
suppose it is possible.

Tom


  parent reply	other threads:[~2001-11-28 16:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-13 16:57 Klaus-Georg Adams
2001-11-26  1:16 ` Klaus-Georg Adams
2001-11-26  1:29 ` Eli Zaretskii
2001-11-13 21:23   ` Eli Zaretskii
2001-11-26  1:59   ` Klaus-Georg Adams
2001-11-13 21:28     ` Klaus-Georg Adams
2001-11-26  4:11     ` Eli Zaretskii
2001-11-13 23:51       ` Eli Zaretskii
2001-11-22  9:19       ` LeakyStain
2001-11-28 15:38         ` LeakyStain
2001-11-22 14:30       ` Tom Tromey [this message]
2001-11-28 16:02         ` Tom Tromey
2001-11-29  0:19         ` Eli Zaretskii
2001-11-23 13:27           ` Eli Zaretskii
2001-11-24 22:42           ` Tom Tromey
2001-11-29  8:04             ` Tom Tromey
2001-11-25 10:38 Klaus-Georg Adams
2001-11-25 10:44 ` Arnaud Charlet
2001-11-30  2:22   ` Arnaud Charlet
2001-11-25 12:10 ` Paul Hilfinger
2001-11-30  3:36   ` Paul Hilfinger
2001-11-30  2:15 ` Klaus-Georg Adams
2001-11-30  2:25 ` Joel Brobecker
2001-11-25 10:54   ` Joel Brobecker

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=87u1veigta.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=Klaus-Georg.Adams@sap.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb@sources.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