You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
8.0KB

  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>Linespec Locations (Debugging with GDB)</title>
  17. <meta name="description" content="Linespec Locations (Debugging with GDB)">
  18. <meta name="keywords" content="Linespec 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="Explicit-Locations.html#Explicit-Locations" rel="next" title="Explicit Locations">
  27. <link href="Specify-Location.html#Specify-Location" rel="prev" title="Specify Location">
  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="Linespec-Locations"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Explicit-Locations.html#Explicit-Locations" accesskey="n" rel="next">Explicit 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="Linespec-Locations-1"></a>
  64. <h4 class="subsection">9.2.1 Linespec Locations</h4>
  65. <a name="index-linespec-locations"></a>
  66. <p>A <em>linespec</em> is a colon-separated list of source location parameters such
  67. as file name, function name, etc. Here are all the different ways of
  68. specifying a linespec:
  69. </p>
  70. <dl compact="compact">
  71. <dt><code><var>linenum</var></code></dt>
  72. <dd><p>Specifies the line number <var>linenum</var> of the current source file.
  73. </p>
  74. </dd>
  75. <dt><code>-<var>offset</var></code></dt>
  76. <dt><code>+<var>offset</var></code></dt>
  77. <dd><p>Specifies the line <var>offset</var> lines before or after the <em>current
  78. line</em>. For the <code>list</code> command, the current line is the last one
  79. printed; for the breakpoint commands, this is the line at which
  80. execution stopped in the currently selected <em>stack frame</em>
  81. (see <a href="Frames.html#Frames">Frames</a>, for a description of stack frames.) When
  82. used as the second of the two linespecs in a <code>list</code> command,
  83. this specifies the line <var>offset</var> lines up or down from the first
  84. linespec.
  85. </p>
  86. </dd>
  87. <dt><code><var>filename</var>:<var>linenum</var></code></dt>
  88. <dd><p>Specifies the line <var>linenum</var> in the source file <var>filename</var>.
  89. If <var>filename</var> is a relative file name, then it will match any
  90. source file name with the same trailing components. For example, if
  91. <var>filename</var> is &lsquo;<samp>gcc/expr.c</samp>&rsquo;, then it will match source file
  92. name of <samp>/build/trunk/gcc/expr.c</samp>, but not
  93. <samp>/build/trunk/libcpp/expr.c</samp> or <samp>/build/trunk/gcc/x-expr.c</samp>.
  94. </p>
  95. </dd>
  96. <dt><code><var>function</var></code></dt>
  97. <dd><p>Specifies the line that begins the body of the function <var>function</var>.
  98. For example, in C, this is the line with the open brace.
  99. </p>
  100. <p>By default, in C<tt>++</tt> and Ada, <var>function</var> is interpreted as
  101. specifying all functions named <var>function</var> in all scopes. For
  102. C<tt>++</tt>, this means in all namespaces and classes. For Ada, this
  103. means in all packages.
  104. </p>
  105. <p>For example, assuming a program with C<tt>++</tt> symbols named
  106. <code>A::B::func</code> and <code>B::func</code>, both commands <kbd>break&nbsp;func</kbd><!-- /@w --> and <kbd>break&nbsp;B::func</kbd><!-- /@w --> set a breakpoint on both symbols.
  107. </p>
  108. <p>Commands that accept a linespec let you override this with the
  109. <code>-qualified</code> option. For example, <kbd>break&nbsp;<span class="nolinebreak">-qualified</span>&nbsp;func</kbd><!-- /@w --> sets a breakpoint on a free-function named <code>func</code> ignoring
  110. any C<tt>++</tt> class methods and namespace functions called <code>func</code>.
  111. </p>
  112. <p>See <a href="Explicit-Locations.html#Explicit-Locations">Explicit Locations</a>.
  113. </p>
  114. </dd>
  115. <dt><code><var>function</var>:<var>label</var></code></dt>
  116. <dd><p>Specifies the line where <var>label</var> appears in <var>function</var>.
  117. </p>
  118. </dd>
  119. <dt><code><var>filename</var>:<var>function</var></code></dt>
  120. <dd><p>Specifies the line that begins the body of the function <var>function</var>
  121. in the file <var>filename</var>. You only need the file name with a
  122. function name to avoid ambiguity when there are identically named
  123. functions in different source files.
  124. </p>
  125. </dd>
  126. <dt><code><var>label</var></code></dt>
  127. <dd><p>Specifies the line at which the label named <var>label</var> appears
  128. in the function corresponding to the currently selected stack frame.
  129. If there is no current selected stack frame (for instance, if the inferior
  130. is not running), then <small>GDB</small> will not search for a label.
  131. </p>
  132. <a name="index-breakpoint-at-static-probe-point"></a>
  133. </dd>
  134. <dt><code>-pstap|-probe-stap <span class="roman">[</span><var>objfile</var>:<span class="roman">[</span><var>provider</var>:<span class="roman">]</span><span class="roman">]</span><var>name</var></code></dt>
  135. <dd><p>The <small>GNU</small>/Linux tool <code>SystemTap</code> provides a way for
  136. applications to embed static probes. See <a href="Static-Probe-Points.html#Static-Probe-Points">Static Probe Points</a>, for more
  137. information on finding and using static probes. This form of linespec
  138. specifies the location of such a static probe.
  139. </p>
  140. <p>If <var>objfile</var> is given, only probes coming from that shared library
  141. or executable matching <var>objfile</var> as a regular expression are considered.
  142. If <var>provider</var> is given, then only probes from that provider are considered.
  143. If several probes match the spec, <small>GDB</small> will insert a breakpoint at
  144. each one of those probes.
  145. </p></dd>
  146. </dl>
  147. <hr>
  148. <div class="header">
  149. <p>
  150. Next: <a href="Explicit-Locations.html#Explicit-Locations" accesskey="n" rel="next">Explicit 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>
  151. </div>
  152. </body>
  153. </html>