public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org,  Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH] gdbserver/linux: probe for libiconv in configure
Date: Thu, 29 Feb 2024 10:40:08 -0700	[thread overview]
Message-ID: <87jzmntbif.fsf@tromey.com> (raw)
In-Reply-To: <20240228231719.238741-1-simon.marchi@polymtl.ca> (Simon Marchi's message of "Wed, 28 Feb 2024 18:15:29 -0500")

>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> I downloaded GNU libiconv, built it for that host, and installed it in
Simon> an arbitrary directory.  To make gdbserver use it, I had to modify the
Simon> gdbserver build system to locate libiconv and use it, the result is this
Simon> patch.

Simon> I eventually found that crosstool-ng has an config option to make uclibc
Simon> provide an implementation of iconv, which is of course much easier.  But
Simon> given that this patch is now written, I think it would be worth merging
Simon> it.  It could help some people who do not have iconv built in their libc
Simon> and may not have the luxury of rebuilding their libc like I do.

gdb also supports in-tree building of libiconv.  To support this case,
you have to patch the top-level to add dependencies on libiconv to
gdbserver.  I think it's safe to just copy the gdb code there.

Simon> To avoid unnecessarily linking against libiconv on hosts that don't need
Simon> it, set `MAYBE_LIBICONV` with the contents of `LIBICONV` only if the
Simon> host is Linux, and use `MAYBE_LIBICONV` in `Makefile.in`.  I considered
Simon> putting `AM_ICONV` in the case, to avoid unnecessarily doing the
Simon> configure checks for the hosts that don't need libiconv, but I'm not
Simon> sure it's safe.

IIRC the way it's supposed to work is that the LIBICONV substitution
variable is just set to the empty string in the case that iconv is
available in libc. 

So, just calling AM_ICONV should be sufficient on the configure side.

I don't think adding some more checks to all hosts is a big enough deal
to bother with the 'case'.

Probably the source has to be updated to check HAVE_ICONV and do
something sensible if it isn't found.  One option would be to just
replace problem characters... the underlying problem being solved here
is that a thread name is a limited number of bytes, so a UTF-8 thread
name might be truncated mid-character.

Tom

  reply	other threads:[~2024-02-29 17:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 23:15 Simon Marchi
2024-02-29 17:40 ` Tom Tromey [this message]
2024-02-29 20:21   ` Simon Marchi
2024-02-29 20:45     ` 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=87jzmntbif.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --cc=simon.marchi@polymtl.ca \
    /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).