I have the following code,
...
char* seg = mmap(0, ...)
printf("seg=%x\n", seg);
...
The program prints with seg=b7ffd000. While in gdb (for the same execution), when using p/x seg, it prints $2 = 0x0. I am confused here. Isn't it the same var seg? why are the values different.
PS: in mmap, the first argument is the preferably address of mapped memory and the return value is the actual address of mapped memory.