412 lines
18 KiB
HTML
412 lines
18 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- Copyright (C) 1988-2022 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." -->
|
|
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<title>Debugging with GDB: GDB/MI File Commands</title>
|
|
|
|
<meta name="description" content="Debugging with GDB: GDB/MI File Commands">
|
|
<meta name="keywords" content="Debugging with GDB: GDB/MI File Commands">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<link href="index.html#Top" rel="start" title="Top">
|
|
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="GDB_002fMI.html#GDB_002fMI" rel="up" title="GDB/MI">
|
|
<link href="GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation" rel="next" title="GDB/MI Target Manipulation">
|
|
<link href="GDB_002fMI-Symbol-Query.html#GDB_002fMI-Symbol-Query" rel="previous" title="GDB/MI Symbol Query">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.smallquotation {font-size: smaller}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.indentedblock {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
div.smalldisplay {margin-left: 3.2em}
|
|
div.smallexample {margin-left: 3.2em}
|
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
|
div.smalllisp {margin-left: 3.2em}
|
|
kbd {font-style:oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
|
pre.smallexample {font-size: smaller}
|
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
|
pre.smalllisp {font-size: smaller}
|
|
span.nocodebreak {white-space:nowrap}
|
|
span.nolinebreak {white-space:nowrap}
|
|
span.roman {font-family:serif; font-weight:normal}
|
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
|
<a name="GDB_002fMI-File-Commands"></a>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation" accesskey="n" rel="next">GDB/MI Target Manipulation</a>, Previous: <a href="GDB_002fMI-Symbol-Query.html#GDB_002fMI-Symbol-Query" accesskey="p" rel="previous">GDB/MI Symbol Query</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</a> [<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>
|
|
</div>
|
|
<hr>
|
|
<a name="GDB_002fMI-File-Commands-1"></a>
|
|
<h3 class="section">27.19 <small>GDB/MI</small> File Commands</h3>
|
|
|
|
<p>This section describes the GDB/MI commands to specify executable file names
|
|
and to read in and obtain symbol table information.
|
|
</p>
|
|
<a name="The-_002dfile_002dexec_002dand_002dsymbols-Command"></a>
|
|
<h4 class="subheading">The <code>-file-exec-and-symbols</code> Command</h4>
|
|
<a name="index-_002dfile_002dexec_002dand_002dsymbols"></a>
|
|
|
|
<a name="Synopsis-87"></a>
|
|
<h4 class="subsubheading">Synopsis</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> -file-exec-and-symbols <var>file</var>
|
|
</pre></div>
|
|
|
|
<p>Specify the executable file to be debugged. This file is the one from
|
|
which the symbol table is also read. If no file is specified, the
|
|
command clears the executable and symbol information. If breakpoints
|
|
are set when using this command with no arguments, <small>GDB</small> will produce
|
|
error messages. Otherwise, no output is produced, except a completion
|
|
notification.
|
|
</p>
|
|
<a name="GDB-Command-69"></a>
|
|
<h4 class="subsubheading"><small>GDB</small> Command</h4>
|
|
|
|
<p>The corresponding <small>GDB</small> command is ‘<samp>file</samp>’.
|
|
</p>
|
|
<a name="Example-69"></a>
|
|
<h4 class="subsubheading">Example</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(gdb)
|
|
-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
|
|
^done
|
|
(gdb)
|
|
</pre></div>
|
|
|
|
|
|
<a name="The-_002dfile_002dexec_002dfile-Command"></a>
|
|
<h4 class="subheading">The <code>-file-exec-file</code> Command</h4>
|
|
<a name="index-_002dfile_002dexec_002dfile"></a>
|
|
|
|
<a name="Synopsis-88"></a>
|
|
<h4 class="subsubheading">Synopsis</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> -file-exec-file <var>file</var>
|
|
</pre></div>
|
|
|
|
<p>Specify the executable file to be debugged. Unlike
|
|
‘<samp>-file-exec-and-symbols</samp>’, the symbol table is <em>not</em> read
|
|
from this file. If used without argument, <small>GDB</small> clears the information
|
|
about the executable file. No output is produced, except a completion
|
|
notification.
|
|
</p>
|
|
<a name="GDB-Command-70"></a>
|
|
<h4 class="subsubheading"><small>GDB</small> Command</h4>
|
|
|
|
<p>The corresponding <small>GDB</small> command is ‘<samp>exec-file</samp>’.
|
|
</p>
|
|
<a name="Example-70"></a>
|
|
<h4 class="subsubheading">Example</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(gdb)
|
|
-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
|
|
^done
|
|
(gdb)
|
|
</pre></div>
|
|
|
|
|
|
|
|
|
|
<a name="The-_002dfile_002dlist_002dexec_002dsource_002dfile-Command"></a>
|
|
<h4 class="subheading">The <code>-file-list-exec-source-file</code> Command</h4>
|
|
<a name="index-_002dfile_002dlist_002dexec_002dsource_002dfile"></a>
|
|
|
|
<a name="Synopsis-89"></a>
|
|
<h4 class="subsubheading">Synopsis</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> -file-list-exec-source-file
|
|
</pre></div>
|
|
|
|
<p>List the line number, the current source file, and the absolute path
|
|
to the current source file for the current executable. The macro
|
|
information field has a value of ‘<samp>1</samp>’ or ‘<samp>0</samp>’ depending on
|
|
whether or not the file includes preprocessor macro information.
|
|
</p>
|
|
<a name="GDB-Command-71"></a>
|
|
<h4 class="subsubheading"><small>GDB</small> Command</h4>
|
|
|
|
<p>The <small>GDB</small> equivalent is ‘<samp>info source</samp>’
|
|
</p>
|
|
<a name="Example-71"></a>
|
|
<h4 class="subsubheading">Example</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(gdb)
|
|
123-file-list-exec-source-file
|
|
123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1"
|
|
(gdb)
|
|
</pre></div>
|
|
|
|
|
|
<a name="The-_002dfile_002dlist_002dexec_002dsource_002dfiles-Command"></a>
|
|
<h4 class="subheading">The <code>-file-list-exec-source-files</code> Command</h4>
|
|
<a name="index-info-sources-1"></a>
|
|
<a name="index-_002dfile_002dlist_002dexec_002dsource_002dfiles"></a>
|
|
|
|
<a name="Synopsis-90"></a>
|
|
<h4 class="subsubheading">Synopsis</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> -file-list-exec-source-files <span class="roman">[</span> <var>--group-by-objfile</var> <span class="roman">]</span>
|
|
<span class="roman">[</span> <var>--dirname</var> <span class="roman">|</span> <var>--basename</var> <span class="roman">]</span>
|
|
<span class="roman">[</span> -- <span class="roman">]</span>
|
|
<span class="roman">[</span> <var>regexp</var> <span class="roman">]</span>
|
|
</pre></div>
|
|
|
|
<p>This command returns information about the source files <small>GDB</small>
|
|
knows about, it will output both the filename and fullname (absolute
|
|
file name) of a source file, though the fullname can be elided if this
|
|
information is not known to <small>GDB</small>.
|
|
</p>
|
|
<p>With no arguments this command returns a list of source files. Each
|
|
source file is represented by a tuple with the fields; <var>file</var>,
|
|
<var>fullname</var>, and <var>debug-fully-read</var>. The <var>file</var> is the
|
|
display name for the file, while <var>fullname</var> is the absolute name
|
|
of the file. The <var>fullname</var> field can be elided if the absolute
|
|
name of the source file can’t be computed. The field
|
|
<var>debug-fully-read</var> will be a string, either <code>true</code> or
|
|
<code>false</code>. When <code>true</code>, this indicates the full debug
|
|
information for the compilation unit describing this file has been
|
|
read in. When <code>false</code>, the full debug information has not yet
|
|
been read in. While reading in the full debug information it is
|
|
possible that <small>GDB</small> could become aware of additional source
|
|
files.
|
|
</p>
|
|
<p>The optional <var>regexp</var> can be used to filter the list of source
|
|
files returned. The <var>regexp</var> will be matched against the full
|
|
source file name. The matching is case-sensitive, except on operating
|
|
systems that have case-insensitive filesystem (e.g.,
|
|
MS-Windows). ‘<samp>--</samp>’ can be used before <var>regexp</var> to prevent
|
|
<small>GDB</small> interpreting <var>regexp</var> as a command option (e.g. if
|
|
<var>regexp</var> starts with ‘<samp>-</samp>’).
|
|
</p>
|
|
<p>If <code>--dirname</code> is provided, then <var>regexp</var> is matched only
|
|
against the directory name of each source file. If <code>--basename</code>
|
|
is provided, then <var>regexp</var> is matched against the basename of each
|
|
source file. Only one of <code>--dirname</code> or <code>--basename</code> may be
|
|
given, and if either is given then <var>regexp</var> is required.
|
|
</p>
|
|
<p>If <code>--group-by-objfile</code> is used then the format of the results is
|
|
changed. The results will now be a list of tuples, with each tuple
|
|
representing an object file (executable or shared library) loaded into
|
|
<small>GDB</small>. The fields of these tuples are; <var>filename</var>,
|
|
<var>debug-info</var>, and <var>sources</var>. The <var>filename</var> is the
|
|
absolute name of the object file, <var>debug-info</var> is a string with
|
|
one of the following values:
|
|
</p>
|
|
<dl compact="compact">
|
|
<dt><code>none</code></dt>
|
|
<dd><p>This object file has no debug information.
|
|
</p></dd>
|
|
<dt><code>partially-read</code></dt>
|
|
<dd><p>This object file has debug information, but it is not fully read in
|
|
yet. When it is read in later, GDB might become aware of additional
|
|
source files.
|
|
</p></dd>
|
|
<dt><code>fully-read</code></dt>
|
|
<dd><p>This object file has debug information, and this information is fully
|
|
read into GDB. The list of source files is complete.
|
|
</p></dd>
|
|
</dl>
|
|
|
|
<p>The <var>sources</var> is a list or tuples, with each tuple describing a
|
|
single source file with the same fields as described previously. The
|
|
<var>sources</var> list can be empty for object files that have no debug
|
|
information.
|
|
</p>
|
|
<a name="GDB-Command-72"></a>
|
|
<h4 class="subsubheading"><small>GDB</small> Command</h4>
|
|
|
|
<p>The <small>GDB</small> equivalent is ‘<samp>info sources</samp>’.
|
|
<code>gdbtk</code> has an analogous command ‘<samp>gdb_listfiles</samp>’.
|
|
</p>
|
|
<a name="Example-72"></a>
|
|
<h4 class="subsubheading">Example</h4>
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(gdb)
|
|
-file-list-exec-source-files
|
|
^done,files=[{file="foo.c",fullname="/home/foo.c",debug-fully-read="true"},
|
|
{file="/home/bar.c",fullname="/home/bar.c",debug-fully-read="true"},
|
|
{file="gdb_could_not_find_fullpath.c",debug-fully-read="true"}]
|
|
(gdb)
|
|
-file-list-exec-source-files
|
|
^done,files=[{file="test.c",
|
|
fullname="/tmp/info-sources/test.c",
|
|
debug-fully-read="true"},
|
|
{file="/usr/include/stdc-predef.h",
|
|
fullname="/usr/include/stdc-predef.h",
|
|
debug-fully-read="true"},
|
|
{file="header.h",
|
|
fullname="/tmp/info-sources/header.h",
|
|
debug-fully-read="true"},
|
|
{file="helper.c",
|
|
fullname="/tmp/info-sources/helper.c",
|
|
debug-fully-read="true"}]
|
|
(gdb)
|
|
-file-list-exec-source-files -- \\.c
|
|
^done,files=[{file="test.c",
|
|
fullname="/tmp/info-sources/test.c",
|
|
debug-fully-read="true"},
|
|
{file="helper.c",
|
|
fullname="/tmp/info-sources/helper.c",
|
|
debug-fully-read="true"}]
|
|
(gdb)
|
|
-file-list-exec-source-files --group-by-objfile
|
|
^done,files=[{filename="/tmp/info-sources/test.x",
|
|
debug-info="fully-read",
|
|
sources=[{file="test.c",
|
|
fullname="/tmp/info-sources/test.c",
|
|
debug-fully-read="true"},
|
|
{file="/usr/include/stdc-predef.h",
|
|
fullname="/usr/include/stdc-predef.h",
|
|
debug-fully-read="true"},
|
|
{file="header.h",
|
|
fullname="/tmp/info-sources/header.h",
|
|
debug-fully-read="true"}]},
|
|
{filename="/lib64/ld-linux-x86-64.so.2",
|
|
debug-info="none",
|
|
sources=[]},
|
|
{filename="system-supplied DSO at 0x7ffff7fcf000",
|
|
debug-info="none",
|
|
sources=[]},
|
|
{filename="/tmp/info-sources/libhelper.so",
|
|
debug-info="fully-read",
|
|
sources=[{file="helper.c",
|
|
fullname="/tmp/info-sources/helper.c",
|
|
debug-fully-read="true"},
|
|
{file="/usr/include/stdc-predef.h",
|
|
fullname="/usr/include/stdc-predef.h",
|
|
debug-fully-read="true"},
|
|
{file="header.h",
|
|
fullname="/tmp/info-sources/header.h",
|
|
debug-fully-read="true"}]},
|
|
{filename="/lib64/libc.so.6",
|
|
debug-info="none",
|
|
sources=[]}]
|
|
</pre></div>
|
|
|
|
<a name="The-_002dfile_002dlist_002dshared_002dlibraries-Command"></a>
|
|
<h4 class="subheading">The <code>-file-list-shared-libraries</code> Command</h4>
|
|
<a name="index-_002dfile_002dlist_002dshared_002dlibraries"></a>
|
|
|
|
<a name="Synopsis-91"></a>
|
|
<h4 class="subsubheading">Synopsis</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> -file-list-shared-libraries [ <var>regexp</var> ]
|
|
</pre></div>
|
|
|
|
<p>List the shared libraries in the program.
|
|
With a regular expression <var>regexp</var>, only those libraries whose
|
|
names match <var>regexp</var> are listed.
|
|
</p>
|
|
<a name="GDB-Command-73"></a>
|
|
<h4 class="subsubheading"><small>GDB</small> Command</h4>
|
|
|
|
<p>The corresponding <small>GDB</small> command is ‘<samp>info shared</samp>’. The fields
|
|
have a similar meaning to the <code>=library-loaded</code> notification.
|
|
The <code>ranges</code> field specifies the multiple segments belonging to this
|
|
library. Each range has the following fields:
|
|
</p>
|
|
<dl compact="compact">
|
|
<dt>‘<samp>from</samp>’</dt>
|
|
<dd><p>The address defining the inclusive lower bound of the segment.
|
|
</p></dd>
|
|
<dt>‘<samp>to</samp>’</dt>
|
|
<dd><p>The address defining the exclusive upper bound of the segment.
|
|
</p></dd>
|
|
</dl>
|
|
|
|
<a name="Example-73"></a>
|
|
<h4 class="subsubheading">Example</h4>
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(gdb)
|
|
-file-list-exec-source-files
|
|
^done,shared-libraries=[
|
|
{id="/lib/libfoo.so",target-name="/lib/libfoo.so",host-name="/lib/libfoo.so",symbols-loaded="1",thread-group="i1",ranges=[{from="0x72815989",to="0x728162c0"}]},
|
|
{id="/lib/libbar.so",target-name="/lib/libbar.so",host-name="/lib/libbar.so",symbols-loaded="1",thread-group="i1",ranges=[{from="0x76ee48c0",to="0x76ee9160"}]}]
|
|
(gdb)
|
|
</pre></div>
|
|
|
|
|
|
|
|
|
|
<a name="The-_002dfile_002dsymbol_002dfile-Command"></a>
|
|
<h4 class="subheading">The <code>-file-symbol-file</code> Command</h4>
|
|
<a name="index-_002dfile_002dsymbol_002dfile"></a>
|
|
|
|
<a name="Synopsis-92"></a>
|
|
<h4 class="subsubheading">Synopsis</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> -file-symbol-file <var>file</var>
|
|
</pre></div>
|
|
|
|
<p>Read symbol table info from the specified <var>file</var> argument. When
|
|
used without arguments, clears <small>GDB</small>’s symbol table info. No output is
|
|
produced, except for a completion notification.
|
|
</p>
|
|
<a name="GDB-Command-74"></a>
|
|
<h4 class="subsubheading"><small>GDB</small> Command</h4>
|
|
|
|
<p>The corresponding <small>GDB</small> command is ‘<samp>symbol-file</samp>’.
|
|
</p>
|
|
<a name="Example-74"></a>
|
|
<h4 class="subsubheading">Example</h4>
|
|
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(gdb)
|
|
-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
|
|
^done
|
|
(gdb)
|
|
</pre></div>
|
|
|
|
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation" accesskey="n" rel="next">GDB/MI Target Manipulation</a>, Previous: <a href="GDB_002fMI-Symbol-Query.html#GDB_002fMI-Symbol-Query" accesskey="p" rel="previous">GDB/MI Symbol Query</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</a> [<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>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|