Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

27.3. Values

When a value is printed in various contexts, gdb uses annotations to delimit the value from the surrounding text.

If a value is printed using print and added to the value history, the annotation looks like

^Z^Zvalue-history-begin history-number value-flags
history-string
^Z^Zvalue-history-value
the-value
^Z^Zvalue-history-end

where history-number is the number it is getting in the value history, history-string is a string, such as $5 = , which introduces the value to the user, the-value is the output corresponding to the value itself, and value-flags is * for a value which can be dereferenced and - for a value which cannot.

If the value is not added to the value history (it is an invalid float or it is printed with the output command), the annotation is similar:

^Z^Zvalue-begin value-flags
the-value
^Z^Zvalue-end

When gdb prints an argument to a function (for example, in the output from the backtrace command), it annotates it as follows:

^Z^Zarg-begin
argument-name
^Z^Zarg-name-end
separator-string
^Z^Zarg-value value-flags
the-value
^Z^Zarg-end

where argument-name is the name of the argument, separator-string is text which separates the name from the value for the user's benefit (such as =), and value-flags and the-value have the same meanings as in a value-history-begin annotation.

When printing a structure, gdb annotates it as follows:

^Z^Zfield-begin value-flags
field-name
^Z^Zfield-name-end
separator-string
^Z^Zfield-value
the-value
^Z^Zfield-end

where field-name is the name of the field, separator-string is text which separates the name from the value for the user's benefit (such as =), and value-flags and the-value have the same meanings as in a value-history-begin annotation.

When printing an array, gdb annotates it as follows:

^Z^Zarray-section-begin array-index value-flags

where array-index is the index of the first element being annotated and value-flags has the same meaning as in a value-history-begin annotation. This is followed by any number of elements, where is element can be either a single element:

, whitespace         ; omitted for the first element
the-value
^Z^Zelt

or a repeated element

, whitespace         ; omitted for the first element
the-value
^Z^Zelt-rep number-of-repetitions
repetition-string
^Z^Zelt-rep-end

In both cases, the-value is the output for the value of the element and whitespace can contain spaces, tabs, and newlines. In the repeated case, number-of-repetitions is the number of consecutive array elements which contain that value, and repetition-string is a string which is designed to convey to the user that repetition is being depicted.

Once all the array elements have been output, the array annotation is ended with

^Z^Zarray-section-end

 
 
  Published under the terms of the GNU General Public License Design by Interspire