This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Signed/unsigned character arrays are not strings


Hi Eli,

On Thu, 25 Jan 2007 05:23:01 +0100, Eli Zaretskii wrote:
> > Date: Thu, 25 Jan 2007 02:54:22 +0100
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > 
> > currently all these types are printed as strings:
> > 	char
> > 	signed char
> > 	unsigned char
> > the patch will reduce the printed strings only to
> > 	char
> > and the signed/unsigned version gets printed as an array of byte values
> > (characters).  I hope nobody uses sign-specification for strings.
> 
> I must say I'm uneasy about this.  Signedness could be random.  What
> will happen on platforms where `char' is unsigned by default?

I had to find an answer to your interesting comment now myself:

# The string identification works despite the compiler flags below due to
# gdbtypes.c:
#   if (name && strcmp (name, "char") == 0)
#     TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;

Provided there now an additional explicit testcase targeting your comment.


> Anyway, this change should probably be reflected in the manual, and
> perhaps also in NEWS.

Provided if it is satisfactionary.


> What bug? can you show it?

Originally posted by personal mail only, formally submitted before as:
	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128


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.



Regards,
Lace

Attachment: gdb-cvs-nosign-array2.patch
Description: Text document

Attachment: gdb-cvs-nosign-char.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]