From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20139 invoked by alias); 13 Sep 2002 00:17:06 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 20131 invoked from network); 13 Sep 2002 00:17:05 -0000 Received: from unknown (HELO epitools.com) (66.166.77.34) by sources.redhat.com with SMTP; 13 Sep 2002 00:17:05 -0000 Received: from FV (fv [205.158.243.63]) by epitools.com (8.9.3/8.8.7) with ESMTP id RAA02527 for ; Thu, 12 Sep 2002 17:17:07 -0700 From: "Fred Viles" Organization: Embedded Performance, Inc. To: Gdb List Date: Thu, 12 Sep 2002 17:17:00 -0000 MIME-Version: 1.0 Subject: Re: question about c-lang.c Reply-to: fv@epitools.com Message-ID: <3D80CC09.15975.F8BDA8@localhost> Priority: normal In-reply-to: <3D810AC7.5040306@ges.redhat.com> Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-SW-Source: 2002-09/txt/msg00133.txt.bz2 On 12 Sep 2002 at 17:44, Andrew Cagney wrote about "Re: question about c-lang.c": | > Today I happened to read c-lang.c:c_emit_char(). | > | > Suppose a string contains the characters \0 (nul), `0' and finally `1'. | > (See appended source.) | > | > Now print this string: | > | > (gdb) p *c @ 4 | > $2 = "\001" | > | > This output is ambiguous, as \001 has another meaning. | | Isn't it simply wrong? A C parser would treat that as '\1'. Right. |... | > I've appended one possible fix. This isn't ideal since it also | > changes how char literals are printed. Perhaps that is acceptable? | | How are char literals changed? Looks to me like c_emit_char() is called both for char and string cases. So char c = '\0'; would result in (gdb) print c $1 = '\000' rather than $1 = '\0' >From the change log, it looks like GDB used to work this way and was patched last December to get the current (wrong for strings) behavior. Maybe making the output conditional on (quoter == '\'') would allow for both cases. - Fred