Linespec-Locations.html 8.1 KB

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