一、C語言的基礎:
1) C結尾文件:源代碼文件
2) O結尾文件:目標文件(二進制文件),每個文件經過編譯都會形成目標文件,多個目標文件連接后可以形成可執行文件。(gcc -g -c hello2.c)
3) H結尾文件:頭文件,存放着C文件中的函數定義,結構體定義等
4) 可執行文件:gcc hello2.c -o hello2.out(生成的文件名)
5)so結尾文件:動態庫
二、尋找代碼的虛擬地址
1)編寫一個C程序

#include <stdio.h> int k=3; int increase_num(int x , int y ) { return x+y; } int main() { printf( " k address is %p \n", &k ); printf("&k=========" ); static int i = 4 ; int x = 1; int y = 2 ; // sum(x,y) ; while(1){ } return 0; }
2)產生一個目標文件
gcc -g -c hello2.c
3)查看反編譯的詳細信息
objdump -s -d hello2.o
4)生成一個可執行文件
gcc hello2.c -o hello2.out
5)找出執行文件的進程號碼 -
ps -ef| grep hello2
進程號碼為 -> 14103 11192 99 16:12 pts/0 00:00:11 ./hello2.out
6)查看虛擬地址
cat /proc/14103/map(cat /proc/進程號碼/map)
圖上的是這個進程占用的虛擬地址:
