NetRoc's Blog

N-Tech

 

WinDbg 文档翻译----70

cc682/NetRoc

http://netroc682.spaces.live.com/

!dh

!dh 扩展显示指定映像的头部。

语法

!dh [OptionsAddress 
!dh -h

参数

Options

下面的选项之一:

-f

显示文件头。

-s

显示节头。

-a

显示所有的头信息。

Address

指定映像的16进制地址。

-h

调试器命令窗口中显示该扩展命令的帮助文本。

DLL

Windows NT 4.0

Dbghelp.dll
Kdextx86.dll
Ntsdexts.dll

Windows 2000

Dbghelp.dll
Kdextx86.dll
Ntsdexts.dll

Windows XP和之后

Dbghelp.dll

 

注释

!lmi 扩展取出映像头中最重要的一些信息并且以简单摘要的方式显示出来。这个扩展要比!dh 更常使用一些。

!dlls

!dlls 扩展显示所有已加载模块或者指定线程或进程使用的所有模块。

语法

!dlls [Options] [LoaderEntryAddress
!dlls -h 

参数

Options

指定显示的级别。该参数可以是下面这些值的任意组合:

-f

显示文件头。

-s

显示节头。

-a

显示完整的模块信息(该选项相当于-f –s。)

-c ModuleAddress

(Windows 2000和之后) 显示包含ModuleAddress 的模块。

-i

(Windows 2000和之后) 按初始化顺序排序输出。

-l

(Windows 2000和之后) 按加载顺序排序输出。这是默认情况。

-m

(Windows 2000和之后) 按内存顺序排序输出。

-v

(Windows XP 和之后) 显示版本信息。该信息从每个模块的资源节中获取。

LoaderEntryAddress

指定模块的loader entry 地址。如果包含该参数,调试器只显示指定的模块。

-h

调试器命令窗口中显示该扩展命令的帮助文本。

DLL

Windows NT 4.0

Kdextx86.dll
Ntsdexts.dll

Windows 2000

Kdextx86.dll
Ntsdexts.dll

Windows XP和之后

Exts.dll

注释

模块列表中包含每个模块的入口点。

.dlls 扩展仅在活动调试时工作(分析崩溃转储时不能使用)。

内核模式下,该扩展显示当前的进程上下文的模块。不能对系统进程或空闲进程使用!dlls

下面是如何使用!dlls 扩展的示例。

kd> !dlls -c 77f60000
Dump dll containing 0x77f60000:

0x00091f38: E:\WINDOWS\System32\ntdll.dll
      Base   0x77f60000  EntryPoint  0x00000000  Size        0x00097000
      Flags  0x00004004  LoadCount   0x0000ffff  TlsIndex    0x00000000
             LDRP_IMAGE_DLL
             LDRP_ENTRY_PROCESSED

kd> !dlls -a 91ec0

0x00091ec0: E:\WINDOWS\system32\winmine.exe
      Base   0x01000000  EntryPoint  0x01003e2e  Size        0x00020000
      Flags  0x00005000  LoadCount   0x0000ffff  TlsIndex    0x00000000
             LDRP_LOAD_IN_PROGRESS
             LDRP_ENTRY_PROCESSED

File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
     14C machine (i386)
       3 number of sections
3A98E856 time date stamp Sun Feb 25 03:11:18 2001

       0 file pointer to symbol table
       0 number of symbols
      E0 size of optional header
     10F characteristics
            Relocations stripped
            Executable
            Line numbers stripped
            Symbols stripped
            32 bit word machine

OPTIONAL HEADER VALUES
     10B magic #
    7.00 linker version
    3A00 size of code
   19E00 size of initialized data
       0 size of uninitialized data
    3E2E address of entry point
    1000 base of code
         ----- new -----
01000000 image base
    1000 section alignment
     200 file alignment
       2 subsystem (Windows GUI)
    5.01 operating system version
    5.01 image version
    4.00 subsystem version
   20000 size of image
     400 size of headers
   21970 checksum
00040000 size of stack reserve
00001000 size of stack commit
00100000 size of heap reserve
00001000 size of heap commit
01000100 Opt Hdr
       0 [       0] address [size] of Export Directory
    40B4 [      B4] address [size] of Import Directory
    6000 [   19170] address [size] of Resource Directory
       0 [       0] address [size] of Exception Directory
       0 [       0] address [size] of Security Directory
       0 [       0] address [size] of Base Relocation Directory
    11B0 [      1C] 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
     258 [      A8] address [size] of Bound Import Directory
    1000 [     1B0] 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
    3992 virtual size
    1000 virtual address
    3A00 size of raw data
     400 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         (no align specified)
         Execute Read


Debug Directories(1)
        Type       Size     Address  Pointer

        cv           1c        13d0      7d0    Format: NB10, 3a98e856, 1, winmi
ne.pdb

SECTION HEADER #2
   .data name
     BB8 virtual size
    5000 virtual address
     200 size of raw data
    3E00 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0000040 flags
         Initialized Data
         (no align specified)
         Read Write

SECTION HEADER #3
   .rsrc name
   19170 virtual size
    6000 virtual address
   19200 size of raw data
    4000 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         (no align specified)
         Read Only

!dumpfa

!dumpfa 扩展显示故障分析项(failure analysis entry)的内容。

语法

!dumpfa Address 

参数

Address

指定要显示的故障分析项的地址。

DLL

Windows NT 4.0

Ext.dll

Windows 2000

Ext.dll

Windows XP和之后

Ext.dll

注释

.dumpfa仅在调试!analyze 扩展时有用,下面是示例。

0:000> !dumpfa 0x00a34140
DataUsed 3b0
Type =        DEBUG_FLR_MARKER_BUCKET 00010016 - Size = 9
Type =          DEBUG_FLR_MARKER_FILE 0001000d - Size = 16
Type =      DEBUG_FLR_SYSXML_LOCALEID 00004200 - Size = 4
Type =      DEBUG_FLR_SYSXML_CHECKSUM 00004201 - Size = 4
Type =         DEBUG_FLR_READ_ADDRESS 0000000e - Size = 8
Type =          DEBUG_FLR_FAULTING_IP 80000000 - Size = 8
Type =     DEBUG_FLR_MM_INTERNAL_CODE 00001004 - Size = 8
Type = DEBUG_FLR_CPU_MICROCODE_VERSION 0000301f - Size = 28
Type = DEBUG_FLR_CUSTOMER_CRASH_COUNT 0000300b - Size = 8
Type =    DEBUG_FLR_DEFAULT_BUCKET_ID 00010008 - Size = 12
Type =         DEBUG_FLR_BUGCHECK_STR 00000600 - Size = 5
Type = DEBUG_FLR_LAST_CONTROL_TRANSFER 0000000a - Size = 18
Type =           DEBUG_FLR_TRAP_FRAME c0000002 - Size = 8
Type =           DEBUG_FLR_STACK_TEXT 00010005 - Size = 1fb
Type =        DEBUG_FLR_STACK_COMMAND 00010004 - Size = 17
Type =        DEBUG_FLR_OS_BUILD_NAME 0000301e - Size = 9
Type =          DEBUG_FLR_MODULE_NAME 00010006 - Size = 8
Type =           DEBUG_FLR_IMAGE_NAME 00010001 - Size = c
Type =      DEBUG_FLR_IMAGE_TIMESTAMP 80000002 - Size = 8

还可以使用 !asd 来调试!analyze 扩展。

!elog_str

!elog_str 扩展将一个字符串加入到事件日志中。

语法

!elog_str String 

参数

String

指定要添加到事件日志的字符串。

DLL

Windows NT 4.0

Ext.dll

Windows 2000

Ext.dll

Windows XP和之后

Ext.dll

注释

由于已注册的事件源不会发送String,所以该字符串以没有事件ID的警告形式出现在事件日志中。

!envvar

!envvar 扩展显示指定的环境变量的值。

语法

!envvar Variable 

参数

Variable

指定要显示值的环境变量。Variable 不区分大小写。

DLL

Windows NT 4.0

不可用

Windows 2000

不可用

Windows XP和之后

Exts.dll

注释

!envvar在用户模式和内核模式下都可以使用。但是,内核模式下当前进程是空闲线程(idle thread)时,指向进程环境块(PEB)的指针是NULL,所以该命令会失败。内核模式下!envvar 扩展显示目标机的环境变量,如下。

0:000> !envvar _nt_symbol_path
        _nt_symbol_path = srv*C:\mysyms*http://msdl.microsoft.com/download/symbols

附加信息

关于环境变量的更多信息,查看环境变量和Microsoft Windows SDK 文档。

!error

!error 扩展解码并显示错误码的信息。

语法

!error Value [Flags]

参数

Value

指定下面这些错误码中的一种:

  • Win32
  • Winsock
  • NTSTATUS
  • NetAPI

Flags

如果Flags 为1,则错误码被当作NTSTATUS代码。

DLL

Windows NT 4.0

Ext.dll

Windows 2000

Ext.dll

Windows XP和之后

Ext.dll

注释

下面的例子说明如何使用!error

0:000> !error 2
Error code: (Win32) 0x2 (2) - The system cannot find the file specified.
0:000> !error 2 1
Error code: (NTSTATUS) 0x2 - STATUS_WAIT_2

!exchain

!exchain 扩展显示当前的异常处理器链。

语法

!exchain [Options

参数

Options

下面这些值之一:

/c

显示调试C++ try/catch 异常相关的信息,如果检测到这种异常的话。

/C

即使没有检测到C++ try/catch 异常,也会显示它的相关的信息。

/f

显示通过遍历CRT函数表获得的信息,即使没有发现CRT异常处理器。

DLL

Windows NT 4.0

Ext.dll

Windows 2000

Ext.dll

Windows XP和之后

Ext.dll

!exchain 扩展仅在x86的机器上可用。

注释

!exchain 扩展显示当前线程的异常处理器列表。

列表以链中的第一个处理器开始(被给予异常的首个处理机会的处理器),并且继续直到结束。下面是该命令的一个示例。

0:000> !exchain
0012fea8: Prymes!_except_handler3+0 (00407604)
  CRT scope  0, filter: Prymes!dzExcepError+e6 (00401576)
                func:   Prymes!dzExcepError+ec (0040157c)
0012ffb0: Prymes!_except_handler3+0 (00407604)
  CRT scope  0, filter: Prymes!mainCRTStartup+f8 (004021b8)
                func:   Prymes!mainCRTStartup+113 (004021d3)
0012ffe0: KERNEL32!GetThreadContext+1c (77ea1856)

!exr

!exr 命令已经废除。使用.exr (Display Exception Record) 命令替代。

posted on 2008-07-09 16:26 NetRoc 阅读(508) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。

导航

统计

常用链接

留言簿(7)

随笔档案(99)

文章分类(35)

文章档案(32)

Friends

Mirror

搜索

最新评论

阅读排行榜

评论排行榜