* [PATCH][gdb] Improve "Converting character sets: Invalid argument"
@ 2022-06-07 12:16 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-06-07 12:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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 ()
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-07 12:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 12:16 [PATCH][gdb] Improve "Converting character sets: Invalid argument" Tom de Vries
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).