<HTML> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- Created on March, 27 2008 by texi2html 1.64 --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others. Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de> Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> --> <HEAD> <TITLE>Debugging with GDB: GDB/MI</TITLE> <META NAME="description" CONTENT="Debugging with GDB: GDB/MI"> <META NAME="keywords" CONTENT="Debugging with GDB: GDB/MI"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="texi2html 1.64"> </HEAD> <BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"> <A NAME="SEC242"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_24.html#SEC241"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC243"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H1> 24. The GDB/MI Interface </H1> <!--docid::SEC242::--> <P> <HR SIZE="6"> <A NAME="SEC243"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC244"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[ << ]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[ >> ]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> Function and Purpose </H2> <!--docid::SEC243::--> <P> <A NAME="IDX1258"></A> GDB/MI is a line based machine oriented text interface to GDB and is activated by specifying using the <SAMP>`--interpreter'</SAMP> command line option (see section <A HREF="gdb_3.html#SEC9">2.1.2 Choosing Modes</A>). It is specifically intended to support the development of systems which use the debugger as just one small component of a larger system. </P><P> This chapter is a specification of the GDB/MI interface. It is written in the form of a reference manual. </P><P> Note that GDB/MI is still under construction, so some of the features described below are incomplete and subject to change (see section <A HREF="gdb_25.html#SEC249">GDB/MI Development and Front Ends</A>). </P><P> <HR SIZE="6"> <A NAME="SEC244"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC243"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC245"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[ << ]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[ >> ]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> Notation and Terminology </H2> <!--docid::SEC244::--> <P> <A NAME="IDX1259"></A> This chapter uses the following notation: </P><P> <UL> <LI> <CODE>|</CODE> separates two alternatives. <P> <LI> <CODE>[ <VAR>something</VAR> ]</CODE> indicates that <VAR>something</VAR> is optional: it may or may not be given. <P> <LI> <CODE>( <VAR>group</VAR> )*</CODE> means that <VAR>group</VAR> inside the parentheses may repeat zero or more times. <P> <LI> <CODE>( <VAR>group</VAR> )+</CODE> means that <VAR>group</VAR> inside the parentheses may repeat one or more times. <P> <LI> <CODE>"<VAR>string</VAR>"</CODE> means a literal <VAR>string</VAR>. </UL> <P> <BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC245">24.1 GDB/MI Command Syntax</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC248">24.2 GDB/MI Compatibility with CLI</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC249">24.3 GDB/MI Development and Front Ends</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC250">24.4 GDB/MI Output Records</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC254">24.5 Simple Examples of GDB/MI Interaction</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC259">24.6 GDB/MI Command Description Format</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC267">24.7 GDB/MI Breakpoint Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC305">24.8 GDB/MI Program Context</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC330">24.9 GDB/MI Thread Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC347">24.10 GDB/MI Program Execution</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC388">24.11 GDB/MI Stack Manipulation Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC413">24.12 GDB/MI Variable Objects</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC449">24.13 GDB/MI Data Manipulation</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC475">24.14 GDB/MI Tracepoint Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC476">24.15 GDB/MI Symbol Query Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC521">24.16 GDB/MI File Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC554">24.17 GDB/MI Target Manipulation Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC595">24.18 GDB/MI File Transfer Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC608">24.19 Miscellaneous GDB/MI Commands</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> </TABLE></BLOCKQUOTE> <P> <A NAME="GDB/MI Command Syntax"></A> <HR SIZE="6"> <A NAME="SEC245"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC244"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC246"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.1 GDB/MI Command Syntax </H2> <!--docid::SEC245::--> <P> <BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC246">24.1.1 GDB/MI Input Syntax</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC247">24.1.2 GDB/MI Output Syntax</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> </TABLE></BLOCKQUOTE> <P> <A NAME="GDB/MI Input Syntax"></A> <HR SIZE="6"> <A NAME="SEC246"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC245"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC247"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC245"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H3> 24.1.1 GDB/MI Input Syntax </H3> <!--docid::SEC246::--> <P> <A NAME="IDX1260"></A> <A NAME="IDX1261"></A> <DL COMPACT> <DT><CODE><VAR>command</VAR> ==></CODE> <DD><CODE><VAR>cli-command</VAR> | <VAR>mi-command</VAR></CODE> <P> <DT><CODE><VAR>cli-command</VAR> ==></CODE> <DD><CODE>[ <VAR>token</VAR> ] <VAR>cli-command</VAR> <VAR>nl</VAR></CODE>, where <VAR>cli-command</VAR> is any existing GDB CLI command. <P> <DT><CODE><VAR>mi-command</VAR> ==></CODE> <DD><CODE>[ <VAR>token</VAR> ] "-" <VAR>operation</VAR> ( " " <VAR>option</VAR> )* <CODE>[</CODE> " --" <CODE>]</CODE> ( " " <VAR>parameter</VAR> )* <VAR>nl</VAR></CODE> <P> <DT><CODE><VAR>token</VAR> ==></CODE> <DD>"any sequence of digits" <P> <DT><CODE><VAR>option</VAR> ==></CODE> <DD><CODE>"-" <VAR>parameter</VAR> [ " " <VAR>parameter</VAR> ]</CODE> <P> <DT><CODE><VAR>parameter</VAR> ==></CODE> <DD><CODE><VAR>non-blank-sequence</VAR> | <VAR>c-string</VAR></CODE> <P> <DT><CODE><VAR>operation</VAR> ==></CODE> <DD><EM>any of the operations described in this chapter</EM> <P> <DT><CODE><VAR>non-blank-sequence</VAR> ==></CODE> <DD><EM>anything, provided it doesn't contain special characters such as "-", <VAR>nl</VAR>, """ and of course " "</EM> <P> <DT><CODE><VAR>c-string</VAR> ==></CODE> <DD><CODE>""" <VAR>seven-bit-iso-c-string-content</VAR> """</CODE> <P> <DT><CODE><VAR>nl</VAR> ==></CODE> <DD><CODE>CR | CR-LF</CODE> </DL> <P> Notes: </P><P> <UL> <LI> The CLI commands are still handled by the MI interpreter; their output is described below. <P> <LI> The <CODE><VAR>token</VAR></CODE>, when present, is passed back when the command finishes. <P> <LI> Some MI commands accept optional arguments as part of the parameter list. Each option is identified by a leading <SAMP>`-'</SAMP> (dash) and may be followed by an optional argument parameter. Options occur first in the parameter list and can be delimited from normal parameters using <SAMP>`--'</SAMP> (this is useful when some parameters begin with a dash). </UL> <P> Pragmatics: </P><P> <UL> <LI> We want easy access to the existing CLI syntax (for debugging). <P> <LI> We want it to be easy to spot a MI operation. </UL> <P> <A NAME="GDB/MI Output Syntax"></A> <HR SIZE="6"> <A NAME="SEC247"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC246"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC245"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H3> 24.1.2 GDB/MI Output Syntax </H3> <!--docid::SEC247::--> <P> <A NAME="IDX1262"></A> <A NAME="IDX1263"></A> The output from GDB/MI consists of zero or more out-of-band records followed, optionally, by a single result record. This result record is for the most recent command. The sequence of output records is terminated by <SAMP>`(gdb)'</SAMP>. </P><P> If an input command was prefixed with a <CODE><VAR>token</VAR></CODE> then the corresponding output for that command will also be prefixed by that same <VAR>token</VAR>. </P><P> <DL COMPACT> <DT><CODE><VAR>output</VAR> ==></CODE> <DD><CODE>( <VAR>out-of-band-record</VAR> )* [ <VAR>result-record</VAR> ] "(gdb)" <VAR>nl</VAR></CODE> <P> <DT><CODE><VAR>result-record</VAR> ==></CODE> <DD><CODE> [ <VAR>token</VAR> ] "^" <VAR>result-class</VAR> ( "," <VAR>result</VAR> )* <VAR>nl</VAR></CODE> <P> <DT><CODE><VAR>out-of-band-record</VAR> ==></CODE> <DD><CODE><VAR>async-record</VAR> | <VAR>stream-record</VAR></CODE> <P> <DT><CODE><VAR>async-record</VAR> ==></CODE> <DD><CODE><VAR>exec-async-output</VAR> | <VAR>status-async-output</VAR> | <VAR>notify-async-output</VAR></CODE> <P> <DT><CODE><VAR>exec-async-output</VAR> ==></CODE> <DD><CODE>[ <VAR>token</VAR> ] "*" <VAR>async-output</VAR></CODE> <P> <DT><CODE><VAR>status-async-output</VAR> ==></CODE> <DD><CODE>[ <VAR>token</VAR> ] "+" <VAR>async-output</VAR></CODE> <P> <DT><CODE><VAR>notify-async-output</VAR> ==></CODE> <DD><CODE>[ <VAR>token</VAR> ] "=" <VAR>async-output</VAR></CODE> <P> <DT><CODE><VAR>async-output</VAR> ==></CODE> <DD><CODE><VAR>async-class</VAR> ( "," <VAR>result</VAR> )* <VAR>nl</VAR></CODE> <P> <DT><CODE><VAR>result-class</VAR> ==></CODE> <DD><CODE>"done" | "running" | "connected" | "error" | "exit"</CODE> <P> <DT><CODE><VAR>async-class</VAR> ==></CODE> <DD><CODE>"stopped" | <VAR>others</VAR></CODE> (where <VAR>others</VAR> will be added depending on the needs--this is still in development). <P> <DT><CODE><VAR>result</VAR> ==></CODE> <DD><CODE> <VAR>variable</VAR> "=" <VAR>value</VAR></CODE> <P> <DT><CODE><VAR>variable</VAR> ==></CODE> <DD><CODE> <VAR>string</VAR> </CODE> <P> <DT><CODE><VAR>value</VAR> ==></CODE> <DD><CODE> <VAR>const</VAR> | <VAR>tuple</VAR> | <VAR>list</VAR> </CODE> <P> <DT><CODE><VAR>const</VAR> ==></CODE> <DD><CODE><VAR>c-string</VAR></CODE> <P> <DT><CODE><VAR>tuple</VAR> ==></CODE> <DD><CODE> "{}" | "{" <VAR>result</VAR> ( "," <VAR>result</VAR> )* "}" </CODE> <P> <DT><CODE><VAR>list</VAR> ==></CODE> <DD><CODE> "[]" | "[" <VAR>value</VAR> ( "," <VAR>value</VAR> )* "]" | "[" <VAR>result</VAR> ( "," <VAR>result</VAR> )* "]" </CODE> <P> <DT><CODE><VAR>stream-record</VAR> ==></CODE> <DD><CODE><VAR>console-stream-output</VAR> | <VAR>target-stream-output</VAR> | <VAR>log-stream-output</VAR></CODE> <P> <DT><CODE><VAR>console-stream-output</VAR> ==></CODE> <DD><CODE>"~" <VAR>c-string</VAR></CODE> <P> <DT><CODE><VAR>target-stream-output</VAR> ==></CODE> <DD><CODE>"@" <VAR>c-string</VAR></CODE> <P> <DT><CODE><VAR>log-stream-output</VAR> ==></CODE> <DD><CODE>"&" <VAR>c-string</VAR></CODE> <P> <DT><CODE><VAR>nl</VAR> ==></CODE> <DD><CODE>CR | CR-LF</CODE> <P> <DT><CODE><VAR>token</VAR> ==></CODE> <DD><EM>any sequence of digits</EM>. </DL> <P> Notes: </P><P> <UL> <LI> All output sequences end in a single line containing a period. <P> <LI> The <CODE><VAR>token</VAR></CODE> is from the corresponding request. If an execution command is interrupted by the <SAMP>`-exec-interrupt'</SAMP> command, the <VAR>token</VAR> associated with the <SAMP>`*stopped'</SAMP> message is the one of the original execution command, not the one of the interrupt command. <P> <LI> <A NAME="IDX1264"></A> <VAR>status-async-output</VAR> contains on-going status information about the progress of a slow operation. It can be discarded. All status output is prefixed by <SAMP>`+'</SAMP>. <P> <LI> <A NAME="IDX1265"></A> <VAR>exec-async-output</VAR> contains asynchronous state change on the target (stopped, started, disappeared). All async output is prefixed by <SAMP>`*'</SAMP>. <P> <LI> <A NAME="IDX1266"></A> <VAR>notify-async-output</VAR> contains supplementary information that the client should handle (e.g., a new breakpoint information). All notify output is prefixed by <SAMP>`='</SAMP>. <P> <LI> <A NAME="IDX1267"></A> <VAR>console-stream-output</VAR> is output that should be displayed as is in the console. It is the textual response to a CLI command. All the console output is prefixed by <SAMP>`~'</SAMP>. <P> <LI> <A NAME="IDX1268"></A> <VAR>target-stream-output</VAR> is the output produced by the target program. All the target output is prefixed by <SAMP>`@'</SAMP>. <P> <LI> <A NAME="IDX1269"></A> <VAR>log-stream-output</VAR> is output text coming from GDB's internals, for instance messages that should be displayed as part of an error log. All the log output is prefixed by <SAMP>`&'</SAMP>. <P> <LI> <A NAME="IDX1270"></A> New GDB/MI commands should only output <VAR>lists</VAR> containing <VAR>values</VAR>. <P> </UL> <P> See section <A HREF="gdb_25.html#SEC252">GDB/MI Stream Records</A>, for more details about the various output records. </P><P> <A NAME="GDB/MI Compatibility with CLI"></A> <HR SIZE="6"> <A NAME="SEC248"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC247"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC249"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC249"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.2 GDB/MI Compatibility with CLI </H2> <!--docid::SEC248::--> <P> <A NAME="IDX1271"></A> <A NAME="IDX1272"></A> </P><P> For the developers convenience CLI commands can be entered directly, but there may be some unexpected behaviour. For example, commands that query the user will behave as if the user replied yes, breakpoint command lists are not executed and some CLI commands, such as <CODE>if</CODE>, <CODE>when</CODE> and <CODE>define</CODE>, prompt for further input with <SAMP>`>'</SAMP>, which is not valid MI output. </P><P> This feature may be removed at some stage in the future and it is recommended that front ends use the <CODE>-interpreter-exec</CODE> command (see <A HREF="gdb_25.html#-interpreter-exec">-interpreter-exec</A>). </P><P> <A NAME="GDB/MI Development and Front Ends"></A> <HR SIZE="6"> <A NAME="SEC249"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC250"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC250"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.3 GDB/MI Development and Front Ends </H2> <!--docid::SEC249::--> <P> The application which takes the MI output and presents the state of the program being debugged to the user is called a <EM>front end</EM>. </P><P> Although GDB/MI is still incomplete, it is currently being used by a variety of front ends to GDB. This makes it difficult to introduce new functionality without breaking existing usage. This section tries to minimize the problems by describing how the protocol might change. </P><P> Some changes in MI need not break a carefully designed front end, and for these the MI version will remain unchanged. The following is a list of changes that may occur within one level, so front ends should parse MI output in a way that can handle them: </P><P> <UL> <LI> New MI commands may be added. <P> <LI> New fields may be added to the output of any MI command. <P> <LI> The range of values for fields with specified values, e.g., <CODE>in_scope</CODE> (see <A HREF="gdb_25.html#-var-update">-var-update</A>) may be extended. <P> </UL> <P> If the changes are likely to break front ends, the MI version level will be increased by one. This will allow the front end to parse the output according to the MI version. Apart from mi0, new versions of GDB will not support old versions of MI and it will be the responsibility of the front end to work with the new one. </P><P> The best way to avoid unexpected changes in MI that might break your front end is to make your project known to GDB developers and follow development on <A HREF="mailto:gdb@sourceware.org">gdb@sourceware.org</A> and <A HREF="mailto:gdb-patches@sourceware.org">gdb-patches@sourceware.org</A>. There is also the mailing list <A HREF="mailto:dmi-discuss@lists.freestandards.org">dmi-discuss@lists.freestandards.org</A>, hosted by the Free Standards Group, which has the aim of creating a more general MI protocol called Debugger Machine Interface (DMI) that will become a standard for all debuggers, not just GDB. <A NAME="IDX1273"></A> </P><P> <A NAME="GDB/MI Output Records"></A> <HR SIZE="6"> <A NAME="SEC250"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC249"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC251"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.4 GDB/MI Output Records </H2> <!--docid::SEC250::--> <P> <BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC251">24.4.1 GDB/MI Result Records</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC252">24.4.2 GDB/MI Stream Records</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> <TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_25.html#SEC253">24.4.3 GDB/MI Out-of-band Records</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> </TABLE></BLOCKQUOTE> <P> <A NAME="GDB/MI Result Records"></A> <HR SIZE="6"> <A NAME="SEC251"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC250"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC252"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC250"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H3> 24.4.1 GDB/MI Result Records </H3> <!--docid::SEC251::--> <P> <A NAME="IDX1274"></A> <A NAME="IDX1275"></A> In addition to a number of out-of-band notifications, the response to a GDB/MI command includes one of the following result indications: </P><P> <DL COMPACT> <A NAME="IDX1276"></A> <DT><CODE>"^done" [ "," <VAR>results</VAR> ]</CODE> <DD>The synchronous operation was successful, <CODE><VAR>results</VAR></CODE> are the return values. <P> <DT><CODE>"^running"</CODE> <DD><A NAME="IDX1277"></A> The asynchronous operation was successfully started. The target is running. <P> <DT><CODE>"^connected"</CODE> <DD><A NAME="IDX1278"></A> GDB has connected to a remote target. <P> <DT><CODE>"^error" "," <VAR>c-string</VAR></CODE> <DD><A NAME="IDX1279"></A> The operation failed. The <CODE><VAR>c-string</VAR></CODE> contains the corresponding error message. <P> <DT><CODE>"^exit"</CODE> <DD><A NAME="IDX1280"></A> GDB has terminated. <P> </DL> <P> <A NAME="GDB/MI Stream Records"></A> <HR SIZE="6"> <A NAME="SEC252"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC251"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC253"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC253"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC250"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H3> 24.4.2 GDB/MI Stream Records </H3> <!--docid::SEC252::--> <P> <A NAME="IDX1281"></A> <A NAME="IDX1282"></A> GDB internally maintains a number of output streams: the console, the target, and the log. The output intended for each of these streams is funneled through the GDB/MI interface using <EM>stream records</EM>. </P><P> Each stream record begins with a unique <EM>prefix character</EM> which identifies its stream (see section <A HREF="gdb_25.html#SEC247">GDB/MI Output Syntax</A>). In addition to the prefix, each stream record contains a <CODE><VAR>string-output</VAR></CODE>. This is either raw text (with an implicit new line) or a quoted C string (which does not contain an implicit newline). </P><P> <DL COMPACT> <DT><CODE>"~" <VAR>string-output</VAR></CODE> <DD>The console output stream contains text that should be displayed in the CLI console window. It contains the textual responses to CLI commands. <P> <DT><CODE>"@" <VAR>string-output</VAR></CODE> <DD>The target output stream contains any textual output from the running target. This is only present when GDB's event loop is truly asynchronous, which is currently only the case for remote targets. <P> <DT><CODE>"&" <VAR>string-output</VAR></CODE> <DD>The log stream contains debugging messages being produced by GDB's internals. </DL> <P> <A NAME="GDB/MI Out-of-band Records"></A> <HR SIZE="6"> <A NAME="SEC253"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC252"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC250"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H3> 24.4.3 GDB/MI Out-of-band Records </H3> <!--docid::SEC253::--> <P> <A NAME="IDX1283"></A> <A NAME="IDX1284"></A> <EM>Out-of-band</EM> records are used to notify the GDB/MI client of additional changes that have occurred. Those changes can either be a consequence of GDB/MI (e.g., a breakpoint modified) or a result of target activity (e.g., target stopped). </P><P> The following is a preliminary list of possible out-of-band records. In particular, the <VAR>exec-async-output</VAR> records. </P><P> <DL COMPACT> <DT><CODE>*stopped,reason="<VAR>reason</VAR>"</CODE> <DD></DL> <P> <VAR>reason</VAR> can be one of the following: </P><P> <DL COMPACT> <DT><CODE>breakpoint-hit</CODE> <DD>A breakpoint was reached. <DT><CODE>watchpoint-trigger</CODE> <DD>A watchpoint was triggered. <DT><CODE>read-watchpoint-trigger</CODE> <DD>A read watchpoint was triggered. <DT><CODE>access-watchpoint-trigger</CODE> <DD>An access watchpoint was triggered. <DT><CODE>function-finished</CODE> <DD>An -exec-finish or similar CLI command was accomplished. <DT><CODE>location-reached</CODE> <DD>An -exec-until or similar CLI command was accomplished. <DT><CODE>watchpoint-scope</CODE> <DD>A watchpoint has gone out of scope. <DT><CODE>end-stepping-range</CODE> <DD>An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or similar CLI command was accomplished. <DT><CODE>exited-signalled</CODE> <DD>The inferior exited because of a signal. <DT><CODE>exited</CODE> <DD>The inferior exited. <DT><CODE>exited-normally</CODE> <DD>The inferior exited normally. <DT><CODE>signal-received</CODE> <DD>A signal was received by the inferior. </DL> <P> <A NAME="GDB/MI Simple Examples"></A> <HR SIZE="6"> <A NAME="SEC254"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC253"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC259"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC259"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.5 Simple Examples of GDB/MI Interaction </H2> <!--docid::SEC254::--> <P> This subsection presents several simple examples of interaction using the GDB/MI interface. In these examples, <SAMP>`->'</SAMP> means that the following line is passed to GDB/MI as input, while <SAMP>`<-'</SAMP> means the output received from GDB/MI. </P><P> Note the line breaks shown in the examples are here only for readability, they don't appear in the real output. </P><P> <A NAME="SEC255"></A> <H3> Setting a Breakpoint </H3> <!--docid::SEC255::--> <P> Setting a breakpoint generates synchronous output which contains detailed information of the breakpoint. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-> -break-insert main <- ^done,bkpt={number="1",type="breakpoint",disp="keep", enabled="y",addr="0x08048564",func="main",file="myprog.c", fullname="/home/nickrob/myprog.c",line="68",times="0"} <- (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC256"></A> <H3> Program Execution </H3> <!--docid::SEC256::--> <P> Program execution generates asynchronous records and MI gives the reason that execution stopped. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-> -exec-run <- ^running <- (gdb) <- *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0", frame={addr="0x08048564",func="main", args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}], file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"} <- (gdb) -> -exec-continue <- ^running <- (gdb) <- *stopped,reason="exited-normally" <- (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC257"></A> <H3> Quitting GDB </H3> <!--docid::SEC257::--> <P> Quitting GDB just prints the result class <SAMP>`^exit'</SAMP>. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-> (gdb) <- -gdb-exit <- ^exit </FONT></pre></td></tr></table></P><P> <A NAME="SEC258"></A> <H3> A Bad Command </H3> <!--docid::SEC258::--> <P> Here's what happens if you pass a non-existent command: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-> -rubbish <- ^error,msg="Undefined MI command: rubbish" <- (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Command Description Format"></A> <HR SIZE="6"> <A NAME="SEC259"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC254"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC267"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC267"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.6 GDB/MI Command Description Format </H2> <!--docid::SEC259::--> <P> The remaining sections describe blocks of commands. Each block of commands is laid out in a fashion similar to this section. </P><P> <A NAME="SEC260"></A> <H3> Motivation </H3> <!--docid::SEC260::--> <P> The motivation for this collection of commands. </P><P> <A NAME="SEC261"></A> <H3> Introduction </H3> <!--docid::SEC261::--> <P> A brief introduction to this collection of commands as a whole. </P><P> <A NAME="SEC262"></A> <H3> Commands </H3> <!--docid::SEC262::--> <P> For each command in the block, the following is described: </P><P> <A NAME="SEC263"></A> <H4> Synopsis </H4> <!--docid::SEC263::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -command <VAR>args</VAR><small>...</small> </FONT></pre></td></tr></table></P><P> <A NAME="SEC264"></A> <H4> Result </H4> <!--docid::SEC264::--> <P> <A NAME="SEC265"></A> <H4> GDB Command </H4> <!--docid::SEC265::--> <P> The corresponding GDB CLI command(s), if any. </P><P> <A NAME="SEC266"></A> <H4> Example </H4> <!--docid::SEC266::--> <P> Example(s) formatted for readability. Some of the described commands have not been implemented yet and these are labeled N.A. (not available). </P><P> <A NAME="GDB/MI Breakpoint Commands"></A> <HR SIZE="6"> <A NAME="SEC267"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC259"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC305"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC305"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.7 GDB/MI Breakpoint Commands </H2> <!--docid::SEC267::--> <P> <A NAME="IDX1285"></A> <A NAME="IDX1286"></A> This section documents GDB/MI commands for manipulating breakpoints. </P><P> <A NAME="SEC268"></A> <H3> The <CODE>-break-after</CODE> Command </H3> <!--docid::SEC268::--> <P> <A NAME="SEC269"></A> <H4> Synopsis </H4> <!--docid::SEC269::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-after <VAR>number</VAR> <VAR>count</VAR> </FONT></pre></td></tr></table></P><P> The breakpoint number <VAR>number</VAR> is not in effect until it has been hit <VAR>count</VAR> times. To see how this is reflected in the output of the <SAMP>`-break-list'</SAMP> command, see the description of the <SAMP>`-break-list'</SAMP> command below. </P><P> <A NAME="SEC270"></A> <H4> GDB Command </H4> <!--docid::SEC270::--> <P> The corresponding GDB command is <SAMP>`ignore'</SAMP>. </P><P> <A NAME="SEC271"></A> <H4> Example </H4> <!--docid::SEC271::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-insert main ^done,bkpt={number="1",addr="0x000100d0",file="hello.c", fullname="/home/foo/hello.c",line="5",times="0"} (gdb) -break-after 1 3 ~ ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",times="0",ignore="3"}]} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC272"></A> <H3> The <CODE>-break-condition</CODE> Command </H3> <!--docid::SEC272::--> <P> <A NAME="SEC273"></A> <H4> Synopsis </H4> <!--docid::SEC273::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-condition <VAR>number</VAR> <VAR>expr</VAR> </FONT></pre></td></tr></table></P><P> Breakpoint <VAR>number</VAR> will stop the program only if the condition in <VAR>expr</VAR> is true. The condition becomes part of the <SAMP>`-break-list'</SAMP> output (see the description of the <SAMP>`-break-list'</SAMP> command below). </P><P> <A NAME="SEC274"></A> <H4> GDB Command </H4> <!--docid::SEC274::--> <P> The corresponding GDB command is <SAMP>`condition'</SAMP>. </P><P> <A NAME="SEC275"></A> <H4> Example </H4> <!--docid::SEC275::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-condition 1 1 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",cond="1",times="0",ignore="3"}]} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC276"></A> <H3> The <CODE>-break-delete</CODE> Command </H3> <!--docid::SEC276::--> <P> <A NAME="SEC277"></A> <H4> Synopsis </H4> <!--docid::SEC277::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-delete ( <VAR>breakpoint</VAR> )+ </FONT></pre></td></tr></table></P><P> Delete the breakpoint(s) whose number(s) are specified in the argument list. This is obviously reflected in the breakpoint list. </P><P> <A NAME="SEC278"></A> <H4> GDB Command </H4> <!--docid::SEC278::--> <P> The corresponding GDB command is <SAMP>`delete'</SAMP>. </P><P> <A NAME="SEC279"></A> <H4> Example </H4> <!--docid::SEC279::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-delete 1 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="0",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[]} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC280"></A> <H3> The <CODE>-break-disable</CODE> Command </H3> <!--docid::SEC280::--> <P> <A NAME="SEC281"></A> <H4> Synopsis </H4> <!--docid::SEC281::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-disable ( <VAR>breakpoint</VAR> )+ </FONT></pre></td></tr></table></P><P> Disable the named <VAR>breakpoint</VAR>(s). The field <SAMP>`enabled'</SAMP> in the break list is now set to <SAMP>`n'</SAMP> for the named <VAR>breakpoint</VAR>(s). </P><P> <A NAME="SEC282"></A> <H4> GDB Command </H4> <!--docid::SEC282::--> <P> The corresponding GDB command is <SAMP>`disable'</SAMP>. </P><P> <A NAME="SEC283"></A> <H4> Example </H4> <!--docid::SEC283::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-disable 2 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",times="0"}]} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC284"></A> <H3> The <CODE>-break-enable</CODE> Command </H3> <!--docid::SEC284::--> <P> <A NAME="SEC285"></A> <H4> Synopsis </H4> <!--docid::SEC285::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-enable ( <VAR>breakpoint</VAR> )+ </FONT></pre></td></tr></table></P><P> Enable (previously disabled) <VAR>breakpoint</VAR>(s). </P><P> <A NAME="SEC286"></A> <H4> GDB Command </H4> <!--docid::SEC286::--> <P> The corresponding GDB command is <SAMP>`enable'</SAMP>. </P><P> <A NAME="SEC287"></A> <H4> Example </H4> <!--docid::SEC287::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-enable 2 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",times="0"}]} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC288"></A> <H3> The <CODE>-break-info</CODE> Command </H3> <!--docid::SEC288::--> <P> <A NAME="SEC289"></A> <H4> Synopsis </H4> <!--docid::SEC289::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-info <VAR>breakpoint</VAR> </FONT></pre></td></tr></table></P><P> Get information about a single breakpoint. </P><P> <A NAME="SEC290"></A> <H4> GDB Command </H4> <!--docid::SEC290::--> <P> The corresponding GDB command is <SAMP>`info break <VAR>breakpoint</VAR>'</SAMP>. </P><P> <A NAME="SEC291"></A> <H4> Example </H4> <!--docid::SEC291::--> N.A. <P> <A NAME="SEC292"></A> <H3> The <CODE>-break-insert</CODE> Command </H3> <!--docid::SEC292::--> <P> <A NAME="SEC293"></A> <H4> Synopsis </H4> <!--docid::SEC293::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-insert [ -t ] [ -h ] [ -f ] [ -c <VAR>condition</VAR> ] [ -i <VAR>ignore-count</VAR> ] [ -p <VAR>thread</VAR> ] [ <VAR>location</VAR> ] </FONT></pre></td></tr></table></P><P> If specified, <VAR>location</VAR>, can be one of: </P><P> <UL> <LI>function <LI>filename:linenum <LI>filename:function <LI>*address </UL> <P> The possible optional parameters of this command are: </P><P> <DL COMPACT> <DT><SAMP>`-t'</SAMP> <DD>Insert a temporary breakpoint. <DT><SAMP>`-h'</SAMP> <DD>Insert a hardware breakpoint. <DT><SAMP>`-c <VAR>condition</VAR>'</SAMP> <DD>Make the breakpoint conditional on <VAR>condition</VAR>. <DT><SAMP>`-i <VAR>ignore-count</VAR>'</SAMP> <DD>Initialize the <VAR>ignore-count</VAR>. <DT><SAMP>`-f'</SAMP> <DD>If <VAR>location</VAR> cannot be parsed (for example if it refers to unknown files or functions), create a pending breakpoint. Without this flag, GDB will report an error, and won't create a breakpoint, if <VAR>location</VAR> cannot be parsed. </DL> <P> <A NAME="SEC294"></A> <H4> Result </H4> <!--docid::SEC294::--> <P> The result is in the form: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>^done,bkpt={number="<VAR>number</VAR>",type="<VAR>type</VAR>",disp="del"|"keep", enabled="y"|"n",addr="<VAR>hex</VAR>",func="<VAR>funcname</VAR>",file="<VAR>filename</VAR>", fullname="<VAR>full_filename</VAR>",line="<VAR>lineno</VAR>",[thread="<VAR>threadno</VAR>,] times="<VAR>times</VAR>"} </FONT></pre></td></tr></table></P><P> where <VAR>number</VAR> is the GDB number for this breakpoint, <VAR>funcname</VAR> is the name of the function where the breakpoint was inserted, <VAR>filename</VAR> is the name of the source file which contains this function, <VAR>lineno</VAR> is the source line number within that file and <VAR>times</VAR> the number of times that the breakpoint has been hit (always 0 for -break-insert but may be greater for -break-info or -break-list which use the same output). </P><P> Note: this format is open to change. </P><P> <A NAME="SEC295"></A> <H4> GDB Command </H4> <!--docid::SEC295::--> <P> The corresponding GDB commands are <SAMP>`break'</SAMP>, <SAMP>`tbreak'</SAMP>, <SAMP>`hbreak'</SAMP>, <SAMP>`thbreak'</SAMP>, and <SAMP>`rbreak'</SAMP>. </P><P> <A NAME="SEC296"></A> <H4> Example </H4> <!--docid::SEC296::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-insert main ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c", fullname="/home/foo/recursive2.c,line="4",times="0"} (gdb) -break-insert -t foo ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c", fullname="/home/foo/recursive2.c,line="11",times="0"} (gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x0001072c", func="main",file="recursive2.c", fullname="/home/foo/recursive2.c,"line="4",times="0"}, bkpt={number="2",type="breakpoint",disp="del",enabled="y", addr="0x00010774",func="foo",file="recursive2.c", fullname="/home/foo/recursive2.c",line="11",times="0"}]} (gdb) -break-insert -r foo.* ~int foo(int, int); ^done,bkpt={number="3",addr="0x00010774",file="recursive2.c, "fullname="/home/foo/recursive2.c",line="11",times="0"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC297"></A> <H3> The <CODE>-break-list</CODE> Command </H3> <!--docid::SEC297::--> <P> <A NAME="SEC298"></A> <H4> Synopsis </H4> <!--docid::SEC298::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-list </FONT></pre></td></tr></table></P><P> Displays the list of inserted breakpoints, showing the following fields: </P><P> <DL COMPACT> <DT><SAMP>`Number'</SAMP> <DD>number of the breakpoint <DT><SAMP>`Type'</SAMP> <DD>type of the breakpoint: <SAMP>`breakpoint'</SAMP> or <SAMP>`watchpoint'</SAMP> <DT><SAMP>`Disposition'</SAMP> <DD>should the breakpoint be deleted or disabled when it is hit: <SAMP>`keep'</SAMP> or <SAMP>`nokeep'</SAMP> <DT><SAMP>`Enabled'</SAMP> <DD>is the breakpoint enabled or no: <SAMP>`y'</SAMP> or <SAMP>`n'</SAMP> <DT><SAMP>`Address'</SAMP> <DD>memory location at which the breakpoint is set <DT><SAMP>`What'</SAMP> <DD>logical location of the breakpoint, expressed by function name, file name, line number <DT><SAMP>`Times'</SAMP> <DD>number of times the breakpoint has been hit </DL> <P> If there are no breakpoints or watchpoints, the <CODE>BreakpointTable</CODE> <CODE>body</CODE> field is an empty list. </P><P> <A NAME="SEC299"></A> <H4> GDB Command </H4> <!--docid::SEC299::--> <P> The corresponding GDB command is <SAMP>`info break'</SAMP>. </P><P> <A NAME="SEC300"></A> <H4> Example </H4> <!--docid::SEC300::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",line="5",times="0"}, bkpt={number="2",type="breakpoint",disp="keep",enabled="y", addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c", line="13",times="0"}]} (gdb) </FONT></pre></td></tr></table></P><P> Here's an example of the result when there are no breakpoints: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-list ^done,BreakpointTable={nr_rows="0",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[]} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC301"></A> <H3> The <CODE>-break-watch</CODE> Command </H3> <!--docid::SEC301::--> <P> <A NAME="SEC302"></A> <H4> Synopsis </H4> <!--docid::SEC302::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -break-watch [ -a | -r ] </FONT></pre></td></tr></table></P><P> Create a watchpoint. With the <SAMP>`-a'</SAMP> option it will create an <EM>access</EM> watchpoint, i.e., a watchpoint that triggers either on a read from or on a write to the memory location. With the <SAMP>`-r'</SAMP> option, the watchpoint created is a <EM>read</EM> watchpoint, i.e., it will trigger only when the memory location is accessed for reading. Without either of the options, the watchpoint created is a regular watchpoint, i.e., it will trigger when the memory location is accessed for writing. See section <A HREF="gdb_6.html#SEC34">Setting Watchpoints</A>. </P><P> Note that <SAMP>`-break-list'</SAMP> will report a single list of watchpoints and breakpoints inserted. </P><P> <A NAME="SEC303"></A> <H4> GDB Command </H4> <!--docid::SEC303::--> <P> The corresponding GDB commands are <SAMP>`watch'</SAMP>, <SAMP>`awatch'</SAMP>, and <SAMP>`rwatch'</SAMP>. </P><P> <A NAME="SEC304"></A> <H4> Example </H4> <!--docid::SEC304::--> <P> Setting a watchpoint on a variable in the <CODE>main</CODE> function: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-watch x ^done,wpt={number="2",exp="x"} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"}, value={old="-268439212",new="55"}, frame={func="main",args=[],file="recursive2.c", fullname="/home/foo/bar/recursive2.c",line="5"} (gdb) </FONT></pre></td></tr></table></P><P> Setting a watchpoint on a variable local to a function. GDB will stop the program execution twice: first for the variable changing value, then for the watchpoint going out of scope. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-watch C ^done,wpt={number="5",exp="C"} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-trigger", wpt={number="5",exp="C"},value={old="-276895068",new="3"}, frame={func="callee4",args=[], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-scope",wpnum="5", frame={func="callee3",args=[{name="strarg", value="0x11940 \"A string argument.\""}], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"} (gdb) </FONT></pre></td></tr></table></P><P> Listing breakpoints and watchpoints, at different points in the program execution. Note that once the watchpoint goes out of scope, it is deleted. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-watch C ^done,wpt={number="2",exp="C"} (gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x00010734",func="callee4", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",times="1"}, bkpt={number="2",type="watchpoint",disp="keep", enabled="y",addr="",what="C",times="0"}]} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"}, value={old="-276895068",new="3"}, frame={func="callee4",args=[], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"} (gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x00010734",func="callee4", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"}, bkpt={number="2",type="watchpoint",disp="keep", enabled="y",addr="",what="C",times="-5"}]} (gdb) -exec-continue ^running ^done,reason="watchpoint-scope",wpnum="2", frame={func="callee3",args=[{name="strarg", value="0x11940 \"A string argument.\""}], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"} (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x00010734",func="callee4", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8", times="1"}]} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Program Context"></A> <HR SIZE="6"> <A NAME="SEC305"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC267"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC330"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC330"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.8 GDB/MI Program Context </H2> <!--docid::SEC305::--> <P> <A NAME="SEC306"></A> <H3> The <CODE>-exec-arguments</CODE> Command </H3> <!--docid::SEC306::--> <P> <A NAME="SEC307"></A> <H4> Synopsis </H4> <!--docid::SEC307::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-arguments <VAR>args</VAR> </FONT></pre></td></tr></table></P><P> Set the inferior program arguments, to be used in the next <SAMP>`-exec-run'</SAMP>. </P><P> <A NAME="SEC308"></A> <H4> GDB Command </H4> <!--docid::SEC308::--> <P> The corresponding GDB command is <SAMP>`set args'</SAMP>. </P><P> <A NAME="SEC309"></A> <H4> Example </H4> <!--docid::SEC309::--> <P> Don't have one around. </P><P> <A NAME="SEC310"></A> <H3> The <CODE>-exec-show-arguments</CODE> Command </H3> <!--docid::SEC310::--> <P> <A NAME="SEC311"></A> <H4> Synopsis </H4> <!--docid::SEC311::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-show-arguments </FONT></pre></td></tr></table></P><P> Print the arguments of the program. </P><P> <A NAME="SEC312"></A> <H4> GDB Command </H4> <!--docid::SEC312::--> <P> The corresponding GDB command is <SAMP>`show args'</SAMP>. </P><P> <A NAME="SEC313"></A> <H4> Example </H4> <!--docid::SEC313::--> N.A. <P> <A NAME="SEC314"></A> <H3> The <CODE>-environment-cd</CODE> Command </H3> <!--docid::SEC314::--> <P> <A NAME="SEC315"></A> <H4> Synopsis </H4> <!--docid::SEC315::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -environment-cd <VAR>pathdir</VAR> </FONT></pre></td></tr></table></P><P> Set GDB's working directory. </P><P> <A NAME="SEC316"></A> <H4> GDB Command </H4> <!--docid::SEC316::--> <P> The corresponding GDB command is <SAMP>`cd'</SAMP>. </P><P> <A NAME="SEC317"></A> <H4> Example </H4> <!--docid::SEC317::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC318"></A> <H3> The <CODE>-environment-directory</CODE> Command </H3> <!--docid::SEC318::--> <P> <A NAME="SEC319"></A> <H4> Synopsis </H4> <!--docid::SEC319::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -environment-directory [ -r ] [ <VAR>pathdir</VAR> ]+ </FONT></pre></td></tr></table></P><P> Add directories <VAR>pathdir</VAR> to beginning of search path for source files. If the <SAMP>`-r'</SAMP> option is used, the search path is reset to the default search path. If directories <VAR>pathdir</VAR> are supplied in addition to the <SAMP>`-r'</SAMP> option, the search path is first reset and then addition occurs as normal. Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated by the system directory-separator character. The directory-separator character must not be used in any directory name. If no directories are specified, the current search path is displayed. </P><P> <A NAME="SEC320"></A> <H4> GDB Command </H4> <!--docid::SEC320::--> <P> The corresponding GDB command is <SAMP>`dir'</SAMP>. </P><P> <A NAME="SEC321"></A> <H4> Example </H4> <!--docid::SEC321::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" (gdb) -environment-directory "" ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" (gdb) -environment-directory -r /home/jjohnstn/src/gdb /usr/src ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd" (gdb) -environment-directory -r ^done,source-path="$cdir:$cwd" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC322"></A> <H3> The <CODE>-environment-path</CODE> Command </H3> <!--docid::SEC322::--> <P> <A NAME="SEC323"></A> <H4> Synopsis </H4> <!--docid::SEC323::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -environment-path [ -r ] [ <VAR>pathdir</VAR> ]+ </FONT></pre></td></tr></table></P><P> Add directories <VAR>pathdir</VAR> to beginning of search path for object files. If the <SAMP>`-r'</SAMP> option is used, the search path is reset to the original search path that existed at gdb start-up. If directories <VAR>pathdir</VAR> are supplied in addition to the <SAMP>`-r'</SAMP> option, the search path is first reset and then addition occurs as normal. Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated by the system directory-separator character. The directory-separator character must not be used in any directory name. If no directories are specified, the current path is displayed. </P><P> <A NAME="SEC324"></A> <H4> GDB Command </H4> <!--docid::SEC324::--> <P> The corresponding GDB command is <SAMP>`path'</SAMP>. </P><P> <A NAME="SEC325"></A> <H4> Example </H4> <!--docid::SEC325::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -environment-path ^done,path="/usr/bin" (gdb) -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin" (gdb) -environment-path -r /usr/local/bin ^done,path="/usr/local/bin:/usr/bin" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC326"></A> <H3> The <CODE>-environment-pwd</CODE> Command </H3> <!--docid::SEC326::--> <P> <A NAME="SEC327"></A> <H4> Synopsis </H4> <!--docid::SEC327::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -environment-pwd </FONT></pre></td></tr></table></P><P> Show the current working directory. </P><P> <A NAME="SEC328"></A> <H4> GDB Command </H4> <!--docid::SEC328::--> <P> The corresponding GDB command is <SAMP>`pwd'</SAMP>. </P><P> <A NAME="SEC329"></A> <H4> Example </H4> <!--docid::SEC329::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -environment-pwd ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Thread Commands"></A> <HR SIZE="6"> <A NAME="SEC330"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC305"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC347"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.9 GDB/MI Thread Commands </H2> <!--docid::SEC330::--> <P> <A NAME="SEC331"></A> <H3> The <CODE>-thread-info</CODE> Command </H3> <!--docid::SEC331::--> <P> <A NAME="SEC332"></A> <H4> Synopsis </H4> <!--docid::SEC332::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -thread-info </FONT></pre></td></tr></table></P><P> <A NAME="SEC333"></A> <H4> GDB Command </H4> <!--docid::SEC333::--> <P> No equivalent. </P><P> <A NAME="SEC334"></A> <H4> Example </H4> <!--docid::SEC334::--> N.A. <P> <A NAME="SEC335"></A> <H3> The <CODE>-thread-list-all-threads</CODE> Command </H3> <!--docid::SEC335::--> <P> <A NAME="SEC336"></A> <H4> Synopsis </H4> <!--docid::SEC336::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -thread-list-all-threads </FONT></pre></td></tr></table></P><P> <A NAME="SEC337"></A> <H4> GDB Command </H4> <!--docid::SEC337::--> <P> The equivalent GDB command is <SAMP>`info threads'</SAMP>. </P><P> <A NAME="SEC338"></A> <H4> Example </H4> <!--docid::SEC338::--> N.A. <P> <A NAME="SEC339"></A> <H3> The <CODE>-thread-list-ids</CODE> Command </H3> <!--docid::SEC339::--> <P> <A NAME="SEC340"></A> <H4> Synopsis </H4> <!--docid::SEC340::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -thread-list-ids </FONT></pre></td></tr></table></P><P> Produces a list of the currently known GDB thread ids. At the end of the list it also prints the total number of such threads. </P><P> <A NAME="SEC341"></A> <H4> GDB Command </H4> <!--docid::SEC341::--> <P> Part of <SAMP>`info threads'</SAMP> supplies the same information. </P><P> <A NAME="SEC342"></A> <H4> Example </H4> <!--docid::SEC342::--> <P> No threads present, besides the main process: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -thread-list-ids ^done,thread-ids={},number-of-threads="0" (gdb) </FONT></pre></td></tr></table></P><P> Several threads: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -thread-list-ids ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"}, number-of-threads="3" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC343"></A> <H3> The <CODE>-thread-select</CODE> Command </H3> <!--docid::SEC343::--> <P> <A NAME="SEC344"></A> <H4> Synopsis </H4> <!--docid::SEC344::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -thread-select <VAR>threadnum</VAR> </FONT></pre></td></tr></table></P><P> Make <VAR>threadnum</VAR> the current thread. It prints the number of the new current thread, and the topmost frame for that thread. </P><P> <A NAME="SEC345"></A> <H4> GDB Command </H4> <!--docid::SEC345::--> <P> The corresponding GDB command is <SAMP>`thread'</SAMP>. </P><P> <A NAME="SEC346"></A> <H4> Example </H4> <!--docid::SEC346::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -exec-next ^running (gdb) *stopped,reason="end-stepping-range",thread-id="2",line="187", file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c" (gdb) -thread-list-ids ^done, thread-ids={thread-id="3",thread-id="2",thread-id="1"}, number-of-threads="3" (gdb) -thread-select 3 ^done,new-thread-id="3", frame={level="0",func="vprintf", args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""}, {name="arg",value="0x2"}],file="vprintf.c",line="31"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Program Execution"></A> <HR SIZE="6"> <A NAME="SEC347"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC330"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC388"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.10 GDB/MI Program Execution </H2> <!--docid::SEC347::--> <P> These are the asynchronous commands which generate the out-of-band record <SAMP>`*stopped'</SAMP>. Currently GDB only really executes asynchronously with remote targets and this interaction is mimicked in other cases. </P><P> <A NAME="SEC348"></A> <H3> The <CODE>-exec-continue</CODE> Command </H3> <!--docid::SEC348::--> <P> <A NAME="SEC349"></A> <H4> Synopsis </H4> <!--docid::SEC349::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-continue </FONT></pre></td></tr></table></P><P> Resumes the execution of the inferior program until a breakpoint is encountered, or until the inferior exits. </P><P> <A NAME="SEC350"></A> <H4> GDB Command </H4> <!--docid::SEC350::--> <P> The corresponding GDB corresponding is <SAMP>`continue'</SAMP>. </P><P> <A NAME="SEC351"></A> <H4> Example </H4> <!--docid::SEC351::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-exec-continue ^running (gdb) @Hello world *stopped,reason="breakpoint-hit",bkptno="2",frame={func="foo",args=[], file="hello.c",fullname="/home/foo/bar/hello.c",line="13"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC352"></A> <H3> The <CODE>-exec-finish</CODE> Command </H3> <!--docid::SEC352::--> <P> <A NAME="SEC353"></A> <H4> Synopsis </H4> <!--docid::SEC353::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-finish </FONT></pre></td></tr></table></P><P> Resumes the execution of the inferior program until the current function is exited. Displays the results returned by the function. </P><P> <A NAME="SEC354"></A> <H4> GDB Command </H4> <!--docid::SEC354::--> <P> The corresponding GDB command is <SAMP>`finish'</SAMP>. </P><P> <A NAME="SEC355"></A> <H4> Example </H4> <!--docid::SEC355::--> <P> Function returning <CODE>void</CODE>. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-exec-finish ^running (gdb) @hello from foo *stopped,reason="function-finished",frame={func="main",args=[], file="hello.c",fullname="/home/foo/bar/hello.c",line="7"} (gdb) </FONT></pre></td></tr></table></P><P> Function returning other than <CODE>void</CODE>. The name of the internal GDB variable storing the result is printed, together with the value itself. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-exec-finish ^running (gdb) *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo", args=[{name="a",value="1"],{name="b",value="9"}}, file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, gdb-result-var="$1",return-value="0" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC356"></A> <H3> The <CODE>-exec-interrupt</CODE> Command </H3> <!--docid::SEC356::--> <P> <A NAME="SEC357"></A> <H4> Synopsis </H4> <!--docid::SEC357::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-interrupt </FONT></pre></td></tr></table></P><P> Interrupts the background execution of the target. Note how the token associated with the stop message is the one for the execution command that has been interrupted. The token for the interrupt itself only appears in the <SAMP>`^done'</SAMP> output. If the user is trying to interrupt a non-running program, an error message will be printed. </P><P> <A NAME="SEC358"></A> <H4> GDB Command </H4> <!--docid::SEC358::--> <P> The corresponding GDB command is <SAMP>`interrupt'</SAMP>. </P><P> <A NAME="SEC359"></A> <H4> Example </H4> <!--docid::SEC359::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) 111-exec-continue 111^running (gdb) 222-exec-interrupt 222^done (gdb) 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt", frame={addr="0x00010140",func="foo",args=[],file="try.c", fullname="/home/foo/bar/try.c",line="13"} (gdb) (gdb) -exec-interrupt ^error,msg="mi_cmd_exec_interrupt: Inferior not executing." (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC360"></A> <H3> The <CODE>-exec-next</CODE> Command </H3> <!--docid::SEC360::--> <P> <A NAME="SEC361"></A> <H4> Synopsis </H4> <!--docid::SEC361::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-next </FONT></pre></td></tr></table></P><P> Resumes execution of the inferior program, stopping when the beginning of the next source line is reached. </P><P> <A NAME="SEC362"></A> <H4> GDB Command </H4> <!--docid::SEC362::--> <P> The corresponding GDB command is <SAMP>`next'</SAMP>. </P><P> <A NAME="SEC363"></A> <H4> Example </H4> <!--docid::SEC363::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-exec-next ^running (gdb) *stopped,reason="end-stepping-range",line="8",file="hello.c" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC364"></A> <H3> The <CODE>-exec-next-instruction</CODE> Command </H3> <!--docid::SEC364::--> <P> <A NAME="SEC365"></A> <H4> Synopsis </H4> <!--docid::SEC365::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-next-instruction </FONT></pre></td></tr></table></P><P> Executes one machine instruction. If the instruction is a function call, continues until the function returns. If the program stops at an instruction in the middle of a source line, the address will be printed as well. </P><P> <A NAME="SEC366"></A> <H4> GDB Command </H4> <!--docid::SEC366::--> <P> The corresponding GDB command is <SAMP>`nexti'</SAMP>. </P><P> <A NAME="SEC367"></A> <H4> Example </H4> <!--docid::SEC367::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -exec-next-instruction ^running (gdb) *stopped,reason="end-stepping-range", addr="0x000100d4",line="5",file="hello.c" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC368"></A> <H3> The <CODE>-exec-return</CODE> Command </H3> <!--docid::SEC368::--> <P> <A NAME="SEC369"></A> <H4> Synopsis </H4> <!--docid::SEC369::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-return </FONT></pre></td></tr></table></P><P> Makes current function return immediately. Doesn't execute the inferior. Displays the new current frame. </P><P> <A NAME="SEC370"></A> <H4> GDB Command </H4> <!--docid::SEC370::--> <P> The corresponding GDB command is <SAMP>`return'</SAMP>. </P><P> <A NAME="SEC371"></A> <H4> Example </H4> <!--docid::SEC371::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) 200-break-insert callee4 200^done,bkpt={number="1",addr="0x00010734", file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"} (gdb) 000-exec-run 000^running (gdb) 000*stopped,reason="breakpoint-hit",bkptno="1", frame={func="callee4",args=[], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"} (gdb) 205-break-delete 205^done (gdb) 111-exec-return 111^done,frame={level="0",func="callee3", args=[{name="strarg", value="0x11940 \"A string argument.\""}], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC372"></A> <H3> The <CODE>-exec-run</CODE> Command </H3> <!--docid::SEC372::--> <P> <A NAME="SEC373"></A> <H4> Synopsis </H4> <!--docid::SEC373::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-run </FONT></pre></td></tr></table></P><P> Starts execution of the inferior from the beginning. The inferior executes until either a breakpoint is encountered or the program exits. In the latter case the output will include an exit code, if the program has exited exceptionally. </P><P> <A NAME="SEC374"></A> <H4> GDB Command </H4> <!--docid::SEC374::--> <P> The corresponding GDB command is <SAMP>`run'</SAMP>. </P><P> <A NAME="SEC375"></A> <H4> Examples </H4> <!--docid::SEC375::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -break-insert main ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"} (gdb) -exec-run ^running (gdb) *stopped,reason="breakpoint-hit",bkptno="1", frame={func="main",args=[],file="recursive2.c", fullname="/home/foo/bar/recursive2.c",line="4"} (gdb) </FONT></pre></td></tr></table></P><P> Program exited normally: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -exec-run ^running (gdb) x = 55 *stopped,reason="exited-normally" (gdb) </FONT></pre></td></tr></table></P><P> Program exited exceptionally: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -exec-run ^running (gdb) x = 55 *stopped,reason="exited",exit-code="01" (gdb) </FONT></pre></td></tr></table></P><P> Another way the program can terminate is if it receives a signal such as <CODE>SIGINT</CODE>. In this case, GDB/MI displays this: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) *stopped,reason="exited-signalled",signal-name="SIGINT", signal-meaning="Interrupt" </FONT></pre></td></tr></table></P><P> <A NAME="SEC376"></A> <H3> The <CODE>-exec-step</CODE> Command </H3> <!--docid::SEC376::--> <P> <A NAME="SEC377"></A> <H4> Synopsis </H4> <!--docid::SEC377::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-step </FONT></pre></td></tr></table></P><P> Resumes execution of the inferior program, stopping when the beginning of the next source line is reached, if the next source line is not a function call. If it is, stop at the first instruction of the called function. </P><P> <A NAME="SEC378"></A> <H4> GDB Command </H4> <!--docid::SEC378::--> <P> The corresponding GDB command is <SAMP>`step'</SAMP>. </P><P> <A NAME="SEC379"></A> <H4> Example </H4> <!--docid::SEC379::--> <P> Stepping into a function: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-exec-step ^running (gdb) *stopped,reason="end-stepping-range", frame={func="foo",args=[{name="a",value="10"}, {name="b",value="0"}],file="recursive2.c", fullname="/home/foo/bar/recursive2.c",line="11"} (gdb) </FONT></pre></td></tr></table></P><P> Regular stepping: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-exec-step ^running (gdb) *stopped,reason="end-stepping-range",line="14",file="recursive2.c" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC380"></A> <H3> The <CODE>-exec-step-instruction</CODE> Command </H3> <!--docid::SEC380::--> <P> <A NAME="SEC381"></A> <H4> Synopsis </H4> <!--docid::SEC381::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-step-instruction </FONT></pre></td></tr></table></P><P> Resumes the inferior which executes one machine instruction. The output, once GDB has stopped, will vary depending on whether we have stopped in the middle of a source line or not. In the former case, the address at which the program stopped will be printed as well. </P><P> <A NAME="SEC382"></A> <H4> GDB Command </H4> <!--docid::SEC382::--> <P> The corresponding GDB command is <SAMP>`stepi'</SAMP>. </P><P> <A NAME="SEC383"></A> <H4> Example </H4> <!--docid::SEC383::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -exec-step-instruction ^running (gdb) *stopped,reason="end-stepping-range", frame={func="foo",args=[],file="try.c", fullname="/home/foo/bar/try.c",line="10"} (gdb) -exec-step-instruction ^running (gdb) *stopped,reason="end-stepping-range", frame={addr="0x000100f4",func="foo",args=[],file="try.c", fullname="/home/foo/bar/try.c",line="10"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC384"></A> <H3> The <CODE>-exec-until</CODE> Command </H3> <!--docid::SEC384::--> <P> <A NAME="SEC385"></A> <H4> Synopsis </H4> <!--docid::SEC385::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-until [ <VAR>location</VAR> ] </FONT></pre></td></tr></table></P><P> Executes the inferior until the <VAR>location</VAR> specified in the argument is reached. If there is no argument, the inferior executes until a source line greater than the current one is reached. The reason for stopping in this case will be <SAMP>`location-reached'</SAMP>. </P><P> <A NAME="SEC386"></A> <H4> GDB Command </H4> <!--docid::SEC386::--> <P> The corresponding GDB command is <SAMP>`until'</SAMP>. </P><P> <A NAME="SEC387"></A> <H4> Example </H4> <!--docid::SEC387::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -exec-until recursive2.c:6 ^running (gdb) x = 55 *stopped,reason="location-reached",frame={func="main",args=[], file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Stack Manipulation"></A> <HR SIZE="6"> <A NAME="SEC388"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC347"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC413"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.11 GDB/MI Stack Manipulation Commands </H2> <!--docid::SEC388::--> <P> <A NAME="SEC389"></A> <H3> The <CODE>-stack-info-frame</CODE> Command </H3> <!--docid::SEC389::--> <P> <A NAME="SEC390"></A> <H4> Synopsis </H4> <!--docid::SEC390::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -stack-info-frame </FONT></pre></td></tr></table></P><P> Get info on the selected frame. </P><P> <A NAME="SEC391"></A> <H4> GDB Command </H4> <!--docid::SEC391::--> <P> The corresponding GDB command is <SAMP>`info frame'</SAMP> or <SAMP>`frame'</SAMP> (without arguments). </P><P> <A NAME="SEC392"></A> <H4> Example </H4> <!--docid::SEC392::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-info-frame ^done,frame={level="1",addr="0x0001076c",func="callee3", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC393"></A> <H3> The <CODE>-stack-info-depth</CODE> Command </H3> <!--docid::SEC393::--> <P> <A NAME="SEC394"></A> <H4> Synopsis </H4> <!--docid::SEC394::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -stack-info-depth [ <VAR>max-depth</VAR> ] </FONT></pre></td></tr></table></P><P> Return the depth of the stack. If the integer argument <VAR>max-depth</VAR> is specified, do not count beyond <VAR>max-depth</VAR> frames. </P><P> <A NAME="SEC395"></A> <H4> GDB Command </H4> <!--docid::SEC395::--> <P> There's no equivalent GDB command. </P><P> <A NAME="SEC396"></A> <H4> Example </H4> <!--docid::SEC396::--> <P> For a stack with frame levels 0 through 11: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-info-depth ^done,depth="12" (gdb) -stack-info-depth 4 ^done,depth="4" (gdb) -stack-info-depth 12 ^done,depth="12" (gdb) -stack-info-depth 11 ^done,depth="11" (gdb) -stack-info-depth 13 ^done,depth="12" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC397"></A> <H3> The <CODE>-stack-list-arguments</CODE> Command </H3> <!--docid::SEC397::--> <P> <A NAME="SEC398"></A> <H4> Synopsis </H4> <!--docid::SEC398::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -stack-list-arguments <VAR>show-values</VAR> [ <VAR>low-frame</VAR> <VAR>high-frame</VAR> ] </FONT></pre></td></tr></table></P><P> Display a list of the arguments for the frames between <VAR>low-frame</VAR> and <VAR>high-frame</VAR> (inclusive). If <VAR>low-frame</VAR> and <VAR>high-frame</VAR> are not provided, list the arguments for the whole call stack. If the two arguments are equal, show the single frame at the corresponding level. It is an error if <VAR>low-frame</VAR> is larger than the actual number of frames. On the other hand, <VAR>high-frame</VAR> may be larger than the actual number of frames, in which case only existing frames will be returned. </P><P> The <VAR>show-values</VAR> argument must have a value of 0 or 1. A value of 0 means that only the names of the arguments are listed, a value of 1 means that both names and values of the arguments are printed. </P><P> <A NAME="SEC399"></A> <H4> GDB Command </H4> <!--docid::SEC399::--> <P> GDB does not have an equivalent command. <CODE>gdbtk</CODE> has a <SAMP>`gdb_get_args'</SAMP> command which partially overlaps with the functionality of <SAMP>`-stack-list-arguments'</SAMP>. </P><P> <A NAME="SEC400"></A> <H4> Example </H4> <!--docid::SEC400::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-list-frames ^done, stack=[ frame={level="0",addr="0x00010734",func="callee4", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"}, frame={level="1",addr="0x0001076c",func="callee3", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"}, frame={level="2",addr="0x0001078c",func="callee2", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"}, frame={level="3",addr="0x000107b4",func="callee1", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"}, frame={level="4",addr="0x000107e0",func="main", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"}] (gdb) -stack-list-arguments 0 ^done, stack-args=[ frame={level="0",args=[]}, frame={level="1",args=[name="strarg"]}, frame={level="2",args=[name="intarg",name="strarg"]}, frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]}, frame={level="4",args=[]}] (gdb) -stack-list-arguments 1 ^done, stack-args=[ frame={level="0",args=[]}, frame={level="1", args=[{name="strarg",value="0x11940 \"A string argument.\""}]}, frame={level="2",args=[ {name="intarg",value="2"}, {name="strarg",value="0x11940 \"A string argument.\""}]}, {frame={level="3",args=[ {name="intarg",value="2"}, {name="strarg",value="0x11940 \"A string argument.\""}, {name="fltarg",value="3.5"}]}, frame={level="4",args=[]}] (gdb) -stack-list-arguments 0 2 2 ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}] (gdb) -stack-list-arguments 1 2 2 ^done,stack-args=[frame={level="2", args=[{name="intarg",value="2"}, {name="strarg",value="0x11940 \"A string argument.\""}]}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC401"></A> <H3> The <CODE>-stack-list-frames</CODE> Command </H3> <!--docid::SEC401::--> <P> <A NAME="SEC402"></A> <H4> Synopsis </H4> <!--docid::SEC402::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -stack-list-frames [ <VAR>low-frame</VAR> <VAR>high-frame</VAR> ] </FONT></pre></td></tr></table></P><P> List the frames currently on the stack. For each frame it displays the following info: </P><P> <DL COMPACT> <DT><SAMP>`<VAR>level</VAR>'</SAMP> <DD>The frame number, 0 being the topmost frame, i.e., the innermost function. <DT><SAMP>`<VAR>addr</VAR>'</SAMP> <DD>The <CODE>$pc</CODE> value for that frame. <DT><SAMP>`<VAR>func</VAR>'</SAMP> <DD>Function name. <DT><SAMP>`<VAR>file</VAR>'</SAMP> <DD>File name of the source file where the function lives. <DT><SAMP>`<VAR>line</VAR>'</SAMP> <DD>Line number corresponding to the <CODE>$pc</CODE>. </DL> <P> If invoked without arguments, this command prints a backtrace for the whole stack. If given two integer arguments, it shows the frames whose levels are between the two arguments (inclusive). If the two arguments are equal, it shows the single frame at the corresponding level. It is an error if <VAR>low-frame</VAR> is larger than the actual number of frames. On the other hand, <VAR>high-frame</VAR> may be larger than the actual number of frames, in which case only existing frames will be returned. </P><P> <A NAME="SEC403"></A> <H4> GDB Command </H4> <!--docid::SEC403::--> <P> The corresponding GDB commands are <SAMP>`backtrace'</SAMP> and <SAMP>`where'</SAMP>. </P><P> <A NAME="SEC404"></A> <H4> Example </H4> <!--docid::SEC404::--> <P> Full stack backtrace: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-list-frames ^done,stack= [frame={level="0",addr="0x0001076c",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"}, frame={level="1",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="2",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="3",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="4",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="5",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="6",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="7",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="8",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="9",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="10",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="11",addr="0x00010738",func="main", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"}] (gdb) </FONT></pre></td></tr></table></P><P> Show frames between <VAR>low_frame</VAR> and <VAR>high_frame</VAR>: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-list-frames 3 5 ^done,stack= [frame={level="3",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="4",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}, frame={level="5",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}] (gdb) </FONT></pre></td></tr></table></P><P> Show a single frame: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-list-frames 3 3 ^done,stack= [frame={level="3",addr="0x000107a4",func="foo", file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC405"></A> <H3> The <CODE>-stack-list-locals</CODE> Command </H3> <!--docid::SEC405::--> <P> <A NAME="SEC406"></A> <H4> Synopsis </H4> <!--docid::SEC406::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -stack-list-locals <VAR>print-values</VAR> </FONT></pre></td></tr></table></P><P> Display the local variable names for the selected frame. If <VAR>print-values</VAR> is 0 or <CODE>--no-values</CODE>, print only the names of the variables; if it is 1 or <CODE>--all-values</CODE>, print also their values; and if it is 2 or <CODE>--simple-values</CODE>, print the name, type and value for simple data types and the name and type for arrays, structures and unions. In this last case, a frontend can immediately display the value of simple data types and create variable objects for other data types when the user wishes to explore their values in more detail. </P><P> <A NAME="SEC407"></A> <H4> GDB Command </H4> <!--docid::SEC407::--> <P> <SAMP>`info locals'</SAMP> in GDB, <SAMP>`gdb_get_locals'</SAMP> in <CODE>gdbtk</CODE>. </P><P> <A NAME="SEC408"></A> <H4> Example </H4> <!--docid::SEC408::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-list-locals 0 ^done,locals=[name="A",name="B",name="C"] (gdb) -stack-list-locals --all-values ^done,locals=[{name="A",value="1"},{name="B",value="2"}, {name="C",value="{1, 2, 3}"}] -stack-list-locals --simple-values ^done,locals=[{name="A",type="int",value="1"}, {name="B",type="int",value="2"},{name="C",type="int [3]"}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC409"></A> <H3> The <CODE>-stack-select-frame</CODE> Command </H3> <!--docid::SEC409::--> <P> <A NAME="SEC410"></A> <H4> Synopsis </H4> <!--docid::SEC410::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -stack-select-frame <VAR>framenum</VAR> </FONT></pre></td></tr></table></P><P> Change the selected frame. Select a different frame <VAR>framenum</VAR> on the stack. </P><P> <A NAME="SEC411"></A> <H4> GDB Command </H4> <!--docid::SEC411::--> <P> The corresponding GDB commands are <SAMP>`frame'</SAMP>, <SAMP>`up'</SAMP>, <SAMP>`down'</SAMP>, <SAMP>`select-frame'</SAMP>, <SAMP>`up-silent'</SAMP>, and <SAMP>`down-silent'</SAMP>. </P><P> <A NAME="SEC412"></A> <H4> Example </H4> <!--docid::SEC412::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -stack-select-frame 2 ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Variable Objects"></A> <HR SIZE="6"> <A NAME="SEC413"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC388"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC449"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.12 GDB/MI Variable Objects </H2> <!--docid::SEC413::--> <P> <A NAME="SEC414"></A> <H3> Introduction to Variable Objects </H3> <!--docid::SEC414::--> <P> <A NAME="IDX1287"></A> </P><P> Variable objects are "object-oriented" MI interface for examining and changing values of expressions. Unlike some other MI interfaces that work with expressions, variable objects are specifically designed for simple and efficient presentation in the frontend. A variable object is identified by string name. When a variable object is created, the frontend specifies the expression for that variable object. The expression can be a simple variable, or it can be an arbitrary complex expression, and can even involve CPU registers. After creating a variable object, the frontend can invoke other variable object operations--for example to obtain or change the value of a variable object, or to change display format. </P><P> Variable objects have hierarchical tree structure. Any variable object that corresponds to a composite type, such as structure in C, has a number of child variable objects, for example corresponding to each element of a structure. A child variable object can itself have children, recursively. Recursion ends when we reach leaf variable objects, which always have built-in types. Child variable objects are created only by explicit request, so if a frontend is not interested in the children of a particular variable object, no child will be created. </P><P> For a leaf variable object it is possible to obtain its value as a string, or set the value from a string. String value can be also obtained for a non-leaf variable object, but it's generally a string that only indicates the type of the object, and does not list its contents. Assignment to a non-leaf variable object is not allowed. A frontend does not need to read the values of all variable objects each time the program stops. Instead, MI provides an update command that lists all variable objects whose values has changed since the last update operation. This considerably reduces the amount of data that must be transferred to the frontend. As noted above, children variable objects are created on demand, and only leaf variable objects have a real value. As result, gdb will read target memory only for leaf variables that frontend has created. </P><P> The automatic update is not always desirable. For example, a frontend might want to keep a value of some expression for future reference, and never update it. For another example, fetching memory is relatively slow for embedded targets, so a frontend might want to disable automatic update for the variables that are either not visible on the screen, or "closed". This is possible using so called "frozen variable objects". Such variable objects are never implicitly updated. </P><P> The following is the complete set of GDB/MI operations defined to access this functionality: </P><P> <TABLE> <TR><TD><STRONG>Operation</STRONG></TD> </TD><TD> <STRONG>Description</STRONG> </TR> <TR><TD><CODE>-var-create</CODE></TD> </TD><TD> create a variable object </TR> <TR><TD><CODE>-var-delete</CODE></TD> </TD><TD> delete the variable object and/or its children </TR> <TR><TD><CODE>-var-set-format</CODE></TD> </TD><TD> set the display format of this variable </TR> <TR><TD><CODE>-var-show-format</CODE></TD> </TD><TD> show the display format of this variable </TR> <TR><TD><CODE>-var-info-num-children</CODE></TD> </TD><TD> tells how many children this object has </TR> <TR><TD><CODE>-var-list-children</CODE></TD> </TD><TD> return a list of the object's children </TR> <TR><TD><CODE>-var-info-type</CODE></TD> </TD><TD> show the type of this variable object </TR> <TR><TD><CODE>-var-info-expression</CODE></TD> </TD><TD> print parent-relative expression that this variable object represents </TR> <TR><TD><CODE>-var-info-path-expression</CODE></TD> </TD><TD> print full expression that this variable object represents </TR> <TR><TD><CODE>-var-show-attributes</CODE></TD> </TD><TD> is this variable editable? does it exist here? </TR> <TR><TD><CODE>-var-evaluate-expression</CODE></TD> </TD><TD> get the value of this variable </TR> <TR><TD><CODE>-var-assign</CODE></TD> </TD><TD> set the value of this variable </TR> <TR><TD><CODE>-var-update</CODE></TD> </TD><TD> update the variable and its children </TR> <TR><TD><CODE>-var-set-frozen</CODE></TD> </TD><TD> set frozeness attribute </TR></TABLE> <P> In the next subsection we describe each operation in detail and suggest how it can be used. </P><P> <A NAME="SEC415"></A> <H3> Description And Use of Operations on Variable Objects </H3> <!--docid::SEC415::--> <P> <A NAME="SEC416"></A> <H3> The <CODE>-var-create</CODE> Command </H3> <!--docid::SEC416::--> <P> <A NAME="SEC417"></A> <H4> Synopsis </H4> <!--docid::SEC417::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-create {<VAR>name</VAR> | "-"} {<VAR>frame-addr</VAR> | "*"} <VAR>expression</VAR> </FONT></pre></td></tr></table></P><P> This operation creates a variable object, which allows the monitoring of a variable, the result of an expression, a memory cell or a CPU register. </P><P> The <VAR>name</VAR> parameter is the string by which the object can be referenced. It must be unique. If <SAMP>`-'</SAMP> is specified, the varobj system will generate a string "varNNNNNN" automatically. It will be unique provided that one does not specify <VAR>name</VAR> on that format. The command fails if a duplicate name is found. </P><P> The frame under which the expression should be evaluated can be specified by <VAR>frame-addr</VAR>. A <SAMP>`*'</SAMP> indicates that the current frame should be used. </P><P> <VAR>expression</VAR> is any expression valid on the current language set (must not begin with a <SAMP>`*'</SAMP>), or one of the following: </P><P> <UL> <LI> <SAMP>`*<VAR>addr</VAR>'</SAMP>, where <VAR>addr</VAR> is the address of a memory cell <P> <LI> <SAMP>`*<VAR>addr</VAR>-<VAR>addr</VAR>'</SAMP> -- a memory address range (TBD) <P> <LI> <SAMP>`$<VAR>regname</VAR>'</SAMP> -- a CPU register name </UL> <P> <A NAME="SEC418"></A> <H4> Result </H4> <!--docid::SEC418::--> <P> This operation returns the name, number of children and the type of the object created. Type is returned as a string as the ones generated by the GDB CLI: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> name="<VAR>name</VAR>",numchild="N",type="<VAR>type</VAR>" </FONT></pre></td></tr></table></P><P> <A NAME="SEC419"></A> <H3> The <CODE>-var-delete</CODE> Command </H3> <!--docid::SEC419::--> <P> <A NAME="SEC420"></A> <H4> Synopsis </H4> <!--docid::SEC420::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-delete [ -c ] <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> Deletes a previously created variable object and all of its children. With the <SAMP>`-c'</SAMP> option, just deletes the children. </P><P> Returns an error if the object <VAR>name</VAR> is not found. </P><P> <A NAME="SEC421"></A> <H3> The <CODE>-var-set-format</CODE> Command </H3> <!--docid::SEC421::--> <P> <A NAME="SEC422"></A> <H4> Synopsis </H4> <!--docid::SEC422::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-set-format <VAR>name</VAR> <VAR>format-spec</VAR> </FONT></pre></td></tr></table></P><P> Sets the output format for the value of the object <VAR>name</VAR> to be <VAR>format-spec</VAR>. </P><P> The syntax for the <VAR>format-spec</VAR> is as follows: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> <VAR>format-spec</VAR> ==> {binary | decimal | hexadecimal | octal | natural} </FONT></pre></td></tr></table></P><P> The natural format is the default format choosen automatically based on the variable type (like decimal for an <CODE>int</CODE>, hex for pointers, etc.). </P><P> For a variable with children, the format is set only on the variable itself, and the children are not affected. </P><P> <A NAME="SEC423"></A> <H3> The <CODE>-var-show-format</CODE> Command </H3> <!--docid::SEC423::--> <P> <A NAME="SEC424"></A> <H4> Synopsis </H4> <!--docid::SEC424::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-show-format <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> Returns the format used to display the value of the object <VAR>name</VAR>. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> <VAR>format</VAR> ==> <VAR>format-spec</VAR> </FONT></pre></td></tr></table></P><P> <A NAME="SEC425"></A> <H3> The <CODE>-var-info-num-children</CODE> Command </H3> <!--docid::SEC425::--> <P> <A NAME="SEC426"></A> <H4> Synopsis </H4> <!--docid::SEC426::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-info-num-children <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> Returns the number of children of a variable object <VAR>name</VAR>: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> numchild=<VAR>n</VAR> </FONT></pre></td></tr></table></P><P> <A NAME="SEC427"></A> <H3> The <CODE>-var-list-children</CODE> Command </H3> <!--docid::SEC427::--> <P> <A NAME="SEC428"></A> <H4> Synopsis </H4> <!--docid::SEC428::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-list-children [<VAR>print-values</VAR>] <VAR>name</VAR> </FONT></pre></td></tr></table><A NAME="-var-list-children"></A> </P><P> Return a list of the children of the specified variable object and create variable objects for them, if they do not already exist. With a single argument or if <VAR>print-values</VAR> has a value for of 0 or <CODE>--no-values</CODE>, print only the names of the variables; if <VAR>print-values</VAR> is 1 or <CODE>--all-values</CODE>, also print their values; and if it is 2 or <CODE>--simple-values</CODE> print the name and value for simple data types and just the name for arrays, structures and unions. </P><P> <A NAME="SEC429"></A> <H4> Example </H4> <!--docid::SEC429::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -var-list-children n ^done,numchild=<VAR>n</VAR>,children=[{name=<VAR>name</VAR>, numchild=<VAR>n</VAR>,type=<VAR>type</VAR>},(repeats N times)] (gdb) -var-list-children --all-values n ^done,numchild=<VAR>n</VAR>,children=[{name=<VAR>name</VAR>, numchild=<VAR>n</VAR>,value=<VAR>value</VAR>,type=<VAR>type</VAR>},(repeats N times)] </FONT></pre></td></tr></table></P><P> <A NAME="SEC430"></A> <H3> The <CODE>-var-info-type</CODE> Command </H3> <!--docid::SEC430::--> <P> <A NAME="SEC431"></A> <H4> Synopsis </H4> <!--docid::SEC431::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-info-type <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> Returns the type of the specified variable <VAR>name</VAR>. The type is returned as a string in the same format as it is output by the GDB CLI: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> type=<VAR>typename</VAR> </FONT></pre></td></tr></table></P><P> <A NAME="SEC432"></A> <H3> The <CODE>-var-info-expression</CODE> Command </H3> <!--docid::SEC432::--> <P> <A NAME="SEC433"></A> <H4> Synopsis </H4> <!--docid::SEC433::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-info-expression <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> Returns a string that is suitable for presenting this variable object in user interface. The string is generally not valid expression in the current language, and cannot be evaluated. </P><P> For example, if <CODE>a</CODE> is an array, and variable object <CODE>A</CODE> was created for <CODE>a</CODE>, then we'll get this output: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -var-info-expression A.1 ^done,lang="C",exp="1" </FONT></pre></td></tr></table></P><P> Here, the values of <CODE>lang</CODE> can be <CODE>{"C" | "C++" | "Java"}</CODE>. </P><P> Note that the output of the <CODE>-var-list-children</CODE> command also includes those expressions, so the <CODE>-var-info-expression</CODE> command is of limited use. </P><P> <A NAME="SEC434"></A> <H3> The <CODE>-var-info-path-expression</CODE> Command </H3> <!--docid::SEC434::--> <P> <A NAME="SEC435"></A> <H4> Synopsis </H4> <!--docid::SEC435::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-info-path-expression <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> Returns an expression that can be evaluated in the current context and will yield the same value that a variable object has. Compare this with the <CODE>-var-info-expression</CODE> command, which result can be used only for UI presentation. Typical use of the <CODE>-var-info-path-expression</CODE> command is creating a watchpoint from a variable object. </P><P> For example, suppose <CODE>C</CODE> is a C<TT>++</TT> class, derived from class <CODE>Base</CODE>, and that the <CODE>Base</CODE> class has a member called <CODE>m_size</CODE>. Assume a variable <CODE>c</CODE> is has the type of <CODE>C</CODE> and a variable object <CODE>C</CODE> was created for variable <CODE>c</CODE>. Then, we'll get this output: <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -var-info-path-expression C.Base.public.m_size ^done,path_expr=((Base)c).m_size) </FONT></pre></td></tr></table></P><P> <A NAME="SEC436"></A> <H3> The <CODE>-var-show-attributes</CODE> Command </H3> <!--docid::SEC436::--> <P> <A NAME="SEC437"></A> <H4> Synopsis </H4> <!--docid::SEC437::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-show-attributes <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> List attributes of the specified variable object <VAR>name</VAR>: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> status=<VAR>attr</VAR> [ ( ,<VAR>attr</VAR> )* ] </FONT></pre></td></tr></table></P><P> where <VAR>attr</VAR> is <CODE>{ { editable | noneditable } | TBD }</CODE>. </P><P> <A NAME="SEC438"></A> <H3> The <CODE>-var-evaluate-expression</CODE> Command </H3> <!--docid::SEC438::--> <P> <A NAME="SEC439"></A> <H4> Synopsis </H4> <!--docid::SEC439::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-evaluate-expression <VAR>name</VAR> </FONT></pre></td></tr></table></P><P> Evaluates the expression that is represented by the specified variable object and returns its value as a string. The format of the string can be changed using the <CODE>-var-set-format</CODE> command. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> value=<VAR>value</VAR> </FONT></pre></td></tr></table></P><P> Note that one must invoke <CODE>-var-list-children</CODE> for a variable before the value of a child variable can be evaluated. </P><P> <A NAME="SEC440"></A> <H3> The <CODE>-var-assign</CODE> Command </H3> <!--docid::SEC440::--> <P> <A NAME="SEC441"></A> <H4> Synopsis </H4> <!--docid::SEC441::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-assign <VAR>name</VAR> <VAR>expression</VAR> </FONT></pre></td></tr></table></P><P> Assigns the value of <VAR>expression</VAR> to the variable object specified by <VAR>name</VAR>. The object must be <SAMP>`editable'</SAMP>. If the variable's value is altered by the assign, the variable will show up in any subsequent <CODE>-var-update</CODE> list. </P><P> <A NAME="SEC442"></A> <H4> Example </H4> <!--docid::SEC442::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -var-assign var1 3 ^done,value="3" (gdb) -var-update * ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC443"></A> <H3> The <CODE>-var-update</CODE> Command </H3> <!--docid::SEC443::--> <P> <A NAME="SEC444"></A> <H4> Synopsis </H4> <!--docid::SEC444::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-update [<VAR>print-values</VAR>] {<VAR>name</VAR> | "*"} </FONT></pre></td></tr></table></P><P> Reevaluate the expressions corresponding to the variable object <VAR>name</VAR> and all its direct and indirect children, and return the list of variable objects whose values have changed; <VAR>name</VAR> must be a root variable object. Here, "changed" means that the result of <CODE>-var-evaluate-expression</CODE> before and after the <CODE>-var-update</CODE> is different. If <SAMP>`*'</SAMP> is used as the variable object names, all existing variable objects are updated, except for frozen ones (see <A HREF="gdb_25.html#-var-set-frozen">-var-set-frozen</A>). The option <VAR>print-values</VAR> determines whether both names and values, or just names are printed. The possible values of this options are the same as for <CODE>-var-list-children</CODE> (see <A HREF="gdb_25.html#-var-list-children">-var-list-children</A>). It is recommended to use the <SAMP>`--all-values'</SAMP> option, to reduce the number of MI commands needed on each program stop. </P><P> <A NAME="SEC445"></A> <H4> Example </H4> <!--docid::SEC445::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -var-assign var1 3 ^done,value="3" (gdb) -var-update --all-values var1 ^done,changelist=[{name="var1",value="3",in_scope="true", type_changed="false"}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="-var-update"></A> The field in_scope may take three values: </P><P> <DL COMPACT> <DT><CODE>"true"</CODE> <DD>The variable object's current value is valid. <P> <DT><CODE>"false"</CODE> <DD>The variable object does not currently hold a valid value but it may hold one in the future if its associated expression comes back into scope. <P> <DT><CODE>"invalid"</CODE> <DD>The variable object no longer holds a valid value. This can occur when the executable file being debugged has changed, either through recompilation or by using the GDB <CODE>file</CODE> command. The front end should normally choose to delete these variable objects. </DL> <P> In the future new values may be added to this list so the front should be prepared for this possibility. See section <A HREF="gdb_25.html#SEC249">GDB/MI Development and Front Ends</A>. </P><P> <A NAME="SEC446"></A> <H3> The <CODE>-var-set-frozen</CODE> Command </H3> <!--docid::SEC446::--> <A NAME="-var-set-frozen"></A> <P> <A NAME="SEC447"></A> <H4> Synopsis </H4> <!--docid::SEC447::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -var-set-frozen <VAR>name</VAR> <VAR>flag</VAR> </FONT></pre></td></tr></table></P><P> Set the frozenness flag on the variable object <VAR>name</VAR>. The <VAR>flag</VAR> parameter should be either <SAMP>`1'</SAMP> to make the variable frozen or <SAMP>`0'</SAMP> to make it unfrozen. If a variable object is frozen, then neither itself, nor any of its children, are implicitly updated by <CODE>-var-update</CODE> of a parent variable or by <CODE>-var-update *</CODE>. Only <CODE>-var-update</CODE> of the variable itself will update its value and values of its children. After a variable object is unfrozen, it is implicitly updated by all subsequent <CODE>-var-update</CODE> operations. Unfreezing a variable does not update it, only subsequent <CODE>-var-update</CODE> does. </P><P> <A NAME="SEC448"></A> <H4> Example </H4> <!--docid::SEC448::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -var-set-frozen V 1 ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Data Manipulation"></A> <HR SIZE="6"> <A NAME="SEC449"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC413"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC475"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.13 GDB/MI Data Manipulation </H2> <!--docid::SEC449::--> <P> <A NAME="IDX1288"></A> <A NAME="IDX1289"></A> This section describes the GDB/MI commands that manipulate data: examine memory and registers, evaluate expressions, etc. </P><P> <A NAME="SEC450"></A> <H3> The <CODE>-data-disassemble</CODE> Command </H3> <!--docid::SEC450::--> <P> <A NAME="SEC451"></A> <H4> Synopsis </H4> <!--docid::SEC451::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -data-disassemble [ -s <VAR>start-addr</VAR> -e <VAR>end-addr</VAR> ] | [ -f <VAR>filename</VAR> -l <VAR>linenum</VAR> [ -n <VAR>lines</VAR> ] ] -- <VAR>mode</VAR> </FONT></pre></td></tr></table></P><P> Where: </P><P> <DL COMPACT> <DT><SAMP>`<VAR>start-addr</VAR>'</SAMP> <DD>is the beginning address (or <CODE>$pc</CODE>) <DT><SAMP>`<VAR>end-addr</VAR>'</SAMP> <DD>is the end address <DT><SAMP>`<VAR>filename</VAR>'</SAMP> <DD>is the name of the file to disassemble <DT><SAMP>`<VAR>linenum</VAR>'</SAMP> <DD>is the line number to disassemble around <DT><SAMP>`<VAR>lines</VAR>'</SAMP> <DD>is the number of disassembly lines to be produced. If it is -1, the whole function will be disassembled, in case no <VAR>end-addr</VAR> is specified. If <VAR>end-addr</VAR> is specified as a non-zero value, and <VAR>lines</VAR> is lower than the number of disassembly lines between <VAR>start-addr</VAR> and <VAR>end-addr</VAR>, only <VAR>lines</VAR> lines are displayed; if <VAR>lines</VAR> is higher than the number of lines between <VAR>start-addr</VAR> and <VAR>end-addr</VAR>, only the lines up to <VAR>end-addr</VAR> are displayed. <DT><SAMP>`<VAR>mode</VAR>'</SAMP> <DD>is either 0 (meaning only disassembly) or 1 (meaning mixed source and disassembly). </DL> <P> <A NAME="SEC452"></A> <H4> Result </H4> <!--docid::SEC452::--> <P> The output for each instruction is composed of four fields: </P><P> <UL> <LI>Address <LI>Func-name <LI>Offset <LI>Instruction </UL> <P> Note that whatever included in the instruction field, is not manipulated directly by GDB/MI, i.e., it is not possible to adjust its format. </P><P> <A NAME="SEC453"></A> <H4> GDB Command </H4> <!--docid::SEC453::--> <P> There's no direct mapping from this command to the CLI. </P><P> <A NAME="SEC454"></A> <H4> Example </H4> <!--docid::SEC454::--> <P> Disassemble from the current value of <CODE>$pc</CODE> to <CODE>$pc + 20</CODE>: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -data-disassemble -s $pc -e "$pc + 20" -- 0 ^done, asm_insns=[ {address="0x000107c0",func-name="main",offset="4", inst="mov 2, %o0"}, {address="0x000107c4",func-name="main",offset="8", inst="sethi %hi(0x11800), %o2"}, {address="0x000107c8",func-name="main",offset="12", inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"}, {address="0x000107cc",func-name="main",offset="16", inst="sethi %hi(0x11800), %o2"}, {address="0x000107d0",func-name="main",offset="20", inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}] (gdb) </FONT></pre></td></tr></table></P><P> Disassemble the whole <CODE>main</CODE> function. Line 32 is part of <CODE>main</CODE>. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-data-disassemble -f basics.c -l 32 -- 0 ^done,asm_insns=[ {address="0x000107bc",func-name="main",offset="0", inst="save %sp, -112, %sp"}, {address="0x000107c0",func-name="main",offset="4", inst="mov 2, %o0"}, {address="0x000107c4",func-name="main",offset="8", inst="sethi %hi(0x11800), %o2"}, [<small>...</small>] {address="0x0001081c",func-name="main",offset="96",inst="ret "}, {address="0x00010820",func-name="main",offset="100",inst="restore "}] (gdb) </FONT></pre></td></tr></table></P><P> Disassemble 3 instructions from the start of <CODE>main</CODE>: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -data-disassemble -f basics.c -l 32 -n 3 -- 0 ^done,asm_insns=[ {address="0x000107bc",func-name="main",offset="0", inst="save %sp, -112, %sp"}, {address="0x000107c0",func-name="main",offset="4", inst="mov 2, %o0"}, {address="0x000107c4",func-name="main",offset="8", inst="sethi %hi(0x11800), %o2"}] (gdb) </FONT></pre></td></tr></table></P><P> Disassemble 3 instructions from the start of <CODE>main</CODE> in mixed mode: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -data-disassemble -f basics.c -l 32 -n 3 -- 1 ^done,asm_insns=[ src_and_asm_line={line="31", file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ testsuite/gdb.mi/basics.c",line_asm_insn=[ {address="0x000107bc",func-name="main",offset="0", inst="save %sp, -112, %sp"}]}, src_and_asm_line={line="32", file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ testsuite/gdb.mi/basics.c",line_asm_insn=[ {address="0x000107c0",func-name="main",offset="4", inst="mov 2, %o0"}, {address="0x000107c4",func-name="main",offset="8", inst="sethi %hi(0x11800), %o2"}]}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC455"></A> <H3> The <CODE>-data-evaluate-expression</CODE> Command </H3> <!--docid::SEC455::--> <P> <A NAME="SEC456"></A> <H4> Synopsis </H4> <!--docid::SEC456::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -data-evaluate-expression <VAR>expr</VAR> </FONT></pre></td></tr></table></P><P> Evaluate <VAR>expr</VAR> as an expression. The expression could contain an inferior function call. The function call will execute synchronously. If the expression contains spaces, it must be enclosed in double quotes. </P><P> <A NAME="SEC457"></A> <H4> GDB Command </H4> <!--docid::SEC457::--> <P> The corresponding GDB commands are <SAMP>`print'</SAMP>, <SAMP>`output'</SAMP>, and <SAMP>`call'</SAMP>. In <CODE>gdbtk</CODE> only, there's a corresponding <SAMP>`gdb_eval'</SAMP> command. </P><P> <A NAME="SEC458"></A> <H4> Example </H4> <!--docid::SEC458::--> <P> In the following example, the numbers that precede the commands are the <EM>tokens</EM> described in <A HREF="gdb_25.html#SEC245">GDB/MI Command Syntax</A>. Notice how GDB/MI returns the same tokens in its output. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>211-data-evaluate-expression A 211^done,value="1" (gdb) 311-data-evaluate-expression &A 311^done,value="0xefffeb7c" (gdb) 411-data-evaluate-expression A+3 411^done,value="4" (gdb) 511-data-evaluate-expression "A + 3" 511^done,value="4" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC459"></A> <H3> The <CODE>-data-list-changed-registers</CODE> Command </H3> <!--docid::SEC459::--> <P> <A NAME="SEC460"></A> <H4> Synopsis </H4> <!--docid::SEC460::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -data-list-changed-registers </FONT></pre></td></tr></table></P><P> Display a list of the registers that have changed. </P><P> <A NAME="SEC461"></A> <H4> GDB Command </H4> <!--docid::SEC461::--> <P> GDB doesn't have a direct analog for this command; <CODE>gdbtk</CODE> has the corresponding command <SAMP>`gdb_changed_register_list'</SAMP>. </P><P> <A NAME="SEC462"></A> <H4> Example </H4> <!--docid::SEC462::--> <P> On a PPC MBX board: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -exec-continue ^running (gdb) *stopped,reason="breakpoint-hit",bkptno="1",frame={func="main", args=[],file="try.c",fullname="/home/foo/bar/try.c",line="5"} (gdb) -data-list-changed-registers ^done,changed-registers=["0","1","2","4","5","6","7","8","9", "10","11","13","14","15","16","17","18","19","20","21","22","23", "24","25","26","27","28","30","31","64","65","66","67","69"] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC463"></A> <H3> The <CODE>-data-list-register-names</CODE> Command </H3> <!--docid::SEC463::--> <P> <A NAME="SEC464"></A> <H4> Synopsis </H4> <!--docid::SEC464::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -data-list-register-names [ ( <VAR>regno</VAR> )+ ] </FONT></pre></td></tr></table></P><P> Show a list of register names for the current target. If no arguments are given, it shows a list of the names of all the registers. If integer numbers are given as arguments, it will print a list of the names of the registers corresponding to the arguments. To ensure consistency between a register name and its number, the output list may include empty register names. </P><P> <A NAME="SEC465"></A> <H4> GDB Command </H4> <!--docid::SEC465::--> <P> GDB does not have a command which corresponds to <SAMP>`-data-list-register-names'</SAMP>. In <CODE>gdbtk</CODE> there is a corresponding command <SAMP>`gdb_regnames'</SAMP>. </P><P> <A NAME="SEC466"></A> <H4> Example </H4> <!--docid::SEC466::--> <P> For the PPC MBX board: <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -data-list-register-names ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7", "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18", "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29", "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9", "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20", "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31", "", "pc","ps","cr","lr","ctr","xer"] (gdb) -data-list-register-names 1 2 3 ^done,register-names=["r1","r2","r3"] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC467"></A> <H3> The <CODE>-data-list-register-values</CODE> Command </H3> <!--docid::SEC467::--> <P> <A NAME="SEC468"></A> <H4> Synopsis </H4> <!--docid::SEC468::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -data-list-register-values <VAR>fmt</VAR> [ ( <VAR>regno</VAR> )*] </FONT></pre></td></tr></table></P><P> Display the registers' contents. <VAR>fmt</VAR> is the format according to which the registers' contents are to be returned, followed by an optional list of numbers specifying the registers to display. A missing list of numbers indicates that the contents of all the registers must be returned. </P><P> Allowed formats for <VAR>fmt</VAR> are: </P><P> <DL COMPACT> <DT><CODE>x</CODE> <DD>Hexadecimal <DT><CODE>o</CODE> <DD>Octal <DT><CODE>t</CODE> <DD>Binary <DT><CODE>d</CODE> <DD>Decimal <DT><CODE>r</CODE> <DD>Raw <DT><CODE>N</CODE> <DD>Natural </DL> <P> <A NAME="SEC469"></A> <H4> GDB Command </H4> <!--docid::SEC469::--> <P> The corresponding GDB commands are <SAMP>`info reg'</SAMP>, <SAMP>`info all-reg'</SAMP>, and (in <CODE>gdbtk</CODE>) <SAMP>`gdb_fetch_registers'</SAMP>. </P><P> <A NAME="SEC470"></A> <H4> Example </H4> <!--docid::SEC470::--> <P> For a PPC MBX board (note: line breaks are for readability only, they don't appear in the actual output): </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -data-list-register-values r 64 65 ^done,register-values=[{number="64",value="0xfe00a300"}, {number="65",value="0x00029002"}] (gdb) -data-list-register-values x ^done,register-values=[{number="0",value="0xfe0043c8"}, {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"}, {number="3",value="0x0"},{number="4",value="0xa"}, {number="5",value="0x3fff68"},{number="6",value="0x3fff58"}, {number="7",value="0xfe011e98"},{number="8",value="0x2"}, {number="9",value="0xfa202820"},{number="10",value="0xfa202808"}, {number="11",value="0x1"},{number="12",value="0x0"}, {number="13",value="0x4544"},{number="14",value="0xffdfffff"}, {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"}, {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"}, {number="19",value="0xffffffff"},{number="20",value="0xffffffff"}, {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"}, {number="23",value="0xffffffff"},{number="24",value="0xffffffff"}, {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"}, {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"}, {number="29",value="0x0"},{number="30",value="0xfe010000"}, {number="31",value="0x0"},{number="32",value="0x0"}, {number="33",value="0x0"},{number="34",value="0x0"}, {number="35",value="0x0"},{number="36",value="0x0"}, {number="37",value="0x0"},{number="38",value="0x0"}, {number="39",value="0x0"},{number="40",value="0x0"}, {number="41",value="0x0"},{number="42",value="0x0"}, {number="43",value="0x0"},{number="44",value="0x0"}, {number="45",value="0x0"},{number="46",value="0x0"}, {number="47",value="0x0"},{number="48",value="0x0"}, {number="49",value="0x0"},{number="50",value="0x0"}, {number="51",value="0x0"},{number="52",value="0x0"}, {number="53",value="0x0"},{number="54",value="0x0"}, {number="55",value="0x0"},{number="56",value="0x0"}, {number="57",value="0x0"},{number="58",value="0x0"}, {number="59",value="0x0"},{number="60",value="0x0"}, {number="61",value="0x0"},{number="62",value="0x0"}, {number="63",value="0x0"},{number="64",value="0xfe00a300"}, {number="65",value="0x29002"},{number="66",value="0x202f04b5"}, {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"}, {number="69",value="0x20002b03"}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC471"></A> <H3> The <CODE>-data-read-memory</CODE> Command </H3> <!--docid::SEC471::--> <P> <A NAME="SEC472"></A> <H4> Synopsis </H4> <!--docid::SEC472::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -data-read-memory [ -o <VAR>byte-offset</VAR> ] <VAR>address</VAR> <VAR>word-format</VAR> <VAR>word-size</VAR> <VAR>nr-rows</VAR> <VAR>nr-cols</VAR> [ <VAR>aschar</VAR> ] </FONT></pre></td></tr></table></P><P> where: </P><P> <DL COMPACT> <DT><SAMP>`<VAR>address</VAR>'</SAMP> <DD>An expression specifying the address of the first memory word to be read. Complex expressions containing embedded white space should be quoted using the C convention. <P> <DT><SAMP>`<VAR>word-format</VAR>'</SAMP> <DD>The format to be used to print the memory words. The notation is the same as for GDB's <CODE>print</CODE> command (see section <A HREF="gdb_9.html#SEC63">Output Formats</A>). <P> <DT><SAMP>`<VAR>word-size</VAR>'</SAMP> <DD>The size of each memory word in bytes. <P> <DT><SAMP>`<VAR>nr-rows</VAR>'</SAMP> <DD>The number of rows in the output table. <P> <DT><SAMP>`<VAR>nr-cols</VAR>'</SAMP> <DD>The number of columns in the output table. <P> <DT><SAMP>`<VAR>aschar</VAR>'</SAMP> <DD>If present, indicates that each row should include an ASCII dump. The value of <VAR>aschar</VAR> is used as a padding character when a byte is not a member of the printable ASCII character set (printable ASCII characters are those whose code is between 32 and 126, inclusively). <P> <DT><SAMP>`<VAR>byte-offset</VAR>'</SAMP> <DD>An offset to add to the <VAR>address</VAR> before fetching memory. </DL> <P> This command displays memory contents as a table of <VAR>nr-rows</VAR> by <VAR>nr-cols</VAR> words, each word being <VAR>word-size</VAR> bytes. In total, <CODE><VAR>nr-rows</VAR> * <VAR>nr-cols</VAR> * <VAR>word-size</VAR></CODE> bytes are read (returned as <SAMP>`total-bytes'</SAMP>). Should less than the requested number of bytes be returned by the target, the missing words are identified using <SAMP>`N/A'</SAMP>. The number of bytes read from the target is returned in <SAMP>`nr-bytes'</SAMP> and the starting address used to read memory in <SAMP>`addr'</SAMP>. </P><P> The address of the next/previous row or page is available in <SAMP>`next-row'</SAMP> and <SAMP>`prev-row'</SAMP>, <SAMP>`next-page'</SAMP> and <SAMP>`prev-page'</SAMP>. </P><P> <A NAME="SEC473"></A> <H4> GDB Command </H4> <!--docid::SEC473::--> <P> The corresponding GDB command is <SAMP>`x'</SAMP>. <CODE>gdbtk</CODE> has <SAMP>`gdb_get_mem'</SAMP> memory read command. </P><P> <A NAME="SEC474"></A> <H4> Example </H4> <!--docid::SEC474::--> <P> Read six bytes of memory starting at <CODE>bytes+6</CODE> but then offset by <CODE>-6</CODE> bytes. Format as three rows of two columns. One byte per word. Display each word in hex. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) 9-data-read-memory -o -6 -- bytes+6 x 1 3 2 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6", next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396", prev-page="0x0000138a",memory=[ {addr="0x00001390",data=["0x00","0x01"]}, {addr="0x00001392",data=["0x02","0x03"]}, {addr="0x00001394",data=["0x04","0x05"]}] (gdb) </FONT></pre></td></tr></table></P><P> Read two bytes of memory starting at address <CODE>shorts + 64</CODE> and display as a single word formatted in decimal. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) 5-data-read-memory shorts+64 d 2 1 1 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2", next-row="0x00001512",prev-row="0x0000150e", next-page="0x00001512",prev-page="0x0000150e",memory=[ {addr="0x00001510",data=["128"]}] (gdb) </FONT></pre></td></tr></table></P><P> Read thirty two bytes of memory starting at <CODE>bytes+16</CODE> and format as eight rows of four columns. Include a string encoding with <SAMP>`x'</SAMP> used as the non-printable character. </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) 4-data-read-memory bytes+16 x 1 8 4 x 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32", next-row="0x000013c0",prev-row="0x0000139c", next-page="0x000013c0",prev-page="0x00001380",memory=[ {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"}, {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"}, {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"}, {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"}, {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"}, {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"}, {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"}, {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Tracepoint Commands"></A> <HR SIZE="6"> <A NAME="SEC475"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC449"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC476"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.14 GDB/MI Tracepoint Commands </H2> <!--docid::SEC475::--> <P> The tracepoint commands are not yet implemented. </P><P> <A NAME="GDB/MI Symbol Query"></A> <HR SIZE="6"> <A NAME="SEC476"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC475"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC521"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.15 GDB/MI Symbol Query Commands </H2> <!--docid::SEC476::--> <P> <A NAME="SEC477"></A> <H3> The <CODE>-symbol-info-address</CODE> Command </H3> <!--docid::SEC477::--> <P> <A NAME="SEC478"></A> <H4> Synopsis </H4> <!--docid::SEC478::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-info-address <VAR>symbol</VAR> </FONT></pre></td></tr></table></P><P> Describe where <VAR>symbol</VAR> is stored. </P><P> <A NAME="SEC479"></A> <H4> GDB Command </H4> <!--docid::SEC479::--> <P> The corresponding GDB command is <SAMP>`info address'</SAMP>. </P><P> <A NAME="SEC480"></A> <H4> Example </H4> <!--docid::SEC480::--> N.A. <P> <A NAME="SEC481"></A> <H3> The <CODE>-symbol-info-file</CODE> Command </H3> <!--docid::SEC481::--> <P> <A NAME="SEC482"></A> <H4> Synopsis </H4> <!--docid::SEC482::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-info-file </FONT></pre></td></tr></table></P><P> Show the file for the symbol. </P><P> <A NAME="SEC483"></A> <H4> GDB Command </H4> <!--docid::SEC483::--> <P> There's no equivalent GDB command. <CODE>gdbtk</CODE> has <SAMP>`gdb_find_file'</SAMP>. </P><P> <A NAME="SEC484"></A> <H4> Example </H4> <!--docid::SEC484::--> N.A. <P> <A NAME="SEC485"></A> <H3> The <CODE>-symbol-info-function</CODE> Command </H3> <!--docid::SEC485::--> <P> <A NAME="SEC486"></A> <H4> Synopsis </H4> <!--docid::SEC486::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-info-function </FONT></pre></td></tr></table></P><P> Show which function the symbol lives in. </P><P> <A NAME="SEC487"></A> <H4> GDB Command </H4> <!--docid::SEC487::--> <P> <SAMP>`gdb_get_function'</SAMP> in <CODE>gdbtk</CODE>. </P><P> <A NAME="SEC488"></A> <H4> Example </H4> <!--docid::SEC488::--> N.A. <P> <A NAME="SEC489"></A> <H3> The <CODE>-symbol-info-line</CODE> Command </H3> <!--docid::SEC489::--> <P> <A NAME="SEC490"></A> <H4> Synopsis </H4> <!--docid::SEC490::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-info-line </FONT></pre></td></tr></table></P><P> Show the core addresses of the code for a source line. </P><P> <A NAME="SEC491"></A> <H4> GDB Command </H4> <!--docid::SEC491::--> <P> The corresponding GDB command is <SAMP>`info line'</SAMP>. <CODE>gdbtk</CODE> has the <SAMP>`gdb_get_line'</SAMP> and <SAMP>`gdb_get_file'</SAMP> commands. </P><P> <A NAME="SEC492"></A> <H4> Example </H4> <!--docid::SEC492::--> N.A. <P> <A NAME="SEC493"></A> <H3> The <CODE>-symbol-info-symbol</CODE> Command </H3> <!--docid::SEC493::--> <P> <A NAME="SEC494"></A> <H4> Synopsis </H4> <!--docid::SEC494::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-info-symbol <VAR>addr</VAR> </FONT></pre></td></tr></table></P><P> Describe what symbol is at location <VAR>addr</VAR>. </P><P> <A NAME="SEC495"></A> <H4> GDB Command </H4> <!--docid::SEC495::--> <P> The corresponding GDB command is <SAMP>`info symbol'</SAMP>. </P><P> <A NAME="SEC496"></A> <H4> Example </H4> <!--docid::SEC496::--> N.A. <P> <A NAME="SEC497"></A> <H3> The <CODE>-symbol-list-functions</CODE> Command </H3> <!--docid::SEC497::--> <P> <A NAME="SEC498"></A> <H4> Synopsis </H4> <!--docid::SEC498::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-list-functions </FONT></pre></td></tr></table></P><P> List the functions in the executable. </P><P> <A NAME="SEC499"></A> <H4> GDB Command </H4> <!--docid::SEC499::--> <P> <SAMP>`info functions'</SAMP> in GDB, <SAMP>`gdb_listfunc'</SAMP> and <SAMP>`gdb_search'</SAMP> in <CODE>gdbtk</CODE>. </P><P> <A NAME="SEC500"></A> <H4> Example </H4> <!--docid::SEC500::--> N.A. <P> <A NAME="SEC501"></A> <H3> The <CODE>-symbol-list-lines</CODE> Command </H3> <!--docid::SEC501::--> <P> <A NAME="SEC502"></A> <H4> Synopsis </H4> <!--docid::SEC502::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-list-lines <VAR>filename</VAR> </FONT></pre></td></tr></table></P><P> Print the list of lines that contain code and their associated program addresses for the given source filename. The entries are sorted in ascending PC order. </P><P> <A NAME="SEC503"></A> <H4> GDB Command </H4> <!--docid::SEC503::--> <P> There is no corresponding GDB command. </P><P> <A NAME="SEC504"></A> <H4> Example </H4> <!--docid::SEC504::--> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -symbol-list-lines basics.c ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}] (gdb) </FONT></pre></td></tr></table><P> <A NAME="SEC505"></A> <H3> The <CODE>-symbol-list-types</CODE> Command </H3> <!--docid::SEC505::--> <P> <A NAME="SEC506"></A> <H4> Synopsis </H4> <!--docid::SEC506::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-list-types </FONT></pre></td></tr></table></P><P> List all the type names. </P><P> <A NAME="SEC507"></A> <H4> GDB Command </H4> <!--docid::SEC507::--> <P> The corresponding commands are <SAMP>`info types'</SAMP> in GDB, <SAMP>`gdb_search'</SAMP> in <CODE>gdbtk</CODE>. </P><P> <A NAME="SEC508"></A> <H4> Example </H4> <!--docid::SEC508::--> N.A. <P> <A NAME="SEC509"></A> <H3> The <CODE>-symbol-list-variables</CODE> Command </H3> <!--docid::SEC509::--> <P> <A NAME="SEC510"></A> <H4> Synopsis </H4> <!--docid::SEC510::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-list-variables </FONT></pre></td></tr></table></P><P> List all the global and static variable names. </P><P> <A NAME="SEC511"></A> <H4> GDB Command </H4> <!--docid::SEC511::--> <P> <SAMP>`info variables'</SAMP> in GDB, <SAMP>`gdb_search'</SAMP> in <CODE>gdbtk</CODE>. </P><P> <A NAME="SEC512"></A> <H4> Example </H4> <!--docid::SEC512::--> N.A. <P> <A NAME="SEC513"></A> <H3> The <CODE>-symbol-locate</CODE> Command </H3> <!--docid::SEC513::--> <P> <A NAME="SEC514"></A> <H4> Synopsis </H4> <!--docid::SEC514::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-locate </FONT></pre></td></tr></table></P><P> <A NAME="SEC515"></A> <H4> GDB Command </H4> <!--docid::SEC515::--> <P> <SAMP>`gdb_loc'</SAMP> in <CODE>gdbtk</CODE>. </P><P> <A NAME="SEC516"></A> <H4> Example </H4> <!--docid::SEC516::--> N.A. <P> <A NAME="SEC517"></A> <H3> The <CODE>-symbol-type</CODE> Command </H3> <!--docid::SEC517::--> <P> <A NAME="SEC518"></A> <H4> Synopsis </H4> <!--docid::SEC518::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -symbol-type <VAR>variable</VAR> </FONT></pre></td></tr></table></P><P> Show type of <VAR>variable</VAR>. </P><P> <A NAME="SEC519"></A> <H4> GDB Command </H4> <!--docid::SEC519::--> <P> The corresponding GDB command is <SAMP>`ptype'</SAMP>, <CODE>gdbtk</CODE> has <SAMP>`gdb_obj_variable'</SAMP>. </P><P> <A NAME="SEC520"></A> <H4> Example </H4> <!--docid::SEC520::--> N.A. <P> <A NAME="GDB/MI File Commands"></A> <HR SIZE="6"> <A NAME="SEC521"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC476"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC554"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.16 GDB/MI File Commands </H2> <!--docid::SEC521::--> <P> This section describes the GDB/MI commands to specify executable file names and to read in and obtain symbol table information. </P><P> <A NAME="SEC522"></A> <H3> The <CODE>-file-exec-and-symbols</CODE> Command </H3> <!--docid::SEC522::--> <P> <A NAME="SEC523"></A> <H4> Synopsis </H4> <!--docid::SEC523::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-exec-and-symbols <VAR>file</VAR> </FONT></pre></td></tr></table></P><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, GDB will produce error messages. Otherwise, no output is produced, except a completion notification. </P><P> <A NAME="SEC524"></A> <H4> GDB Command </H4> <!--docid::SEC524::--> <P> The corresponding GDB command is <SAMP>`file'</SAMP>. </P><P> <A NAME="SEC525"></A> <H4> Example </H4> <!--docid::SEC525::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC526"></A> <H3> The <CODE>-file-exec-file</CODE> Command </H3> <!--docid::SEC526::--> <P> <A NAME="SEC527"></A> <H4> Synopsis </H4> <!--docid::SEC527::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-exec-file <VAR>file</VAR> </FONT></pre></td></tr></table></P><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, GDB clears the information about the executable file. No output is produced, except a completion notification. </P><P> <A NAME="SEC528"></A> <H4> GDB Command </H4> <!--docid::SEC528::--> <P> The corresponding GDB command is <SAMP>`exec-file'</SAMP>. </P><P> <A NAME="SEC529"></A> <H4> Example </H4> <!--docid::SEC529::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC530"></A> <H3> The <CODE>-file-list-exec-sections</CODE> Command </H3> <!--docid::SEC530::--> <P> <A NAME="SEC531"></A> <H4> Synopsis </H4> <!--docid::SEC531::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-list-exec-sections </FONT></pre></td></tr></table></P><P> List the sections of the current executable file. </P><P> <A NAME="SEC532"></A> <H4> GDB Command </H4> <!--docid::SEC532::--> <P> The GDB command <SAMP>`info file'</SAMP> shows, among the rest, the same information as this command. <CODE>gdbtk</CODE> has a corresponding command <SAMP>`gdb_load_info'</SAMP>. </P><P> <A NAME="SEC533"></A> <H4> Example </H4> <!--docid::SEC533::--> N.A. <P> <A NAME="SEC534"></A> <H3> The <CODE>-file-list-exec-source-file</CODE> Command </H3> <!--docid::SEC534::--> <P> <A NAME="SEC535"></A> <H4> Synopsis </H4> <!--docid::SEC535::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-list-exec-source-file </FONT></pre></td></tr></table></P><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><P> <A NAME="SEC536"></A> <H4> GDB Command </H4> <!--docid::SEC536::--> <P> The GDB equivalent is <SAMP>`info source'</SAMP> </P><P> <A NAME="SEC537"></A> <H4> Example </H4> <!--docid::SEC537::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) 123-file-list-exec-source-file 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c,macro-info="1" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC538"></A> <H3> The <CODE>-file-list-exec-source-files</CODE> Command </H3> <!--docid::SEC538::--> <P> <A NAME="SEC539"></A> <H4> Synopsis </H4> <!--docid::SEC539::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-list-exec-source-files </FONT></pre></td></tr></table></P><P> List the source files for the current executable. </P><P> It will always output the filename, but only when GDB can find the absolute file name of a source file, will it output the fullname. </P><P> <A NAME="SEC540"></A> <H4> GDB Command </H4> <!--docid::SEC540::--> <P> The GDB equivalent is <SAMP>`info sources'</SAMP>. <CODE>gdbtk</CODE> has an analogous command <SAMP>`gdb_listfiles'</SAMP>. </P><P> <A NAME="SEC541"></A> <H4> Example </H4> <!--docid::SEC541::--> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -file-list-exec-source-files ^done,files=[ {file=foo.c,fullname=/home/foo.c}, {file=/home/bar.c,fullname=/home/bar.c}, {file=gdb_could_not_find_fullpath.c}] (gdb) </FONT></pre></td></tr></table><P> <A NAME="SEC542"></A> <H3> The <CODE>-file-list-shared-libraries</CODE> Command </H3> <!--docid::SEC542::--> <P> <A NAME="SEC543"></A> <H4> Synopsis </H4> <!--docid::SEC543::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-list-shared-libraries </FONT></pre></td></tr></table></P><P> List the shared libraries in the program. </P><P> <A NAME="SEC544"></A> <H4> GDB Command </H4> <!--docid::SEC544::--> <P> The corresponding GDB command is <SAMP>`info shared'</SAMP>. </P><P> <A NAME="SEC545"></A> <H4> Example </H4> <!--docid::SEC545::--> N.A. <P> <A NAME="SEC546"></A> <H3> The <CODE>-file-list-symbol-files</CODE> Command </H3> <!--docid::SEC546::--> <P> <A NAME="SEC547"></A> <H4> Synopsis </H4> <!--docid::SEC547::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-list-symbol-files </FONT></pre></td></tr></table></P><P> List symbol files. </P><P> <A NAME="SEC548"></A> <H4> GDB Command </H4> <!--docid::SEC548::--> <P> The corresponding GDB command is <SAMP>`info file'</SAMP> (part of it). </P><P> <A NAME="SEC549"></A> <H4> Example </H4> <!--docid::SEC549::--> N.A. <P> <A NAME="SEC550"></A> <H3> The <CODE>-file-symbol-file</CODE> Command </H3> <!--docid::SEC550::--> <P> <A NAME="SEC551"></A> <H4> Synopsis </H4> <!--docid::SEC551::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -file-symbol-file <VAR>file</VAR> </FONT></pre></td></tr></table></P><P> Read symbol table info from the specified <VAR>file</VAR> argument. When used without arguments, clears GDB's symbol table info. No output is produced, except for a completion notification. </P><P> <A NAME="SEC552"></A> <H4> GDB Command </H4> <!--docid::SEC552::--> <P> The corresponding GDB command is <SAMP>`symbol-file'</SAMP>. </P><P> <A NAME="SEC553"></A> <H4> Example </H4> <!--docid::SEC553::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Target Manipulation"></A> <HR SIZE="6"> <A NAME="SEC554"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC521"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC595"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.17 GDB/MI Target Manipulation Commands </H2> <!--docid::SEC554::--> <P> <A NAME="SEC555"></A> <H3> The <CODE>-target-attach</CODE> Command </H3> <!--docid::SEC555::--> <P> <A NAME="SEC556"></A> <H4> Synopsis </H4> <!--docid::SEC556::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-attach <VAR>pid</VAR> | <VAR>file</VAR> </FONT></pre></td></tr></table></P><P> Attach to a process <VAR>pid</VAR> or a file <VAR>file</VAR> outside of GDB. </P><P> <A NAME="SEC557"></A> <H4> GDB Command </H4> <!--docid::SEC557::--> <P> The corresponding GDB command is <SAMP>`attach'</SAMP>. </P><P> <A NAME="SEC558"></A> <H4> Example </H4> <!--docid::SEC558::--> N.A. <P> <A NAME="SEC559"></A> <H3> The <CODE>-target-compare-sections</CODE> Command </H3> <!--docid::SEC559::--> <P> <A NAME="SEC560"></A> <H4> Synopsis </H4> <!--docid::SEC560::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-compare-sections [ <VAR>section</VAR> ] </FONT></pre></td></tr></table></P><P> Compare data of section <VAR>section</VAR> on target to the exec file. Without the argument, all sections are compared. </P><P> <A NAME="SEC561"></A> <H4> GDB Command </H4> <!--docid::SEC561::--> <P> The GDB equivalent is <SAMP>`compare-sections'</SAMP>. </P><P> <A NAME="SEC562"></A> <H4> Example </H4> <!--docid::SEC562::--> N.A. <P> <A NAME="SEC563"></A> <H3> The <CODE>-target-detach</CODE> Command </H3> <!--docid::SEC563::--> <P> <A NAME="SEC564"></A> <H4> Synopsis </H4> <!--docid::SEC564::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-detach </FONT></pre></td></tr></table></P><P> Detach from the remote target which normally resumes its execution. There's no output. </P><P> <A NAME="SEC565"></A> <H4> GDB Command </H4> <!--docid::SEC565::--> <P> The corresponding GDB command is <SAMP>`detach'</SAMP>. </P><P> <A NAME="SEC566"></A> <H4> Example </H4> <!--docid::SEC566::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -target-detach ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC567"></A> <H3> The <CODE>-target-disconnect</CODE> Command </H3> <!--docid::SEC567::--> <P> <A NAME="SEC568"></A> <H4> Synopsis </H4> <!--docid::SEC568::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-disconnect </FONT></pre></td></tr></table></P><P> Disconnect from the remote target. There's no output and the target is generally not resumed. </P><P> <A NAME="SEC569"></A> <H4> GDB Command </H4> <!--docid::SEC569::--> <P> The corresponding GDB command is <SAMP>`disconnect'</SAMP>. </P><P> <A NAME="SEC570"></A> <H4> Example </H4> <!--docid::SEC570::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -target-disconnect ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC571"></A> <H3> The <CODE>-target-download</CODE> Command </H3> <!--docid::SEC571::--> <P> <A NAME="SEC572"></A> <H4> Synopsis </H4> <!--docid::SEC572::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-download </FONT></pre></td></tr></table></P><P> Loads the executable onto the remote target. It prints out an update message every half second, which includes the fields: </P><P> <DL COMPACT> <DT><SAMP>`section'</SAMP> <DD>The name of the section. <DT><SAMP>`section-sent'</SAMP> <DD>The size of what has been sent so far for that section. <DT><SAMP>`section-size'</SAMP> <DD>The size of the section. <DT><SAMP>`total-sent'</SAMP> <DD>The total size of what was sent so far (the current and the previous sections). <DT><SAMP>`total-size'</SAMP> <DD>The size of the overall executable to download. </DL> <P> Each message is sent as status record (see section <A HREF="gdb_25.html#SEC247">GDB/MI 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><P> <DL COMPACT> <DT><SAMP>`section'</SAMP> <DD>The name of the section. <DT><SAMP>`section-size'</SAMP> <DD>The size of the section. <DT><SAMP>`total-size'</SAMP> <DD>The size of the overall executable to download. </DL> <P> At the end, a summary is printed. </P><P> <A NAME="SEC573"></A> <H4> GDB Command </H4> <!--docid::SEC573::--> <P> The corresponding GDB command is <SAMP>`load'</SAMP>. </P><P> <A NAME="SEC574"></A> <H4> Example </H4> <!--docid::SEC574::--> <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><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(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) </FONT></pre></td></tr></table></P><P> <A NAME="SEC575"></A> <H3> The <CODE>-target-exec-status</CODE> Command </H3> <!--docid::SEC575::--> <P> <A NAME="SEC576"></A> <H4> Synopsis </H4> <!--docid::SEC576::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-exec-status </FONT></pre></td></tr></table></P><P> Provide information on the state of the target (whether it is running or not, for instance). </P><P> <A NAME="SEC577"></A> <H4> GDB Command </H4> <!--docid::SEC577::--> <P> There's no equivalent GDB command. </P><P> <A NAME="SEC578"></A> <H4> Example </H4> <!--docid::SEC578::--> N.A. <P> <A NAME="SEC579"></A> <H3> The <CODE>-target-list-available-targets</CODE> Command </H3> <!--docid::SEC579::--> <P> <A NAME="SEC580"></A> <H4> Synopsis </H4> <!--docid::SEC580::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-list-available-targets </FONT></pre></td></tr></table></P><P> List the possible targets to connect to. </P><P> <A NAME="SEC581"></A> <H4> GDB Command </H4> <!--docid::SEC581::--> <P> The corresponding GDB command is <SAMP>`help target'</SAMP>. </P><P> <A NAME="SEC582"></A> <H4> Example </H4> <!--docid::SEC582::--> N.A. <P> <A NAME="SEC583"></A> <H3> The <CODE>-target-list-current-targets</CODE> Command </H3> <!--docid::SEC583::--> <P> <A NAME="SEC584"></A> <H4> Synopsis </H4> <!--docid::SEC584::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-list-current-targets </FONT></pre></td></tr></table></P><P> Describe the current target. </P><P> <A NAME="SEC585"></A> <H4> GDB Command </H4> <!--docid::SEC585::--> <P> The corresponding information is printed by <SAMP>`info file'</SAMP> (among other things). </P><P> <A NAME="SEC586"></A> <H4> Example </H4> <!--docid::SEC586::--> N.A. <P> <A NAME="SEC587"></A> <H3> The <CODE>-target-list-parameters</CODE> Command </H3> <!--docid::SEC587::--> <P> <A NAME="SEC588"></A> <H4> Synopsis </H4> <!--docid::SEC588::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-list-parameters </FONT></pre></td></tr></table></P><P> <A NAME="SEC589"></A> <H4> GDB Command </H4> <!--docid::SEC589::--> <P> No equivalent. </P><P> <A NAME="SEC590"></A> <H4> Example </H4> <!--docid::SEC590::--> N.A. <P> <A NAME="SEC591"></A> <H3> The <CODE>-target-select</CODE> Command </H3> <!--docid::SEC591::--> <P> <A NAME="SEC592"></A> <H4> Synopsis </H4> <!--docid::SEC592::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-select <VAR>type</VAR> <VAR>parameters <small>...</small></VAR> </FONT></pre></td></tr></table></P><P> Connect GDB to the remote target. This command takes two args: </P><P> <DL COMPACT> <DT><SAMP>`<VAR>type</VAR>'</SAMP> <DD>The type of target, for instance <SAMP>`async'</SAMP>, <SAMP>`remote'</SAMP>, etc. <DT><SAMP>`<VAR>parameters</VAR>'</SAMP> <DD>Device names, host names and the like. See section <A HREF="gdb_17.html#SEC160">Commands for Managing Targets</A>, for more details. </DL> <P> The output is a connection notification, followed by the address at which the target program is, in the following form: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>^connected,addr="<VAR>address</VAR>",func="<VAR>function name</VAR>", args=[<VAR>arg list</VAR>] </FONT></pre></td></tr></table></P><P> <A NAME="SEC593"></A> <H4> GDB Command </H4> <!--docid::SEC593::--> <P> The corresponding GDB command is <SAMP>`target'</SAMP>. </P><P> <A NAME="SEC594"></A> <H4> Example </H4> <!--docid::SEC594::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -target-select async /dev/ttya ^connected,addr="0xfe00a300",func="??",args=[] (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI File Transfer Commands"></A> <HR SIZE="6"> <A NAME="SEC595"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC554"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC608"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.18 GDB/MI File Transfer Commands </H2> <!--docid::SEC595::--> <P> <A NAME="SEC596"></A> <H3> The <CODE>-target-file-put</CODE> Command </H3> <!--docid::SEC596::--> <P> <A NAME="SEC597"></A> <H4> Synopsis </H4> <!--docid::SEC597::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-file-put <VAR>hostfile</VAR> <VAR>targetfile</VAR> </FONT></pre></td></tr></table></P><P> Copy file <VAR>hostfile</VAR> from the host system (the machine running GDB) to <VAR>targetfile</VAR> on the target system. </P><P> <A NAME="SEC598"></A> <H4> GDB Command </H4> <!--docid::SEC598::--> <P> The corresponding GDB command is <SAMP>`remote put'</SAMP>. </P><P> <A NAME="SEC599"></A> <H4> Example </H4> <!--docid::SEC599::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -target-file-put localfile remotefile ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC600"></A> <H3> The <CODE>-target-file-put</CODE> Command </H3> <!--docid::SEC600::--> <P> <A NAME="SEC601"></A> <H4> Synopsis </H4> <!--docid::SEC601::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-file-get <VAR>targetfile</VAR> <VAR>hostfile</VAR> </FONT></pre></td></tr></table></P><P> Copy file <VAR>targetfile</VAR> from the target system to <VAR>hostfile</VAR> on the host system. </P><P> <A NAME="SEC602"></A> <H4> GDB Command </H4> <!--docid::SEC602::--> <P> The corresponding GDB command is <SAMP>`remote get'</SAMP>. </P><P> <A NAME="SEC603"></A> <H4> Example </H4> <!--docid::SEC603::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -target-file-get remotefile localfile ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC604"></A> <H3> The <CODE>-target-file-delete</CODE> Command </H3> <!--docid::SEC604::--> <P> <A NAME="SEC605"></A> <H4> Synopsis </H4> <!--docid::SEC605::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -target-file-delete <VAR>targetfile</VAR> </FONT></pre></td></tr></table></P><P> Delete <VAR>targetfile</VAR> from the target system. </P><P> <A NAME="SEC606"></A> <H4> GDB Command </H4> <!--docid::SEC606::--> <P> The corresponding GDB command is <SAMP>`remote delete'</SAMP>. </P><P> <A NAME="SEC607"></A> <H4> Example </H4> <!--docid::SEC607::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -target-file-delete remotefile ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="GDB/MI Miscellaneous Commands"></A> <HR SIZE="6"> <A NAME="SEC608"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC595"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC242"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 24.19 Miscellaneous GDB/MI Commands </H2> <!--docid::SEC608::--> <P> <A NAME="SEC609"></A> <H3> The <CODE>-gdb-exit</CODE> Command </H3> <!--docid::SEC609::--> <P> <A NAME="SEC610"></A> <H4> Synopsis </H4> <!--docid::SEC610::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -gdb-exit </FONT></pre></td></tr></table></P><P> Exit GDB immediately. </P><P> <A NAME="SEC611"></A> <H4> GDB Command </H4> <!--docid::SEC611::--> <P> Approximately corresponds to <SAMP>`quit'</SAMP>. </P><P> <A NAME="SEC612"></A> <H4> Example </H4> <!--docid::SEC612::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -gdb-exit ^exit </FONT></pre></td></tr></table></P><P> <A NAME="SEC613"></A> <H3> The <CODE>-exec-abort</CODE> Command </H3> <!--docid::SEC613::--> <P> <A NAME="SEC614"></A> <H4> Synopsis </H4> <!--docid::SEC614::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -exec-abort </FONT></pre></td></tr></table></P><P> Kill the inferior running program. </P><P> <A NAME="SEC615"></A> <H4> GDB Command </H4> <!--docid::SEC615::--> <P> The corresponding GDB command is <SAMP>`kill'</SAMP>. </P><P> <A NAME="SEC616"></A> <H4> Example </H4> <!--docid::SEC616::--> N.A. <P> <A NAME="SEC617"></A> <H3> The <CODE>-gdb-set</CODE> Command </H3> <!--docid::SEC617::--> <P> <A NAME="SEC618"></A> <H4> Synopsis </H4> <!--docid::SEC618::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -gdb-set </FONT></pre></td></tr></table></P><P> Set an internal GDB variable. </P><P> <A NAME="SEC619"></A> <H4> GDB Command </H4> <!--docid::SEC619::--> <P> The corresponding GDB command is <SAMP>`set'</SAMP>. </P><P> <A NAME="SEC620"></A> <H4> Example </H4> <!--docid::SEC620::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -gdb-set $foo=3 ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC621"></A> <H3> The <CODE>-gdb-show</CODE> Command </H3> <!--docid::SEC621::--> <P> <A NAME="SEC622"></A> <H4> Synopsis </H4> <!--docid::SEC622::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -gdb-show </FONT></pre></td></tr></table></P><P> Show the current value of a GDB variable. </P><P> <A NAME="SEC623"></A> <H4> GDB Command </H4> <!--docid::SEC623::--> <P> The corresponding GDB command is <SAMP>`show'</SAMP>. </P><P> <A NAME="SEC624"></A> <H4> Example </H4> <!--docid::SEC624::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -gdb-show annotate ^done,value="0" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC625"></A> <H3> The <CODE>-gdb-version</CODE> Command </H3> <!--docid::SEC625::--> <P> <A NAME="SEC626"></A> <H4> Synopsis </H4> <!--docid::SEC626::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre> -gdb-version </FONT></pre></td></tr></table></P><P> Show version information for GDB. Used mostly in testing. </P><P> <A NAME="SEC627"></A> <H4> GDB Command </H4> <!--docid::SEC627::--> <P> The GDB equivalent is <SAMP>`show version'</SAMP>. GDB by default shows this information when you start an interactive session. </P><P> <A NAME="SEC628"></A> <H4> Example </H4> <!--docid::SEC628::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -gdb-version ~GNU gdb 5.2.1 ~Copyright 2000 Free Software Foundation, Inc. ~GDB is free software, covered by the GNU General Public License, and ~you are welcome to change it and/or distribute copies of it under ~ certain conditions. ~Type "show copying" to see the conditions. ~There is absolutely no warranty for GDB. Type "show warranty" for ~ details. ~This GDB was configured as "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi". ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC629"></A> <H3> The <CODE>-list-features</CODE> Command </H3> <!--docid::SEC629::--> <P> Returns a list of particular features of the MI protocol that this version of gdb implements. A feature can be a command, or a new field in an output of some command, or even an important bugfix. While a frontend can sometimes detect presence of a feature at runtime, it is easier to perform detection at debugger startup. </P><P> The command returns a list of strings, with each string naming an available feature. Each returned string is just a name, it does not have any internal structure. The list of possible feature names is given below. </P><P> Example output: </P><P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -list-features ^done,result=["feature1","feature2"] </FONT></pre></td></tr></table></P><P> The current list of features is: </P><P> <UL> <LI> <SAMP>`frozen-varobjs'</SAMP>---indicates presence of the <CODE>-var-set-frozen</CODE> command, as well as possible presense of the <CODE>frozen</CODE> field in the output of <CODE>-varobj-create</CODE>. <LI> <SAMP>`pending-breakpoints'</SAMP>---indicates presence of the <CODE>-f</CODE> option to the <CODE>-break-insert</CODE> command. <P> </UL> <P> <A NAME="SEC630"></A> <H3> The <CODE>-interpreter-exec</CODE> Command </H3> <!--docid::SEC630::--> <P> <A NAME="SEC631"></A> <H3> Synopsis </H3> <!--docid::SEC631::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-interpreter-exec <VAR>interpreter</VAR> <VAR>command</VAR> </FONT></pre></td></tr></table><A NAME="-interpreter-exec"></A> </P><P> Execute the specified <VAR>command</VAR> in the given <VAR>interpreter</VAR>. </P><P> <A NAME="SEC632"></A> <H3> GDB Command </H3> <!--docid::SEC632::--> <P> The corresponding GDB command is <SAMP>`interpreter-exec'</SAMP>. </P><P> <A NAME="SEC633"></A> <H3> Example </H3> <!--docid::SEC633::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -interpreter-exec console "break main" &"During symbol reading, couldn't parse type; debugger out of date?.\n" &"During symbol reading, bad structure-type format.\n" ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n" ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC634"></A> <H3> The <CODE>-inferior-tty-set</CODE> Command </H3> <!--docid::SEC634::--> <P> <A NAME="SEC635"></A> <H3> Synopsis </H3> <!--docid::SEC635::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-inferior-tty-set /dev/pts/1 </FONT></pre></td></tr></table></P><P> Set terminal for future runs of the program being debugged. </P><P> <A NAME="SEC636"></A> <H3> GDB Command </H3> <!--docid::SEC636::--> <P> The corresponding GDB command is <SAMP>`set inferior-tty'</SAMP> /dev/pts/1. </P><P> <A NAME="SEC637"></A> <H3> Example </H3> <!--docid::SEC637::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -inferior-tty-set /dev/pts/1 ^done (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC638"></A> <H3> The <CODE>-inferior-tty-show</CODE> Command </H3> <!--docid::SEC638::--> <P> <A NAME="SEC639"></A> <H3> Synopsis </H3> <!--docid::SEC639::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-inferior-tty-show </FONT></pre></td></tr></table></P><P> Show terminal for future runs of program being debugged. </P><P> <A NAME="SEC640"></A> <H3> GDB Command </H3> <!--docid::SEC640::--> <P> The corresponding GDB command is <SAMP>`show inferior-tty'</SAMP>. </P><P> <A NAME="SEC641"></A> <H3> Example </H3> <!--docid::SEC641::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -inferior-tty-set /dev/pts/1 ^done (gdb) -inferior-tty-show ^done,inferior_tty_terminal="/dev/pts/1" (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="SEC642"></A> <H3> The <CODE>-enable-timings</CODE> Command </H3> <!--docid::SEC642::--> <P> <A NAME="SEC643"></A> <H3> Synopsis </H3> <!--docid::SEC643::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>-enable-timings [yes | no] </FONT></pre></td></tr></table></P><P> Toggle the printing of the wallclock, user and system times for an MI command as a field in its output. This command is to help frontend developers optimize the performance of their code. No argument is equivalent to <SAMP>`yes'</SAMP>. </P><P> <A NAME="SEC644"></A> <H3> GDB Command </H3> <!--docid::SEC644::--> <P> No equivalent. </P><P> <A NAME="SEC645"></A> <H3> Example </H3> <!--docid::SEC645::--> <P> <TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) -enable-timings ^done (gdb) -break-insert main ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x080484ed",func="main",file="myprog.c", fullname="/home/nickrob/myprog.c",line="73",times="0"}, time={wallclock="0.05185",user="0.00800",system="0.00000"} (gdb) -enable-timings no ^done (gdb) -exec-run ^running (gdb) *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0", frame={addr="0x080484ed",func="main",args=[{name="argc",value="1"}, {name="argv",value="0xbfb60364"}],file="myprog.c", fullname="/home/nickrob/myprog.c",line="73"} (gdb) </FONT></pre></td></tr></table></P><P> <A NAME="Annotations"></A> <HR SIZE="6"> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_25.html#SEC248"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_26.html#SEC646"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <BR> <FONT SIZE="-1"> <address> <p>Please send FSF & GNU inquiries & questions to <a href="mailto:gnu@gnu.org">gnu@gnu.org</a>. There are also <a href="http://www.gnu.org/home.html#ContactInfo">other ways to contact</a> the FSF.</p> <p>These pages are maintained by <a href="http://www.gnu.org/software/gdb/">the GDB developers</a>.</p> <p>Copyright Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.</p> <p>Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.</p> </address> This document was generated by <I>GDB Administrator</I> on <I>March, 27 2008</I> using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html "><I>texi2html</I></A> </BODY> </HTML>