This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
How to portably print out Env of a Process
- From: "Arijit Das" <arijit79 at gmail dot com>
- To: gdb at sourceware dot org
- Date: Tue, 23 May 2006 09:16:42 +0530
- Subject: How to portably print out Env of a Process
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?
Thanks,
Arijit