Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Arijit Das <arijit79@gmail.com>
Cc: Bob Rossi <bob_rossi@cox.net>, gdb@sourceware.org
Subject: Re: How to portably print out Env of a Process
Date: Wed, 12 Jul 2006 16:56:00 -0000	[thread overview]
Message-ID: <20060712165630.GC22834@nevyn.them.org> (raw)
In-Reply-To: <5f3d30900605232143w18744017s439a8762616b53e8@mail.gmail.com>

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


  reply	other threads:[~2006-07-12 16:56 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 [this message]
2006-06-17 20:00 ` Mark Kettenis
2006-07-12 16:39   ` Daniel Jacobowitz
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=20060712165630.GC22834@nevyn.them.org \
    --to=drow@false.org \
    --cc=arijit79@gmail.com \
    --cc=bob_rossi@cox.net \
    --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