From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13635 invoked by alias); 3 Jan 2002 04:25:50 -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 13571 invoked from network); 3 Jan 2002 04:25:48 -0000 Received: from unknown (HELO localhost.cygnus.com) (24.114.42.213) by sources.redhat.com with SMTP; 3 Jan 2002 04:25:48 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.cygnus.com (Postfix) with ESMTP id 942643C44; Wed, 2 Jan 2002 23:25:44 -0500 (EST) Message-ID: <3C33DD48.2050801@cygnus.com> Date: Wed, 02 Jan 2002 20:25:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.6) Gecko/20011207 X-Accept-Language: en-us MIME-Version: 1.0 To: Daniel Jacobowitz Cc: Eli Zaretskii , gdb@sources.redhat.com Subject: Re: Handling of structure dereferencing References: <20011206120739.A1490@nevyn.them.org> <7263-Thu06Dec2001214750+0200-eliz@is.elta.co.il> <20011206154348.D11234@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-01/txt/msg00003.txt.bz2 > On Thu, Dec 06, 2001 at 09:47:50PM +0200, Eli Zaretskii wrote: > >> > Date: Thu, 6 Dec 2001 12:07:39 -0500 >> > From: Daniel Jacobowitz >> > >> > Right now, and historically, gdb has accepted things like: >> > struct foo {char a} *b, **c, ***d; >> > >> > (gdb) print b.a >> > (gdb) print d->a b->a and b.a are probably commonly used - don't some languages even accept both forms? As for ``d.a'', I don't have an opinion - hmm, now that I know about it I might just start using it :-( Do you know which code was involved? I can dig up a little bit more of the history. > Yes, exactly. > > >> > So, straw poll: how would people feel about: >> > - not letting this happen; only explicit dereferencing > >> >> I don't mind in this specific case, but I wonder whether there isn't >> some iceberg of which this is only a tip. We do want GDB to continue >> to print a string when you say "p str", and str is a pointer to a >> string, right? It's quite possible that the same machinery which >> supports printing arrays also causes the above. > > > I don't think that's the case; printing a char* does not involve > implicit dereferencing (if it did, you'd only get the first character). GDB certainly does pull some magic though - ``(gdb) print (char*)foo'' prints a string up to NUL. I know this cos I've a fuzzy memory of one version of GDB breaking this behavour and the bug report triggering a long argument over the advantages/disadvantages of such features. Andrew