Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb@sourceware.org
Subject: Re: How to portably print out Env of a Process
Date: Wed, 12 Jul 2006 16:39:00 -0000	[thread overview]
Message-ID: <20060712163910.GB22834@nevyn.them.org> (raw)
In-Reply-To: <200606171914.k5HJEJGY032428@elgar.sibelius.xs4all.nl>

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


  reply	other threads:[~2006-07-12 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-23 13:05 Arijit Das
2006-05-23 18:32 ` Bob Rossi
2006-05-23 22:07   ` Daniel Jacobowitz
2006-05-24  9:16     ` Arijit Das
2006-07-12 16:56       ` Daniel Jacobowitz
2006-06-17 20:00 ` Mark Kettenis
2006-07-12 16:39   ` Daniel Jacobowitz [this message]
2006-07-16 16:48     ` Mark Kettenis
2006-07-17  0:57       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060712163910.GB22834@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox