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 b
and 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 BOOLEAN
value.