Next: Server Prefix, Up: Annotations [Contents][Index]

### 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 in GDB’s Obsolete Annotations).

`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.

Next: Server Prefix, Up: Annotations [Contents][Index]