Getting ready

In the process of debugging embedded Linux systems, we can use the same toolbox as standard Linux systems. One of these tools enables applications to generate a memory core dump upon crashing. This assumes that we have enough disk space to store the application's entire memory map, and that writing to disk is quick enough that it will not drag the system to a halt.

Once the memory core dump is generated, we use the host's GDB to analyze the core dump. GDB needs to have debug information available. To install debug information, we use the dbg-pkgs feature. By default, this installs the debug information of a package in a .debug directory in the same location as the executable itself. To add debug information for all packages in a target image, we add the following to our conf/local.conf configuration file:

EXTRA_IMAGE_FEATURES += "dbg-pkgs" 

Debug packages can also be added only for those packages we are interested in by adding the debug version of the package to our image with:

IMAGE_INSTALL_append = " <packagename>-dbg" 

We can then build an appropriate toolchain generated to match our filesystem, as we saw in the Preparing and using an SDK recipe in Chapter 4, Application Development. The core dump contains build IDs for the executables and libraries in use at the time of the crash, so it's important to match the toolchain and the target image.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset