This is the mail archive of the gdb@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: GDB transition to GPLv3 should now be complete


On Fri, Aug 24, 2007 at 06:16:25PM +0200, Mark Kettenis wrote:
> 1. There is quite a bit of code that uses "unsigned char *" for
>    strings, to avoid unwanted sign extension.

This is the real question, yes.  I've made it even easier to view
these as strings if desired.  I've asked several times if the changes
were good enough.  I think I got a generally affirmative reaction, but
it's hard to tell.

We can't be right by default all the time, since there just isn't
enough information.  What I'm suggesting is that the new behavior will
be right more often than the old behavior.  I have worked with a
variety of high performance computing and signal processing
developers who are interested in unsigned single-byte data.

If you're already using user-defined commands to print data, by the
way, the difference is a non-issue.  I believe that covers much of
the Emacs case.

> 2. Not all debug formats (most notably stabs) do not make the
>    distinction between unqualified "char" and "(un)signed char".

That does not seem to be correct, at least in the case of stabs.  Even
with -gstabs (i.e. without GNU extensions to stabs), GDB correctly
sets the NOSIGN and UNSIGNED flags for char variants (example below).
I also checked the "maint print type" output and NOSIGN is set where
I'd expect.  And it already gets set for types whose name is char in
init_type; this also handles all typedefs to char, et cetera, as long
as your debug format represents typedefs.  I admit it will leave
"typedef char char_t" users having to type a couple extra characters
to get a string if they're using mdebug...

I did find a bug in the stabs reader testing this, though.  It
bypasses the NOSIGN check because it creates the type and then sets
TYPE_NAME later.  Easy to fix.

drow@caradoc:~% cat foo.c
char c;
signed char d;
unsigned char e;
int main(){}

drow@caradoc:~% gcc -gstabs foo.c
drow@caradoc:~% gdb ./a.out
GNU gdb 6.6-debian
...
(gdb) ptype c
type = char
(gdb) ptype d
type = signed char
(gdb) ptype e
type = unsigned char

-- 
Daniel Jacobowitz
CodeSourcery


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