From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20926 invoked by alias); 24 Aug 2007 18:11:34 -0000 Received: (qmail 20666 invoked by uid 22791); 24 Aug 2007 18:11:32 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Aug 2007 18:11:25 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.1/8.14.0) with ESMTP id l7OIBI85012356; Fri, 24 Aug 2007 20:11:18 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.1/8.14.1/Submit) id l7OIBHnO027640; Fri, 24 Aug 2007 20:11:17 +0200 (CEST) Date: Fri, 24 Aug 2007 18:11:00 -0000 Message-Id: <200708241811.l7OIBHnO027640@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: drow@false.org CC: gdb@sourceware.org In-reply-to: <20070824165439.GA782@caradoc.them.org> (message from Daniel Jacobowitz on Fri, 24 Aug 2007 12:54:39 -0400) Subject: Re: GDB transition to GPLv3 should now be complete References: <20070824151251.GG6056@adacore.com> <200708241528.l7OFSgDi030135@brahms.sibelius.xs4all.nl> <20070824153333.GA30256@caradoc.them.org> <200708241616.l7OGGOhD010090@brahms.sibelius.xs4all.nl> <20070824165439.GA782@caradoc.them.org> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00198.txt.bz2 > Date: Fri, 24 Aug 2007 12:54:39 -0400 > From: Daniel Jacobowitz > > 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. Well, the problem with this diff is that it actually seems to be a good idea until you actually start to use it. I thought it was a good idea, so I put it in my tree. And I threw it out again after a few days because I was annoyed by the fact that it didn't print strings as strings in many cases where I was sure it did before. As I said, the use of "unsigned char *" is very common in string manipulation code. > 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. Yes, I can imagine that, but these people are working in fairly specialized areas with specific requirements. > 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. But the developers you talk about above can easily do the same. And when I'm not specifically talking about Emacs when I talk about code that does string manipulations. > > 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 Ah, that fix would be very welcome. Need to verify this with GCC 2.95.3 though.