PowerAda Debugging Mixed-Language Programs
Programs that contain both Ada code and code written in another language present special problems during debugging. The following commands enable you to debug mixed-language programs using commands and expressions similar to those provided in C, C++, and assembler.
To ensure that AIX debugging information is available for any C code linked into your programs, compile the C source files with the XLC -g option. For Linux, you should compile the C source files with the gcc -g option. Because this option makes the resulting object and executable files bigger, do not use it once your program is fully debugged. On AIX, the debugger can use in the information from XCOFF stab strings in the object file, regardless of the language; the following discussion refers only to the C language.
Selecting the Language to Debug: MODE
The preceding discussion of debugging commands describes how they work while debugging Ada code. With the MODE command, you can select C mode to work with C subprograms, variables, and expressions. After debugging the C portion of the program, you can return to Ada mode. The MODE command with no argument displays the current language mode. The syntax to use is:
mode [ada | c]
Most commands work the same way regardless of the language mode. The major differences are in the way the debugger interprets program locations and object names:
Breakpoint locations for BREAK and UNBREAK
You can use the name of the C subprogram as either the compilation unit or the subprogram. You cannot use a name of the form
Expressions for PUT, PUT_LINE, and ?
These expressions refer to C objects. You can always refer to global variables. You can refer to parameters and other variables that are local to a subprogram or block only while the program is stopped inside that subprogram or block.
Expressions for :=
These expressions also refer to C objects. You can use the
:type qualifiers, and the 'ADDRESS, 'SIZE, and 'LAST (for one-dimensional arrays) attributes. You can use the 0x and 0 notations to specify hexadecimal and octal numeric literals. You can only assign a value to a discrete object that has one of the C predefined types.
You can use the '.' operator for structure components, the square brackets operators for array elements or slices, and the + and - operators. + and - must be used within square brackets, and are the only operators allowed within square brackets.