116 lines
6.4 KiB
HTML
116 lines
6.4 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Linespec Locations - Debugging with GDB</title>
|
|
<meta http-equiv="Content-Type" content="text/html">
|
|
<meta name="description" content="Debugging with GDB">
|
|
<meta name="generator" content="makeinfo 4.13">
|
|
<link title="Top" rel="start" href="index.html#Top">
|
|
<link rel="up" href="Specify-Location.html#Specify-Location" title="Specify Location">
|
|
<link rel="next" href="Explicit-Locations.html#Explicit-Locations" title="Explicit Locations">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
Copyright (C) 1988-2019 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with the
|
|
Invariant Sections being ``Free Software'' and ``Free Software Needs
|
|
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
|
|
and with the Back-Cover Texts as in (a) below.
|
|
|
|
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
|
|
this GNU Manual. Buying copies from GNU Press supports the FSF in
|
|
developing GNU and promoting software freedom.''
|
|
-->
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<style type="text/css"><!--
|
|
pre.display { font-family:inherit }
|
|
pre.format { font-family:inherit }
|
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
|
pre.smallexample { font-size:smaller }
|
|
pre.smalllisp { font-size:smaller }
|
|
span.sc { font-variant:small-caps }
|
|
span.roman { font-family:serif; font-weight:normal; }
|
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<a name="Linespec-Locations"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Explicit-Locations.html#Explicit-Locations">Explicit Locations</a>,
|
|
Up: <a rel="up" accesskey="u" href="Specify-Location.html#Specify-Location">Specify Location</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h4 class="subsection">9.2.1 Linespec Locations</h4>
|
|
|
|
<p><a name="index-linespec-locations-563"></a>
|
|
A <dfn>linespec</dfn> is a colon-separated list of source location parameters such
|
|
as file name, function name, etc. Here are all the different ways of
|
|
specifying a linespec:
|
|
|
|
<dl>
|
|
<dt><var>linenum</var><dd>Specifies the line number <var>linenum</var> of the current source file.
|
|
|
|
<br><dt><code>-</code><var>offset</var><dt><code>+</code><var>offset</var><dd>Specifies the line <var>offset</var> lines before or after the <dfn>current
|
|
line</dfn>. For the <code>list</code> command, the current line is the last one
|
|
printed; for the breakpoint commands, this is the line at which
|
|
execution stopped in the currently selected <dfn>stack frame</dfn>
|
|
(see <a href="Frames.html#Frames">Frames</a>, for a description of stack frames.) When
|
|
used as the second of the two linespecs in a <code>list</code> command,
|
|
this specifies the line <var>offset</var> lines up or down from the first
|
|
linespec.
|
|
|
|
<br><dt><var>filename</var><code>:</code><var>linenum</var><dd>Specifies the line <var>linenum</var> in the source file <var>filename</var>.
|
|
If <var>filename</var> is a relative file name, then it will match any
|
|
source file name with the same trailing components. For example, if
|
|
<var>filename</var> is ‘<samp><span class="samp">gcc/expr.c</span></samp>’, then it will match source file
|
|
name of <samp><span class="file">/build/trunk/gcc/expr.c</span></samp>, but not
|
|
<samp><span class="file">/build/trunk/libcpp/expr.c</span></samp> or <samp><span class="file">/build/trunk/gcc/x-expr.c</span></samp>.
|
|
|
|
<br><dt><var>function</var><dd>Specifies the line that begins the body of the function <var>function</var>.
|
|
For example, in C, this is the line with the open brace.
|
|
|
|
<p>By default, in C<tt>++</tt> and Ada, <var>function</var> is interpreted as
|
|
specifying all functions named <var>function</var> in all scopes. For
|
|
C<tt>++</tt>, this means in all namespaces and classes. For Ada, this
|
|
means in all packages.
|
|
|
|
<p>For example, assuming a program with C<tt>++</tt> symbols named
|
|
<code>A::B::func</code> and <code>B::func</code>, both commands <kbd>break func</kbd><!-- /@w --> and <kbd>break B::func</kbd><!-- /@w --> set a breakpoint on both symbols.
|
|
|
|
<p>Commands that accept a linespec let you override this with the
|
|
<code>-qualified</code> option. For example, <kbd>break -qualified func</kbd><!-- /@w --> sets a breakpoint on a free-function named <code>func</code> ignoring
|
|
any C<tt>++</tt> class methods and namespace functions called <code>func</code>.
|
|
|
|
<p>See <a href="Explicit-Locations.html#Explicit-Locations">Explicit Locations</a>.
|
|
|
|
<br><dt><var>function</var><code>:</code><var>label</var><dd>Specifies the line where <var>label</var> appears in <var>function</var>.
|
|
|
|
<br><dt><var>filename</var><code>:</code><var>function</var><dd>Specifies the line that begins the body of the function <var>function</var>
|
|
in the file <var>filename</var>. You only need the file name with a
|
|
function name to avoid ambiguity when there are identically named
|
|
functions in different source files.
|
|
|
|
<br><dt><var>label</var><dd>Specifies the line at which the label named <var>label</var> appears
|
|
in the function corresponding to the currently selected stack frame.
|
|
If there is no current selected stack frame (for instance, if the inferior
|
|
is not running), then <span class="sc">gdb</span> will not search for a label.
|
|
|
|
<p><a name="index-breakpoint-at-static-probe-point-564"></a><br><dt><code>-pstap|-probe-stap </code><span class="roman">[</span><var>objfile</var><code>:</code><span class="roman">[</span><var>provider</var><code>:</code><span class="roman">]</span><span class="roman">]</span><var>name</var><dd>The <span class="sc">gnu</span>/Linux tool <code>SystemTap</code> provides a way for
|
|
applications to embed static probes. See <a href="Static-Probe-Points.html#Static-Probe-Points">Static Probe Points</a>, for more
|
|
information on finding and using static probes. This form of linespec
|
|
specifies the location of such a static probe.
|
|
|
|
<p>If <var>objfile</var> is given, only probes coming from that shared library
|
|
or executable matching <var>objfile</var> as a regular expression are considered.
|
|
If <var>provider</var> is given, then only probes from that provider are considered.
|
|
If several probes match the spec, <span class="sc">gdb</span> will insert a breakpoint at
|
|
each one of those probes.
|
|
</dl>
|
|
|
|
</body></html>
|
|
|