| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <!-- Copyright (C) 1988-2015 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.2, http://www.gnu.org/software/texinfo/ --> |
| <head> |
| <title>Debugging with GDB: GDB/MI Target Manipulation</title> |
| |
| <meta name="description" content="Debugging with GDB: GDB/MI Target Manipulation"> |
| <meta name="keywords" content="Debugging with GDB: GDB/MI Target Manipulation"> |
| <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.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-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> [<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-82"></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 |
| ‘<samp>-list-thread-groups --available</samp>’ must be used. |
| </p> |
| <a name="GDB-Command-64"></a> |
| <h4 class="subsubheading"><small>GDB</small> Command</h4> |
| |
| <p>The corresponding <small>GDB</small> command is ‘<samp>attach</samp>’. |
| </p> |
| <a name="Example-64"></a> |
| <h4 class="subsubheading">Example</h4> |
| <div class="smallexample"> |
| <pre class="smallexample">(gdb) |
| -target-attach 34 |
| =thread-created,id="1" |
| *stopped,thread-id="1",frame={addr="0xb7f7e410",func="bar",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-83"></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’s no output. |
| </p> |
| <a name="GDB-Command-65"></a> |
| <h4 class="subsubheading"><small>GDB</small> Command</h4> |
| |
| <p>The corresponding <small>GDB</small> command is ‘<samp>detach</samp>’. |
| </p> |
| <a name="Example-65"></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-84"></a> |
| <h4 class="subsubheading">Synopsis</h4> |
| |
| <div class="smallexample"> |
| <pre class="smallexample"> -target-disconnect |
| </pre></div> |
| |
| <p>Disconnect from the remote target. There’s no output and the target is |
| generally not resumed. |
| </p> |
| <a name="GDB-Command-66"></a> |
| <h4 class="subsubheading"><small>GDB</small> Command</h4> |
| |
| <p>The corresponding <small>GDB</small> command is ‘<samp>disconnect</samp>’. |
| </p> |
| <a name="Example-66"></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-85"></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>‘<samp>section</samp>’</dt> |
| <dd><p>The name of the section. |
| </p></dd> |
| <dt>‘<samp>section-sent</samp>’</dt> |
| <dd><p>The size of what has been sent so far for that section. |
| </p></dd> |
| <dt>‘<samp>section-size</samp>’</dt> |
| <dd><p>The size of the section. |
| </p></dd> |
| <dt>‘<samp>total-sent</samp>’</dt> |
| <dd><p>The total size of what was sent so far (the current and the previous sections). |
| </p></dd> |
| <dt>‘<samp>total-size</samp>’</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>‘<samp>section</samp>’</dt> |
| <dd><p>The name of the section. |
| </p></dd> |
| <dt>‘<samp>section-size</samp>’</dt> |
| <dd><p>The size of the section. |
| </p></dd> |
| <dt>‘<samp>total-size</samp>’</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-67"></a> |
| <h4 class="subsubheading"><small>GDB</small> Command</h4> |
| |
| <p>The corresponding <small>GDB</small> command is ‘<samp>load</samp>’. |
| </p> |
| <a name="Example-67"></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=".text",section-size="6668",total-size="9880"} |
| +download,{section=".text",section-sent="512",section-size="6668", |
| total-sent="512",total-size="9880"} |
| +download,{section=".text",section-sent="1024",section-size="6668", |
| total-sent="1024",total-size="9880"} |
| +download,{section=".text",section-sent="1536",section-size="6668", |
| total-sent="1536",total-size="9880"} |
| +download,{section=".text",section-sent="2048",section-size="6668", |
| total-sent="2048",total-size="9880"} |
| +download,{section=".text",section-sent="2560",section-size="6668", |
| total-sent="2560",total-size="9880"} |
| +download,{section=".text",section-sent="3072",section-size="6668", |
| total-sent="3072",total-size="9880"} |
| +download,{section=".text",section-sent="3584",section-size="6668", |
| total-sent="3584",total-size="9880"} |
| +download,{section=".text",section-sent="4096",section-size="6668", |
| total-sent="4096",total-size="9880"} |
| +download,{section=".text",section-sent="4608",section-size="6668", |
| total-sent="4608",total-size="9880"} |
| +download,{section=".text",section-sent="5120",section-size="6668", |
| total-sent="5120",total-size="9880"} |
| +download,{section=".text",section-sent="5632",section-size="6668", |
| total-sent="5632",total-size="9880"} |
| +download,{section=".text",section-sent="6144",section-size="6668", |
| total-sent="6144",total-size="9880"} |
| +download,{section=".text",section-sent="6656",section-size="6668", |
| total-sent="6656",total-size="9880"} |
| +download,{section=".init",section-size="28",total-size="9880"} |
| +download,{section=".fini",section-size="28",total-size="9880"} |
| +download,{section=".data",section-size="3156",total-size="9880"} |
| +download,{section=".data",section-sent="512",section-size="3156", |
| total-sent="7236",total-size="9880"} |
| +download,{section=".data",section-sent="1024",section-size="3156", |
| total-sent="7748",total-size="9880"} |
| +download,{section=".data",section-sent="1536",section-size="3156", |
| total-sent="8260",total-size="9880"} |
| +download,{section=".data",section-sent="2048",section-size="3156", |
| total-sent="8772",total-size="9880"} |
| +download,{section=".data",section-sent="2560",section-size="3156", |
| total-sent="9284",total-size="9880"} |
| +download,{section=".data",section-sent="3072",section-size="3156", |
| total-sent="9796",total-size="9880"} |
| ^done,address="0x10004",load-size="9880",transfer-rate="6586", |
| write-rate="429" |
| (gdb) |
| </pre></div> |
| |
| |
| |
| <a name="GDB-Command-68"></a> |
| <h4 class="subsubheading"><small>GDB</small> Command</h4> |
| |
| <p>No equivalent. |
| </p> |
| <a name="Example-68"></a> |
| <h4 class="subsubheading">Example</h4> |
| <p>N.A. |
| </p> |
| |
| <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-86"></a> |
| <h4 class="subsubheading">Synopsis</h4> |
| |
| <div class="smallexample"> |
| <pre class="smallexample"> -target-select <var>type</var> <var>parameters …</var> |
| </pre></div> |
| |
| <p>Connect <small>GDB</small> to the remote target. This command takes two args: |
| </p> |
| <dl compact="compact"> |
| <dt>‘<samp><var>type</var></samp>’</dt> |
| <dd><p>The type of target, for instance ‘<samp>remote</samp>’, etc. |
| </p></dd> |
| <dt>‘<samp><var>parameters</var></samp>’</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="<var>address</var>",func="<var>function name</var>", |
| args=[<var>arg list</var>] |
| </pre></div> |
| |
| <a name="GDB-Command-69"></a> |
| <h4 class="subsubheading"><small>GDB</small> Command</h4> |
| |
| <p>The corresponding <small>GDB</small> command is ‘<samp>target</samp>’. |
| </p> |
| <a name="Example-69"></a> |
| <h4 class="subsubheading">Example</h4> |
| |
| <div class="smallexample"> |
| <pre class="smallexample">(gdb) |
| -target-select remote /dev/ttya |
| ^connected,addr="0xfe00a300",func="??",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> [<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> |