Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / gdb / GDB-MI-Simple-Examples.html
blob15f77af6dd325e5818a6f98069bee7762b7178b7
1 <html lang="en">
2 <head>
3 <title>Debugging with GDB</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="Debugging with GDB">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="GDB%2fMI%20Simple%20Examples">GDB/MI Simple Examples</a>,
13 Previous:<a rel="previous" accesskey="p" href="GDB-MI-Output-Syntax.html#GDB%2fMI%20Output%20Syntax">GDB/MI Output Syntax</a>,
14 Up:<a rel="up" accesskey="u" href="GDB-MI-Command-Syntax.html#GDB%2fMI%20Command%20Syntax">GDB/MI Command Syntax</a>
15 <hr><br>
16 </div>
18 <h4 class="subsection">Simple Examples of <small>GDB/MI</small> Interaction</h4>
20 <p>This subsection presents several simple examples of interaction using
21 the <small>GDB/MI</small> interface. In these examples, <code>-&gt;</code> means that the
22 following line is passed to <small>GDB/MI</small> as input, while <code>&lt;-</code> means
23 the output received from <small>GDB/MI</small>.
25 <h5 class="subsubheading">Target Stop</h5>
27 <p>Here's an example of stopping the inferior process:
29 <pre class="example"> -&gt; -stop
30 &lt;- (gdb)
31 </pre>
33 <p>and later:
35 <pre class="example"> &lt;- *stop,reason="stop",address="0x123",source="a.c:123"
36 &lt;- (gdb)
37 </pre>
39 <h5 class="subsubheading">Simple CLI Command</h5>
41 <p>Here's an example of a simple CLI command being passed through
42 <small>GDB/MI</small> and on to the CLI.
44 <pre class="example"> -&gt; print 1+2
45 &lt;- ~3\n
46 &lt;- (gdb)
47 </pre>
49 <h5 class="subsubheading">Command With Side Effects</h5>
51 <pre class="example"> -&gt; -symbol-file xyz.exe
52 &lt;- *breakpoint,nr="3",address="0x123",source="a.c:123"
53 &lt;- (gdb)
54 </pre>
56 <h5 class="subsubheading">A Bad Command</h5>
58 <p>Here's what happens if you pass a non-existent command:
60 <pre class="example"> -&gt; -rubbish
61 &lt;- error,"Rubbish not found"
62 &lt;- (gdb)
63 </pre>
65 </body></html>