windbg 几个命令

  windbg  windows上最强调试器了 、、、

  对于一下可执行文件没法直接调试的 比如 dll 可以在源码里面插入断点  并使用 windbg -I 设置windbg 为默认的调试器  然后运行到断点的时候就会弹出 windbg 来调试

   r eax=0x11 设置 eax 的值

   gu  跳出函数的执行 就是执行到 ret 返回

  pc: The pc command executes the program until a call instruction is reached. 

  x 查看符号 

x nt!*

.detach  释放附加的进程 

//  dump 当前的所有进程

kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
PROCESS 82bb97c0  SessionId: none  Cid: 0004    Peb: 00000000  ParentCid: 0000
    DirBase: 00368000  ObjectTable: e1001c48  HandleCount: 296.
    Image: System

PROCESS 82774020  SessionId: none  Cid: 0234    Peb: 7ffdb000  ParentCid: 0004
    DirBase: 0de80020  ObjectTable: e1940870  HandleCount:  19.
    Image: smss.exe

// attach 上一个进程

kd> .process 82774020  
Implicit process is now 82774020
WARNING: .cache forcedecodeuser is not enabled

// 查看一个结构的信息

kd> dt  ntdll!_PEB
   +0x000 InheritedAddressSpace : UChar
   +0x001 ReadImageFileExecOptions : UChar
   +0x002 BeingDebugged    : UChar
   +0x003 SpareBool        : UChar
   +0x004 Mutant           : Ptr32 Void
   +0x008 ImageBaseAddress : Ptr32 Void
   +0x00c Ldr              : Ptr32 _PEB_LDR_DATA
   +0x010 ProcessParameters : Ptr32 _RTL_USER_PROCESS_PARAMETERS
   +0x014 SubSystemData    : Ptr32 Void
   +0x018 ProcessHeap      : Ptr32 Void
   +0x01c FastPebLock      : Ptr32 _RTL_CRITICAL_SECTION
   +0x020 FastPebLockRoutine : Ptr32 Void
   +0x024 FastPebUnlockRoutine : Ptr32 Void
   +0x028 EnvironmentUpdateCount : Uint4B
   +0x02c KernelCallbackTable : Ptr32 Void
   +0x030 SystemReserved   : [1] Uint4B
   +0x034 AtlThunkSListPtr32 : Uint4B
   +0x038 FreeList         : Ptr32 _PEB_FREE_BLOCK
   +0x03c TlsExpansionCounter : Uint4B
   +0x040 TlsBitmap        : Ptr32 Void

// 查看当前进程的 PEB


kd> !PEB
PEB at 7ffdb000
    InheritedAddressSpace:    No
    ReadImageFileExecOptions: No
    BeingDebugged:            No
    ImageBaseAddress:         48580000
    Ldr                       00261e90
    Ldr.Initialized:          Yes
    Ldr.InInitializationOrderModuleList: 00261f28 . 00261f28
    Ldr.InLoadOrderModuleList:           00261ec0 . 00261f18
    Ldr.InMemoryOrderModuleList:         00261ec8 . 00261f20
            Base TimeStamp                     Module
        48580000 48025241 Apr 14 02:34:41 2008 \SystemRoot\System32\smss.exe
        7c920000 4d00f280 Dec 09 23:15:12 2010 C:\WINDOWS\system32\ntdll.dll
    SubSystemData:     00000000
    ProcessHeap:       00160000
    ProcessParameters: 00110000
    CurrentDirectory:  'C:\WINDOWS\'
    WindowTitle:  '< Name not readable >'
    ImageFile:    '\SystemRoot\System32\smss.exe'
    CommandLine:  '\SystemRoot\System32\smss.exe'
    DllPath:      'C:\WINDOWS\System32'
    Environment:  00100000
        CommonProgramFiles=
        Path=C:\WINDOWS\System32
        ProgramFiles=
        SystemDrive=C:
        SystemRoot=C:\WINDOWS

/// 将一个地址 和 一个结构对应起来

kd> dt ntdll!_LIST_ENTRY 00261ec8
 [ 0x261f20 - 0x261ea4 ]
   +0x000 Flink            : 0x00261f20 _LIST_ENTRY [ 0x261ea4 - 0x261ec8 ]
   +0x004 Blink            : 0x00261ea4 _LIST_ENTRY [ 0x261ec8 - 0x261f20 ]

kd> dt ntdll!_LDR_DATA_TABLE_ENTRY 0x261ec8
   +0x000 InLoadOrderLinks : _LIST_ENTRY [ 0x261f20 - 0x261ea4 ]
   +0x008 InMemoryOrderLinks : _LIST_ENTRY [ 0x0 - 0x0 ]
   +0x010 InInitializationOrderLinks : _LIST_ENTRY [ 0x48580000 - 0x4858a4c8 ]
   +0x018 DllBase          : 0x0000f000 Void
   +0x01c EntryPoint       : 0x0208003a Void
   +0x020 SizeOfImage      : 0x1106a0
   +0x024 FullDllName      : _UNICODE_STRING "smss.exe"
   +0x02c BaseDllName      : _UNICODE_STRING "--- memory read error at address 0x0000ffff ---"
   +0x034 Flags            : 0x7c99e310
   +0x038 LoadCount        : 0xe310
   +0x03a TlsIndex         : 0x7c99
   +0x03c HashLinks        : _LIST_ENTRY [ 0x48025241 - 0x0 ]
   +0x03c SectionPointer   : 0x48025241 Void
   +0x040 CheckSum         : 0
   +0x044 TimeDateStamp    : 0
   +0x044 LoadedImports    : (null)
   +0x048 EntryPointActivationContext : 0x000b000b Void
   +0x04c PatchInformation : 0x00080110 Void


你可能感兴趣的:(windbg 几个命令)