Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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