15.1.2 Setting the Working Language
If you allow gdb to set the language automatically, expressions are interpreted the same way in your debugging session and your program.
If you wish, you may set the language manually. To do this, issue the
command set language lang, where lang is the name of
a language, such as
For a list of the supported languages, type set language.
Setting the language manually prevents gdb from updating the working language automatically. This can lead to confusion if you try to debug a program when the working language is not the same as the source language, when an expression is acceptable to both languages—but means different things. For instance, if the current source file were written in C, and gdb was parsing Modula-2, a command such as:
print a = b + c
might not have the effect you intended. In C, this means to add
c and place the result in
a. The result
printed would be the value of
a. In Modula-2, this means to compare
a to the result of
b+c, yielding a