You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
10.0KB

  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 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>C++ Exception GDB/MI Catchpoint Commands (Debugging with GDB)</title>
  17. <meta name="description" content="C++ Exception GDB/MI Catchpoint Commands (Debugging with GDB)">
  18. <meta name="keywords" content="C++ Exception GDB/MI Catchpoint Commands (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  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="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands" rel="up" title="GDB/MI Catchpoint Commands">
  26. <link href="GDB_002fMI-Program-Context.html#GDB_002fMI-Program-Context" rel="next" title="GDB/MI Program Context">
  27. <link href="Ada-Exception-GDB_002fMI-Catchpoint-Commands.html#Ada-Exception-GDB_002fMI-Catchpoint-Commands" rel="prev" title="Ada Exception GDB/MI Catchpoint Commands">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="C_002b_002b-Exception-GDB_002fMI-Catchpoint-Commands"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="Ada-Exception-GDB_002fMI-Catchpoint-Commands.html#Ada-Exception-GDB_002fMI-Catchpoint-Commands" accesskey="p" rel="prev">Ada Exception GDB/MI Catchpoint Commands</a>, Up: <a href="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands" accesskey="u" rel="up">GDB/MI Catchpoint Commands</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>
  61. </div>
  62. <hr>
  63. <a name="C_002b_002b-Exception-GDB_002fMI-Catchpoints"></a>
  64. <h4 class="subsection">27.9.3 C<tt>++</tt> Exception <small>GDB/MI</small> Catchpoints</h4>
  65. <p>The following <small>GDB/MI</small> commands can be used to create catchpoints
  66. that stop the execution when C<tt>++</tt> exceptions are being throw, rethrown,
  67. or caught.
  68. </p>
  69. <a name="The-_002dcatch_002dthrow-Command"></a>
  70. <h4 class="subheading">The <code>-catch-throw</code> Command</h4>
  71. <a name="index-_002dcatch_002dthrow"></a>
  72. <a name="Synopsis-18"></a>
  73. <h4 class="subsubheading">Synopsis</h4>
  74. <div class="smallexample">
  75. <pre class="smallexample"> -catch-throw [ -t ] [ -r <var>regexp</var>]
  76. </pre></div>
  77. <p>Stop when the debuggee throws a C<tt>++</tt> exception. If <var>regexp</var> is
  78. given, then only exceptions whose type matches the regular expression
  79. will be caught.
  80. </p>
  81. <p>If &lsquo;<samp>-t</samp>&rsquo; is given, then the catchpoint is enabled only for one
  82. stop, the catchpoint is automatically deleted after stopping once for
  83. the event.
  84. </p>
  85. <a name="GDB-Command-17"></a>
  86. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  87. <p>The corresponding <small>GDB</small> commands are &lsquo;<samp>catch throw</samp>&rsquo;
  88. and &lsquo;<samp>tcatch throw</samp>&rsquo; (see <a href="Set-Catchpoints.html#Set-Catchpoints">Set Catchpoints</a>).
  89. </p>
  90. <a name="Example-17"></a>
  91. <h4 class="subsubheading">Example</h4>
  92. <div class="smallexample">
  93. <pre class="smallexample">-catch-throw -r exception_type
  94. ^done,bkpt={number=&quot;1&quot;,type=&quot;catchpoint&quot;,disp=&quot;keep&quot;,enabled=&quot;y&quot;,
  95. what=&quot;exception throw&quot;,catch-type=&quot;throw&quot;,
  96. thread-groups=[&quot;i1&quot;],
  97. regexp=&quot;exception_type&quot;,times=&quot;0&quot;}
  98. (gdb)
  99. -exec-run
  100. ^running
  101. (gdb)
  102. ~&quot;\n&quot;
  103. ~&quot;Catchpoint 1 (exception thrown), 0x00007ffff7ae00ed
  104. in __cxa_throw () from /lib64/libstdc++.so.6\n&quot;
  105. *stopped,bkptno=&quot;1&quot;,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,
  106. frame={addr=&quot;0x00007ffff7ae00ed&quot;,func=&quot;__cxa_throw&quot;,
  107. args=[],from=&quot;/lib64/libstdc++.so.6&quot;,arch=&quot;i386:x86-64&quot;},
  108. thread-id=&quot;1&quot;,stopped-threads=&quot;all&quot;,core=&quot;6&quot;
  109. (gdb)
  110. </pre></div>
  111. <a name="The-_002dcatch_002drethrow-Command"></a>
  112. <h4 class="subheading">The <code>-catch-rethrow</code> Command</h4>
  113. <a name="index-_002dcatch_002drethrow"></a>
  114. <a name="Synopsis-19"></a>
  115. <h4 class="subsubheading">Synopsis</h4>
  116. <div class="smallexample">
  117. <pre class="smallexample"> -catch-rethrow [ -t ] [ -r <var>regexp</var>]
  118. </pre></div>
  119. <p>Stop when a C<tt>++</tt> exception is re-thrown. If <var>regexp</var> is given,
  120. then only exceptions whose type matches the regular expression will be
  121. caught.
  122. </p>
  123. <p>If &lsquo;<samp>-t</samp>&rsquo; is given, then the catchpoint is enabled only for one
  124. stop, the catchpoint is automatically deleted after the first event is
  125. caught.
  126. </p>
  127. <a name="GDB-Command-18"></a>
  128. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  129. <p>The corresponding <small>GDB</small> commands are &lsquo;<samp>catch rethrow</samp>&rsquo;
  130. and &lsquo;<samp>tcatch rethrow</samp>&rsquo; (see <a href="Set-Catchpoints.html#Set-Catchpoints">Set Catchpoints</a>).
  131. </p>
  132. <a name="Example-18"></a>
  133. <h4 class="subsubheading">Example</h4>
  134. <div class="smallexample">
  135. <pre class="smallexample">-catch-rethrow -r exception_type
  136. ^done,bkpt={number=&quot;1&quot;,type=&quot;catchpoint&quot;,disp=&quot;keep&quot;,enabled=&quot;y&quot;,
  137. what=&quot;exception rethrow&quot;,catch-type=&quot;rethrow&quot;,
  138. thread-groups=[&quot;i1&quot;],
  139. regexp=&quot;exception_type&quot;,times=&quot;0&quot;}
  140. (gdb)
  141. -exec-run
  142. ^running
  143. (gdb)
  144. ~&quot;\n&quot;
  145. ~&quot;Catchpoint 1 (exception rethrown), 0x00007ffff7ae00ed
  146. in __cxa_rethrow () from /lib64/libstdc++.so.6\n&quot;
  147. *stopped,bkptno=&quot;1&quot;,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,
  148. frame={addr=&quot;0x00007ffff7ae00ed&quot;,func=&quot;__cxa_rethrow&quot;,
  149. args=[],from=&quot;/lib64/libstdc++.so.6&quot;,arch=&quot;i386:x86-64&quot;},
  150. thread-id=&quot;1&quot;,stopped-threads=&quot;all&quot;,core=&quot;6&quot;
  151. (gdb)
  152. </pre></div>
  153. <a name="The-_002dcatch_002dcatch-Command"></a>
  154. <h4 class="subheading">The <code>-catch-catch</code> Command</h4>
  155. <a name="index-_002dcatch_002dcatch"></a>
  156. <a name="Synopsis-20"></a>
  157. <h4 class="subsubheading">Synopsis</h4>
  158. <div class="smallexample">
  159. <pre class="smallexample"> -catch-catch [ -t ] [ -r <var>regexp</var>]
  160. </pre></div>
  161. <p>Stop when the debuggee catches a C<tt>++</tt> exception. If <var>regexp</var>
  162. is given, then only exceptions whose type matches the regular
  163. expression will be caught.
  164. </p>
  165. <p>If &lsquo;<samp>-t</samp>&rsquo; is given, then the catchpoint is enabled only for one
  166. stop, the catchpoint is automatically deleted after the first event is
  167. caught.
  168. </p>
  169. <a name="GDB-Command-19"></a>
  170. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  171. <p>The corresponding <small>GDB</small> commands are &lsquo;<samp>catch catch</samp>&rsquo;
  172. and &lsquo;<samp>tcatch catch</samp>&rsquo; (see <a href="Set-Catchpoints.html#Set-Catchpoints">Set Catchpoints</a>).
  173. </p>
  174. <a name="Example-19"></a>
  175. <h4 class="subsubheading">Example</h4>
  176. <div class="smallexample">
  177. <pre class="smallexample">-catch-catch -r exception_type
  178. ^done,bkpt={number=&quot;1&quot;,type=&quot;catchpoint&quot;,disp=&quot;keep&quot;,enabled=&quot;y&quot;,
  179. what=&quot;exception catch&quot;,catch-type=&quot;catch&quot;,
  180. thread-groups=[&quot;i1&quot;],
  181. regexp=&quot;exception_type&quot;,times=&quot;0&quot;}
  182. (gdb)
  183. -exec-run
  184. ^running
  185. (gdb)
  186. ~&quot;\n&quot;
  187. ~&quot;Catchpoint 1 (exception caught), 0x00007ffff7ae00ed
  188. in __cxa_begin_catch () from /lib64/libstdc++.so.6\n&quot;
  189. *stopped,bkptno=&quot;1&quot;,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,
  190. frame={addr=&quot;0x00007ffff7ae00ed&quot;,func=&quot;__cxa_begin_catch&quot;,
  191. args=[],from=&quot;/lib64/libstdc++.so.6&quot;,arch=&quot;i386:x86-64&quot;},
  192. thread-id=&quot;1&quot;,stopped-threads=&quot;all&quot;,core=&quot;6&quot;
  193. (gdb)
  194. </pre></div>
  195. <hr>
  196. <div class="header">
  197. <p>
  198. Previous: <a href="Ada-Exception-GDB_002fMI-Catchpoint-Commands.html#Ada-Exception-GDB_002fMI-Catchpoint-Commands" accesskey="p" rel="prev">Ada Exception GDB/MI Catchpoint Commands</a>, Up: <a href="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands" accesskey="u" rel="up">GDB/MI Catchpoint Commands</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>
  199. </div>
  200. </body>
  201. </html>