| DWARF_GET_MACRO_DETAILS(3) | Library Functions Manual | DWARF_GET_MACRO_DETAILS(3) | 
dwarf_get_macro_details —
#include <libdwarf.h>
int
  
  dwarf_get_macro_details(Dwarf_Debug
    dbg, Dwarf_Off offset,
    Dwarf_Unsigned max_count, Dwarf_Signed
    *entry_cnt, Dwarf_Macro_Details **details,
    Dwarf_Error *err);
dwarf_get_macro_details() retrieves information
  about macros associated with a DWARF debug context. Information about macro
  entries are returned as an array of descriptors of type
  Dwarf_Macro_Details, with each
  Dwarf_Macro_Details descriptor describing one macro
  information entry.
Argument dbg should reference a DWARF debug context allocated using dwarf_init(3). Argument offset is an offset, relative to the “.debug_macinfo” section, to the start of the desired macro information. Argument max_count specifies the maximum number of macro information entries to be returned, or 0 if all entries are to be returned. Argument entry_cnt should point to a location that will be set to the number of entries actually returned. Argument details should point to a location that will be set to a pointer to an array of Dwarf_Macro_Details descriptors. If argument err is not NULL, it will be used to store error information in case of an error.
Dwarf_Macro_Details descriptors are defined
    in the header file
    <libdwarf.h>, and consist of
    the following fields:
DW_MACINFO_* constants defined by the DWARF
      specification.DW_MACINFO_start_file.DW_MACINFO_defineDW_MACINFO_undefDW_MACINFO_vendor_extdwarf_dealloc() with the allocation
  type DW_DLA_STRING to indicate that the memory may be
  freed.
dwarf_get_macro_details() returns
  DW_DLV_OK when it succeeds. It returns
  DW_DLV_NO_ENTRY if there is no more macro information
  at the specified offset offset. In case of an error, it
  returns DW_DLV_ERROR and sets the argument
  err.
dwarf_get_macro_details() can fail with:
DW_DLE_ARGUMENT]DW_DLE_NO_ENTRY]
Dwarf_Debug dbg;
Dwarf_Unsigned offset;
Dwarf_Signed cnt;
Dwarf_Macro_Details *md;
Dwarf_Error de;
offset = 0;
while (dwarf_get_macro_details(dbg, offset, 0,
    &cnt, &md, &de) == DW_DLV_OK) {
	for (i = 0; i < cnt; i++) {
		/* Access fields of md[i] ... */
	}
	offset = md[cnt - 1].dmd_offset + 1;
}
| March 20, 2011 | NetBSD 9.3 |