From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10421 invoked by alias); 12 Jul 2006 16:39:15 -0000 Received: (qmail 10412 invoked by uid 22791); 12 Jul 2006 16:39:15 -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:39:12 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1G0hjy-00062C-Qx for gdb@sourceware.org; Wed, 12 Jul 2006 12:39:10 -0400 Date: Wed, 12 Jul 2006 16:39:00 -0000 From: Daniel Jacobowitz To: gdb@sourceware.org Subject: Re: How to portably print out Env of a Process Message-ID: <20060712163910.GB22834@nevyn.them.org> Mail-Followup-To: gdb@sourceware.org References: <5f3d30900605222046t810dd4cue180cba7b0541fa7@mail.gmail.com> <200606171914.k5HJEJGY032428@elgar.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200606171914.k5HJEJGY032428@elgar.sibelius.xs4all.nl> 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/msg00049.txt.bz2 On Sat, Jun 17, 2006 at 09:14:19PM +0200, Mark Kettenis wrote: > 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. Actually, we (Debian) don't by default. The example was: p (char *) getenv("HOME") We ship two sets of debug libraries, both in the libc6-dbg package. One set are used automatically by GDB (via set debug-file-directory); these have only .debug_frame in them, and are used only for backtraces. The other includes symbolic debug info and is not used unless you specify LD_LIBRARY_PATH=/usr/lib/debug. They aren't the default because GDB takes a large amount of RAM and is much slower when given that much debug information, for an otherwise small program. So, if you are running a program that includes the header defining getenv, and your program is compiled with -g, the example will work. And if you use the libc6-dbg libraries explicitly, the example will work. Otherwise, GDB has to guess, and guesses wrong. I wonder if guessing "long" for return values might be more overall useful than guessing "int", for this exact reason? Is that likely to break anything not already broken? -- Daniel Jacobowitz CodeSourcery