From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [RFC] --with-iconv-path
Date: Fri, 06 May 2011 00:27:00 -0000 [thread overview]
Message-ID: <20110506002720.DE3BF2461B1@ruffy.mtv.corp.google.com> (raw)
Hi.
We have one environment where the iconv binary comes from a non-standard
location. This patch lets one tell gdb where to find it.
Before I write docs/NEWS, can anyone think of any problems with this approach?
One alternative that I don't like is requiring the user to set $PATH
to find the right iconv - that is an internal implementation detail
the user shouldn't have to deal with.
[Ideally one could query some iconv_*() function at runtime: It knows where
its going to find its .so files, and iconv is typically at a fixed path
relative to that. But I couldn't find such an interface.
Another alternative would be to have an iconv_*() function that returned
a list of all the charsets: that's all gdb uses the iconv program for.
And I realize some environments have iconvlist.
Alas one also has to work with the glibcs that are out there.]
TIA
2011-05-05 Doug Evans <dje@google.com>
* configure.ac: New configure option --with-iconv-path.
* configure: Regenerate.
* config.in: Regenerate.
* charset.c (find_charset_names): Use ICONV_PATH if defined.
Index: charset.c
===================================================================
RCS file: /cvs/src/src/gdb/charset.c,v
retrieving revision 1.44
diff -u -p -r1.44 charset.c
--- charset.c 21 Apr 2011 14:26:38 -0000 1.44
+++ charset.c 6 May 2011 00:14:37 -0000
@@ -799,6 +799,7 @@ find_charset_names (void)
char *args[3];
int err, status;
int fail = 1;
+ int flags;
struct gdb_environ *iconv_env;
/* Older iconvs, e.g. 2.2.2, don't omit the intro text if stdout is
@@ -811,12 +812,20 @@ find_charset_names (void)
child = pex_init (PEX_USE_PIPES, "iconv", NULL);
+#ifdef ICONV_PATH
+ args[0] = ICONV_PATH;
+#else
args[0] = "iconv";
+#endif
args[1] = "-l";
args[2] = NULL;
+ flags = PEX_STDERR_TO_STDOUT;
+#ifndef ICONV_PATH
+ flags |= PEX_SEARCH;
+#endif
/* Note that we simply ignore errors here. */
- if (!pex_run_in_environment (child, PEX_SEARCH | PEX_STDERR_TO_STDOUT,
- "iconv", args, environ_vector (iconv_env),
+ if (!pex_run_in_environment (child, flags,
+ args[0], args, environ_vector (iconv_env),
NULL, NULL, &err))
{
FILE *in = pex_read_output (child, 0);
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.144
diff -u -p -r1.144 configure.ac
--- configure.ac 17 Mar 2011 13:19:10 -0000 1.144
+++ configure.ac 6 May 2011 00:14:37 -0000
@@ -433,6 +433,16 @@ AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl])
AM_ICONV
+# GDB may invoke iconv to get the list of supported character sets.
+# Allow the user to specify where to find it.
+
+AC_ARG_WITH(iconv-path,
+AS_HELP_STRING([--with-iconv-path=PATH], [specify where to find the iconv program]),
+[iconv_path="${withval}"
+ AC_DEFINE_UNQUOTED([ICONV_PATH], ["${iconv_path}"],
+ [Path of iconv program.])
+])
+
# On alpha-osf, it appears that libtermcap and libcurses are not compatible.
# There is a very specific comment in /usr/include/curses.h explaining that
# termcap routines built into libcurses must not be used.
next reply other threads:[~2011-05-06 0:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 0:27 Doug Evans [this message]
2011-05-06 15:12 ` Joel Brobecker
2011-05-06 15:33 ` Doug Evans
2011-05-06 16:13 ` Joseph S. Myers
2011-05-06 17:57 ` 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=20110506002720.DE3BF2461B1@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=gdb-patches@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