国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
How to use WinDbg to debug native programs

WinDbg is a powerful debug tool whichcan help programmer to locate the issues in a short time, especially incase there is no development environment. If the software product hasbeen deployed to the customers' workstation and an issue occurred, canyou ask your customer to install a visual studio for you to diagnosticit? Ofcourse not. Thus, WinDbg can help you in this situation. Thisarticle is to introduce how to start your trip on WinDbg. Hope it ishelpful for you, enjoy it!

 

1.Download andinstall Debugging Tools for Windows

http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx

 

2.Setup environmentvariables to point to Microsoft Symbol server

_NT_SYMBOL_PATH = http://msdl.microsoft.com/download/symbols

OR

Specify it from[File]->[Symbol File Path...] in the menu of WinDbg UI

 

3.Start to debug theprogram you want to debug

a. start the programfrom windbg :[File]->[Open Executable...]

b. attach windbg toan existing process:[File]->[Attach to a process...]

c. automaticallyattach a debugger to an application when it starts to run:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Image File Execution Options

Create a newregistry key with the name of the process you want todebug, add an stringvalue "Debugger", set the data to the full path ofntsd.exe. It willuse ntsd.exe to debug the process you specified here.

 

 

 

4.Use command todebug the program

Category

Command

Description

Example

RUN

F10/p

Step over

 

 

F11/t

Step into

 

 

Shift+F11/gu

Step out

 

 

F5/g

Go

 

 

F9

Insert/Remove breakpoint

 

Display

dv

Display local variable

 

 

R

Display register

R ecx

 

U

Show usassemble

U WindbgEx1!Example2

 

kb

Display stack trace

 

 

.lastevent

Last exception record

 

 

bl

List all of the breakpoints

 

 

lm

List all of the loaded modules

 

 

~

Display all threads

 

 

.hh

help

.hh dbgerr005

QUIT

Q

 

 

 

5.Example

First of all, startthe process you want to debug:[File]->[Open Executable...].

Click [Call stack]icon in UI or Alt+6 to sett the call stack, Alt+2 to show the Watch window...

Add breakpoint insource code, and F5 to run into the breakpoint, see the illustration below:

 

 

 

Now, it is the sameas the Visual Studio platform. F10 to step over, and F11 to step into.

Press F5 to run intothe breakpoint, the variable is displayed in Locals window.

 

 

Press F5 to continuethe process,  an exception raised anddisplayed in Command window:

0:000> g

(1668.1920): Integerdivide-by-zero - code c0000094 (first chance)

First chance exceptions arereported before any exception handling.

This exception may be expectedand handled.

WindbgEx1!Example2+0x2d:

00000001`3f27117d f7f9            idiv    eax,ecx

 

We can display theregister using the "r" command:

0:000> r ecx

ecx=0

0:000> r eax

eax=47

From the assemblyand register value, we can find the reason of the exception.

 

Note: First chanceexceptions are thrown from the application, whichgets a change to handle theexception, if the application does not handlethe exception, the debugger willcatch it and has another change, we canit second change exception,  to handle it.

 

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
[Python] 手把手教你寫Windows64位平臺調(diào)試器 | 教程大全
Code Analysis with the Eclipse Profiler
SAP技術(shù)專家的ABAP調(diào)試器培訓(xùn)材料
Ollydbg 編寫腳本的一些語法及例子(OD腳本)
gdb 調(diào)試nasm語法的匯編程序
OllyScript v0.92中文幫助文檔
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服