z/OS Common Debug Architecture User's Guide
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF


Reading DWARF data from an ELF object file with libelf and libdwarf

z/OS Common Debug Architecture User's Guide
SC14-7310-00

Once a descriptor has been created, consumer operations can use it to read the DWARF debugging information from the ELF object file. This section discusses how consumer operations read from an ELF object file using the libelf and libdwarf libraries.

The following diagram shows an overview of the process.

Figure 1. Read from an ELF object file with libelf and libdwarf
An overview of the process to read from an ELF object file using the libelf and libdwarf libraries.

The following table shows the stages of reading from an ELF descriptor with calls to libelf and libdwarf operations.

Stage Description
Create an ELF descriptor Create an ELF descriptor for reading. This descriptor will be used to access the DWARF debugging information in the ELF object file. For more information, see Creating an ELF descriptor.
Initialize a libdwarf object Initialize the Dwarf_Debug consumer object by calling dwarf_elf_init, using the ELF descriptor.

libdwarf sets up the consumer libdwarf object to be able to load debugging information from the ELF descriptor.

Use libdwarf APIs libdwarf operations are called to retrieve the DWARF data. For example, dwarf_get_globals will retrieve the list of global symbol entries, and dwarf_get_dies_given_name will return a list of DIEs in a section that match the given name.
Terminate the libdwarf object dwarf_finish is called to terminate the Dwarf_Debug object.
Terminate the ELF descriptor The ELF descriptor is terminated with elf_end.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2013