diff options
author | Mark Wielaard <mjw@redhat.com> | 2013-08-30 23:55:12 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2013-09-06 12:09:45 +0200 |
commit | b2535b6a6be7717cdd41834d76e5cb48cb446b83 (patch) | |
tree | 6f90ce8b4e754103beaf72cef9778fe744ddc65d /libdw/libdwP.h | |
parent | 66eaae9bcc1608efad65e3aa0204afbb3cb1a83d (diff) | |
download | elfutils-b2535b6a6be7717cdd41834d76e5cb48cb446b83.tar.gz |
libdw: Add new functions dwarf_getlocation_attr and dwarf_getlocation_die.
Some location expression operations have a DIE associated with them.
Examples are some of the new GNU typed DWARF extensions, DW_OP_GNU_convert,
DW_OP_GNU_reinterpret, DW_OP_GNU_const_type, DW_OP_GNU_regval_type and
DW_OP_GNU_deref_type. Others have (block) values associated with them,
like DW_OP_GNU_entry_value and DW_OP_GNU_const_type.
It is not always easy to access these values. The DIE offset is given in
various formats either as global offset or CU relative offset. The (block)
value might be constant or a location description. And the block might be
encoded with a uleb128 or ubyte length. The new functions help to easily
get at the DIE or attribute value.
In theory dwarf_getlocation_attr could be used for all cases, since
besides returning DW_AT_const_value or DW_AT_location, it could also
return an attribute referencing a DIE. But at least one operation,
DW_OP_GNU_const_type, has both a (type) DIE and a constant (block)
value associated with it. And directly getting the DIE when needed
is easier than first having to retrieve a (synthesized) attribute
and then getting the actual (type) DIE.
Expression operations that reference an actual DIE for the
DW_AT_location or DW_AT_const_value, like DW_OP_call2, DW_OP_call4,
DW_OP_callref and DW_OP_GNU_implicit_pointer can be used with both
dwarf_getlocation_attr and dwarf_getlocation_die.
DW_OP_implicit_value and DW_OP_GNU_implicit_pointer already had
their own special accessors (dwarf_getlocation_implicit_value
and dwarf_getlocation_implicit_pointer), but it seemed consistent
to include them in the new more generic accessors too.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libdw/libdwP.h')
-rw-r--r-- | libdw/libdwP.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 76bddffa..f02a5bf2 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -1,5 +1,5 @@ /* Internal definitions for libdwarf. - Copyright (C) 2002-2011 Red Hat, Inc. + Copyright (C) 2002-2011, 2013 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -654,6 +654,7 @@ INTDECL (dwarf_formudata) INTDECL (dwarf_getarange_addr) INTDECL (dwarf_getarangeinfo) INTDECL (dwarf_getaranges) +INTDECL (dwarf_getlocation_die) INTDECL (dwarf_getsrcfiles) INTDECL (dwarf_getsrclines) INTDECL (dwarf_hasattr) |