This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Signed/unsigned character arrays are not strings
- From: Daniel Jacobowitz <drow at false dot org>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Eli Zaretskii <eliz at gnu dot org>, gdb-patches at sourceware dot org
- Date: Mon, 12 Feb 2007 17:14:52 -0500
- Subject: Re: [RFC] Signed/unsigned character arrays are not strings
- References: <20070125015422.GA19113@host0.dyn.jankratochvil.net> <u8xfrd9ay.fsf@gnu.org> <20070125113206.GA26448@host0.dyn.jankratochvil.net>
On Thu, Jan 25, 2007 at 12:32:06PM +0100, Jan Kratochvil wrote:
> Attaching also "gdb-cvs-nosign-char.patch" for possible comments.
> It starts printing
> $1 = {65 'A', 0 '\0'}
> finally as
> $1 = {65, 0}
> Not submitting it for commit review as it breaks the whole testsuite.
> Still if anybody could update the testsuite it would be IMO a helpful patch.
> Currently GDB displays the variants " 'X'" in many inappropriate cases.
I must have forgotten about this message when the other patch went in.
This would be a painful testsuite update... but I think it would be
really nice. Does anyone else have an opinion?
Before Jan's now committed patch, for strings:
(gdb) p $mm0.v8_int8
$1 = "\000\000\000\000\000\000\000"
After, i.e. CVS HEAD:
(gdb) p $mm0.v8_int8
$2 = {0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0'}
That's better... but it really should be:
$2 = {0, 0, 0, 0, 0, 0, 0, 0}
This is int8_t, we know it's not a char, and when I'm trying to do
math with an eight-element integer vector the chars are confusing.
If this is a good idea, I'll take care of the testsuite updates for at
least two platforms. That will cover most of it, and then we can
fix the rest as they are noticed.
--
Daniel Jacobowitz
CodeSourcery