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

371 lines
15 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 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." -->
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GDB/MI Target Manipulation (Debugging with GDB)</title>
<meta name="description" content="GDB/MI Target Manipulation (Debugging with GDB)">
<meta name="keywords" content="GDB/MI Target Manipulation (Debugging with GDB)">
<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-File-Transfer-Commands.html#GDB_002fMI-File-Transfer-Commands" rel="next" title="GDB/MI File Transfer Commands">
<link href="GDB_002fMI-File-Commands.html#GDB_002fMI-File-Commands" rel="prev" title="GDB/MI File Commands">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
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.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="GDB_002fMI-Target-Manipulation"></a>
<div class="header">
<p>
Next: <a href="GDB_002fMI-File-Transfer-Commands.html#GDB_002fMI-File-Transfer-Commands" accesskey="n" rel="next">GDB/MI File Transfer Commands</a>, Previous: <a href="GDB_002fMI-File-Commands.html#GDB_002fMI-File-Commands" accesskey="p" rel="prev">GDB/MI File Commands</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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>
</div>
<hr>
<a name="GDB_002fMI-Target-Manipulation-Commands"></a>
<h3 class="section">27.20 <small>GDB/MI</small> Target Manipulation Commands</h3>
<a name="The-_002dtarget_002dattach-Command"></a>
<h4 class="subheading">The <code>-target-attach</code> Command</h4>
<a name="index-_002dtarget_002dattach"></a>
<a name="Synopsis-84"></a>
<h4 class="subsubheading">Synopsis</h4>
<div class="smallexample">
<pre class="smallexample"> -target-attach <var>pid</var> | <var>gid</var> | <var>file</var>
</pre></div>
<p>Attach to a process <var>pid</var> or a file <var>file</var> outside of
<small>GDB</small>, or a thread group <var>gid</var>. If attaching to a thread
group, the id previously returned by
&lsquo;<samp>-list-thread-groups --available</samp>&rsquo; must be used.
</p>
<a name="GDB-Command-66"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>attach</samp>&rsquo;.
</p>
<a name="Example-66"></a>
<h4 class="subsubheading">Example</h4>
<div class="smallexample">
<pre class="smallexample">(gdb)
-target-attach 34
=thread-created,id=&quot;1&quot;
*stopped,thread-id=&quot;1&quot;,frame={addr=&quot;0xb7f7e410&quot;,func=&quot;bar&quot;,args=[]}
^done
(gdb)
</pre></div>
<a name="The-_002dtarget_002ddetach-Command"></a>
<h4 class="subheading">The <code>-target-detach</code> Command</h4>
<a name="index-_002dtarget_002ddetach"></a>
<a name="Synopsis-85"></a>
<h4 class="subsubheading">Synopsis</h4>
<div class="smallexample">
<pre class="smallexample"> -target-detach [ <var>pid</var> | <var>gid</var> ]
</pre></div>
<p>Detach from the remote target which normally resumes its execution.
If either <var>pid</var> or <var>gid</var> is specified, detaches from either
the specified process, or specified thread group. There&rsquo;s no output.
</p>
<a name="GDB-Command-67"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>detach</samp>&rsquo;.
</p>
<a name="Example-67"></a>
<h4 class="subsubheading">Example</h4>
<div class="smallexample">
<pre class="smallexample">(gdb)
-target-detach
^done
(gdb)
</pre></div>
<a name="The-_002dtarget_002ddisconnect-Command"></a>
<h4 class="subheading">The <code>-target-disconnect</code> Command</h4>
<a name="index-_002dtarget_002ddisconnect"></a>
<a name="Synopsis-86"></a>
<h4 class="subsubheading">Synopsis</h4>
<div class="smallexample">
<pre class="smallexample"> -target-disconnect
</pre></div>
<p>Disconnect from the remote target. There&rsquo;s no output and the target is
generally not resumed.
</p>
<a name="GDB-Command-68"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>disconnect</samp>&rsquo;.
</p>
<a name="Example-68"></a>
<h4 class="subsubheading">Example</h4>
<div class="smallexample">
<pre class="smallexample">(gdb)
-target-disconnect
^done
(gdb)
</pre></div>
<a name="The-_002dtarget_002ddownload-Command"></a>
<h4 class="subheading">The <code>-target-download</code> Command</h4>
<a name="index-_002dtarget_002ddownload"></a>
<a name="Synopsis-87"></a>
<h4 class="subsubheading">Synopsis</h4>
<div class="smallexample">
<pre class="smallexample"> -target-download
</pre></div>
<p>Loads the executable onto the remote target.
It prints out an update message every half second, which includes the fields:
</p>
<dl compact="compact">
<dt>&lsquo;<samp>section</samp>&rsquo;</dt>
<dd><p>The name of the section.
</p></dd>
<dt>&lsquo;<samp>section-sent</samp>&rsquo;</dt>
<dd><p>The size of what has been sent so far for that section.
</p></dd>
<dt>&lsquo;<samp>section-size</samp>&rsquo;</dt>
<dd><p>The size of the section.
</p></dd>
<dt>&lsquo;<samp>total-sent</samp>&rsquo;</dt>
<dd><p>The total size of what was sent so far (the current and the previous sections).
</p></dd>
<dt>&lsquo;<samp>total-size</samp>&rsquo;</dt>
<dd><p>The size of the overall executable to download.
</p></dd>
</dl>
<p>Each message is sent as status record (see <a href="GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax"><small>GDB/MI</small> Output Syntax</a>).
</p>
<p>In addition, it prints the name and size of the sections, as they are
downloaded. These messages include the following fields:
</p>
<dl compact="compact">
<dt>&lsquo;<samp>section</samp>&rsquo;</dt>
<dd><p>The name of the section.
</p></dd>
<dt>&lsquo;<samp>section-size</samp>&rsquo;</dt>
<dd><p>The size of the section.
</p></dd>
<dt>&lsquo;<samp>total-size</samp>&rsquo;</dt>
<dd><p>The size of the overall executable to download.
</p></dd>
</dl>
<p>At the end, a summary is printed.
</p>
<a name="GDB-Command-69"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>load</samp>&rsquo;.
</p>
<a name="Example-69"></a>
<h4 class="subsubheading">Example</h4>
<p>Note: each status message appears on a single line. Here the messages
have been broken down so that they can fit onto a page.
</p>
<div class="smallexample">
<pre class="smallexample">(gdb)
-target-download
+download,{section=&quot;.text&quot;,section-size=&quot;6668&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;512&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;512&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;1024&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;1024&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;1536&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;1536&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;2048&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;2048&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;2560&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;2560&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;3072&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;3072&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;3584&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;3584&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;4096&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;4096&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;4608&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;4608&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;5120&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;5120&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;5632&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;5632&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;6144&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;6144&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.text&quot;,section-sent=&quot;6656&quot;,section-size=&quot;6668&quot;,
total-sent=&quot;6656&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.init&quot;,section-size=&quot;28&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.fini&quot;,section-size=&quot;28&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.data&quot;,section-size=&quot;3156&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.data&quot;,section-sent=&quot;512&quot;,section-size=&quot;3156&quot;,
total-sent=&quot;7236&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.data&quot;,section-sent=&quot;1024&quot;,section-size=&quot;3156&quot;,
total-sent=&quot;7748&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.data&quot;,section-sent=&quot;1536&quot;,section-size=&quot;3156&quot;,
total-sent=&quot;8260&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.data&quot;,section-sent=&quot;2048&quot;,section-size=&quot;3156&quot;,
total-sent=&quot;8772&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.data&quot;,section-sent=&quot;2560&quot;,section-size=&quot;3156&quot;,
total-sent=&quot;9284&quot;,total-size=&quot;9880&quot;}
+download,{section=&quot;.data&quot;,section-sent=&quot;3072&quot;,section-size=&quot;3156&quot;,
total-sent=&quot;9796&quot;,total-size=&quot;9880&quot;}
^done,address=&quot;0x10004&quot;,load-size=&quot;9880&quot;,transfer-rate=&quot;6586&quot;,
write-rate=&quot;429&quot;
(gdb)
</pre></div>
<a name="GDB-Command-70"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
<p>No equivalent.
</p>
<a name="Example-70"></a>
<h4 class="subsubheading">Example</h4>
<p>N.A.
</p>
<a name="The-_002dtarget_002dflash_002derase-Command"></a>
<h4 class="subheading">The <code>-target-flash-erase</code> Command</h4>
<a name="index-_002dtarget_002dflash_002derase"></a>
<a name="Synopsis-88"></a>
<h4 class="subsubheading">Synopsis</h4>
<div class="smallexample">
<pre class="smallexample"> -target-flash-erase
</pre></div>
<p>Erases all known flash memory regions on the target.
</p>
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>flash-erase</samp>&rsquo;.
</p>
<p>The output is a list of flash regions that have been erased, with starting
addresses and memory region sizes.
</p>
<div class="smallexample">
<pre class="smallexample">(gdb)
-target-flash-erase
^done,erased-regions={address=&quot;0x0&quot;,size=&quot;0x40000&quot;}
(gdb)
</pre></div>
<a name="The-_002dtarget_002dselect-Command"></a>
<h4 class="subheading">The <code>-target-select</code> Command</h4>
<a name="index-_002dtarget_002dselect"></a>
<a name="Synopsis-89"></a>
<h4 class="subsubheading">Synopsis</h4>
<div class="smallexample">
<pre class="smallexample"> -target-select <var>type</var> <var>parameters &hellip;</var>
</pre></div>
<p>Connect <small>GDB</small> to the remote target. This command takes two args:
</p>
<dl compact="compact">
<dt>&lsquo;<samp><var>type</var></samp>&rsquo;</dt>
<dd><p>The type of target, for instance &lsquo;<samp>remote</samp>&rsquo;, etc.
</p></dd>
<dt>&lsquo;<samp><var>parameters</var></samp>&rsquo;</dt>
<dd><p>Device names, host names and the like. See <a href="Target-Commands.html#Target-Commands">Commands for Managing Targets</a>, for more details.
</p></dd>
</dl>
<p>The output is a connection notification, followed by the address at
which the target program is, in the following form:
</p>
<div class="smallexample">
<pre class="smallexample">^connected,addr=&quot;<var>address</var>&quot;,func=&quot;<var>function name</var>&quot;,
args=[<var>arg list</var>]
</pre></div>
<a name="GDB-Command-71"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>target</samp>&rsquo;.
</p>
<a name="Example-71"></a>
<h4 class="subsubheading">Example</h4>
<div class="smallexample">
<pre class="smallexample">(gdb)
-target-select remote /dev/ttya
^connected,addr=&quot;0xfe00a300&quot;,func=&quot;??&quot;,args=[]
(gdb)
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="GDB_002fMI-File-Transfer-Commands.html#GDB_002fMI-File-Transfer-Commands" accesskey="n" rel="next">GDB/MI File Transfer Commands</a>, Previous: <a href="GDB_002fMI-File-Commands.html#GDB_002fMI-File-Commands" accesskey="p" rel="prev">GDB/MI File Commands</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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>
</div>
</body>
</html>