Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle Solaris Studio 12.3: Debugging a Program With dbx Oracle Solaris Studio 12.3 Information Library |
4. Viewing and Navigating To Code
5. Controlling Program Execution
6. Setting Breakpoints and Traces
8. Evaluating and Displaying Data
11. Debugging Multithreaded Applications
16. Debugging Fortran Using dbx
17. Debugging a Java Application With dbx
18. Debugging at the Machine-Instruction Level
19. Using dbx With the Korn Shell
20. Debugging Shared Libraries
dbx can recognize macro definitions in two ways:
Definitions are provided by the compilers when you compile with the -g3 option if you use the default DWARF format for debugging information. They are not provided if you specify the -xdebugformat=stabs option when compiling.
dbx can recreate definitions by skimming the source file and its include files. Accurate recreation depends on access to the original sources and include files. It also depends on the availability of the pathname to the compiler used, and on compiler options like -D and -I. This information is available in both DWARF and stabs formats from Oracle Solaris Studio compiler, but not from GNU compilers. See Skimming Errors and Using the pathmap Command To Improve Skimming for information on ensuring successful skimming.
Which one of the two methods dbx uses to recognize macro definitions is controlled by the dbx environment variable macro_source (seeTable 3-1 in Chapter 3, Customizing dbx).
There are several factors to take into account in choosing which method you want dbx to use.
One factor is the availability of various types of information that depend on which compiler and compiler options you used to build your code. The following table shows which methods you can choose depending on the compiler and debugging information options.
Table C-1 Macro Definition Methods Available for Various Build Options
|
Another factor to take into account is the tradeoffs in functionality depending on which method you choose:
Size of executable. The main advantage of the skimming method is that it does not require compilation with the -g3 option because it works with the smaller executables produced by compiling with the -g option.
Debugging format. Skimming works with both DWARF and stabs. Compiling with the -g3 option to get the definitions from the compiler works only with DWARF.
Speed. Skimming takes up to one second the first time an expression is evaluation for a module for which dbx has not yet read the debugging information.
Accuracy. Information provided by the compilers when you compile with the -g3 option is more stable and accurate than information provided by skimming.
Availability of the build environment. Skimming requires that the compilers, source code files, and include files be available during debugging. dbx does not check for these items becoming out of date, so if they are likely to change, accuracy might deteriorate and it might be better to compile with the -g3 option than to depend on skimming.
Debugging on a different system from the one where the code was compiled. If you compiled the code on system A and are debugging it on system B, dbx accesses files on system A using NFS with some help from the pathmap command (see Using the pathmap Command To Improve Skimming.
The pathmap command also helps facilitate file access during skimming. It works for your program's source files and include files. But it might not work for system include files because /usr/include is not usually available through NFS, so macro definitions are extracted from /usr/include on the debugging system instead of on the build system.
You can choose to be aware of and tolerant of possible discrepancies between system include files, or choose to compile with the -g3 option.
Though Fortran compilers support macros through the cpp(1) function or the fpp(1) function, dbx does not support macro expansion for Fortran.
dbx ignores macro information generated by compiling with the -g3 option and the -xdebugformat=stabs option.
Skimming works with code compiled with the -g option and the -xdebugformat=stabs option.