To use all the debugging features in the GDB debugging tool, you must generate symbolic debugging information when you compile components. This information is stored in object files and describes the data type of each variable or function and the correspondence between source line numbers and addresses in the executable code.
How you enable debugging in components depends on which release of ChorusOS 5.0 you have. The binary release of ChorusOS 5.0 includes the source code for the BSP, driver and example components. These are compiled in an imake build environment because the imake tool is used to create the Makefiles for these components.
The source release of ChorusOS 5.0 includes everything in the binary release plus source code for system components, such as the microkernel and the operating system. These components are built in a mkmk build environment where the mkmk tool is used to build Makefiles.
For more information about imake and mkmk, see "Using make and imake" in the ChorusOS 5.0 Application Developer's Guide.
Select one of the following to enable symbolic debugging:
The following two procedures indicate how to enable symbolic debugging for components that have been built with imake.
Edit the Project.tmpl file.
The Project.tmpl file is located in the root of the component directory. Add the following line to the end of the file:
DEBUG=$(DEBUG_ON)
Remove all the object files and executables.
$ make clean |
Rebuild the local Makefile.
$ make Makefile |
Rebuild the Makefiles in the subdirectories.
$ make Makefiles |
Rebuild the component.
$ make |
Edit the Imakefile.
Edit the Imakefile within each desired directory and add the following line to the end:
DEBUG=$(DEBUG_ON)
Remove all the object files and executables.
$ make clean |
Rebuild the local Makefile.
$ make Makefile |
Rebuild the component.
$ make |
If you prefer not to modify the Imakefile or Project.tmpl files, you can pass the debug option within the make command itself:
Remove all the object files and executables:
$ make clean |
Rebuild the component with symbolic debugging enabled:
$ make DEBUG=-gdwarf-2 |
You can also create a DEBUG environment variable.
If you use the C shell:
%setenv DEBUG -gdwarf-2
If you use the Bourne shell:
$ DEBUG=-gdwarf-2
$ export DEBUG
Call make with the -e option to import environment variables:
$ make -e |
If the component is part of the system image, rebuild and reboot the system image.
The following procedure describes how to enable symbolic debugging for system components built with mkmk.
Edit the definition file.
Add the following line to the end of the specified *.df (definition) file:
FREMOTEDEB=ON
Remove all the object files and executables.
$ make clean |
Create a new Makefile.
$ make mkmk |
Rebuild the system component.
$ make |
It is possible to build all components (those built with imake and those built with mkmk) with symbolic debugging information turned on. To do this, edit the Paths file, created when you run the configure command. The Paths file is located in build_dir.
Add the following line to the end of the file:
FREMOTEDEB=ON
This modification should be made just after running the configure command, otherwise it will apply only to newly compiled files.