Next: Server Prefix, Up: Annotations

### 28.1 What is an Annotation?

Annotations start with a newline character, two ‘`control-z`’ characters, and the name of the annotation. If there is no additional information associated with this annotation, the name of the annotation is followed immediately by a newline. If there is additional information, the name of the annotation is followed by a space, the additional information, and a newline. The additional information cannot contain newline characters.

Any output not beginning with a newline and two ‘`control-z`’ characters denotes literal output from gdb. Currently there is no need for gdb to output a newline followed by two ‘`control-z`’ characters, but if there was such a need, the annotations could be extended with an ‘`escape`’ annotation which means those three characters as output.

The annotation level, which is specified using the `--annotate` command line option (see Mode Options), controls how much information gdb prints together with its prompt, values of expressions, source lines, and other types of output. Level 0 is for no annotations, level 1 is for use when gdb is run as a subprocess of gnu Emacs, level 3 is the maximum annotation suitable for programs that control gdb, and level 2 annotations have been made obsolete (see Limitations of the Annotation Interface).

`set annotate` level
  The gdb command `set annotate` sets the level of annotations to the specified level.
`show annotate`
  Show the current annotation level.

This chapter describes level 3 annotations.

A simple example of starting up gdb with annotations is:

         $ gdb --annotate=3
         GNU gdb 6.0
         Copyright 2003 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 "i386-pc-linux-gnu"

         ^Z^Zpre-prompt
         (gdb)
         ^Z^Zprompt
         quit

         ^Z^Zpost-prompt
         $

Here ‘`quit`’ is input to gdb; the rest is output from gdb. The three lines beginning ‘`^Z^Z`’ (where ‘`^Z`’ denotes a ‘`control-z`’ character) are annotations; the rest is output from gdb.