天天看點

使用dumpbin指令——visual c++

作者: wuyanhuiyishi

在使用vc時,可以用dumpbin。exe來得到某個dll中所輸出的符号的清單。如下面的

指令:dumpbin -exports cmpnt1.dll

如:

c:/windows/system32>dumpbin -exports msgsvc.dll

microsoft (r) coff binary file dumper version 6.00.8447

copyright (c) microsoft corp 1992-1998. all rights reserved.

dump of file msgsvc.dll

file type: dll

  section contains the following exports for msgsvc.dll

           0 characteristics

    41107f60 time date stamp wed aug 04 14:17:04 2004

        0.00 version

           1 ordinal base

           2 number of functions

           2 number of names

    ordinal hint rva      name

          1    0 00004abf servicemain

          2    1 00004595 svchostpushserviceglobals

  summary

        1000 .data

        1000 .reloc

        1000 .rsrc

        8000 .text

c:/>dumpbin

microsoft (r) coff binary file dumper version 6.00.844

copyright (c) microsoft corp 1992-1998. all rights res

usage: dumpbin [options] [files]

   options:

      /all

      /arch

      /archivemembers

      /dependents

      /directives

      /disasm

      /exports

      /fpo

      /headers

      /imports

      /linenumbers

      /linkermember[:<1|2>]

      /loadconfig

      /out:filename

      /pdata

      /rawdata[:[,#]]

      /relocations

      /section:name

      /summary

      /symbols

若要運作 dumpbin,請使用下列文法:

dumpbin [options] files...

指定一個或多個二進制檔案,以及控制資訊所需的任何選項。dumpbin 将該資訊顯示到标準輸出。可以将輸出重定向到檔案,或者使用 /out 選項為輸出指定檔案名。

當在檔案上運作 dumpbin 但未指定選項時,dumpbin 顯示 /summary 輸出。

當鍵入指令 dumpbin 但沒有任何其他指令行輸入時,dumpbin 顯示彙總其選項的用法語句。

dumpbin 選項

/all

此選項顯示除代碼反彙編外的所有可用資訊。使用 /disasm 顯示反彙編。可以與 /all 一起使用 /rawdata:none 來省略檔案的原始二進制詳細資料。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/archivemembers

此選項顯示有關庫成員對象的最少資訊。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/clrheader file

此處: file 用 /clr 生成的圖像檔案。 備注

clrheader 顯示有關在任何托管程式中使用的 .net 頭的資訊。輸出顯示 .net 頭及其中各節的位置和大小(以位元組計)。

file format spec.doc 描述 .net 頭中的資訊。net sdk 将 file format spec.doc 安裝在 tools developers guide 目錄中。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/directives

此選項轉儲圖像中由編譯器生成的 .directive 節。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/dependents

轉儲圖像從中導入函數的 dll 的名稱。不要轉儲導入函數名。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/disasm

此選項顯示代碼段的反彙編,如果出現在檔案中則使用符号。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/exports

此選項顯示從可執行檔案或 dll 導出的所有定義。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/fpo

此選項顯示架構指針優化 (fpo) 記錄。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/headers

此選項顯示檔案頭和每節的頭。當用于庫時,顯示每個成員對象的頭。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/imports[:file]

此選項顯示導入到可執行檔案或 dll 的 dll 清單(靜态連結的和延遲加載)和上述每個 dll 的各個導入。

可選 file 規範允許指定僅顯示某個 dll 的導入。例如:

dumpbin /imports:msvcrt.dll

此選項顯示的輸出與 /exports 輸出相似。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/linenumbers

此選項顯示 coff 行号。如果對象檔案是用程式資料庫 (/zi)、c7 相容 (/z7) 或僅限行号 (/zd) 編譯的,則它包含行号。如果可執行檔案或 dll 是與生成調試資訊 (/debug) 連結的,則它包含 coff 行号。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/linkermember[:<1|2>]

此選項顯示庫中定義的公共符号。指定參數 1 将按對象順序顯示符号及其偏移量。指定參數 2 将顯示對象的偏移量和索引号,然後按字母順序列出這些符号及每個符号的對象索引。若要兩個輸出都獲得,指定不帶數字參數的 /linkermember。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/loadconfig

此選項轉儲 image_load_config_directory 結構,此結構是由 windows nt 加載程式使用并在 winnt.h 中定義的可選結構。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/out:filename

此選項指定輸出的 filename。預設情況下,dumpbin 将資訊顯示到标準輸出。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/pdbpath[:verbose] filename

此處: filename 要為其查找比對 .pdb 檔案的 .dll 或 .exe 檔案名。 verbose(可選) 報告曾嘗試在其中定位 .pdb 檔案的所有目錄。 備注

/pdbpath 将沿調試器搜尋 .pdb 檔案的同一路徑搜尋計算機,并将報告哪些 .pdb 檔案(若有)和 filename 中指定的檔案相對應。

使用 visual studio 調試器時可能會遇到問題,這是因為調試器對調試檔案的不同版本使用 .pdb 檔案。

/pdbpath 将沿下列路徑搜尋 .pdb 檔案: 檢查可執行檔案駐留的位置。 檢查寫入可執行檔案的 pdb 的位置。這通常是圖像被連結時的位置。 沿 visual studio ide 中配置的搜尋路徑檢查。 沿 _nt_symbol_path 和 _nt_alt_symbol_path 環境變量中的路徑檢查。 在 windows 目錄中檢查。

/pdata

僅用于 risc 處理器。

此選項從圖像或對象轉儲異常表 (.pdata)。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/rawdata[:<1|2|4|8|none[ ,number]]

此選項顯示檔案中每節的原始内容。參數控制顯示格式,如下所示:

參數結果1預設值。内容以十六進制位元組顯示,如果内容具有列印的表示形式,則還顯示為 ascii 字元。2内容顯示為十六進制的 2 位元組值。4内容顯示為十六進制的 4 位元組值。8内容顯示為十六進制的 8 位元組值。none取消顯示原始資料。此參數對控制 /all 輸出很有用。number顯示的行被設定為每行具有 number 個值的寬度。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/relocations

此選項顯示對象或圖像中的任何重定位。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/section:section

此選項限制與指定的 section 有關的資訊的輸出。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/summary

此選項顯示有關節的最少資訊(包括總大小)。如果未指定其他選項,則此選項為預設值。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/symbols

此選項顯示 coff 符号表。符号表存在于所有對象檔案中。而對于圖像檔案,隻有當它是與 /debug 連結的時,它才包含 coff 符号表。

下面是關于 /symbols 輸出的說明。通過查閱 winnt.h(image_symbol 和 image_aux_symbol)或 coff 文檔,可找到有關 /symbols 輸出含義的附加資訊。

假設有下列示例轉儲:

dump of file main.objfile type: coff objectcoff symbol table000 00000000 debug notype filename | .file main.cpp002 000b1fdb abs notype static | @comp.id003 00000000 sect1 notype static | .drectve section length 26, #relocs 0, #linenums 0, checksum 722c964f005 00000000 sect2 notype static | .text section length 23, #relocs 1, #linenums 0, checksum 459ff65f, selection 1 (pick no duplicates)007 00000000 sect2 notype () external | _main008 00000000 undef notype () external | ?mydump@@yaxxz (void __cdecl mydump(void))string table size = 0x10 bytessummary 26 .drectve 23 .text

對于以符号号碼開頭的行,下列說明描述了含有與使用者相關的資訊的列: 開頭的 3 位數字是符号索引/号碼。 如果第三列包含 sectx,則符号在對象檔案的那一節中定義。但如果出現 undef,則它不在那個對象中定義并且必須在其他地方被解析。 第五列 (static, external) 說明符号是否隻在那個對象的内部可見,或者是否是公共的(外部可見)。靜态符号 _sym 不會連結到公共符号 _sym;這些符号是名為 _sym 的函數的兩種不同執行個體。

編号行中的最後一列是符号名(修飾名和未修飾名)。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

/unwindinfo

在程式圖像(例如 exe 和 dll)中轉儲結構化異常處理 (seh) 表的展開描述符。/unwindinfo 僅适用于 ia64 圖像。

隻有 /headers dumpbin 選項可用于由 /gl 編譯器選項産生的檔案。

繼續閱讀