From: Daniel Jacobowitz <drow@false.org>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: mathieu lacage <Mathieu.Lacage@sophia.inria.fr>,
Nick Roberts <nickrob@snap.net.nz>,
gdb@sourceware.org
Subject: Re: [RFC] Signed/unsigned character arrays are not strings
Date: Tue, 10 Apr 2007 21:59:00 -0000 [thread overview]
Message-ID: <20070410215951.GC6338@caradoc.them.org> (raw)
In-Reply-To: <20070225195350.GA12811@host0.dyn.jankratochvil.net>
On Sun, Feb 25, 2007 at 08:53:50PM +0100, Jan Kratochvil wrote:
> On Sun, 25 Feb 2007 08:59:41 +0100, mathieu lacage wrote:
> ...
> > I don't know how useful that is to you but a lot of people (the first
> > which comes to my mind is libxml2) decided to use "unsigned char *" to
> > identify utf-8 encoded strings in C.
>
> Together with the attached RMS's response I became more inclined to revert this
> change and provide only "$xmm"-specific fix instead (probably for the GDB
> int8_t/uint8_t internal types).
There was a lot of discussion about how to treat signed char, unsigned
char, signed char *, et cetera. There weren't a lot of conclusions,
but several people did not like the new behavior, and then discussion
trailed off.
I don't want to just revert the patch, because the problem that Jan
was fixing (unuseful display of $xmm registers) is really quite
annoying. I see these options:
1. Make vector types special. Treat arrays of single byte integers
as characters, like before, unless they occur in a vector type. This
is reasonable, but tricky to implement.
2. Make two special single byte integer types, with a GDB internal
"not a char" flag set. Use them for our builtin int8_t and uint8_t.
Use these to build types for vector registers. Print all other single
byte types from user code as chars or strings. This is similar to
#1, a little less helpful, but fairly easy.
3. Treat "char" as a character, but "unsigned char" and "signed char"
as numbers (Jan's patch started down this road and Jim's went a bit
further). Treat pointers/arrays of char as strings and
pointers/arrays of unsigned or signed char as numbers. Add a "/s"
flag to the print command that treats single byte types as
characters or strings.
For example:
char str[] = "hi";
unsigned char version[] = "6.5";
(gdb) p version
$1 = { 54, 46, 53 }
(gdb) p/s version
$2 = "6.5"
(gdb) p str
$3 = "hi"
4. Like #3, except that instead of adding a /s modifier, add a "set"
knob. Of course in this case we get to argue about the default value.
I think it's important that we resolve this open issue before we
release a new version of GDB, so please post which you prefer. I like
#3 best, followed by #2; #4 is a good compromise but I worry that we
are proliferating knobs that no one ever changes. I'm interested in
any other suggestions, though I think we've ruled out guessing based
on the type name.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2007-04-10 21:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-24 16:13 Nick Roberts
2007-02-24 20:11 ` Daniel Jacobowitz
2007-02-24 20:53 ` Nick Roberts
2007-02-24 21:07 ` Jan Kratochvil
2007-02-25 8:00 ` Daniel Jacobowitz
2007-02-25 19:54 ` Nick Roberts
2007-02-25 21:07 ` mathieu lacage
2007-02-26 0:45 ` Jan Kratochvil
2007-02-27 7:17 ` Eli Zaretskii
2007-02-27 9:29 ` Daniel Jacobowitz
2007-02-27 12:02 ` Nick Roberts
2007-02-27 17:06 ` Robert Dewar
2007-02-27 18:42 ` Daniel Jacobowitz
2007-02-27 21:53 ` Eli Zaretskii
2007-02-27 22:12 ` Daniel Jacobowitz
2007-02-27 22:14 ` Mark Kettenis
2007-02-28 0:47 ` Paul Koning
2007-02-28 1:14 ` Jim Blandy
2007-02-28 1:59 ` Jim Blandy
2007-02-28 5:26 ` Nick Roberts
2007-02-28 14:35 ` Daniel Jacobowitz
2007-03-01 0:43 ` Jim Blandy
2007-03-01 0:54 ` Nick Roberts
2007-02-27 21:47 ` Eli Zaretskii
2007-02-27 22:12 ` Daniel Jacobowitz
2007-04-10 21:59 ` Daniel Jacobowitz [this message]
2007-02-28 13:05 pkoning
2007-03-01 11:01 ` Mark Kettenis
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=20070410215951.GC6338@caradoc.them.org \
--to=drow@false.org \
--cc=Mathieu.Lacage@sophia.inria.fr \
--cc=gdb@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=nickrob@snap.net.nz \
/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