Previous: Type Checking, Up: Checks
In some languages (such as Modula-2), it is an error to exceed the bounds of a type; this is enforced with run-time checks. Such range checking is meant to ensure program correctness by making sure computations do not overflow, or indices on an array element access do not exceed the bounds of the array.
For expressions you use in gdb commands, you can tell gdb to treat range errors in one of three ways: ignore them, always treat them as errors and abandon the expression, or issue warnings but evaluate the expression anyway.
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, for further details on specific languages.
gdb provides some additional commands for controlling the range checker:
set check range auto
set check range on
set check range off
set check range warn
show range