Cygwin-Native.html 11 KB

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