PowerAda Other Issues

From OC Systems Wiki!
< PowerAda:The PowerAda Debugger: adbg
Revision as of 21:53, 14 April 2019 by imported>WikiVisor
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Debugging Large Programs

The debugger provides maximum flexibility during debugging when you compile all Ada compilation units in the program without the -k option, and all C files with the -g option. However, the size of your Ada sublibrary and executable file might become large.

As an alternative, you can generate minimal overhead by only compiling keeping debug information for those portions of the program you are immediately interested in. However, if more units need to be debugged later, recompiling the needed library units can trigger other, undesired recompilations, greatly slowing the debugging process.

The best strategy is to compile all Ada library units with debug information, because doing so adds very little extra information to the sublibrary. For the first debugging attempt, only compile the secondary units of interest without the -k option and compile the remaining units with -k. You can then compile with the -b or -m option to produce an executable file. If more secondary units need to be debugged, you can compile them without the -k option without triggering any additional recompilations. You can then link a new executable file to allow debugging of the new units.

If you have completed debugging and want to reclaim the extra space that the debugger information uses in your working sublibrary, recompile the debugged units with the -k option. You can also enable higher-level optimizations now, because the correspondence between generated code and source line numbers is only important during debugging.

How the Debugger Uses the Ada Library

You must compile main programs to be debugged without the -k option and then link them. The result of these operations is that information required for debugging is placed in the Ada library.

To ensure that the debugger is using the correct versions of all compilation units (and not duplicate versions from different sublibraries), use exactly the same set of sublibraries to compile, link, and debug a program.

It is important that the information about compilation order and the up-to-date status of units is the same when you debug a program as when you compiled it. Avoid changes to the library that affect the units in your program between the time the program is bound and a subsequent debugging session.

By default, the debugger verifies that the same versions of all compilation units are present. The debugger will not continue if this verification fails. The consistency checks can be suppressed with the -F option but the debugger may behave unpredictably.

How the Debugger Uses Ada Source Files

The debugger uses information in the Ada sublibraries to determine what source files contain particular compilation units. The debugger will use source files stored in the sublibraries if present. (Source is always stored in the sublibrary unless the -P compiler option is used.)

If -P is used (to save space or prevent source access by others), the debugger will use the original source files if they are accessible. Any changes you have made to the source files since compiling them may cause the debugger's line-number information to be inaccurate. Renaming the source files or moving them to different directories prevents the debugger from using them at all.

The name and location of the program source files are stored in the working sublibrary during compilation, so the debugger can locate them when it needs source information. If the SOURCE_PATH debugger variable is set, it first searches the directories specified in the variable before looking in the default (stored) location. The original source files must have the same base names and contents that they had when they were compiled.

The debugger cannot examine the units contained in source files it cannot locate. You cannot set breakpoints or display objects in them.