dwarf_pcscope operation

The dwarf_pcscope operation returns the block DIE that encloses the given PC address with the smallest range.

The block DIE has a DW_TAG_lexical_block tag.

Prototype

int dwarf_pcscope(
  Dwarf_Debug           dbg,
  Dwarf_Addr            pc,
  Dwarf_Die*            ret_die,
  Dwarf_Error*          error);

Parameters

dbg
Input. This accepts a libdwarf consumer object.
pc
Input. This accepts the PC address.
ret_die
Output. This returns the block DIE that is closest to the given address.
error
Input/output. This accepts or returns the Dwarf_Error object.

Return values

The dwarf_pcscope operation returns DW_DLV_NO_ENTRY if the ret_die does not contain the PC address.

Example: Parameter deallocation

You can deallocate the parameters as required.

The following code fragment deallocates the ret_die parameter:

if (dwarf_pcscope (dbg, pc, &ret_die, &err) == DW_DLV_OK)
    dwarf_dealloc(dbg, ret_die, DW_DLA_DIE);