From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7573 invoked by alias); 17 Jun 2006 19:14:25 -0000 Received: (qmail 7565 invoked by uid 22791); 17 Jun 2006 19:14:25 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 17 Jun 2006 19:14:23 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k5HJEJY6013731; Sat, 17 Jun 2006 21:14:19 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6) with ESMTP id k5HJEJlO017782; Sat, 17 Jun 2006 21:14:19 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6/Submit) id k5HJEJGY032428; Sat, 17 Jun 2006 21:14:19 +0200 (CEST) Date: Sat, 17 Jun 2006 20:00:00 -0000 Message-Id: <200606171914.k5HJEJGY032428@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: arijit79@gmail.com CC: gdb@sourceware.org In-reply-to: <5f3d30900605222046t810dd4cue180cba7b0541fa7@mail.gmail.com> (arijit79@gmail.com) Subject: Re: How to portably print out Env of a Process References: <5f3d30900605222046t810dd4cue180cba7b0541fa7@mail.gmail.com> 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-06/txt/msg00112.txt.bz2 > X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on > elgar.sibelius.xs4all.nl > X-Spam-Level: > X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed > version=3.1.1 > Date: Tue, 23 May 2006 09:16:42 +0530 > From: "Arijit Das" > Content-Disposition: inline > X-IsSubscribed: yes > Mailing-List: contact gdb-help@sourceware.org; run by ezmlm > Sender: gdb-owner@sourceware.org > X-UTwente-MailScanner-Information: Scanned by MailScanner. Contact helpdesk@ITBE.utwente.nl for more information. > X-UTwente-MailScanner: Found to be clean > X-UTwente-MailScanner-SpamScore: s > X-UTwente-MailScanner-From: gdb-return-25381-m.m.kettenis=alumnus.utwente.nl@sourceware.org > X-XS4ALL-DNSBL-Checked: mxdrop44.xs4all.nl checked 130.89.2.8 against DNS blacklists > X-Virus-Scanned: by XS4ALL Virus Scanner > X-XS4ALL-Spam-Score: 0.401 () FROM_ENDS_IN_NUMS,HTML_MESSAGE > X-XS4ALL-Spam: NO > Envelope-To: mark.kettenis@xs4all.nl > X-MIME-Autoconverted: from quoted-printable to 8bit by mxdrop44.xs4all.nl id k4N3lNcQ019572 > X-UIDL: 1148356045._smtp.mxdrop44.19580,S=3409 > > 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? > Make sure you install libc with full debug info. It looks like you're using Linux. Debian has packages with the necessary debug info. Other distros might not. If your distro does not provide such packages please complain. Cheers, Mark