Linux-g-gcc编译后栈内存地址与实际相反
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
Linux-g++gcc编译后栈内存地址与实际相反
栈正常存储内存地址
栈空间先使用
高地址
在使用底地址
Win_Devc++
#include <iostream>
using namespace std;
int main() {
int a = 0;
int b = 0;
printf("a == %p\n", &a);
printf("b == %p\n", &b);
return 0;
}
代码_截图
运行_结果
a == 00000000006ffe1c
b == 00000000006ffe18
--------------------------------
Vim(Linux)
#include <iostream>
using namespace std;
int main() {
int a = 0;
int b = 0;
printf("a == %p\n", &a);
printf("b == %p\n", &b);
return 0;
}
运行_结果(默认)
发现二个变量 a, b在栈中存储的地址由高到底分别为 a>b> 跟课上面dev正好相反.
a == 0x7ffffa941740
b == 0x7ffffa941744
关闭栈保护
关闭栈保护后的结果:
与推断的结果相同.
g++ test.cpp -fno-stack-protector -o ttw
a == 0x7fffc18bfd1c
b == 0x7fffc18bfd18
运行截图
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:23 天前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献1条内容
所有评论(0)