Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

225 linhas
11KB

  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 "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Exception Handling (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Exception Handling (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Exception Handling (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Stack-and-Calling.html#Stack-and-Calling" rel="up" title="Stack and Calling">
  30. <link href="Stack-Checking.html#Stack-Checking" rel="next" title="Stack Checking">
  31. <link href="Frame-Layout.html#Frame-Layout" rel="prev" title="Frame Layout">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Exception-Handling"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Stack-Checking.html#Stack-Checking" accesskey="n" rel="next">Stack Checking</a>, Previous: <a href="Frame-Layout.html#Frame-Layout" accesskey="p" rel="prev">Frame Layout</a>, Up: <a href="Stack-and-Calling.html#Stack-and-Calling" accesskey="u" rel="up">Stack and Calling</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Exception-Handling-Support"></a>
  68. <h4 class="subsection">18.9.2 Exception Handling Support</h4>
  69. <a name="index-exception-handling-1"></a>
  70. <dl>
  71. <dt><a name="index-EH_005fRETURN_005fDATA_005fREGNO"></a>Macro: <strong>EH_RETURN_DATA_REGNO</strong> <em>(<var>N</var>)</em></dt>
  72. <dd><p>A C expression whose value is the <var>N</var>th register number used for
  73. data by exception handlers, or <code>INVALID_REGNUM</code> if fewer than
  74. <var>N</var> registers are usable.
  75. </p>
  76. <p>The exception handling library routines communicate with the exception
  77. handlers via a set of agreed upon registers. Ideally these registers
  78. should be call-clobbered; it is possible to use call-saved registers,
  79. but may negatively impact code size. The target must support at least
  80. 2 data registers, but should define 4 if there are enough free registers.
  81. </p>
  82. <p>You must define this macro if you want to support call frame exception
  83. handling like that provided by DWARF 2.
  84. </p></dd></dl>
  85. <dl>
  86. <dt><a name="index-EH_005fRETURN_005fSTACKADJ_005fRTX"></a>Macro: <strong>EH_RETURN_STACKADJ_RTX</strong></dt>
  87. <dd><p>A C expression whose value is RTL representing a location in which
  88. to store a stack adjustment to be applied before function return.
  89. This is used to unwind the stack to an exception handler&rsquo;s call frame.
  90. It will be assigned zero on code paths that return normally.
  91. </p>
  92. <p>Typically this is a call-clobbered hard register that is otherwise
  93. untouched by the epilogue, but could also be a stack slot.
  94. </p>
  95. <p>Do not define this macro if the stack pointer is saved and restored
  96. by the regular prolog and epilog code in the call frame itself; in
  97. this case, the exception handling library routines will update the
  98. stack location to be restored in place. Otherwise, you must define
  99. this macro if you want to support call frame exception handling like
  100. that provided by DWARF 2.
  101. </p></dd></dl>
  102. <dl>
  103. <dt><a name="index-EH_005fRETURN_005fHANDLER_005fRTX"></a>Macro: <strong>EH_RETURN_HANDLER_RTX</strong></dt>
  104. <dd><p>A C expression whose value is RTL representing a location in which
  105. to store the address of an exception handler to which we should
  106. return. It will not be assigned on code paths that return normally.
  107. </p>
  108. <p>Typically this is the location in the call frame at which the normal
  109. return address is stored. For targets that return by popping an
  110. address off the stack, this might be a memory address just below
  111. the <em>target</em> call frame rather than inside the current call
  112. frame. If defined, <code>EH_RETURN_STACKADJ_RTX</code> will have already
  113. been assigned, so it may be used to calculate the location of the
  114. target call frame.
  115. </p>
  116. <p>Some targets have more complex requirements than storing to an
  117. address calculable during initial code generation. In that case
  118. the <code>eh_return</code> instruction pattern should be used instead.
  119. </p>
  120. <p>If you want to support call frame exception handling, you must
  121. define either this macro or the <code>eh_return</code> instruction pattern.
  122. </p></dd></dl>
  123. <dl>
  124. <dt><a name="index-RETURN_005fADDR_005fOFFSET"></a>Macro: <strong>RETURN_ADDR_OFFSET</strong></dt>
  125. <dd><p>If defined, an integer-valued C expression for which rtl will be generated
  126. to add it to the exception handler address before it is searched in the
  127. exception handling tables, and to subtract it again from the address before
  128. using it to return to the exception handler.
  129. </p></dd></dl>
  130. <dl>
  131. <dt><a name="index-ASM_005fPREFERRED_005fEH_005fDATA_005fFORMAT"></a>Macro: <strong>ASM_PREFERRED_EH_DATA_FORMAT</strong> <em>(<var>code</var>, <var>global</var>)</em></dt>
  132. <dd><p>This macro chooses the encoding of pointers embedded in the exception
  133. handling sections. If at all possible, this should be defined such
  134. that the exception handling section will not require dynamic relocations,
  135. and so may be read-only.
  136. </p>
  137. <p><var>code</var> is 0 for data, 1 for code labels, 2 for function pointers.
  138. <var>global</var> is true if the symbol may be affected by dynamic relocations.
  139. The macro should return a combination of the <code>DW_EH_PE_*</code> defines
  140. as found in <samp>dwarf2.h</samp>.
  141. </p>
  142. <p>If this macro is not defined, pointers will not be encoded but
  143. represented directly.
  144. </p></dd></dl>
  145. <dl>
  146. <dt><a name="index-ASM_005fMAYBE_005fOUTPUT_005fENCODED_005fADDR_005fRTX"></a>Macro: <strong>ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX</strong> <em>(<var>file</var>, <var>encoding</var>, <var>size</var>, <var>addr</var>, <var>done</var>)</em></dt>
  147. <dd><p>This macro allows the target to emit whatever special magic is required
  148. to represent the encoding chosen by <code>ASM_PREFERRED_EH_DATA_FORMAT</code>.
  149. Generic code takes care of pc-relative and indirect encodings; this must
  150. be defined if the target uses text-relative or data-relative encodings.
  151. </p>
  152. <p>This is a C statement that branches to <var>done</var> if the format was
  153. handled. <var>encoding</var> is the format chosen, <var>size</var> is the number
  154. of bytes that the format occupies, <var>addr</var> is the <code>SYMBOL_REF</code>
  155. to be emitted.
  156. </p></dd></dl>
  157. <dl>
  158. <dt><a name="index-MD_005fFALLBACK_005fFRAME_005fSTATE_005fFOR"></a>Macro: <strong>MD_FALLBACK_FRAME_STATE_FOR</strong> <em>(<var>context</var>, <var>fs</var>)</em></dt>
  159. <dd><p>This macro allows the target to add CPU and operating system specific
  160. code to the call-frame unwinder for use when there is no unwind data
  161. available. The most common reason to implement this macro is to unwind
  162. through signal frames.
  163. </p>
  164. <p>This macro is called from <code>uw_frame_state_for</code> in
  165. <samp>unwind-dw2.c</samp>, <samp>unwind-dw2-xtensa.c</samp> and
  166. <samp>unwind-ia64.c</samp>. <var>context</var> is an <code>_Unwind_Context</code>;
  167. <var>fs</var> is an <code>_Unwind_FrameState</code>. Examine <code>context-&gt;ra</code>
  168. for the address of the code being executed and <code>context-&gt;cfa</code> for
  169. the stack pointer value. If the frame can be decoded, the register
  170. save addresses should be updated in <var>fs</var> and the macro should
  171. evaluate to <code>_URC_NO_REASON</code>. If the frame cannot be decoded,
  172. the macro should evaluate to <code>_URC_END_OF_STACK</code>.
  173. </p>
  174. <p>For proper signal handling in Java this macro is accompanied by
  175. <code>MAKE_THROW_FRAME</code>, defined in <samp>libjava/include/*-signal.h</samp> headers.
  176. </p></dd></dl>
  177. <dl>
  178. <dt><a name="index-MD_005fHANDLE_005fUNWABI"></a>Macro: <strong>MD_HANDLE_UNWABI</strong> <em>(<var>context</var>, <var>fs</var>)</em></dt>
  179. <dd><p>This macro allows the target to add operating system specific code to the
  180. call-frame unwinder to handle the IA-64 <code>.unwabi</code> unwinding directive,
  181. usually used for signal or interrupt frames.
  182. </p>
  183. <p>This macro is called from <code>uw_update_context</code> in libgcc&rsquo;s
  184. <samp>unwind-ia64.c</samp>. <var>context</var> is an <code>_Unwind_Context</code>;
  185. <var>fs</var> is an <code>_Unwind_FrameState</code>. Examine <code>fs-&gt;unwabi</code>
  186. for the abi and context in the <code>.unwabi</code> directive. If the
  187. <code>.unwabi</code> directive can be handled, the register save addresses should
  188. be updated in <var>fs</var>.
  189. </p></dd></dl>
  190. <dl>
  191. <dt><a name="index-TARGET_005fUSES_005fWEAK_005fUNWIND_005fINFO"></a>Macro: <strong>TARGET_USES_WEAK_UNWIND_INFO</strong></dt>
  192. <dd><p>A C expression that evaluates to true if the target requires unwind
  193. info to be given comdat linkage. Define it to be <code>1</code> if comdat
  194. linkage is necessary. The default is <code>0</code>.
  195. </p></dd></dl>
  196. <hr>
  197. <div class="header">
  198. <p>
  199. Next: <a href="Stack-Checking.html#Stack-Checking" accesskey="n" rel="next">Stack Checking</a>, Previous: <a href="Frame-Layout.html#Frame-Layout" accesskey="p" rel="prev">Frame Layout</a>, Up: <a href="Stack-and-Calling.html#Stack-and-Calling" accesskey="u" rel="up">Stack and Calling</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  200. </div>
  201. </body>
  202. </html>