From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5581 invoked by alias); 23 May 2006 12:56:36 -0000 Received: (qmail 5564 invoked by uid 22791); 23 May 2006 12:56:34 -0000 X-Spam-Check-By: sourceware.org Received: from eastrmmtao06.cox.net (HELO eastrmmtao06.cox.net) (68.230.240.33) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 23 May 2006 12:56:24 +0000 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao06.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060523125621.HVVE16402.eastrmmtao06.cox.net@localhost.localdomain>; Tue, 23 May 2006 08:56:21 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FiWQw-0000jX-Qd; Tue, 23 May 2006 08:56:22 -0400 Date: Tue, 23 May 2006 18:32:00 -0000 From: Bob Rossi To: Arijit Das Cc: gdb@sourceware.org Subject: Re: How to portably print out Env of a Process Message-ID: <20060523125622.GA15393@brasko.net> References: <5f3d30900605222046t810dd4cue180cba7b0541fa7@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f3d30900605222046t810dd4cue180cba7b0541fa7@mail.gmail.com> User-Agent: Mutt/1.5.9i 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-05/txt/msg00335.txt.bz2 On Tue, May 23, 2006 at 09:16:42AM +0530, Arijit Das wrote: > Hi, > > Is it possible to print out the env of a process portably with the > same cmdline/script in different os/arch combinations? > > Here is how I tried to do it for i686 - RH3.0: > > (gdb) p (char *) getenv("HOME") > [Switching to Thread 1024 (LWP 17639)] > $1 = 0xdffff781 "/remote/vtghome7/arijit" > (gdb) > > It worked fine. > > But when I tried executing this command in x86_64, I got strange results: > > (gdb) p (char *) getenv("HOME") > [Switching to Thread 182901576896 (LWP 26427)] > $1 = 0xffffffffbfffc790
> (gdb) > > I guess some kind of 32/64 bits conversion might be messing things up > here....but am not sure exactly what? Any help here? How about, 'shell echo $HOME'? Bob Rossi