Small problem

Andi Kleen ak@muc.de
Wed Jun 30 04:37:00 GMT 1999


In article < npd7ygykk5.fsf@zwingli.cygnus.com >,
Jim Blandy <jimb@cygnus.com> writes:

> Do you mean, where does the kernel put the environment variables when
> it exec's a new file?  That's usually specified by the ABI.  SCO's web
> site has the ABI that Linux seems to follow.  I'm still learning my
> way around Linux at that level, so I wouldn't be able to tell you
> whether and where Linux practice deviates from what's described in
> SCO's documents.

Linux/i386/ELF stores the environment variables at the top of the
memory, directly below the filename and before the arguments.  

main(int ac, char **av, char **env)
{
        printf("%p\n", env);
}
fred:~% ./T
0xbffff93c

Memory mapped above 0xbfffffff is used by the kernel, some later versions
of Linux have a config option to move this border to support machines with
>2GB of memory.

BTW, I have a question too: is it possible to tell gdb to reread the
core file? I use gdb vmlinux /proc/kcore_elf to read some kernel variables,
but I ATM always restart it to get new values :/

-Andi



More information about the Gdb mailing list