{"id":209,"date":"2010-04-18T00:35:14","date_gmt":"2010-04-18T09:35:14","guid":{"rendered":"\/blog\/?p=209"},"modified":"2023-09-21T09:39:10","modified_gmt":"2023-09-21T00:39:10","slug":"windbg-%ea%b8%b0%eb%b3%b8-%eb%aa%85%eb%a0%b9%ec%96%b4","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=209","title":{"rendered":"WinDbg \uae30\ubcf8 \uba85\ub839\uc5b4"},"content":{"rendered":"\n<h3><a class=\"con_link\" name=\"_Toc64133681\" target=\"_blank\" rel=\"noopener\">Basic Commands<\/a><\/h3>\n<p>The help file that comes with the WinDbg installation documents commands \nwell, but the following basic commands should get you started:<\/p>\n<table id=\"table2\" border=\"1\">\n<tbody>\n<tr>\n<td>Feature<\/td>\n<td>Command<\/td>\n<td>What Does it Do<\/td>\n<td>Example \/ Comments<\/td>\n<td>See Also Related Commands<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Stack trace<\/td>\n<td>K, KB <code>x<\/code><\/td>\n<td>Displays stack trace of current thread (<code>x<\/code> frames). Kb causes \nthe display to include the first three parameters passed to each function.<\/td>\n<td>&nbsp;<\/td>\n<td>KP, Kp, or KV<\/td><\/tr>\n<tr>\n<td>Frame<\/td>\n<td>.frame <code>X<\/code><\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Register watch<\/td>\n<td>R<\/td>\n<td>Displays register set. reax \u2013 displays the <code lang=\"asm\"><span class=\"code-keyword\">eax<\/span><\/code> register.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Step<\/td>\n<td>t<\/td>\n<td>Trace = Step into (F11)<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>p<\/td>\n<td>Step over (F10)<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>Step out<\/td>\n<td>Shift + F11<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Disassemble<\/td>\n<td>u<\/td>\n<td>Unassemble next few instructions<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>u &lt;<code>start_address<\/code>&gt;<\/td>\n<td>Unassemble instructions at <code>start_address<\/code><\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>u &lt;<code>start_address<\/code>&gt; \n<p>&lt;<code>end_address<\/code>&gt;<\/p><\/td>\n<td>Unassemble instructions from <code>start_address<\/code> till \n<code>end_address<\/code><\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Breakpoints<\/td>\n<td>Bl<\/td>\n<td>List breakpoints.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>be, bd, bc<\/td>\n<td>Enable \/ disable \/ clear breakpoint.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>bp<\/td>\n<td>Set a breakpoint.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>bu<\/td>\n<td>Set unresolved breakpoint. Breakpoint is resolved by symbolic name, not \nabsolute address. Use this to set breakpoint at a function whose containing \nmodule has not yet been loaded.<\/td>\n<td>bu foo<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Comment<\/td>\n<td>*<\/td>\n<td>Ignores the command<\/td>\n<td>* Hello World<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Continue<\/td>\n<td>G &lt;<code>address_X<\/code> \/ <code>symbol<\/code>&gt;<\/td>\n<td>Go. Resumes execution until <code>address_X<\/code><\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>GH<\/td>\n<td>Go, exception handled<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>GN<\/td>\n<td>Go, exception not handled<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Quit<\/td>\n<td>Q<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Dumping data<\/td>\n<td>dv<\/td>\n<td>Display local variables.<\/td>\n<td>You need private symbols.<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>Dd &lt;<code>address<\/code>&gt;<\/td>\n<td>Display <code>dword<\/code> values at specified address.<\/td>\n<td>To see value of an <code><span class=\"code-keyword\">int<\/span><\/code>, DD \n&lt;<code>addr<\/code>&gt; L1<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>Ds, da (ASCII), du (Unicode)<\/td>\n<td>Dump string<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>Dt [dt <i>module<\/i>!<i>typedef<\/i> <i>adr<\/i>]<\/td>\n<td>Dump type. Will dump the contents of the memory using <code><span class=\"code-keyword\">typedef<\/span><\/code> as a template.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Change \/ Edit Values<\/td>\n<td>Eb (<code><span class=\"code-SDKkeyword\">byte<\/span><\/code>), ed \n(<code>dword<\/code>), ea (ASCII), eu (Unicode)<\/td>\n<td>Edit value of a variable<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>List modules<\/td>\n<td>lm<\/td>\n<td>List loaded modules<\/td>\n<td>&nbsp;<\/td>\n<td>Lmi, lml, !dlls<\/td><\/tr>\n<tr>\n<td>Threads<\/td>\n<td>~<\/td>\n<td>Lists all threads<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Command on thread n<\/td>\n<td>~n&lt;<code>command<\/code>&gt;<\/td>\n<td>Switch to a specific thread by thread-id and execute a command on the \nthread.<\/td>\n<td>~2kb (second thread's stack)<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Search for a symbol in a module<\/td>\n<td>X module!&lt;pattern&gt;<\/td>\n<td>&nbsp;<\/td>\n<td>X blah!*foo*<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Dump<\/td>\n<td>.dump<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Source line display<\/td>\n<td>.lines<\/td>\n<td>Turns on source code display<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>ln <i>adr<\/i><\/td>\n<td>Will show the symbol nearest to that location.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr><\/tbody><\/table><a class=\"con_link\" name=\"_Toc59285745\" target=\"_blank\" rel=\"noopener\">Note:<\/a> \n<ol><li>There is no \"step out\" (Shift+F11). You have to find the return address on \nthe stack manually and use \"g <i>adr<\/i>\". You can find this address by using \n\"k\". If you know the function uses ebp frames you can use \"g poi(ebp+4)\" to step \nout. \n<\/li><li>To inspect local variables: \n<ol type=\"a\"><li>Use the \"dv\" command. \n<\/li><li>Then use the \"dt &lt;<code>variablename<\/code>&gt;\" command. \n<\/li><li>Note: you may not see correct values if values are stored in registers or \ndue to FPO. <\/li><\/ol><\/li><\/ol>\n<h3><a class=\"con_link\" name=\"_Toc64133682\" target=\"_blank\" rel=\"noopener\">More Commands<\/a><\/h3>\n<table id=\"table3\" border=\"1\">\n<tbody>\n<tr>\n<td>Feature<\/td>\n<td>Command<\/td>\n<td>What Does it Do<\/td>\n<td>Example \/ Comments<\/td>\n<td>See Also Related Commands<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>Vertarget<\/td>\n<td>Shows information about the system on which you are debugging.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Data breakpoint (hardware bp)<\/td>\n<td>Ba \n<p>[ba r\/w\/e <i>size<\/i> <i>adr<\/i>]<\/p><\/td>\n<td>Sets a data breakpoint. You can break on read\/ write\/ execute attempt of a \nmemory location.<\/td>\n<td>ba w4 <i>adr<\/i><\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Exceptions<\/td>\n<td>.lastevent<\/td>\n<td>Displays last exception record<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Exceptions<\/td>\n<td>Sx, Sxe, sxd, sxn, sxi <code>exception_X<\/code><\/td>\n<td>Enable\/ disable\/ notify-only\/ ignore first chance exception \/event \n<code>exception_X<\/code><i>. <\/i>Example of event: module unload\/ thread \ncreation.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Display type<\/td>\n<td>Dt<\/td>\n<td>Shows <code><span class=\"code-keyword\">struct<\/span><\/code> and field \nvalues.<\/td>\n<td><i>Dt x;<\/i> \/\/ x: int<br \/><i>Dt myStruct;<\/i> \/\/ struct myStruct<br \/><i>Dt \nmyStruct myVar1;<\/i> \/\/ shows myStruct.myVar1<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Reload symbols<\/td>\n<td>.reload<\/td>\n<td>Reloads symbols using the symbol path you would have set.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>Source lines<\/td>\n<td>l+l, l+o, l+s, l+t<\/td>\n<td>Source line options<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>.ecxr<\/td>\n<td>If you had an exception, switches context to faulting context.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>.quit_lock<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>;<\/td>\n<td>Command separator<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>?<\/td>\n<td>Evaluate expression<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>|<\/td>\n<td>Display process information<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>.chain<\/td>\n<td>Lists all loaded debugger extensions.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>.echo &lt;<code><span class=\"code-SDKkeyword\">string<\/span><\/code>&gt;<\/td>\n<td>Echo\/ print any string<\/td>\n<td>Echo xyz<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>.exr &lt;<code>address_x<\/code>&gt;<\/td>\n<td>Display exception record at <code>x<\/code>.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>.cxr &lt;<code>address_x<\/code>&gt;<\/td>\n<td>Display context record at <code>x<\/code>.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>.trap<\/td>\n<td>Dump a trap frame.<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td><\/tr><\/tbody><\/table>\n<h3><a class=\"con_link\" name=\"_Toc59285746\" target=\"_blank\" rel=\"noopener\">Handy Extension Commands<\/a><\/h3>\n<ul><li>!help \u2013 help for WinDbg extension commands. \n<\/li><li>!load, !unload \u2013 to load and unload debugger extension DLLs. \n<\/li><li>!handle \u2013 displays information about handles owned by processes. \n<\/li><li>!peb - shows the PEB (process environment block) including DLL information. \n<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Basic Commands The help file that comes with the WinDbg installation documents commands well, but the following basic commands should get you started: Feature Command What Does it Do Example \/ Comments See Also Related Commands &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Stack trace K, KB x Displays stack trace of current thread (x frames). Kb [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[24],"tags":[],"class_list":["post-209","post","type-post","status-publish","format-standard","hentry","category-development_winddk"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/209\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}