1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc. 4 5Permission is granted to copy, distribute and/or modify this document 6under the terms of the GNU Free Documentation License, Version 1.3 or 7any later version published by the Free Software Foundation; with the 8Invariant Sections being "Free Software" and "Free Software Needs 9Free Documentation", with the Front-Cover Texts being "A GNU Manual," 10and with the Back-Cover Texts as in (a) below. 11 12(a) The FSF's Back-Cover Text is: "You are free to copy and modify 13this GNU Manual. Buying copies from GNU Press supports the FSF in 14developing GNU and promoting software freedom." --> 15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 16<head> 17<title>Debugging with GDB: Annotations Overview</title> 18 19<meta name="description" content="Debugging with GDB: Annotations Overview"> 20<meta name="keywords" content="Debugging with GDB: Annotations Overview"> 21<meta name="resource-type" content="document"> 22<meta name="distribution" content="global"> 23<meta name="Generator" content="makeinfo"> 24<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 25<link href="index.html#Top" rel="start" title="Top"> 26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> 27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 28<link href="Annotations.html#Annotations" rel="up" title="Annotations"> 29<link href="Server-Prefix.html#Server-Prefix" rel="next" title="Server Prefix"> 30<link href="Annotations.html#Annotations" rel="previous" title="Annotations"> 31<style type="text/css"> 32<!-- 33a.summary-letter {text-decoration: none} 34blockquote.smallquotation {font-size: smaller} 35div.display {margin-left: 3.2em} 36div.example {margin-left: 3.2em} 37div.indentedblock {margin-left: 3.2em} 38div.lisp {margin-left: 3.2em} 39div.smalldisplay {margin-left: 3.2em} 40div.smallexample {margin-left: 3.2em} 41div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 42div.smalllisp {margin-left: 3.2em} 43kbd {font-style:oblique} 44pre.display {font-family: inherit} 45pre.format {font-family: inherit} 46pre.menu-comment {font-family: serif} 47pre.menu-preformatted {font-family: serif} 48pre.smalldisplay {font-family: inherit; font-size: smaller} 49pre.smallexample {font-size: smaller} 50pre.smallformat {font-family: inherit; font-size: smaller} 51pre.smalllisp {font-size: smaller} 52span.nocodebreak {white-space:nowrap} 53span.nolinebreak {white-space:nowrap} 54span.roman {font-family:serif; font-weight:normal} 55span.sansserif {font-family:sans-serif; font-weight:normal} 56ul.no-bullet {list-style: none} 57--> 58</style> 59 60 61</head> 62 63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 64<a name="Annotations-Overview"></a> 65<div class="header"> 66<p> 67Next: <a href="Server-Prefix.html#Server-Prefix" accesskey="n" rel="next">Server Prefix</a>, Up: <a href="Annotations.html#Annotations" accesskey="u" rel="up">Annotations</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 68</div> 69<hr> 70<a name="What-Is-an-Annotation_003f"></a> 71<h3 class="section">28.1 What Is an Annotation?</h3> 72<a name="index-annotations"></a> 73 74<p>Annotations start with a newline character, two ‘<samp>control-z</samp>’ 75characters, and the name of the annotation. If there is no additional 76information associated with this annotation, the name of the annotation 77is followed immediately by a newline. If there is additional 78information, the name of the annotation is followed by a space, the 79additional information, and a newline. The additional information 80cannot contain newline characters. 81</p> 82<p>Any output not beginning with a newline and two ‘<samp>control-z</samp>’ 83characters denotes literal output from <small>GDB</small>. Currently there is 84no need for <small>GDB</small> to output a newline followed by two 85‘<samp>control-z</samp>’ characters, but if there was such a need, the 86annotations could be extended with an ‘<samp>escape</samp>’ annotation which 87means those three characters as output. 88</p> 89<p>The annotation <var>level</var>, which is specified using the 90<samp>--annotate</samp> command line option (see <a href="Mode-Options.html#Mode-Options">Mode Options</a>), controls 91how much information <small>GDB</small> prints together with its prompt, 92values of expressions, source lines, and other types of output. Level 0 93is for no annotations, level 1 is for use when <small>GDB</small> is run as a 94subprocess of <small>GNU</small> Emacs, level 3 is the maximum annotation suitable 95for programs that control <small>GDB</small>, and level 2 annotations have 96been made obsolete (see <a href="../annotate/Limitations.html#Limitations">Limitations of the Annotation 97Interface</a> in <cite>GDB’s Obsolete Annotations</cite>). 98</p> 99<dl compact="compact"> 100<dd><a name="index-set-annotate"></a> 101</dd> 102<dt><code>set annotate <var>level</var></code></dt> 103<dd><p>The <small>GDB</small> command <code>set annotate</code> sets the level of 104annotations to the specified <var>level</var>. 105</p> 106</dd> 107<dt><code>show annotate</code></dt> 108<dd><a name="index-show-annotate"></a> 109<p>Show the current annotation level. 110</p></dd> 111</dl> 112 113<p>This chapter describes level 3 annotations. 114</p> 115<p>A simple example of starting up <small>GDB</small> with annotations is: 116</p> 117<div class="smallexample"> 118<pre class="smallexample">$ <kbd>gdb --annotate=3</kbd> 119GNU gdb 6.0 120Copyright 2003 Free Software Foundation, Inc. 121GDB is free software, covered by the GNU General Public License, 122and you are welcome to change it and/or distribute copies of it 123under certain conditions. 124Type "show copying" to see the conditions. 125There is absolutely no warranty for GDB. Type "show warranty" 126for details. 127This GDB was configured as "i386-pc-linux-gnu" 128 129^Z^Zpre-prompt 130(gdb) 131^Z^Zprompt 132<kbd>quit</kbd> 133 134^Z^Zpost-prompt 135$ 136</pre></div> 137 138<p>Here ‘<samp>quit</samp>’ is input to <small>GDB</small>; the rest is output from 139<small>GDB</small>. The three lines beginning ‘<samp>^Z^Z</samp>’ (where ‘<samp>^Z</samp>’ 140denotes a ‘<samp>control-z</samp>’ character) are annotations; the rest is 141output from <small>GDB</small>. 142</p> 143<hr> 144<div class="header"> 145<p> 146Next: <a href="Server-Prefix.html#Server-Prefix" accesskey="n" rel="next">Server Prefix</a>, Up: <a href="Annotations.html#Annotations" accesskey="u" rel="up">Annotations</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 147</div> 148 149 150 151</body> 152</html> 153