Building debug information for a C or C++ application program
You can debug a C or C++ application program compiled by using the GNU Compiler Collection (GCC) or the Dignus Systems/C or Systems/C++ compiler in the z/TPF system.
GCC
To debug a C or C++ application program compiled by using GCC in the z/TPF system, the application program must be compiled with the -gdwarf-2 option specified to generate information in DWARF debug format.
To specify the -gdwarf option when using GCC, do one of the following actions:
- You can specify the TPF_GDWARF_LEVEL=2|0 setting in your
maketpf configuration file or makefile.
- When 2 is specified, the -gdwarf-2 option is added and debug information is generated. This is the default.
- When 0 is specified, the -gdwarf option is omitted. Debug information will not be generated for the compiled object.
- You can specify the -gdwarf-2 option with the CFLAGS_ or CXXFLAGS_ setting in your maketpf configuration file or makefile.
The -glevel option also can be specified, where
level is the level of debug information that is generated when
-gdwarf-2
is implicitly or explicitly specified. This option can be set only by
using the CFLAGS_ or CXXFLAGS_ setting in your maketpf
configuration file or makefile.- -g0 generates no debug information.
- -g1 includes functions and external variables.
- -g2 includes additional information for local variables and line numbers. This is the GCC default value.
- -g3 includes additional macro definitions presented in the application program.
Dignus Systems/C and Systems/C++ compilers
To debug a C or C++ application program compiled by using the Dignus Systems/C or Systems/C++ compiler in the z/TPF system, the application program must be compiled with the -gdwarf option to generate information in DWARF debug format.
To specify the -gdwarf option when using the Systems/C or Systems/C++ compilers, do one of the following actions:
- You can specify the TPF_GDWARF_LEVEL=2|0 setting in your
maketpf configuration file or makefile.
- When 2 is specified, the -gdwarf -fdfe options are added and debug information is generated. This is the default.
- When 0 is specified, the -gdwarf option is omitted. Debug information will not be generated for the compiled object.
- You can specify the -g0 or -gdwarf option with the
CFLAGS_ or CXXFLAGS_ setting in your maketpf configuration file or makefile.
- When -gdwarf is specified, the -gdwarf option is added and debug information is generated. It is recommended that the -fdfe option be specified when -gdwarf is specified.
- When -g0 is specified, debug information is not generated.
In the Debug view, the optimization levels and debug information levels can be seen in the stack frame.