Bug-Reporting.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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: Bug Reporting</title>
  16. <meta name="description" content="Debugging with GDB: Bug Reporting">
  17. <meta name="keywords" content="Debugging with GDB: Bug Reporting">
  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="GDB-Bugs.html#GDB-Bugs" rel="up" title="GDB Bugs">
  26. <link href="Command-Line-Editing.html#Command-Line-Editing" rel="next" title="Command Line Editing">
  27. <link href="Bug-Criteria.html#Bug-Criteria" rel="previous" title="Bug Criteria">
  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="Bug-Reporting"></a>
  59. <div class="header">
  60. <p>
  61. Previous: <a href="Bug-Criteria.html#Bug-Criteria" accesskey="p" rel="previous">Bug Criteria</a>, Up: <a href="GDB-Bugs.html#GDB-Bugs" accesskey="u" rel="up">GDB Bugs</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="How-to-Report-Bugs"></a>
  65. <h3 class="section">31.2 How to Report Bugs</h3>
  66. <a name="index-bug-reports"></a>
  67. <a name="index-GDB-bugs_002c-reporting"></a>
  68. <p>A number of companies and individuals offer support for <small>GNU</small> products.
  69. If you obtained <small>GDB</small> from a support organization, we recommend you
  70. contact that organization first.
  71. </p>
  72. <p>You can find contact information for many support companies and
  73. individuals in the file <samp>etc/SERVICE</samp> in the <small>GNU</small> Emacs
  74. distribution.
  75. </p>
  76. <p>In any event, we also recommend that you submit bug reports for
  77. <small>GDB</small> to <a href="https://bugs.linaro.org/">https://bugs.linaro.org/</a>.
  78. </p>
  79. <p>The fundamental principle of reporting bugs usefully is this:
  80. <strong>report all the facts</strong>. If you are not sure whether to state a
  81. fact or leave it out, state it!
  82. </p>
  83. <p>Often people omit facts because they think they know what causes the
  84. problem and assume that some details do not matter. Thus, you might
  85. assume that the name of the variable you use in an example does not matter.
  86. Well, probably it does not, but one cannot be sure. Perhaps the bug is a
  87. stray memory reference which happens to fetch from the location where that
  88. name is stored in memory; perhaps, if the name were different, the contents
  89. of that location would fool the debugger into doing the right thing despite
  90. the bug. Play it safe and give a specific, complete example. That is the
  91. easiest thing for you to do, and the most helpful.
  92. </p>
  93. <p>Keep in mind that the purpose of a bug report is to enable us to fix the
  94. bug. It may be that the bug has been reported previously, but neither
  95. you nor we can know that unless your bug report is complete and
  96. self-contained.
  97. </p>
  98. <p>Sometimes people give a few sketchy facts and ask, &ldquo;Does this ring a
  99. bell?&rdquo; Those bug reports are useless, and we urge everyone to
  100. <em>refuse to respond to them</em> except to chide the sender to report
  101. bugs properly.
  102. </p>
  103. <p>To enable us to fix the bug, you should include all these things:
  104. </p>
  105. <ul>
  106. <li> The version of <small>GDB</small>. <small>GDB</small> announces it if you start
  107. with no arguments; you can also print it at any time using <code>show
  108. version</code>.
  109. <p>Without this, we will not know whether there is any point in looking for
  110. the bug in the current version of <small>GDB</small>.
  111. </p>
  112. </li><li> The type of machine you are using, and the operating system name and
  113. version number.
  114. </li><li> The details of the <small>GDB</small> build-time configuration.
  115. <small>GDB</small> shows these details if you invoke it with the
  116. <samp>--configuration</samp> command-line option, or if you type
  117. <code>show configuration</code> at <small>GDB</small>&rsquo;s prompt.
  118. </li><li> What compiler (and its version) was used to compile <small>GDB</small>&mdash;e.g.
  119. &ldquo;gcc&ndash;2.8.1&rdquo;.
  120. </li><li> What compiler (and its version) was used to compile the program you are
  121. debugging&mdash;e.g. &ldquo;gcc&ndash;2.8.1&rdquo;, or &ldquo;HP92453-01 A.10.32.03 HP
  122. C Compiler&rdquo;. For <small>GCC</small>, you can say <kbd>gcc --version</kbd>
  123. to get this information; for other compilers, see the documentation for
  124. those compilers.
  125. </li><li> The command arguments you gave the compiler to compile your example and
  126. observe the bug. For example, did you use &lsquo;<samp>-O</samp>&rsquo;? To guarantee
  127. you will not omit something important, list them all. A copy of the
  128. Makefile (or the output from make) is sufficient.
  129. <p>If we were to try to guess the arguments, we would probably guess wrong
  130. and then we might not encounter the bug.
  131. </p>
  132. </li><li> A complete input script, and all necessary source files, that will
  133. reproduce the bug.
  134. </li><li> A description of what behavior you observe that you believe is
  135. incorrect. For example, &ldquo;It gets a fatal signal.&rdquo;
  136. <p>Of course, if the bug is that <small>GDB</small> gets a fatal signal, then we
  137. will certainly notice it. But if the bug is incorrect output, we might
  138. not notice unless it is glaringly wrong. You might as well not give us
  139. a chance to make a mistake.
  140. </p>
  141. <p>Even if the problem you experience is a fatal signal, you should still
  142. say so explicitly. Suppose something strange is going on, such as, your
  143. copy of <small>GDB</small> is out of synch, or you have encountered a bug in
  144. the C library on your system. (This has happened!) Your copy might
  145. crash and ours would not. If you told us to expect a crash, then when
  146. ours fails to crash, we would know that the bug was not happening for
  147. us. If you had not told us to expect a crash, then we would not be able
  148. to draw any conclusion from our observations.
  149. </p>
  150. <a name="index-script"></a>
  151. <a name="index-recording-a-session-script"></a>
  152. <p>To collect all this information, you can use a session recording program
  153. such as <code>script</code>, which is available on many Unix systems.
  154. Just run your <small>GDB</small> session inside <code>script</code> and then
  155. include the <samp>typescript</samp> file with your bug report.
  156. </p>
  157. <p>Another way to record a <small>GDB</small> session is to run <small>GDB</small>
  158. inside Emacs and then save the entire buffer to a file.
  159. </p>
  160. </li><li> If you wish to suggest changes to the <small>GDB</small> source, send us context
  161. diffs. If you even discuss something in the <small>GDB</small> source, refer to
  162. it by context, not by line number.
  163. <p>The line numbers in our development sources will not match those in your
  164. sources. Your line numbers would convey no useful information to us.
  165. </p>
  166. </li></ul>
  167. <p>Here are some things that are not necessary:
  168. </p>
  169. <ul>
  170. <li> A description of the envelope of the bug.
  171. <p>Often people who encounter a bug spend a lot of time investigating
  172. which changes to the input file will make the bug go away and which
  173. changes will not affect it.
  174. </p>
  175. <p>This is often time consuming and not very useful, because the way we
  176. will find the bug is by running a single example under the debugger
  177. with breakpoints, not by pure deduction from a series of examples.
  178. We recommend that you save your time for something else.
  179. </p>
  180. <p>Of course, if you can find a simpler example to report <em>instead</em>
  181. of the original one, that is a convenience for us. Errors in the
  182. output will be easier to spot, running under the debugger will take
  183. less time, and so on.
  184. </p>
  185. <p>However, simplification is not vital; if you do not want to do this,
  186. report the bug anyway and send us the entire test case you used.
  187. </p>
  188. </li><li> A patch for the bug.
  189. <p>A patch for the bug does help us if it is a good one. But do not omit
  190. the necessary information, such as the test case, on the assumption that
  191. a patch is all we need. We might see problems with your patch and decide
  192. to fix the problem another way, or we might not understand it at all.
  193. </p>
  194. <p>Sometimes with a program as complicated as <small>GDB</small> it is very hard to
  195. construct an example that will make the program follow a certain path
  196. through the code. If you do not send us the example, we will not be able
  197. to construct one, so we will not be able to verify that the bug is fixed.
  198. </p>
  199. <p>And if we cannot understand what bug you are trying to fix, or why your
  200. patch should be an improvement, we will not install it. A test case will
  201. help us to understand.
  202. </p>
  203. </li><li> A guess about what the bug is or what it depends on.
  204. <p>Such guesses are usually wrong. Even we cannot guess right about such
  205. things without first using the debugger to find the facts.
  206. </p></li></ul>
  207. <hr>
  208. <div class="header">
  209. <p>
  210. Previous: <a href="Bug-Criteria.html#Bug-Criteria" accesskey="p" rel="previous">Bug Criteria</a>, Up: <a href="GDB-Bugs.html#GDB-Bugs" accesskey="u" rel="up">GDB Bugs</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>
  211. </div>
  212. </body>
  213. </html>