1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc. 4 5Permission is granted to copy, distribute and/or modify this document 6under the terms of the GNU Free Documentation License, Version 1.3 or 7any later version published by the Free Software Foundation; with the 8Invariant Sections being "Free Software" and "Free Software Needs 9Free Documentation", with the Front-Cover Texts being "A GNU Manual," 10and with the Back-Cover Texts as in (a) below. 11 12(a) The FSF's Back-Cover Text is: "You are free to copy and modify 13this GNU Manual. Buying copies from GNU Press supports the FSF in 14developing GNU and promoting software freedom." --> 15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 16<head> 17<title>Debugging with GDB: Cygwin Native</title> 18 19<meta name="description" content="Debugging with GDB: Cygwin Native"> 20<meta name="keywords" content="Debugging with GDB: Cygwin Native"> 21<meta name="resource-type" content="document"> 22<meta name="distribution" content="global"> 23<meta name="Generator" content="makeinfo"> 24<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 25<link href="index.html#Top" rel="start" title="Top"> 26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> 27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 28<link href="Native.html#Native" rel="up" title="Native"> 29<link href="Non_002ddebug-DLL-Symbols.html#Non_002ddebug-DLL-Symbols" rel="next" title="Non-debug DLL Symbols"> 30<link href="DJGPP-Native.html#DJGPP-Native" rel="previous" title="DJGPP Native"> 31<style type="text/css"> 32<!-- 33a.summary-letter {text-decoration: none} 34blockquote.smallquotation {font-size: smaller} 35div.display {margin-left: 3.2em} 36div.example {margin-left: 3.2em} 37div.indentedblock {margin-left: 3.2em} 38div.lisp {margin-left: 3.2em} 39div.smalldisplay {margin-left: 3.2em} 40div.smallexample {margin-left: 3.2em} 41div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 42div.smalllisp {margin-left: 3.2em} 43kbd {font-style:oblique} 44pre.display {font-family: inherit} 45pre.format {font-family: inherit} 46pre.menu-comment {font-family: serif} 47pre.menu-preformatted {font-family: serif} 48pre.smalldisplay {font-family: inherit; font-size: smaller} 49pre.smallexample {font-size: smaller} 50pre.smallformat {font-family: inherit; font-size: smaller} 51pre.smalllisp {font-size: smaller} 52span.nocodebreak {white-space:nowrap} 53span.nolinebreak {white-space:nowrap} 54span.roman {font-family:serif; font-weight:normal} 55span.sansserif {font-family:sans-serif; font-weight:normal} 56ul.no-bullet {list-style: none} 57--> 58</style> 59 60 61</head> 62 63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 64<a name="Cygwin-Native"></a> 65<div class="header"> 66<p> 67Next: <a href="Hurd-Native.html#Hurd-Native" accesskey="n" rel="next">Hurd Native</a>, Previous: <a href="DJGPP-Native.html#DJGPP-Native" accesskey="p" rel="previous">DJGPP Native</a>, Up: <a href="Native.html#Native" accesskey="u" rel="up">Native</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 68</div> 69<hr> 70<a name="Features-for-Debugging-MS-Windows-PE-Executables"></a> 71<h4 class="subsection">21.1.4 Features for Debugging MS Windows PE Executables</h4> 72<a name="index-MS-Windows-debugging"></a> 73<a name="index-native-Cygwin-debugging"></a> 74<a name="index-Cygwin_002dspecific-commands"></a> 75 76<p><small>GDB</small> supports native debugging of MS Windows programs, including 77DLLs with and without symbolic debugging information. 78</p> 79<a name="index-Ctrl_002dBREAK_002c-MS_002dWindows"></a> 80<a name="index-interrupt-debuggee-on-MS_002dWindows"></a> 81<p>MS-Windows programs that call <code>SetConsoleMode</code> to switch off the 82special meaning of the ‘<samp>Ctrl-C</samp>’ keystroke cannot be interrupted 83by typing <kbd>C-c</kbd>. For this reason, <small>GDB</small> on MS-Windows 84supports <kbd>C-<span class="key">BREAK</span></kbd> as an alternative interrupt key 85sequence, which can be used to interrupt the debuggee even if it 86ignores <kbd>C-c</kbd>. 87</p> 88<p>There are various additional Cygwin-specific commands, described in 89this section. Working with DLLs that have no debugging symbols is 90described in <a href="Non_002ddebug-DLL-Symbols.html#Non_002ddebug-DLL-Symbols">Non-debug DLL Symbols</a>. 91</p> 92<dl compact="compact"> 93<dd><a name="index-info-w32"></a> 94</dd> 95<dt><code>info w32</code></dt> 96<dd><p>This is a prefix of MS Windows-specific commands which print 97information about the target system and important OS structures. 98</p> 99</dd> 100<dt><code>info w32 selector</code></dt> 101<dd><p>This command displays information returned by 102the Win32 API <code>GetThreadSelectorEntry</code> function. 103It takes an optional argument that is evaluated to 104a long value to give the information about this given selector. 105Without argument, this command displays information 106about the six segment registers. 107</p> 108</dd> 109<dt><code>info w32 thread-information-block</code></dt> 110<dd><p>This command displays thread specific information stored in the 111Thread Information Block (readable on the X86 CPU family using <code>$fs</code> 112selector for 32-bit programs and <code>$gs</code> for 64-bit programs). 113</p> 114<a name="index-signal_002devent"></a> 115</dd> 116<dt><code>signal-event <var>id</var></code></dt> 117<dd><p>This command signals an event with user-provided <var>id</var>. Used to resume 118crashing process when attached to it using MS-Windows JIT debugging (AeDebug). 119</p> 120<p>To use it, create or edit the following keys in 121<code>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug</code> and/or 122<code>HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug</code> 123(for x86_64 versions): 124</p> 125<ul class="no-bullet"> 126<li>- <code>Debugger</code> (REG_SZ) — a command to launch the debugger. 127Suggested command is: <code><var>fully-qualified-path-to-gdb.exe</var> -ex 128"attach %ld" -ex "signal-event %ld" -ex "continue"</code>. 129 130<p>The first <code>%ld</code> will be replaced by the process ID of the 131crashing process, the second <code>%ld</code> will be replaced by the ID of 132the event that blocks the crashing process, waiting for <small>GDB</small> 133to attach. 134</p> 135</li><li>- <code>Auto</code> (REG_SZ) — either <code>1</code> or <code>0</code>. <code>1</code> will 136make the system run debugger specified by the Debugger key 137automatically, <code>0</code> will cause a dialog box with “OK” and 138“Cancel” buttons to appear, which allows the user to either 139terminate the crashing process (OK) or debug it (Cancel). 140</li></ul> 141 142<a name="index-set-cygwin_002dexceptions"></a> 143<a name="index-debugging-the-Cygwin-DLL"></a> 144<a name="index-Cygwin-DLL_002c-debugging"></a> 145</dd> 146<dt><code>set cygwin-exceptions <var>mode</var></code></dt> 147<dd><p>If <var>mode</var> is <code>on</code>, <small>GDB</small> will break on exceptions that 148happen inside the Cygwin DLL. If <var>mode</var> is <code>off</code>, 149<small>GDB</small> will delay recognition of exceptions, and may ignore some 150exceptions which seem to be caused by internal Cygwin DLL 151“bookkeeping”. This option is meant primarily for debugging the 152Cygwin DLL itself; the default value is <code>off</code> to avoid annoying 153<small>GDB</small> users with false <code>SIGSEGV</code> signals. 154</p> 155<a name="index-show-cygwin_002dexceptions"></a> 156</dd> 157<dt><code>show cygwin-exceptions</code></dt> 158<dd><p>Displays whether <small>GDB</small> will break on exceptions that happen 159inside the Cygwin DLL itself. 160</p> 161<a name="index-set-new_002dconsole"></a> 162</dd> 163<dt><code>set new-console <var>mode</var></code></dt> 164<dd><p>If <var>mode</var> is <code>on</code> the debuggee will 165be started in a new console on next start. 166If <var>mode</var> is <code>off</code>, the debuggee will 167be started in the same console as the debugger. 168</p> 169<a name="index-show-new_002dconsole"></a> 170</dd> 171<dt><code>show new-console</code></dt> 172<dd><p>Displays whether a new console is used 173when the debuggee is started. 174</p> 175<a name="index-set-new_002dgroup"></a> 176</dd> 177<dt><code>set new-group <var>mode</var></code></dt> 178<dd><p>This boolean value controls whether the debuggee should 179start a new group or stay in the same group as the debugger. 180This affects the way the Windows OS handles 181‘<samp>Ctrl-C</samp>’. 182</p> 183<a name="index-show-new_002dgroup"></a> 184</dd> 185<dt><code>show new-group</code></dt> 186<dd><p>Displays current value of new-group boolean. 187</p> 188<a name="index-set-debugevents"></a> 189</dd> 190<dt><code>set debugevents</code></dt> 191<dd><p>This boolean value adds debug output concerning kernel events related 192to the debuggee seen by the debugger. This includes events that 193signal thread and process creation and exit, DLL loading and 194unloading, console interrupts, and debugging messages produced by the 195Windows <code>OutputDebugString</code> API call. 196</p> 197<a name="index-set-debugexec"></a> 198</dd> 199<dt><code>set debugexec</code></dt> 200<dd><p>This boolean value adds debug output concerning execute events 201(such as resume thread) seen by the debugger. 202</p> 203<a name="index-set-debugexceptions"></a> 204</dd> 205<dt><code>set debugexceptions</code></dt> 206<dd><p>This boolean value adds debug output concerning exceptions in the 207debuggee seen by the debugger. 208</p> 209<a name="index-set-debugmemory"></a> 210</dd> 211<dt><code>set debugmemory</code></dt> 212<dd><p>This boolean value adds debug output concerning debuggee memory reads 213and writes by the debugger. 214</p> 215<a name="index-set-shell"></a> 216</dd> 217<dt><code>set shell</code></dt> 218<dd><p>This boolean values specifies whether the debuggee is called 219via a shell or directly (default value is on). 220</p> 221<a name="index-show-shell"></a> 222</dd> 223<dt><code>show shell</code></dt> 224<dd><p>Displays if the debuggee will be started with a shell. 225</p> 226</dd> 227</dl> 228 229<table class="menu" border="0" cellspacing="0"> 230<tr><td align="left" valign="top">• <a href="Non_002ddebug-DLL-Symbols.html#Non_002ddebug-DLL-Symbols" accesskey="1">Non-debug DLL Symbols</a>:</td><td> </td><td align="left" valign="top">Support for DLLs without debugging symbols 231</td></tr> 232</table> 233 234<hr> 235<div class="header"> 236<p> 237Next: <a href="Hurd-Native.html#Hurd-Native" accesskey="n" rel="next">Hurd Native</a>, Previous: <a href="DJGPP-Native.html#DJGPP-Native" accesskey="p" rel="previous">DJGPP Native</a>, Up: <a href="Native.html#Native" accesskey="u" rel="up">Native</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 238</div> 239 240 241 242</body> 243</html> 244