Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)

A range error can result from numerical overflow, from exceeding an array index bound, or when
you type a constant that is not a member of any type. Some languages, however, do not treat
overflows as an error. In many implementations of C, mathematical overflow causes the result to
wrap around” to lower values―for example, if m is the largest integer value, and s is the smallest,
then
m + 1 s
This, too, is specific to individual languages, and in some cases specific to individual compilers
or machines. See “Supported languages” (page 74), for further details on specific languages.
GDB provides the following additional commands for controlling the range checker:
set check range auto Set range checking on or off based on the current working
language. See “Supported languages” (page 74), for the default
settings for each language.
set check range on, set
check range off
Set range checking on or off, overriding the default setting for the
current working language. A warning is issued if the setting does
not match the default language. If a range error occurs and range
checking is on, then a message is printed and evaluation of the
expression is aborted.
set check range warn Output messages when the GDB range checker detects a range
error, but attempt to evaluate the expression anyway. Evaluating
the expression may still be impossible for other reasons, such as
accessing memory that the process does not own (a typical
example from many Unix systems).
show range Show the current setting of the range checker, and whether or not
it is being set automatically by GDB.
Supported languages
Some GDB features may be used in expressions regardless of the language you use: the GDB @
and :: operators, and the '{type}addr' construct (see “Expressions” (page 58)) can be used
with the constructs of any supported language.
The following section discusses GDB support for each source language. These sections are not
meant to be language tutorials or references, but serve only as a reference guide to what the GDB
expression parser accepts, and what input and output formats should look like for different
languages.
C and C++
Since C and C++ are so closely related, many features of GDB apply to both languages. Whenever
this is the case, we discuss those languages together.
The C++ debugging facilities are jointly implemented by the C++ compiler and GDB. Therefore,
to debug your C++ code effectively, you must compile your C++ programs with a supported C++
compiler, such as the HP aC++ compiler (aCC).
Version A.06.27 of the HP aC++/HP C compiler provides leading edge support for C++11
standard language features. The following are the features where HP WDB supports debugging
of C++11 features along with the existing C++ features:
ptype command for char16_t and char32_t types
ptype, list, and break commands for variadic template functions
enum class
rvalue
74 Using GDB with Different Languages