public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ciaranwoodward at xmos dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31853] GDB's use of iconv does not work with macOS Sonoma
Date: Fri, 07 Jun 2024 16:18:40 +0000	[thread overview]
Message-ID: <bug-31853-4717-PaLKx2hoz7@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31853-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31853

--- Comment #4 from Ciaran Woodward <ciaranwoodward at xmos dot com> ---
I wrote a quick preprocessor check to double-confirm:

> * Does not define __STDC_ISO_10646__
> * ... and defines _LIBICONV_VERSION

And both of these are correct. __STDC_ISO_10646__ is not
defined, and _LIBICONV_VERSION is defined as 0x010B (with
a comment which claims "compatible").

> * ... but for its own libiconv, not the GNU libiconv

I can't find any official documentation stating that libiconv
was replaced, but have found references to it on online forums,
and the header is substantially different (but claims to be
compatible). It seems it was Apple's intention to provide
this iconv as a 'drop in' replacement, so building against an
old "mac SDK" (so your application is compatible with older
macOSs) will still have the new non-GNU libiconv linked when
run on the newer system.

> * ... but does use UTF-32 as its wchar_t encoding

I am not sure about this, nor how to check it really.
I can see the wchar_t type is 4-bytes in size, but maybe
that is different for very-old versions of macOS.

The intermediate_encoding() (in charset.c) function that ends up getting
used as INTERMEDIATE_ENCODING will adjust the bitwidth to match the
width of wchar_t. It will use either UTF-16,UTF-32,UCS-2 or UCS-4
depending on what iconv_open supports (by runtime testing).

From my understanding, this is all fine because GDB is only using
this as an intermediate encoding, not expecting the host or target
to necessarily understand it natively.

> Also, will the approach taken in your patch also work on
> older versions of the OS?

I have tested on all of the 'currently supported' versions
of macOS and it seems to work, but I really don't understand
the platform well enough to guarantee it will work for every
possible past version.

I also reported this issue to Apple, but no guarantees they
actually acknowledge/fix it in their iconv implementation :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-06-07 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 15:10 [Bug gdb/31853] New: " ciaranwoodward at xmos dot com
2024-06-06 15:10 ` [Bug gdb/31853] " ciaranwoodward at xmos dot com
2024-06-06 15:25 ` ciaranwoodward at xmos dot com
2024-06-07 15:30 ` tromey at sourceware dot org
2024-06-07 16:18 ` ciaranwoodward at xmos dot com [this message]
2024-06-07 21:32 ` tromey at sourceware dot org
2024-06-10 16:16 ` ciaranwoodward at xmos dot com
2024-06-11 10:30 ` cvs-commit at gcc dot gnu.org
2024-06-11 15:08 ` tromey at sourceware dot org
2024-06-12 10:21 ` cvs-commit at gcc dot gnu.org
2024-06-12 12:39 ` tromey at sourceware dot org

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=bug-31853-4717-PaLKx2hoz7@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).