public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Patrick Monnerat <patrick@monnerat.net>
Cc: Tom Tromey <tom@tromey.com>,
	 Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb: add UTF16/UTF32 target charsets in phony_iconv
Date: Sat, 08 Oct 2022 12:55:36 -0600	[thread overview]
Message-ID: <874jwejgbb.fsf@tromey.com> (raw)
In-Reply-To: <0a978271-3085-8bf3-f5fd-6a0b3f9f3ea2@monnerat.net> (Patrick Monnerat's message of "Sat, 8 Oct 2022 02:12:02 +0200")

>> I don't recall the outcome from this, but is there no way to improve gdb
>> to use this iconv?  If it truly works well enough then it seems like it
>> would be the better approach.

Patrick> There is a fuzzy source comment about an iconv problem in
Patrick> Solaris. Your bugzilla comment 
Patrick> https://sourceware.org/bugzilla/show_bug.cgi?id=29315#c2 also goes in
Patrick> this direction: however we have no details about what the problem is,
Patrick> if we should still support it and/or if there are other systems
Patrick> affected by such an iconv problem.

Ok.  Thank you for the link, I knew we had discussed this somewhere in
the past...

The comments at the top of gdb_wchar.h describe the situation somewhat,
though they don't really explain what was wrong with Solaris.  My
recollection, though, is that the Solaris wchar_t doesn't have any
ordinary encoding but is instead a weird hybrid thing, and furthermore
that the Solaris iconv doesn't accept "wchar_t" as an encoding name.
So, on Solaris, there's no convenient way to do the conversions (it's
possible to convert wchar_t to/from the locale's multi-byte encoding,
but I didn't implement that since it seemed like a pain).

All of this is based on the idea that it's convenient to work in a wide
character representation at some points in the code.  At the time, I
figured relying on wchar_t would be good for this because (presumably)
hosts would support that reasonably well and we wouldn't have to do
extra work in gdb.

However, it seems to me that it doesn't really have to be done this way.
We could use UTF-32 instead, by making our own tables (along the lines
of ada-unicode.py) for "isdigit" and "isprint".

In addition to this, I suppose we could simply require iconv.  Probably
any host that has iconv will support UTF-32 (if not, what good is it
really).  And libiconv exists and can even be conveniently dropped into
the source tree if there are any hosts that don't have it.  This may not
be a good plan if there are active host platforms where this would be a
pain to deal with.

Anyway, what do you think of this plan?

Patrick> Please note I had the intention to determine the Solaris problem and
Patrick> tried to install the last available OpenSolaris (dated 2009) in a VM 
Patrick> without success: I gave up.

Yeah, that's fine, I wouldn't have done it myself.

Tom

  reply	other threads:[~2022-10-08 18:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02 14:00 Patrick Monnerat
2022-10-07 20:10 ` Tom Tromey
2022-10-08  0:12   ` Patrick Monnerat
2022-10-08 18:55     ` Tom Tromey [this message]
2022-10-09  0:47       ` Patrick Monnerat
2022-10-10 16:11         ` Tom Tromey
2022-10-16  1:50           ` Tom Tromey
2022-10-16  6:24             ` Eli Zaretskii
2022-10-17 23:10               ` Tom Tromey

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=874jwejgbb.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=patrick@monnerat.net \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).