Debugging Mixed-Language Programs

The idb debugger lets you debug mixed-language programs. Program flow of control across subprograms written in different languages is transparent.

The debugger automatically identifies the language of the current subprogram or code segment on the basis of information embedded in the executable file. For example, if program execution is suspended in a subprogram in Fortran, the current language is Fortran. If the debugger stops the program in a C function, the current language becomes C. The debugger uses the current language to determine the valid expression syntax and the semantics used to evaluate an expression.

The debugger sets the $lang environment variable to the language of the current subprogram or code segment. By manually setting the $lang  environment variable, you can force the debugger to interpret expressions used in commands by the rules and semantics of a particular language. For example, you can check the current setting of $lang and change it as follows:

(idb) print $lang

"C++"

(idb) set $lang = "Fortran"

When the $lang environment variable is set to "Fortran", names are case-insensitive. To make names case-sensitive when the program was compiled with the -names as_is option, specify another language for the $lang environment variable, such as C, view the variable, then set the $lang environment variable to "Fortran."