国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > Linux > 正文

Linux下查看.so和可執(zhí)行文件是否debug編譯的方法(必看)

2019-10-26 18:51:08
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

今天同事問我,如何判斷一個(gè).so是否是debug編譯的。

我記得以前自己是用file來(lái)查看一個(gè).so,根據(jù)是否包含"not stripped"來(lái)判斷該.so是否是debug編譯的,于是就沒做實(shí)驗(yàn)就回答。

然而,stripped/not stripped并不是debug/release編譯的判斷標(biāo)準(zhǔn). 我對(duì)debug和release的.so運(yùn)行file后,得出幾乎相同的輸出, 都是not stripped. 所以我算是誤導(dǎo)同事了。

根據(jù)<Computers Systems - A Programmer's Perspective>所言, debug/release的區(qū)別更多的表現(xiàn)在.so和可執(zhí)行程序所擁有的段上。debug編譯出來(lái)的。so和可執(zhí)行程序擁有很多附加的段來(lái)包含哪些debug的信息。 所以查看段信息是一種判斷的方式。

我在Ubuntu 11.04上分別對(duì)同一個(gè)開源軟件進(jìn)行debug和release編譯,并且查看某個(gè).so的段(readelf -S),發(fā)現(xiàn)release編譯的只有29個(gè)段:

There are 29 section headers, starting at offset 0x1b7d78:Section Headers:[Nr] Name Type Address OffsetSize EntSize Flags Link Info Align[ 0] NULL 0000000000000000 000000000000000000000000 0000000000000000 0 0 0[ 1] .note.gnu.build-i NOTE 00000000000001c8 000001c80000000000000024 0000000000000000 A 0 0 4[ 2] .gnu.hash GNU_HASH 00000000000001f0 000001f00000000000003430 0000000000000000 A 3 0 8[ 3] .dynsym DYNSYM 0000000000003620 00003620000000000000b400 0000000000000018 A 4 2 8[ 4] .dynstr STRTAB 000000000000ea20 0000ea2000000000000083e2 0000000000000000 A 0 0 1[ 5] .gnu.version VERSYM 0000000000016e02 00016e020000000000000f00 0000000000000002 A 3 0 2[ 6] .gnu.version_r VERNEED 0000000000017d08 00017d080000000000000080 0000000000000000 A 4 2 8[ 7] .rela.dyn RELA 0000000000017d88 00017d880000000000009570 0000000000000018 A 3 0 8[ 8] .rela.plt RELA 00000000000212f8 000212f800000000000080d0 0000000000000018 A 3 10 8[ 9] .init PROGBITS 00000000000293c8 000293c80000000000000018 0000000000000000 AX 0 0 4[10] .plt PROGBITS 00000000000293e0 000293e000000000000055f0 0000000000000010 AX 0 0 4[11] .text PROGBITS 000000000002e9d0 0002e9d00000000000144658 0000000000000000 AX 0 0 16[12] .fini PROGBITS 0000000000173028 00173028000000000000000e 0000000000000000 AX 0 0 4[13] .rodata PROGBITS 0000000000173040 00173040000000000001e9a0 0000000000000000 A 0 0 32[14] .eh_frame_hdr PROGBITS 00000000001919e0 001919e0000000000000427c 0000000000000000 A 0 0 4[15] .eh_frame PROGBITS 0000000000195c60 00195c600000000000017d7c 0000000000000000 A 0 0 8[16] .ctors PROGBITS 00000000003ae1e8 001ae1e80000000000000010 0000000000000000 WA 0 0 8[17] .dtors PROGBITS 00000000003ae1f8 001ae1f80000000000000010 0000000000000000 WA 0 0 8[18] .jcr PROGBITS 00000000003ae208 001ae2080000000000000008 0000000000000000 WA 0 0 8[19] .data.rel.ro PROGBITS 00000000003ae220 001ae2200000000000005b38 0000000000000000 WA 0 0 32[20] .dynamic DYNAMIC 00000000003b3d58 001b3d5800000000000001a0 0000000000000010 WA 4 0 8[21] .got PROGBITS 00000000003b3ef8 001b3ef800000000000010e8 0000000000000008 WA 0 0 8[22] .got.plt PROGBITS 00000000003b4fe8 001b4fe80000000000002b08 0000000000000008 WA 0 0 8[23] .data PROGBITS 00000000003b7b00 001b7b000000000000000158 0000000000000000 WA 0 0 32[24] .bss NOBITS 00000000003b7c58 001b7c580000000000000010 0000000000000000 WA 0 0 8[25] .comment PROGBITS 0000000000000000 001b7c58000000000000002a 0000000000000001 MS 0 0 1[26] .shstrtab STRTAB 0000000000000000 001b7c8200000000000000f5 0000000000000000 0 0 1[27] .symtab SYMTAB 0000000000000000 001b84b8000000000000fdb0 0000000000000018 28 788 8[28] .strtab STRTAB 0000000000000000 001c8268000000000000b8b0 0000000000000000 0 0 1Key to Flags:W (write), A (alloc), X (execute), M (merge), S (strings), l (large)I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)O (extra OS processing required) o (OS specific), p (processor specific)            
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 鹰潭市| 宣武区| 安多县| 山西省| 安国市| 浙江省| 安图县| 龙州县| 綦江县| 保靖县| 红河县| 盐源县| 肃北| 侯马市| 城口县| 客服| 宁乡县| 太仓市| 邹平县| 仪陇县| 无锡市| 望城县| 西平县| 潼关县| 峨边| 望都县| 芮城县| 莆田市| 咸丰县| 巴林右旗| 常宁市| 鄂托克旗| 惠安县| 包头市| 万宁市| 西和县| 榆社县| 娄烦县| 汉沽区| 新泰市| 新建县|