我写了一个小程序,如下:
#include<stdio.h>
int c=0;
int main()
{
int a=10,b=20;
printf("Hello World\n");
c = a+b;
printf("%d\n",c);
return 0;
}
我可以使用命令gcc -save-temps helloworld.c创建a.out文件。save-temps标志允许我们保存中间文件 helloworld.i、helloworld.s、helloworld.o
现在我想确切地知道这个程序的堆栈在执行过程中是如何变化的。有人可以告诉我如何去做。
我这个问题的目的是确切地知道在任何程序的执行过程中会发生什么。