Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: Julian Brown <julian@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH/WIP] C/C++ wchar_t/Unicode printing support
Date: Fri, 16 Jan 2009 00:01:00 -0000	[thread overview]
Message-ID: <m3mydsjf4y.fsf@fleche.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0901152112030.15655@digraph.polyomino.org.uk> (Joseph S. Myers's message of "Thu\, 15 Jan 2009 21\:17\:46 +0000 \(UTC\)")

>>>>> "Joseph" == Joseph S Myers <joseph@codesourcery.com> writes:

Joseph> (Of course, now C++0x has and C1x has accepted (not yet in a
Joseph> draft) a lot of further new string syntax that Jakub has
Joseph> implemented for GCC 4.5.)

Yeah, I haven't looked at that yet.

Joseph> If you handle input of the new string syntax, do you also
Joseph> handle the interesting concatenation issues?  "\xab" L"c" is a
Joseph> wide string with two characters, L'\xab' and L'c' (plus the
Joseph> trailing NUL); you do not interpret '\xab' as a member of the
Joseph> target narrow character set and convert to the target wide
Joseph> character set (nor do you interpret it as L"\xabc", with a
Joseph> single escape sequence), so you can't convert escape sequences
Joseph> to bytes of a string until after you know whether the final
Joseph> string is narrow or wide (or some other variant, in
Joseph> C++0x/C1x).

I think my patch handles this correctly, though I have not written any
tests for it yet.

What I do is construct an OP_STRING in a new format.  This is done in
the C parser.  This format describes the resulting type, and then has
each sub-string included separately.  Some escape processing is done
in the lexer, but not everything, and in particular not \x.

Then, the C language overrides the interpretation of OP_STRING to do
its work.  This step converts the strings to the desired target
format.

This could all be done in the parser, of course, but I chose to defer
part of it to expression evaluation for a reason.  This approach gives
us the ability to use a single expression across multiple inferiors,
which may (in theory -- not practice, yet) have different
target-charset settings.

It does have another user-visible effect, which is that a string in a
breakpoint condition will change when the target-charset is changed.
I tend to think this is a feature.

Finally, my patch supports UCNs in strings and character literals,
though, I suspect, incorrectly.  I haven't dug into it.  In any case
the differences are only likely to be noticed in fairly unusual code.

Tom


  reply	other threads:[~2009-01-16  0:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15 20:24 Julian Brown
2009-01-15 21:02 ` Tom Tromey
2009-01-15 21:18   ` Joseph S. Myers
2009-01-16  0:01     ` Tom Tromey [this message]
2009-01-15 22:16   ` Julian Brown
2009-01-16  0:53     ` Tom Tromey
2009-01-16  9:36 ` Eli Zaretskii
2009-01-16 16:18   ` Tom Tromey
2009-01-16 16:40     ` Eli Zaretskii
2009-01-16 16:57       ` Mark Kettenis
2009-01-30  4:11 ` Tom Tromey
2009-01-30 22:14   ` Joel Brobecker
     [not found]     ` <m3ocxos6og.fsf@fleche.redhat.com>
2009-02-01 18:23       ` Daniel Jacobowitz
2009-02-01 22:42         ` Tom Tromey
2009-02-01 23:16           ` Daniel Jacobowitz
2009-02-01 23:18             ` Daniel Jacobowitz
2009-02-01 23:26             ` Tom Tromey
2009-02-03  0:41           ` 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=m3mydsjf4y.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=joseph@codesourcery.com \
    --cc=julian@codesourcery.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