from gdb.texinfo on 11 July 1994 -->
Go to the previous, next section.
Some languages, such as Modula-2, are strongly typed, meaning that the arguments to operators and functions have to be of the correct type, otherwise an error occurs. These checks prevent type mismatch errors from ever causing any run-time problems. For example,
1 + 2 => 3 but error--> 1 + 2.3
The second example fails because the CARDINAL
1 is not
type-compatible with the REAL
2.3.
For expressions you use in GDB commands, you can tell the GDB type checker to skip checking; to treat any mismatches as errors and abandon the expression; or only issue warnings when type mismatches occur, but evaluate the expression anyway. When you choose the last of these, GDB evaluates expressions like the second example above, but also issues a warning.
Even though you may turn type checking off, other type-based reasons may
prevent GDB from evaluating an expression. For instance, GDB does not
know how to add an int
and a struct foo
. These particular
type errors have nothing to do with the language in use, and usually
arise from expressions, such as the one described above, which make
little sense to evaluate anyway.
Each language defines to what degree it is strict about type. For instance, both Modula-2 and C require the arguments to arithmetical operators to be numbers. In C, enumerated types and pointers can be represented as numbers, so that they are valid arguments to mathematical operators. See section Supported languages, for further details on specific languages.
GDB provides some additional commands for controlling the type checker:
set check type auto
set check type on
set check type off
set check type warn
show type
Go to the previous, next section.