Teach libdwarf about the DW_FORM_flag_present dwarf attribute, so

programs using libdwarf (such as ctfconvert) don't error out on files
containing the attribute.

MFC after:	2 weeks
This commit is contained in:
Dimitry Andric 2012-08-29 18:49:41 +00:00
parent ff3657eeaf
commit 1c7dd55c33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239872
4 changed files with 9 additions and 0 deletions

View file

@ -184,6 +184,7 @@
#define DW_FORM_ref8 0x14
#define DW_FORM_ref_udata 0x15
#define DW_FORM_indirect 0x16
#define DW_FORM_flag_present 0x19
#define DW_OP_addr 0x03
#define DW_OP_deref 0x06

View file

@ -101,6 +101,7 @@ dwarf_attrval_flag(Dwarf_Die die, uint64_t attr, Dwarf_Bool *valp, Dwarf_Error *
} else {
switch (av->av_form) {
case DW_FORM_flag:
case DW_FORM_flag_present:
*valp = (Dwarf_Bool) av->u[0].u64;
break;
default:

View file

@ -240,6 +240,8 @@ get_form_desc(uint32_t form)
return "DW_FORM_data8";
case DW_FORM_flag:
return "DW_FORM_flag";
case DW_FORM_flag_present:
return "DW_FORM_flag_present";
case DW_FORM_indirect:
return "DW_FORM_indirect";
case DW_FORM_ref1:
@ -648,6 +650,7 @@ dwarf_dump_av(Dwarf_Die die, Dwarf_AttrValue av)
case DW_FORM_data4:
case DW_FORM_data8:
case DW_FORM_flag:
case DW_FORM_flag_present:
printf("%llu", (unsigned long long) av->u[0].u64);
break;
case DW_FORM_ref1:

View file

@ -396,6 +396,10 @@ dwarf_init_attr(Dwarf_Debug dbg, Elf_Data **dp, uint64_t *offsetp,
avref.u[1].s = elf_strptr(dbg->dbg_elf,
dbg->dbg_s[DWARF_debug_str].s_shnum, avref.u[0].u64);
break;
case DW_FORM_flag_present:
/* This form has no value encoded in the DIE. */
avref.u[0].u64 = 1;
break;
default:
DWARF_SET_ERROR(error, DWARF_E_NOT_IMPLEMENTED);
ret = DWARF_E_NOT_IMPLEMENTED;