From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH][gdb] Improve "Converting character sets: Invalid argument"
Date: Tue, 7 Jun 2022 14:16:55 +0200 [thread overview]
Message-ID: <20220607121653.GA22267@delia.home> (raw)
Hi,
When running selftest rust-lex on an openSUSE Leap 15.3 system with
glibc-locale-base and glibc-locale packages deinstalled, we run into:
...
$ gdb -q -batch -ex "maint selftest rust-lex"
Running selftest rust-lex.
Self test failed: Converting character sets: Invalid argument.
Ran 1 unit tests, 1 failed
...
The "invalid argument" is due to iconv_open returning EINVALID, meaning the
conversion is not supported by the implementation.
Make the error more informative, such that we have:
...
Self test failed: Cannot convert between character sets `ANSI_X3.4-1968' and \
`UTF-32LE'
...
Tested on x86_64-linux.
https://sourceware.org/bugzilla/show_bug.cgi?id=29202
Any comments?
Thanks,
- Tom
[gdb] Improve "Converting character sets: Invalid argument"
---
gdb/charset.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/gdb/charset.c b/gdb/charset.c
index 74f742e0aa7..e182a67d683 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -474,7 +474,14 @@ class iconv_wrapper
{
m_desc = iconv_open (to, from);
if (m_desc == (iconv_t) -1)
- perror_with_name (_("Converting character sets"));
+ {
+ if (errno == EINVAL)
+ throw_error (NOT_SUPPORTED_ERROR,
+ _("Cannot convert between character sets `%s' and `%s'"),
+ from, to);
+ else
+ perror_with_name (_("Converting character sets"));
+ }
}
~iconv_wrapper ()
reply other threads:[~2022-06-07 12:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220607121653.GA22267@delia.home \
--to=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
--cc=tom@tromey.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