on-internet
← Community

What's inside the stack?

Stack Overflow ·

If I run a program, just like #include <stdio.h> int main(int argc, char *argv[], char *env[]) { printf("My references are at %p, %p, %p\n", &argc, &argv, &env); } We can see that those regions are actually in the stack. But what else is there? If we ran a loop through all the values in Linux 3.5.3 (for example, until segfault) we can see some weird numbers, and kind of two regions, separated by a bunch of zeros, maybe to try to prevent overwriting the environment variables accidentally. Anyway, in the first region there must be a lot of numbers, such as all the frames for each function call.

Comments

Sign in or sign up to comment and upvote.

No comments yet.