1. 程式人生 > >linux 檢視庫資訊

linux 檢視庫資訊

ar : 建立靜態庫,插入,刪除,列出和提取成員

strings : 列出檔案中的所有可列印字串
strip : 從目標檔案中刪除符號表資訊
nm : 列出目標檔案中符號表中定義的符號
size : 列出目標檔案中節的名字和大小

ldd 

列出可執行檔案和動態庫所依賴的動態庫資訊。

DESCRIPTION

         ldd prints the shared libraries required by each program or shared library specified on the command line.   

readelf

列出ELF格式檔案的資訊。readelf 後面必須跟引數,引數控制要顯示的內容。readelf功能與objdump相似,且其不依賴BFD庫。

DESCRIPTION
       readelf displays information about one or more ELF format object files.  The options control what particular information to display.

       elffile... are the object files to be examined.  32-bit and 64-bit ELF files are supported, as are archives containing ELF files.

       This program performs a similar function to objdump but it goes into more detail and it exists independently of the BFD library, so
       if there is a bug in BFD then readelf will not be affected.

options (我常用的options做了中文解釋,資訊很多沒有看懂幾個,哈哈!!)

SYNOPSIS
       readelf [-a|--all]
               [-h|--file-header]
               [-l|--program-headers|--segments]
               [-S|--section-headers|--sections]
               [-g|--section-groups]
               [-t|--section-details]
               [-e|--headers]
               [-s|--syms|--symbols]   ------------ 檔案的符號
               [-n|--notes]
               [-r|--relocs]
               [-u|--unwind]
               [-d|--dynamic]               ------------ 檔案依賴的動態庫資訊
               [-V|--version-info]
               [-A|--arch-specific]
               [-D|--use-dynamic]
               [-x <number or name>|--hex-dump=<number or name>]
               [-p <number or name>|--string-dump=<number or name>]
               [-R <number or name>|--relocated-dump=<number or name>]
               [-c|--archive-index]
               [-w[lLiaprmfFsoR]|
                --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]]
               [-I|-histogram]
               [-v|--version]
               [-W|--wide]

               [-H|--help]

objdump  與readelf功能相似。objdump : 所有二進位制工具之母。能夠顯示一個目標檔案中的所有資訊,它最有用的功能是反彙編.text節中的二進位制指令

DESCRIPTION
       objdump displays information about one or more object files.  The options control what particular information to display.  This
       information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their
       program to compile and work.

       objfile... are the object files to be examined.  When you specify archives, objdump shows information on each of the member object
       files.


SYNOPSIS
       objdump [-a|--archive-headers]
               [-b bfdname|--target=bfdname]
               [-C|--demangle[=style] ]
               [-d|--disassemble]
               [-D|--disassemble-all]
               [-z|--disassemble-zeroes]
               [-EB|-EL|--endian={big | little }]
               [-f|--file-headers]
               [-F|--file-offsets]
               [--file-start-context]
               [-g|--debugging]
               [-e|--debugging-tags]
               [-h|--section-headers|--headers]
               [-i|--info]
               [-j section|--section=section]                --------------------- 指定某段資訊
               [-l|--line-numbers]
               [-S|--source]
               [-m machine|--architecture=machine]
               [-M options|--disassembler-options=options]
               [-p|--private-headers]
               [-r|--reloc]
               [-R|--dynamic-reloc]
               [-s|--full-contents]
               [-W[lLiaprmfFsoR]|
                --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]]
               [-G|--stabs]
               [-t|--syms]                                                ---------------------- 符號資訊
               [-T|--dynamic-syms]
               [-x|--all-headers]

               [-w|--wide]

  [--stop-address=address]

  [--start-address=address]

               [--prefix-addresses]
               [--[no-]show-raw-insn]
               [--adjust-vma=offset]
               [--special-syms]
               [--prefix=prefix]
               [--prefix-strip=level]
               [--insn-width=width]
               [-V|--version]
               [-H|--help]
               objfile...

常用選項:

反彙編

# objdump  -j .text -S  objfile