PageRenderTime 53ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/share/doc/arm-arm-none-linux-gnueabi/html/libc/Program-Error-Signals.html

https://github.com/apc-io/apc-rock-toolchain
HTML | 252 lines | 167 code | 22 blank | 63 comment | 0 complexity | f696f761af22b6782e30c5d0411b9fb2 MD5 | raw file
Possible License(s): GPL-3.0
  1. <html lang="en">
  2. <head>
  3. <title>Program Error Signals - The GNU C Library</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="The GNU C Library">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="Standard-Signals.html#Standard-Signals" title="Standard Signals">
  9. <link rel="next" href="Termination-Signals.html#Termination-Signals" title="Termination Signals">
  10. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  11. <!--
  12. This file documents the GNU C library.
  13. This is Edition 0.12, last updated 2007-10-27,
  14. of `The GNU C Library Reference Manual', for version
  15. 2.8 (Sourcery G++ Lite 2011.03-41).
  16. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
  17. 2003, 2007, 2008, 2010 Free Software Foundation, Inc.
  18. Permission is granted to copy, distribute and/or modify this document
  19. under the terms of the GNU Free Documentation License, Version 1.3 or
  20. any later version published by the Free Software Foundation; with the
  21. Invariant Sections being ``Free Software Needs Free Documentation''
  22. and ``GNU Lesser General Public License'', the Front-Cover texts being
  23. ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A
  24. copy of the license is included in the section entitled "GNU Free
  25. Documentation License".
  26. (a) The FSF's Back-Cover Text is: ``You have the freedom to
  27. copy and modify this GNU manual. Buying copies from the FSF
  28. supports it in developing GNU and promoting software freedom.''-->
  29. <meta http-equiv="Content-Style-Type" content="text/css">
  30. <style type="text/css"><!--
  31. pre.display { font-family:inherit }
  32. pre.format { font-family:inherit }
  33. pre.smalldisplay { font-family:inherit; font-size:smaller }
  34. pre.smallformat { font-family:inherit; font-size:smaller }
  35. pre.smallexample { font-size:smaller }
  36. pre.smalllisp { font-size:smaller }
  37. span.sc { font-variant:small-caps }
  38. span.roman { font-family:serif; font-weight:normal; }
  39. span.sansserif { font-family:sans-serif; font-weight:normal; }
  40. --></style>
  41. <link rel="stylesheet" type="text/css" href="../cs.css">
  42. </head>
  43. <body>
  44. <div class="node">
  45. <a name="Program-Error-Signals"></a>
  46. <p>
  47. Next:&nbsp;<a rel="next" accesskey="n" href="Termination-Signals.html#Termination-Signals">Termination Signals</a>,
  48. Up:&nbsp;<a rel="up" accesskey="u" href="Standard-Signals.html#Standard-Signals">Standard Signals</a>
  49. <hr>
  50. </div>
  51. <h4 class="subsection">24.2.1 Program Error Signals</h4>
  52. <p><a name="index-program-error-signals-2824"></a>
  53. The following signals are generated when a serious program error is
  54. detected by the operating system or the computer itself. In general,
  55. all of these signals are indications that your program is seriously
  56. broken in some way, and there's usually no way to continue the
  57. computation which encountered the error.
  58. <p>Some programs handle program error signals in order to tidy up before
  59. terminating; for example, programs that turn off echoing of terminal
  60. input should handle program error signals in order to turn echoing back
  61. on. The handler should end by specifying the default action for the
  62. signal that happened and then reraising it; this will cause the program
  63. to terminate with that signal, as if it had not had a handler.
  64. (See <a href="Termination-in-Handler.html#Termination-in-Handler">Termination in Handler</a>.)
  65. <p>Termination is the sensible ultimate outcome from a program error in
  66. most programs. However, programming systems such as Lisp that can load
  67. compiled user programs might need to keep executing even if a user
  68. program incurs an error. These programs have handlers which use
  69. <code>longjmp</code> to return control to the command level.
  70. <p>The default action for all of these signals is to cause the process to
  71. terminate. If you block or ignore these signals or establish handlers
  72. for them that return normally, your program will probably break horribly
  73. when such signals happen, unless they are generated by <code>raise</code> or
  74. <code>kill</code> instead of a real error.
  75. <p><a name="index-COREFILE-2825"></a>When one of these program error signals terminates a process, it also
  76. writes a <dfn>core dump file</dfn> which records the state of the process at
  77. the time of termination. The core dump file is named <samp><span class="file">core</span></samp> and is
  78. written in whichever directory is current in the process at the time.
  79. (On the GNU system, you can specify the file name for core dumps with
  80. the environment variable <code>COREFILE</code>.) The purpose of core dump
  81. files is so that you can examine them with a debugger to investigate
  82. what caused the error.
  83. <!-- signal.h -->
  84. <!-- ISO -->
  85. <div class="defun">
  86. &mdash; Macro: int <b>SIGFPE</b><var><a name="index-SIGFPE-2826"></a></var><br>
  87. <blockquote><p>The <code>SIGFPE</code> signal reports a fatal arithmetic error. Although the
  88. name is derived from &ldquo;floating-point exception&rdquo;, this signal actually
  89. covers all arithmetic errors, including division by zero and overflow.
  90. If a program stores integer data in a location which is then used in a
  91. floating-point operation, this often causes an &ldquo;invalid operation&rdquo;
  92. exception, because the processor cannot recognize the data as a
  93. floating-point number.
  94. <a name="index-exception-2827"></a><a name="index-floating_002dpoint-exception-2828"></a>
  95. Actual floating-point exceptions are a complicated subject because there
  96. are many types of exceptions with subtly different meanings, and the
  97. <code>SIGFPE</code> signal doesn't distinguish between them. The <cite>IEEE
  98. Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985
  99. and ANSI/IEEE Std 854-1987)</cite>
  100. defines various floating-point exceptions and requires conforming
  101. computer systems to report their occurrences. However, this standard
  102. does not specify how the exceptions are reported, or what kinds of
  103. handling and control the operating system can offer to the programmer.
  104. </p></blockquote></div>
  105. <p>BSD systems provide the <code>SIGFPE</code> handler with an extra argument
  106. that distinguishes various causes of the exception. In order to access
  107. this argument, you must define the handler to accept two arguments,
  108. which means you must cast it to a one-argument function type in order to
  109. establish the handler. The GNU library does provide this extra
  110. argument, but the value is meaningful only on operating systems that
  111. provide the information (BSD systems and GNU systems).
  112. <dl>
  113. <!-- signal.h -->
  114. <!-- BSD -->
  115. <dt><code>FPE_INTOVF_TRAP</code><dd><a name="index-FPE_005fINTOVF_005fTRAP-2829"></a>Integer overflow (impossible in a C program unless you enable overflow
  116. trapping in a hardware-specific fashion).
  117. <!-- signal.h -->
  118. <!-- BSD -->
  119. <br><dt><code>FPE_INTDIV_TRAP</code><dd><a name="index-FPE_005fINTDIV_005fTRAP-2830"></a>Integer division by zero.
  120. <!-- signal.h -->
  121. <!-- BSD -->
  122. <br><dt><code>FPE_SUBRNG_TRAP</code><dd><a name="index-FPE_005fSUBRNG_005fTRAP-2831"></a>Subscript-range (something that C programs never check for).
  123. <!-- signal.h -->
  124. <!-- BSD -->
  125. <br><dt><code>FPE_FLTOVF_TRAP</code><dd><a name="index-FPE_005fFLTOVF_005fTRAP-2832"></a>Floating overflow trap.
  126. <!-- signal.h -->
  127. <!-- BSD -->
  128. <br><dt><code>FPE_FLTDIV_TRAP</code><dd><a name="index-FPE_005fFLTDIV_005fTRAP-2833"></a>Floating/decimal division by zero.
  129. <!-- signal.h -->
  130. <!-- BSD -->
  131. <br><dt><code>FPE_FLTUND_TRAP</code><dd><a name="index-FPE_005fFLTUND_005fTRAP-2834"></a>Floating underflow trap. (Trapping on floating underflow is not
  132. normally enabled.)
  133. <!-- signal.h -->
  134. <!-- BSD -->
  135. <br><dt><code>FPE_DECOVF_TRAP</code><dd><a name="index-FPE_005fDECOVF_005fTRAP-2835"></a>Decimal overflow trap. (Only a few machines have decimal arithmetic and
  136. C never uses it.)
  137. </dl>
  138. <!-- signal.h -->
  139. <!-- ISO -->
  140. <div class="defun">
  141. &mdash; Macro: int <b>SIGILL</b><var><a name="index-SIGILL-2836"></a></var><br>
  142. <blockquote><p>The name of this signal is derived from &ldquo;illegal instruction&rdquo;; it
  143. usually means your program is trying to execute garbage or a privileged
  144. instruction. Since the C compiler generates only valid instructions,
  145. <code>SIGILL</code> typically indicates that the executable file is corrupted,
  146. or that you are trying to execute data. Some common ways of getting
  147. into the latter situation are by passing an invalid object where a
  148. pointer to a function was expected, or by writing past the end of an
  149. automatic array (or similar problems with pointers to automatic
  150. variables) and corrupting other data on the stack such as the return
  151. address of a stack frame.
  152. <p><code>SIGILL</code> can also be generated when the stack overflows, or when
  153. the system has trouble running the handler for a signal.
  154. </p></blockquote></div>
  155. <a name="index-illegal-instruction-2837"></a>
  156. <!-- signal.h -->
  157. <!-- ISO -->
  158. <div class="defun">
  159. &mdash; Macro: int <b>SIGSEGV</b><var><a name="index-SIGSEGV-2838"></a></var><br>
  160. <blockquote><p><a name="index-segmentation-violation-2839"></a>This signal is generated when a program tries to read or write outside
  161. the memory that is allocated for it, or to write memory that can only be
  162. read. (Actually, the signals only occur when the program goes far
  163. enough outside to be detected by the system's memory protection
  164. mechanism.) The name is an abbreviation for &ldquo;segmentation violation&rdquo;.
  165. <p>Common ways of getting a <code>SIGSEGV</code> condition include dereferencing
  166. a null or uninitialized pointer, or when you use a pointer to step
  167. through an array, but fail to check for the end of the array. It varies
  168. among systems whether dereferencing a null pointer generates
  169. <code>SIGSEGV</code> or <code>SIGBUS</code>.
  170. </p></blockquote></div>
  171. <!-- signal.h -->
  172. <!-- BSD -->
  173. <div class="defun">
  174. &mdash; Macro: int <b>SIGBUS</b><var><a name="index-SIGBUS-2840"></a></var><br>
  175. <blockquote><p>This signal is generated when an invalid pointer is dereferenced. Like
  176. <code>SIGSEGV</code>, this signal is typically the result of dereferencing an
  177. uninitialized pointer. The difference between the two is that
  178. <code>SIGSEGV</code> indicates an invalid access to valid memory, while
  179. <code>SIGBUS</code> indicates an access to an invalid address. In particular,
  180. <code>SIGBUS</code> signals often result from dereferencing a misaligned
  181. pointer, such as referring to a four-word integer at an address not
  182. divisible by four. (Each kind of computer has its own requirements for
  183. address alignment.)
  184. <p>The name of this signal is an abbreviation for &ldquo;bus error&rdquo;.
  185. </p></blockquote></div>
  186. <a name="index-bus-error-2841"></a>
  187. <!-- signal.h -->
  188. <!-- ISO -->
  189. <div class="defun">
  190. &mdash; Macro: int <b>SIGABRT</b><var><a name="index-SIGABRT-2842"></a></var><br>
  191. <blockquote><p><a name="index-abort-signal-2843"></a>This signal indicates an error detected by the program itself and
  192. reported by calling <code>abort</code>. See <a href="Aborting-a-Program.html#Aborting-a-Program">Aborting a Program</a>.
  193. </p></blockquote></div>
  194. <!-- signal.h -->
  195. <!-- Unix -->
  196. <div class="defun">
  197. &mdash; Macro: int <b>SIGIOT</b><var><a name="index-SIGIOT-2844"></a></var><br>
  198. <blockquote><p>Generated by the PDP-11 &ldquo;iot&rdquo; instruction. On most machines, this is
  199. just another name for <code>SIGABRT</code>.
  200. </p></blockquote></div>
  201. <!-- signal.h -->
  202. <!-- BSD -->
  203. <div class="defun">
  204. &mdash; Macro: int <b>SIGTRAP</b><var><a name="index-SIGTRAP-2845"></a></var><br>
  205. <blockquote><p>Generated by the machine's breakpoint instruction, and possibly other
  206. trap instructions. This signal is used by debuggers. Your program will
  207. probably only see <code>SIGTRAP</code> if it is somehow executing bad
  208. instructions.
  209. </p></blockquote></div>
  210. <!-- signal.h -->
  211. <!-- BSD -->
  212. <div class="defun">
  213. &mdash; Macro: int <b>SIGEMT</b><var><a name="index-SIGEMT-2846"></a></var><br>
  214. <blockquote><p>Emulator trap; this results from certain unimplemented instructions
  215. which might be emulated in software, or the operating system's
  216. failure to properly emulate them.
  217. </p></blockquote></div>
  218. <!-- signal.h -->
  219. <!-- Unix -->
  220. <div class="defun">
  221. &mdash; Macro: int <b>SIGSYS</b><var><a name="index-SIGSYS-2847"></a></var><br>
  222. <blockquote><p>Bad system call; that is to say, the instruction to trap to the
  223. operating system was executed, but the code number for the system call
  224. to perform was invalid.
  225. </p></blockquote></div>
  226. </body></html>