Dumpbin命令的使用

此文搜于网上,为了防止自己以后要去重新百度,还是转载过来比较方便。

原文地址:http://zhouruijun163.blog.163.com/blog/static/10771562008320102453910/

DUMPBIN 实用程序提供与 32 位版本的 MicrosoftVisualC++, 结合 LINK、 LIB 和 EXEHDR 实用程序的能力。 可执行文件、 库和 DLL 中的这些工具功能组合能够提供格式和符号信息提供文件。

本文概述的一些选项和输出由 DUMPBIN 实用程序。 有关 DUMPBIN 工具, 参阅产品文档。

更多信息

下面列出 DUMPBIN 命令行选项。 还列出一部分选项提供输出。

/ ALL 显示除代码反汇编所有可用信息。 使用 /DISASM 选项可以显示反汇编。 可使用 /RAWDATA: 与 /ALL NONE 选项要省略文件的原始二进制细节。
因为 / ALL 选项是只组合的所有其他选项, 不需要的示例。
/ ARCHIVEMEMBERS 显示库中成员对象小信息。
的输出文件大小取决于库中对象模块的数量。 下面是属于从 Scrnsave.lib 文件输出:
Archive member name at 582: /0        ..\..\common\retail\scrnsave.obj
2FF359CC time/date Thu Jun 29 18:56:28 1995
uid
gid
100666 mode
214A size
correct header end

反汇编代码部分, 如果文件中存在使用符号 / DISASM 显示。
以下是从 Lib.exe 文件反汇编代码的一部分:
00401000: 8B 44 24 08        mov         eax,dword ptr [esp+8]
00401004: 68 00 20 40 00 push 402000h
00401009: 8B 4C 24 08 mov ecx,dword ptr [esp+8]
0040100D: 50 push eax
0040100E: 51 push ecx
0040100F: E8 0C 00 00 00 call 00401020
00401014: 33 C0 xor eax,eax
00401016: C3 ret
00401017: CC int 3

从可执行文件或 DLL 导 / EXPORTS 显示所有定义出。
MFC40.DLL 产生以下导出信息:

导出以下部分包含有关 MFC40.DLL
          0 characteristics
30733286 time date stamp Wed Oct 04 18:19:02 1995
0.00 version
1 ordinal base
5782 number of functions
4 number of names

ordinal hint name

2 0 DllCanUnloadNow (00096182)
1 1 DllGetClassObject (0009611E)
3 2 DllRegisterServer (000961DB)
4 3 DllUnregisterServer (00096242)

框架指针优化 (FPO) 记录 / FPO 显示。
指针优化记录之一 MFC 库, Nafxis.lib, 附带我们: 框架的一些示例
FPO Data (1)
Use Has Frame
Address Proc Size Locals Prolog BP SEH Type Params
00000000 9 0 0 N N fpo 0

FPO Data (1)
Use Has Frame
Address Proc Size Locals Prolog BP SEH Type Params
00000000 11 0 0 N N fpo C

FPO Data (1)
Use Has Frame
Address Proc Size Locals Prolog BP SEH Type Params
00000000 3 0 0 N N fpo 0

/ HEADERS 显示文件头和对每节头。 当用于库, 显示标题为每个成员对象。
从资源编译器, Rc.exe 显示此信息:

FILE HEADER VALUES
14C machine (i386)
6 number of sections
306F7A22 time date stamp Sun Oct 01 22:35:30 1995
0 file pointer to symbol table
1D1 number of symbols
E0 size of optional header
302 characteristics
Executable
32 bit word machine
Debug information stripped

OPTIONAL HEADER VALUES
10B magic #
2.60 linker version
1E00 size of code
1E00 size of initialized data
0 size of uninitialized data
1144 address of entry point
1000 base of code
3000 base of data
----- new -----
2BB0000 image base
1000 section alignment
200 file alignment
3 subsystem (Windows CUI)
4.00 operating system version
4.00 image version
3.50 subsystem version
8000 size of image
400 size of headers
62C8 checksum
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 [ 0] address [size] of Export Directory
5000 [ 3C] address [size] of Import Directory
6000 [ 394] address [size] of Resource Directory
0 [ 0] address [size] of Exception Directory
0 [ 0] address [size] of Security Directory
7000 [ 21C] address [size] of Base Relocation Directory
3030 [ 38] address [size] of Debug Directory
0 [ 0] address [size] of Description Directory
0 [ 0] address [size] of Special Directory
0 [ 0] address [size] of Thread Storage Directory
0 [ 0] address [size] of Load Configuration Directory
268 [ 44] address [size] of Bound Import Directory
50A0 [ 64] address [size] of Import Address Table Directory
0 [ 0] address [size] of Reserved Directory
0 [ 0] address [size] of Reserved Directory
0 [ 0] address [size] of Reserved Directory

SECTION HEADER #1
.text name
1D24 virtual size
1000 virtual address
1E00 size of raw data
400 file pointer to raw data
0 file pointer to relocation table
3C20 file pointer to line numbers
0 number of relocations
37E number of line numbers
60000020 flags
Code
(no align specified)
Execute Read

/ IMPORTS 显示所有定义导入到可执行文件或 DLL。
此处显示输出与 / EXPORTS 输出很相似。
/ LINENUMBERS 显示 COFF 行号。 如果它是用 C 7 兼容 ProgramDatabase(/Zi), 编译对象文件中存在行号 (/), Z7 或行数字仅 (/ Zd) 切换。 如果它是与生成调试信息链接一个可执行文件或 DLL 包含 COFF 行号 (/ DEBUG) /) 选项 DEBUGTYPE:COFF 和 COFF 格式 (。
使用应用程序向导生成的应用程序显示信息数据如下行:

LINENUMBERS #1
1E90 13 1ECD 13 1EF7 13 1F16 13 1F31 15
1F46 15 1F61 24 1F9A 27 1FD0 2A 2001 2B

[ { 1|2 } / LINKERMEMBER: 显示库中定义公共符号 ]。 指定 1 参数将按对象顺序, 以及他们偏移显示符号。 指定两个参数将显示对象, 的偏移量和索引号, 然后列出符号按字母顺序, 以及为每个对象索引。 要获取两个输出, /LINKERMEMBER 指定不带数字参数。
Windows 多媒体库, Winmmm.lib, 用于获取以下示例的 DUMPBIN 输出。

Archive member name at 8: / 
2FB537E1 time/date Sat May 13 15:51:13 1995
uid
gid
0 mode
2864 size
correct header end

391 public symbols

556C _CloseDriver@12
58A0 _DefDriverProc@20
5BDC _DriverCallback@28
5F1C _DrvGetModuleHandle@4
626A _GetDriverModuleHandle@4
65C4 _NotifyCallbackData@20
6914 _OpenDriver@12
6C44 _PlaySound@12
6F70 _PlaySoundA@12
72A0 _PlaySoundW@12

/ OUT:filename 指定用于输出文件名。 默认情况下, DUMPBIN 信息显示到标准输出。

[ { BYTES|SHORTS|LONGS|NONE } ] / RAWDATA:, 号码 ] 显示文件中每节的原始内容。 参数控制显示, 的格式如下所示:

Argument    Result

BYTES The default. Contents are displayed in hexadecimal bytes,
and also as ASCII characters if they have a printed
representation.
SHORTS Contents are displayed as hexadecimal words.
LONGS Contents are displayed as hexadecimal longwords.
NONE Raw data is suppressed. This argument is useful to control
the output of /ALL.
number Displayed lines are set to a width that holds <number> values
per line.

使用此选项生成信息是非常大, 这是从应用程序向导应用程序使用 LONGS 格式输出的小示例:

RAW DATA #1
00000000 53EC8B55 00A15756 | E9004058 00000000 U[ASCII 239]_SVW[ASCII
237].|X@._...._
00000010 C95B5E5F EC8B55C3 | 5304EC83 4D895756 _^[++U[ASCII
239]_|[ASCII 226]_.SVW[ASCII 235]M_
00000020 3058B8FC 00E90040 | 5F000000 C3C95B5E n+X0@._.|..._^[++_

/ RELOCATIONS 对象或图像中显示任何重定位。
下面是从应用程序向导应用程序获得定位输出的一小部分:

BASE RELOCATIONS #6

1000 virtual address, B0 SizeOfBlock
7 HIGHLOW
22 HIGHLOW
36 HIGHLOW
67 HIGHLOW
89 HIGHLOW

/ SECTION:section Restricts 输出对指定节上信息。

/ 概要 显示节, 包括总大小最少信息。 如果没有指定其他选项选项是默认值。

Microsoft (R) COFF Binary File Dumper Version 3.00.5270
Copyright (C) Microsoft Corp 1992-1995. All rights reserved.

Dump of file tracer.exe

File Type: EXECUTABLE IMAGE

Summary

1000 .data
1000 .idata
1000 .rdata
1000 .reloc
1000 .rsrc
1000 .text

/ SYMBOLS 显示 COFF 符号表。 符号表存在于所有对象文件。 只有它与生成调试信息和 COFF 格式选项 Debug Info 下对调试类别为链接器 (或命令行上 / DEBUG 和 /DEBUGTYPE:COFF 选项) 链接才 COFF 符号表显示图像文件中。
应用程序向导应用程序是用于获取以下示例:

COFF SYMBOL TABLE
000 000065D0 SECT5 notype Static | .rsrc$02
001 00000011 DEBUG notype Filename | .file
C:\code\test\testView.cpp
004 000041A0 SECT3 notype Static | $SG23289
005 00004018 SECT3 notype Static | _$S189$S23301
006 00004168 SECT3 notype Static | _THIS_FILE$S23282
007 00001E90 SECT1 notype Static | .text
Section length 2DE, #relocs 27, #linenums 22
009 00001EE2 SECT1 notype () Static | _$E188
00A 00001EF7 SECT1 notype () Static | _$E187
tag index 0000002E size 0000001F lines 000012DF next function 00000033
00C 000042AC SECT3 notype Static | __init_CTestView$S23291
00D 00003998 SECT2 notype Static | $T23440
00E 00003978 SECT2 notype Static | $T23438
00F 000039C0 SECT2 notype Static | $T23447
010 000039A0 SECT2 notype Static | $T23446
011 00000021 DEBUG notype Filename | .file
 
原文地址:https://www.cnblogs.com/tlm1992/p/dumpbin_useage_tlm1992.html