libdwarf
Retrieving tag,attribute,etc names

Example getting tag,attribute,etc names as strings.

*/
void examplezb(void)
{
const char * out = "unknown something";
int res = 0;
/* The following is wrong, do not do it!
Confusing TAG with ACCESS! */
res = dwarf_get_ACCESS_name(DW_TAG_entry_point,&out);
/* Nothing one does here with 'res' or 'out'
is meaningful. */
out = "<unknown TAG>"; /* Not a malloc'd string! */
/* The following is meaningful.*/
res = dwarf_get_TAG_name(DW_TAG_entry_point,&out);
(void)res; /* avoids unused var compiler warning */
/* If res == DW_DLV_ERROR or DW_DLV_NO_ENTRY
out will be the locally assigned static string.
If res == DW_DLV_OK it will be a usable
TAG name string.
In no case should a returned string be free()d. */
}
int dwarf_get_ACCESS_name(unsigned int dw_val_in, const char **dw_s_out)
dwarf_get_ACCESS_name
int dwarf_get_TAG_name(unsigned int dw_val_in, const char **dw_s_out)
dwarf_get_TAG_name