|GDB’s Obsolete Annotations: Limitations|
The level two annotations mechanism is known to have a number of technical and architectural limitations. As a consequence, in 2001, with the release of GDB 5.1 and the addition of GDB/MI, the annotation interface was marked as deprecated.
This chapter discusses the known problems.
The annotation interface works by interspersing markups with GDB normal command-line interpreter output. Unfortunately, this makes the annotation client dependant on not just the annotations, but also the CLI output. This is because the client is forced to assume that specific GDB commands provide specific information. Any change to GDB’s CLI output modifies or removes that information and, consequently, likely breaks the client.
Since the GDB/MI output is independent of the CLI, it does not have this problem.
The annotation interface relies on value annotations (see Value Annotations) and the display mechanism as a way of obtaining up-to-date value information. These mechanisms are not scalable.
In a graphical environment, where many values can be displayed simultaneously, a serious performance problem occurs when the client tries to first extract from GDB, and then re-display, all those values. The client should instead only request and update the values that changed.
The GDB/MI Variable Objects provide just that mechanism.
The annotation interface assumes that a variable’s value can only be changed when the target is running. This assumption is not correct. A single assignment to a single variable can result in the entire target, and all displayed values, needing an update.
The GDB/MI Variable Objects include a mechanism for efficiently reporting such changes.
The GDB/MI interface includes a dedicated test directory (gdb/gdb.mi), and any addition or fix to GDB/MI must include testsuite changes.
The annotation mechanism was implemented by interspersing CLI print statements with various annotations. As a consequence, any CLI output change can alter the annotation output.
Since the GDB/MI output is independent of the CLI, and the GDB/MI is increasingly implemented independent of the CLI code, its long term maintenance is much easier.