From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21585 invoked by alias); 12 Jul 2006 16:56:35 -0000 Received: (qmail 21571 invoked by uid 22791); 12 Jul 2006 16:56:35 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 12 Jul 2006 16:56:34 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1G0i0k-0006D5-Bf; Wed, 12 Jul 2006 12:56:30 -0400 Date: Wed, 12 Jul 2006 16:56:00 -0000 From: Daniel Jacobowitz To: Arijit Das Cc: Bob Rossi , gdb@sourceware.org Subject: Re: How to portably print out Env of a Process Message-ID: <20060712165630.GC22834@nevyn.them.org> Mail-Followup-To: Arijit Das , Bob Rossi , gdb@sourceware.org References: <5f3d30900605222046t810dd4cue180cba7b0541fa7@mail.gmail.com> <20060523125622.GA15393@brasko.net> <20060523130544.GA21177@nevyn.them.org> <5f3d30900605232143w18744017s439a8762616b53e8@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f3d30900605232143w18744017s439a8762616b53e8@mail.gmail.com> User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00051.txt.bz2 On Wed, May 24, 2006 at 10:13:16AM +0530, Arijit Das wrote: > Thanks... > > (gdb) p ((char * (*)()) getenv) ("HOME") > > seems to be working fine so far. But couldn't make sense of the cast > logically. As you said, ideally, it should have been something like > > (gdb) p ((char * (*)(const char *)) getenv) ("HOME") > > which doesn't work! I haven't got the time it's going to take to fix this right now, but I do see what's wrong. It's a combination of two things. One is the "const"; push_type and follow_types don't have any scoping in them, so a call to follow_types always eats everything on the stack. Which eats the bit making this a pointer to a function instead of a function. The other is that the func_mod rule in c-exp.y just discards the arguments. We never look at them. This is all somewhat lame, but will be tricky to improve without breaking something that already works. Thanks for reporting this! -- Daniel Jacobowitz CodeSourcery