Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

157 lines
7.8KB

  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>Explicit Locations (Debugging with GDB)</title>
  17. <meta name="description" content="Explicit Locations (Debugging with GDB)">
  18. <meta name="keywords" content="Explicit Locations (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="Specify-Location.html#Specify-Location" rel="up" title="Specify Location">
  26. <link href="Address-Locations.html#Address-Locations" rel="next" title="Address Locations">
  27. <link href="Linespec-Locations.html#Linespec-Locations" rel="prev" title="Linespec Locations">
  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="Explicit-Locations"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Address-Locations.html#Address-Locations" accesskey="n" rel="next">Address Locations</a>, Previous: <a href="Linespec-Locations.html#Linespec-Locations" accesskey="p" rel="prev">Linespec Locations</a>, Up: <a href="Specify-Location.html#Specify-Location" accesskey="u" rel="up">Specify Location</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="Explicit-Locations-1"></a>
  64. <h4 class="subsection">9.2.2 Explicit Locations</h4>
  65. <a name="index-explicit-locations"></a>
  66. <p><em>Explicit locations</em> allow the user to directly specify the source
  67. location&rsquo;s parameters using option-value pairs.
  68. </p>
  69. <p>Explicit locations are useful when several functions, labels, or
  70. file names have the same name (base name for files) in the program&rsquo;s
  71. sources. In these cases, explicit locations point to the source
  72. line you meant more accurately and unambiguously. Also, using
  73. explicit locations might be faster in large programs.
  74. </p>
  75. <p>For example, the linespec &lsquo;<samp>foo:bar</samp>&rsquo; may refer to a function <code>bar</code>
  76. defined in the file named <samp>foo</samp> or the label <code>bar</code> in a function
  77. named <code>foo</code>. <small>GDB</small> must search either the file system or
  78. the symbol table to know.
  79. </p>
  80. <p>The list of valid explicit location options is summarized in the
  81. following table:
  82. </p>
  83. <dl compact="compact">
  84. <dt><code>-source <var>filename</var></code></dt>
  85. <dd><p>The value specifies the source file name. To differentiate between
  86. files with the same base name, prepend as many directories as is necessary
  87. to uniquely identify the desired file, e.g., <samp>foo/bar/baz.c</samp>. Otherwise
  88. <small>GDB</small> will use the first file it finds with the given base
  89. name. This option requires the use of either <code>-function</code> or <code>-line</code>.
  90. </p>
  91. </dd>
  92. <dt><code>-function <var>function</var></code></dt>
  93. <dd><p>The value specifies the name of a function. Operations
  94. on function locations unmodified by other options (such as <code>-label</code>
  95. or <code>-line</code>) refer to the line that begins the body of the function.
  96. In C, for example, this is the line with the open brace.
  97. </p>
  98. <p>By default, in C<tt>++</tt> and Ada, <var>function</var> is interpreted as
  99. specifying all functions named <var>function</var> in all scopes. For
  100. C<tt>++</tt>, this means in all namespaces and classes. For Ada, this
  101. means in all packages.
  102. </p>
  103. <p>For example, assuming a program with C<tt>++</tt> symbols named
  104. <code>A::B::func</code> and <code>B::func</code>, both commands <kbd>break&nbsp;<span class="nolinebreak">-function</span>&nbsp;func</kbd><!-- /@w --> and <kbd>break&nbsp;<span class="nolinebreak">-function</span>&nbsp;B::func</kbd><!-- /@w --> set a
  105. breakpoint on both symbols.
  106. </p>
  107. <p>You can use the <kbd>-qualified</kbd> flag to override this (see below).
  108. </p>
  109. </dd>
  110. <dt><code>-qualified</code></dt>
  111. <dd>
  112. <p>This flag makes <small>GDB</small> interpret a function name specified with
  113. <kbd>-function</kbd> as a complete fully-qualified name.
  114. </p>
  115. <p>For example, assuming a C<tt>++</tt> program with symbols named
  116. <code>A::B::func</code> and <code>B::func</code>, the <kbd>break&nbsp;<span class="nolinebreak">-qualified</span>&nbsp;<span class="nolinebreak">-function</span>&nbsp;B::func</kbd><!-- /@w --> command sets a breakpoint on <code>B::func</code>, only.
  117. </p>
  118. <p>(Note: the <kbd>-qualified</kbd> option can precede a linespec as well
  119. (see <a href="Linespec-Locations.html#Linespec-Locations">Linespec Locations</a>), so the particular example above could be
  120. simplified as <kbd>break&nbsp;<span class="nolinebreak">-qualified</span>&nbsp;B::func</kbd><!-- /@w -->.)
  121. </p>
  122. </dd>
  123. <dt><code>-label <var>label</var></code></dt>
  124. <dd><p>The value specifies the name of a label. When the function
  125. name is not specified, the label is searched in the function of the currently
  126. selected stack frame.
  127. </p>
  128. </dd>
  129. <dt><code>-line <var>number</var></code></dt>
  130. <dd><p>The value specifies a line offset for the location. The offset may either
  131. be absolute (<code>-line 3</code>) or relative (<code>-line +3</code>), depending on
  132. the command. When specified without any other options, the line offset is
  133. relative to the current line.
  134. </p></dd>
  135. </dl>
  136. <p>Explicit location options may be abbreviated by omitting any non-unique
  137. trailing characters from the option name, e.g., <kbd>break&nbsp;<span class="nolinebreak">-s</span>&nbsp;main.c&nbsp;<span class="nolinebreak">-li</span>&nbsp;3</kbd><!-- /@w -->.
  138. </p>
  139. <hr>
  140. <div class="header">
  141. <p>
  142. Next: <a href="Address-Locations.html#Address-Locations" accesskey="n" rel="next">Address Locations</a>, Previous: <a href="Linespec-Locations.html#Linespec-Locations" accesskey="p" rel="prev">Linespec Locations</a>, Up: <a href="Specify-Location.html#Specify-Location" accesskey="u" rel="up">Specify Location</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>
  143. </div>
  144. </body>
  145. </html>