This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: How to portably print out Env of a Process
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 <Address 0xffffffffbfffc790 out of bounds>
> (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