diff options
author | dim <dim@FreeBSD.org> | 2012-08-29 18:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-08-29 18:49:41 +0000 |
commit | 31e19c2da67608f7e84286c35dd40d3c5be53a56 (patch) | |
tree | 5918304f35bcdb5e9e7b66d9ef0ea1e148bb0015 | |
parent | 5adf2c54b3105c045c6986fa0c072ac520a30b03 (diff) | |
download | FreeBSD-src-31e19c2da67608f7e84286c35dd40d3c5be53a56.zip FreeBSD-src-31e19c2da67608f7e84286c35dd40d3c5be53a56.tar.gz |
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
-rw-r--r-- | lib/libdwarf/dwarf.h | 1 | ||||
-rw-r--r-- | lib/libdwarf/dwarf_attrval.c | 1 | ||||
-rw-r--r-- | lib/libdwarf/dwarf_dump.c | 3 | ||||
-rw-r--r-- | lib/libdwarf/dwarf_init.c | 4 |
4 files changed, 9 insertions, 0 deletions
diff --git a/lib/libdwarf/dwarf.h b/lib/libdwarf/dwarf.h index ecbafcf..6eb2077 100644 --- a/lib/libdwarf/dwarf.h +++ b/lib/libdwarf/dwarf.h @@ -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 diff --git a/lib/libdwarf/dwarf_attrval.c b/lib/libdwarf/dwarf_attrval.c index db07ee7..25286de 100644 --- a/lib/libdwarf/dwarf_attrval.c +++ b/lib/libdwarf/dwarf_attrval.c @@ -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: diff --git a/lib/libdwarf/dwarf_dump.c b/lib/libdwarf/dwarf_dump.c index e92fee0d..dc22800 100644 --- a/lib/libdwarf/dwarf_dump.c +++ b/lib/libdwarf/dwarf_dump.c @@ -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: diff --git a/lib/libdwarf/dwarf_init.c b/lib/libdwarf/dwarf_init.c index 95642a0..aca6cef 100644 --- a/lib/libdwarf/dwarf_init.c +++ b/lib/libdwarf/dwarf_init.c @@ -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; |