summaryrefslogtreecommitdiffstats
path: root/src/libdw
diff options
context:
space:
mode:
Diffstat (limited to 'src/libdw')
-rwxr-xr-xsrc/libdw/Android.mk232
-rw-r--r--src/libdw/ChangeLog711
-rw-r--r--src/libdw/Makefile986
-rw-r--r--src/libdw/Makefile.am71
-rw-r--r--src/libdw/Makefile.in426
-rw-r--r--src/libdw/cfi.c136
-rw-r--r--src/libdw/cfi.h65
-rw-r--r--src/libdw/cie.c59
-rw-r--r--src/libdw/dwarf.h100
-rw-r--r--src/libdw/dwarf_abbrev_hash.c59
-rw-r--r--src/libdw/dwarf_abbrev_hash.h59
-rw-r--r--src/libdw/dwarf_abbrevhaschildren.c59
-rw-r--r--src/libdw/dwarf_addrdie.c59
-rw-r--r--src/libdw/dwarf_aggregate_size.c89
-rw-r--r--src/libdw/dwarf_arrayorder.c59
-rw-r--r--src/libdw/dwarf_attr.c63
-rw-r--r--src/libdw/dwarf_attr_integrate.c59
-rw-r--r--src/libdw/dwarf_begin.c64
-rw-r--r--src/libdw/dwarf_begin_elf.c114
-rw-r--r--src/libdw/dwarf_bitoffset.c59
-rw-r--r--src/libdw/dwarf_bitsize.c59
-rw-r--r--src/libdw/dwarf_bytesize.c59
-rw-r--r--src/libdw/dwarf_cfi_addrframe.c59
-rw-r--r--src/libdw/dwarf_cfi_end.c59
-rw-r--r--src/libdw/dwarf_child.c127
-rw-r--r--src/libdw/dwarf_cu_die.c68
-rw-r--r--src/libdw/dwarf_cu_getdwarf.c47
-rw-r--r--src/libdw/dwarf_cuoffset.c63
-rw-r--r--src/libdw/dwarf_decl_column.c59
-rw-r--r--src/libdw/dwarf_decl_file.c63
-rw-r--r--src/libdw/dwarf_decl_line.c72
-rw-r--r--src/libdw/dwarf_diecu.c59
-rw-r--r--src/libdw/dwarf_diename.c59
-rw-r--r--src/libdw/dwarf_dieoffset.c63
-rw-r--r--src/libdw/dwarf_end.c70
-rw-r--r--src/libdw/dwarf_entry_breakpoints.c59
-rw-r--r--src/libdw/dwarf_entrypc.c59
-rw-r--r--src/libdw/dwarf_error.c67
-rw-r--r--src/libdw/dwarf_filesrc.c59
-rw-r--r--src/libdw/dwarf_formaddr.c59
-rw-r--r--src/libdw/dwarf_formblock.c81
-rw-r--r--src/libdw/dwarf_formflag.c59
-rw-r--r--src/libdw/dwarf_formref.c83
-rw-r--r--src/libdw/dwarf_formref_die.c90
-rw-r--r--src/libdw/dwarf_formsdata.c86
-rw-r--r--src/libdw/dwarf_formstring.c78
-rw-r--r--src/libdw/dwarf_formudata.c98
-rw-r--r--src/libdw/dwarf_frame_cfa.c59
-rw-r--r--src/libdw/dwarf_frame_info.c59
-rw-r--r--src/libdw/dwarf_frame_register.c65
-rw-r--r--src/libdw/dwarf_func_inline.c58
-rw-r--r--src/libdw/dwarf_getabbrev.c89
-rw-r--r--src/libdw/dwarf_getabbrevattr.c68
-rw-r--r--src/libdw/dwarf_getabbrevcode.c59
-rw-r--r--src/libdw/dwarf_getabbrevtag.c59
-rw-r--r--src/libdw/dwarf_getalt.c42
-rw-r--r--src/libdw/dwarf_getarange_addr.c59
-rw-r--r--src/libdw/dwarf_getarangeinfo.c59
-rw-r--r--src/libdw/dwarf_getaranges.c70
-rw-r--r--src/libdw/dwarf_getattrcnt.c59
-rw-r--r--src/libdw/dwarf_getattrs.c100
-rw-r--r--src/libdw/dwarf_getcfi.c59
-rw-r--r--src/libdw/dwarf_getcfi_elf.c74
-rw-r--r--src/libdw/dwarf_getelf.c59
-rw-r--r--src/libdw/dwarf_getfuncs.c156
-rw-r--r--src/libdw/dwarf_getlocation.c453
-rw-r--r--src/libdw/dwarf_getlocation_attr.c122
-rw-r--r--src/libdw/dwarf_getlocation_die.c78
-rw-r--r--src/libdw/dwarf_getlocation_implicit_pointer.c77
-rw-r--r--src/libdw/dwarf_getmacros.c617
-rw-r--r--src/libdw/dwarf_getpubnames.c83
-rw-r--r--src/libdw/dwarf_getscopes.c59
-rw-r--r--src/libdw/dwarf_getscopes_die.c59
-rw-r--r--src/libdw/dwarf_getscopevar.c59
-rw-r--r--src/libdw/dwarf_getsrc_die.c59
-rw-r--r--src/libdw/dwarf_getsrc_file.c59
-rw-r--r--src/libdw/dwarf_getsrcdirs.c59
-rw-r--r--src/libdw/dwarf_getsrcfiles.c64
-rw-r--r--src/libdw/dwarf_getsrclines.c1352
-rw-r--r--src/libdw/dwarf_getstring.c59
-rw-r--r--src/libdw/dwarf_hasattr.c102
-rw-r--r--src/libdw/dwarf_hasattr_integrate.c59
-rw-r--r--src/libdw/dwarf_haschildren.c79
-rw-r--r--src/libdw/dwarf_hasform.c59
-rw-r--r--src/libdw/dwarf_haspc.c59
-rw-r--r--src/libdw/dwarf_highpc.c88
-rw-r--r--src/libdw/dwarf_lineaddr.c59
-rw-r--r--src/libdw/dwarf_linebeginstatement.c59
-rw-r--r--src/libdw/dwarf_lineblock.c59
-rw-r--r--src/libdw/dwarf_linecol.c59
-rw-r--r--src/libdw/dwarf_linediscriminator.c59
-rw-r--r--src/libdw/dwarf_lineendsequence.c59
-rw-r--r--src/libdw/dwarf_lineepiloguebegin.c59
-rw-r--r--src/libdw/dwarf_lineisa.c59
-rw-r--r--src/libdw/dwarf_lineno.c59
-rw-r--r--src/libdw/dwarf_lineop_index.c59
-rw-r--r--src/libdw/dwarf_lineprologueend.c59
-rw-r--r--src/libdw/dwarf_linesrc.c59
-rw-r--r--src/libdw/dwarf_lowpc.c59
-rw-r--r--src/libdw/dwarf_macro_getparamcnt.c43
-rw-r--r--src/libdw/dwarf_macro_getsrcfiles.c88
-rw-r--r--src/libdw/dwarf_macro_opcode.c59
-rw-r--r--src/libdw/dwarf_macro_param.c46
-rw-r--r--src/libdw/dwarf_macro_param1.c67
-rw-r--r--src/libdw/dwarf_macro_param2.c77
-rw-r--r--src/libdw/dwarf_next_cfi.c79
-rw-r--r--src/libdw/dwarf_nextcu.c59
-rw-r--r--src/libdw/dwarf_offabbrev.c59
-rw-r--r--src/libdw/dwarf_offdie.c59
-rw-r--r--src/libdw/dwarf_onearange.c59
-rw-r--r--src/libdw/dwarf_onesrcline.c59
-rw-r--r--src/libdw/dwarf_peel_type.c74
-rw-r--r--src/libdw/dwarf_ranges.c59
-rw-r--r--src/libdw/dwarf_setalt.c40
-rw-r--r--src/libdw/dwarf_siblingof.c69
-rw-r--r--src/libdw/dwarf_sig8_hash.c59
-rw-r--r--src/libdw/dwarf_sig8_hash.h59
-rw-r--r--src/libdw/dwarf_srclang.c59
-rw-r--r--src/libdw/dwarf_tag.c79
-rw-r--r--src/libdw/dwarf_whatattr.c59
-rw-r--r--src/libdw/dwarf_whatform.c59
-rw-r--r--src/libdw/encoded-value.h67
-rw-r--r--src/libdw/fde.c120
-rw-r--r--src/libdw/frame-cache.c59
-rw-r--r--src/libdw/known-dwarf.h629
-rw-r--r--src/libdw/libdw.h249
-rw-r--r--src/libdw/libdw.map68
-rw-r--r--src/libdw/libdwP.h253
-rw-r--r--src/libdw/libdw_alloc.c59
-rw-r--r--src/libdw/libdw_findcu.c137
-rw-r--r--src/libdw/libdw_form.c146
-rw-r--r--src/libdw/libdw_visit_scopes.c186
-rw-r--r--src/libdw/memory-access.c71
-rw-r--r--src/libdw/memory-access.h215
134 files changed, 8405 insertions, 6342 deletions
diff --git a/src/libdw/Android.mk b/src/libdw/Android.mk
index 5579b244..b0a1c99f 100755
--- a/src/libdw/Android.mk
+++ b/src/libdw/Android.mk
@@ -15,107 +15,125 @@
LOCAL_PATH := $(call my-dir)
LIBDW_SRC_FILES := \
- cfi.c \
- cie.c \
- dwarf_abbrevhaschildren.c \
- dwarf_abbrev_hash.c \
- dwarf_addrdie.c \
- dwarf_arrayorder.c \
- dwarf_attr.c \
- dwarf_attr_integrate.c \
- dwarf_begin.c \
- dwarf_begin_elf.c \
- dwarf_bitoffset.c \
- dwarf_bitsize.c \
- dwarf_bytesize.c \
- dwarf_cfi_addrframe.c \
- dwarf_child.c \
- dwarf_cuoffset.c \
- dwarf_decl_column.c \
- dwarf_decl_file.c \
- dwarf_decl_line.c \
- dwarf_diecu.c \
- dwarf_diename.c \
- dwarf_dieoffset.c \
- dwarf_end.c \
- dwarf_entry_breakpoints.c \
- dwarf_entrypc.c \
- dwarf_error.c \
- dwarf_filesrc.c \
- dwarf_formaddr.c \
- dwarf_formblock.c \
- dwarf_formflag.c \
- dwarf_formref.c \
- dwarf_formref_die.c \
- dwarf_formsdata.c \
- dwarf_formstring.c \
- dwarf_formudata.c \
- dwarf_frame_cfa.c \
- dwarf_func_inline.c \
- dwarf_getabbrevattr.c \
- dwarf_getabbrev.c \
- dwarf_getabbrevcode.c \
- dwarf_getabbrevtag.c \
- dwarf_getarange_addr.c \
- dwarf_getarangeinfo.c \
- dwarf_getaranges.c \
- dwarf_getattrcnt.c \
- dwarf_getattrs.c \
- dwarf_getcfi.c \
- dwarf_getcfi_elf.c \
- dwarf_getelf.c \
- dwarf_getfuncs.c \
- dwarf_getlocation.c \
- dwarf_getmacros.c \
- dwarf_getpubnames.c \
- dwarf_getscopes.c \
- dwarf_getscopes_die.c \
- dwarf_getscopevar.c \
- dwarf_getsrc_die.c \
- dwarf_getsrcdirs.c \
- dwarf_getsrc_file.c \
- dwarf_getsrcfiles.c \
- dwarf_getsrclines.c \
- dwarf_getstring.c \
- dwarf_hasattr.c \
- dwarf_hasattr_integrate.c \
- dwarf_haschildren.c \
- dwarf_hasform.c \
- dwarf_haspc.c \
- dwarf_highpc.c \
- dwarf_lineaddr.c \
- dwarf_linebeginstatement.c \
- dwarf_lineblock.c \
- dwarf_linecol.c \
- dwarf_lineendsequence.c \
- dwarf_lineepiloguebegin.c \
- dwarf_lineno.c \
- dwarf_lineprologueend.c \
- dwarf_linesrc.c \
- dwarf_lowpc.c \
- dwarf_macro_opcode.c \
- dwarf_macro_param1.c \
- dwarf_macro_param2.c \
- dwarf_next_cfi.c \
- dwarf_nextcu.c \
- dwarf_offabbrev.c \
- dwarf_offdie.c \
- dwarf_onearange.c \
- dwarf_onesrcline.c \
- dwarf_ranges.c \
- dwarf_siblingof.c \
- dwarf_sig8_hash.c \
- dwarf_srclang.c \
- dwarf_tag.c \
- dwarf_whatattr.c \
- dwarf_whatform.c \
- fde.c \
- frame-cache.c \
- libdw_alloc.c \
- libdw_findcu.c \
- libdw_form.c \
- libdw_visit_scopes.c \
- memory-access.c
+ cfi.c \
+ cie.c \
+ dwarf_abbrevhaschildren.c \
+ dwarf_abbrev_hash.c \
+ dwarf_addrdie.c \
+ dwarf_aggregate_size.c \
+ dwarf_arrayorder.c \
+ dwarf_attr.c \
+ dwarf_attr_integrate.c \
+ dwarf_begin.c \
+ dwarf_begin_elf.c \
+ dwarf_bitoffset.c \
+ dwarf_bitsize.c \
+ dwarf_bytesize.c \
+ dwarf_cfi_addrframe.c \
+ dwarf_cfi_end.c \
+ dwarf_child.c \
+ dwarf_cu_die.c \
+ dwarf_cu_getdwarf.c \
+ dwarf_cuoffset.c \
+ dwarf_decl_column.c \
+ dwarf_decl_file.c \
+ dwarf_decl_line.c \
+ dwarf_diecu.c \
+ dwarf_diename.c \
+ dwarf_dieoffset.c \
+ dwarf_end.c \
+ dwarf_entry_breakpoints.c \
+ dwarf_entrypc.c \
+ dwarf_error.c \
+ dwarf_filesrc.c \
+ dwarf_formaddr.c \
+ dwarf_formblock.c \
+ dwarf_formflag.c \
+ dwarf_formref.c \
+ dwarf_formref_die.c \
+ dwarf_formsdata.c \
+ dwarf_formstring.c \
+ dwarf_formudata.c \
+ dwarf_frame_cfa.c \
+ dwarf_frame_info.c \
+ dwarf_frame_register.c \
+ dwarf_func_inline.c \
+ dwarf_getabbrevattr.c \
+ dwarf_getabbrev.c \
+ dwarf_getabbrevcode.c \
+ dwarf_getabbrevtag.c \
+ dwarf_getalt.c \
+ dwarf_getarange_addr.c \
+ dwarf_getarangeinfo.c \
+ dwarf_getaranges.c \
+ dwarf_getattrcnt.c \
+ dwarf_getattrs.c \
+ dwarf_getcfi.c \
+ dwarf_getcfi_elf.c \
+ dwarf_getelf.c \
+ dwarf_getfuncs.c \
+ dwarf_getlocation_attr.c \
+ dwarf_getlocation.c \
+ dwarf_getlocation_die.c \
+ dwarf_getlocation_implicit_pointer.c \
+ dwarf_getmacros.c \
+ dwarf_getpubnames.c \
+ dwarf_getscopes.c \
+ dwarf_getscopes_die.c \
+ dwarf_getscopevar.c \
+ dwarf_getsrc_die.c \
+ dwarf_getsrcdirs.c \
+ dwarf_getsrc_file.c \
+ dwarf_getsrcfiles.c \
+ dwarf_getsrclines.c \
+ dwarf_getstring.c \
+ dwarf_hasattr.c \
+ dwarf_hasattr_integrate.c \
+ dwarf_haschildren.c \
+ dwarf_hasform.c \
+ dwarf_haspc.c \
+ dwarf_highpc.c \
+ dwarf_lineaddr.c \
+ dwarf_linebeginstatement.c \
+ dwarf_lineblock.c \
+ dwarf_linecol.c \
+ dwarf_linediscriminator.c \
+ dwarf_lineendsequence.c \
+ dwarf_lineepiloguebegin.c \
+ dwarf_lineisa.c \
+ dwarf_lineno.c \
+ dwarf_lineop_index.c \
+ dwarf_lineprologueend.c \
+ dwarf_linesrc.c \
+ dwarf_lowpc.c \
+ dwarf_macro_getparamcnt.c \
+ dwarf_macro_getsrcfiles.c \
+ dwarf_macro_opcode.c \
+ dwarf_macro_param1.c \
+ dwarf_macro_param2.c \
+ dwarf_macro_param.c \
+ dwarf_next_cfi.c \
+ dwarf_nextcu.c \
+ dwarf_offabbrev.c \
+ dwarf_offdie.c \
+ dwarf_onearange.c \
+ dwarf_onesrcline.c \
+ dwarf_peel_type.c \
+ dwarf_ranges.c \
+ dwarf_setalt.c \
+ dwarf_siblingof.c \
+ dwarf_sig8_hash.c \
+ dwarf_srclang.c \
+ dwarf_tag.c \
+ dwarf_whatattr.c \
+ dwarf_whatform.c \
+ fde.c \
+ frame-cache.c \
+ libdw_alloc.c \
+ libdw_findcu.c \
+ libdw_form.c \
+ libdw_visit_scopes.c \
+
ifeq ($(HOST_OS),linux)
@@ -136,7 +154,7 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../libdw \
$(LOCAL_PATH)/../libelf
-LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE -DIS_LIBDW
+LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE -D_BSD_SOURCE -DIS_LIBDW
# to suppress the "pointer of type ‘void *’ used in arithmetic" warning
LOCAL_CFLAGS += -Wno-pointer-arith
@@ -145,6 +163,8 @@ LOCAL_MODULE:= libdw
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+LOCAL_STATIC_LIBRARIES := libz
+
include $(BUILD_HOST_STATIC_LIBRARY)
endif # linux
@@ -166,11 +186,11 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../libdw \
$(LOCAL_PATH)/../libelf
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/../bionic-fixup
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../bionic-fixup
-LOCAL_CFLAGS += -include $(LOCAL_PATH)/../bionic-fixup/AndroidFixup.h
+LOCAL_CFLAGS += -include $(LOCAL_PATH)/../../bionic-fixup/AndroidFixup.h
-LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -DIS_LIBDW -Werror
+LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE -D_BSD_SOURCE -DIS_LIBDW -Werror
# to suppress the "pointer of type ‘void *’ used in arithmetic" warning
LOCAL_CFLAGS += -Wno-pointer-arith
@@ -181,4 +201,6 @@ LOCAL_MODULE:= libdw
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+LOCAL_STATIC_LIBRARIES := libz
+
include $(BUILD_STATIC_LIBRARY)
diff --git a/src/libdw/ChangeLog b/src/libdw/ChangeLog
index 98b67f4a..abc2d71a 100644
--- a/src/libdw/ChangeLog
+++ b/src/libdw/ChangeLog
@@ -1,3 +1,714 @@
+2014-12-18 Ulrich Drepper <drepper@gmail.com>
+
+ * Makefile.am: Suppress output of textrel_check command.
+
+2014-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (read_srclines): Check diridx is valid under
+ DW_LNE_define_file.
+
+2014-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getpubnames.c (dwarf_getpubnames): Make sure there is enough
+ space to read die offset.
+
+2014-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (read_srclines): Correct overflow check for
+ unit_length.
+
+2014-12-15 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getpubnames.c (get_offsets): Make sure whole unit fall inside
+ section data. Set error to DWARF_E_NO_ENTRY if cnt is zero.
+ (dwarf_getpubnames): Make sure section data contains string zero
+ terminator.
+
+2014-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * memory-access.h (__libdw_get_sleb128): Unroll the first step to help
+ the compiler optimize for the common single-byte case.
+
+2014-12-15 Josh Stone <jistone@redhat.com>
+
+ * memory-access.h (__libdw_max_len_leb128): New.
+ (__libdw_get_uleb128): Use __libdw_max_len_leb128.
+ (__libdw_get_sleb128): Likewise.
+
+2014-12-14 Mark Wielaard <mjw@redhat.com>
+
+ * cfi.c (execute_cfi): Add program bounds checks.
+ * dwarf_child.c (__libdw_find_attr): Add attrp bounds checks.
+ * dwarf_formblock.c (dwarf_formblock): Call get_uleb128 with endp.
+ * dwarf_formref.c (__libdw_formref): Add datap bounds checks.
+ * dwarf_formsdata.c (dwarf_formsdata): Likewise.
+ * dwarf_formudata.c (dwarf_formudata): Likewise.
+ * dwarf_frame_register.c (dwarf_frame_register): Call get_uleb128
+ with end of data buf.
+ * dwarf_getabbrev.c (__libdw_getabbrev): Add abbrevp bounds checks.
+ * dwarf_getabbrevattr.c (dwarf_getabbrevattr): Assume get_uleb128
+ call gets enough data.
+ * dwarf_getattrs,c (dwarf_getattrs): Call get_uleb128 with endp.
+ * dwarf_getlocation.c (store_implicit_value): Call get_uleb128
+ with enough data.
+ (__libdw_intern_expression): Call get_uleb128/get_sleb128 with
+ end_data.
+ * dwarf_getmacros.c (get_table_for_offset): Add nforms bounds check.
+ * dwarf_getsrclines.c (read_srclines): Bounds check linep and call
+ get_uleb128 with lineendp.
+ * dwarf_hasattr.c (dwarf_hasattr): Bounds check attrp and call
+ get_uleb128 with endp.
+ * dwarf_next_cfi.c (dwarf_next_cfi): Bounds check bytes and call
+ get_uleb128/get_sleb128 with limit.
+ * encoded-value.h (read_encoded_value): Assume get_uleb128 and
+ get_sleb128 get called with enough data.
+ * fde.c (intern_fde): Call get_uleb128 with instructions_end.
+ * libdwP.h (__libdw_dieabbrev): Call get_uleb128 with die->cu->endp.
+ * libdw_form.c (__libdw_form_val_compute_len): Call get_uleb128 with
+ endp.
+ * memory-access.h (__libdw_get_uleb128): Take an extra endp.
+ Don't call get_uleb128_step if out of data.
+ (__libdw_get_sleb128): Likewise for get_sleb128_step.
+
+2014-12-12 Mark Wielaard <mjw@redhat.com>
+
+ * libdwP.h (struct Dwarf): Add fake_loc_cu.
+ (cu_data): Removed.
+ (DIE_OFFSET_FROM_CU_OFFSET): Don't use cu_data, use cu_sec_idx.
+ (__libdw_form_val_compute_len): Drop dbg and endp arguments.
+ (__libdw_form_val_len): Likewise.
+ * libdw_form.c (__libdw_form_val_compute_len): Likewise.
+ * libdw_findcu.c (__libdw_intern_next_unit): Don't use cu_data, use
+ the already found data buffer directly.
+ * dwarf_begin_elf.c (valid_p): Setup fake_loc_cu.
+ * dwarf_end.c (dwarf_end): Free fake_loc_cu.
+ * dwarf_child.c (__libdw_find_attr): Call __libdw_form_val_len with
+ just cu.
+ * dwarf_getattrs.c (dwarf_getattrs): Likewise.
+ * dwarf_formblock.c (dwarf_formblock): Add bounds checking.
+ * dwarf_getlocation_attr.c (attr_form_cu): New function.
+ (dwarf_getlocation_attr): Use attr_form_cu to set result->cu.
+ (getlocation): Handle empty blocks immediately.
+ * dwarf_getlocation_implicit_pointer.c (empty_cu): New static var.
+ (__libdw_empty_loc_attr): Drop cu argument, use empty_cu.
+ (dwarf_getlocation_implicit_pointer): Call __libdw_empty_loc_attr with
+ one argument.
+ * dwarf_getmacros.c (read_macros): Also setup startp and endp for
+ fake_cu. Call __libdw_form_val_len with just fake_cu.
+ * dwarf_formref_die.c (dwarf_formref_die): Don't use cu_data, get
+ datap and size directly from cu startp and endp.
+
+2014-12-11 Mark Wielaard <mjw@redhat.com>
+
+ * libdw_findcu.c (__libdw_intern_next_unit): Sanity check offset.
+
+2014-12-13 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getaranges.c (compare_aranges): Make sure Dwarf_Addr
+ difference doesn't wrap around before returning as int.
+
+2014-12-11 Josh Stone <jistone@redhat.com>
+
+ * dwarf_getsrclines.c (struct linelist): Add sequence.
+ (compare_lines): Take linelists, and break ties by sequence.
+ (read_srclines): Use linelists for sorting.
+ (read_srclines::add_new_line): Set sequence.
+
+2014-12-10 Josh Stone <jistone@redhat.com>
+
+ * libdwP.h (Dwarf_CU): Add startp and endp boundaries.
+ * libdw_findcu.c (__libdw_intern_next_unit): Set startp and endp.
+ * dwarf_child.c (dwarf_child): Use cu->endp.
+ * dwarf_cuoffset.c (dwarf_cuoffset): Use cu->startp.
+ * dwarf_dieoffset.c (dwarf_dieoffset): Use cu->startp.
+ * dwarf_siblingof.c (dwarf_siblingof): Use both.
+
+2014-12-10 Josh Stone <jistone@redhat.com>
+
+ * dwarf_hasattr.c (dwarf_hasattr): Just walk abbrev for presence.
+
+2014-12-10 Josh Stone <jistone@redhat.com>
+
+ * libdwP.h (__libdw_dieabbrev): New die->abbrev lookup function.
+ * dwarf_child.c (__libdw_find_attr, dwarf_child): Use it.
+ * dwarf_getattrs.c (dwarf_getattrs): Likewise.
+ * dwarf_haschildren.c (dwarf_haschildren): Likewise.
+ * dwarf_tag.c (dwarf_tag): Likewise.
+
+2014-12-04 Mark Wielaard <mjw@redhat.com>
+
+ * libdwP.h (__libdw_form_val_compute_len): Add endp argument.
+ (__libdw_form_val_len): Likewise and check len doesn't overflow.
+ * libdw_form.c (__libdw_form_val_compute_len): Likewise.
+ * dwarf_child.c (__libdw_find_attr): Call __libdw_form_val_len
+ with endp.
+ * dwarf_getattrs.c (dwarf_getattrs): Likewise.
+ * dwarf_getmacros.c (read_macros): Likewise and check for errors.
+
+2014-12-02 Petr Machata <pmachata@redhat.com>
+
+ * dwarf_getmacros.c (token_from_offset, offset_from_token): New
+ helper functions.
+ (do_dwarf_getmacros_die): Merge into dwarf_getmacros.
+ * libdw.h (DWARF_GETMACROS_START): New macro.
+
+2014-11-27 Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am (libdw.so): Use textrel_check.
+
+2014-11-27 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getcfi_elf.c (getcfi_gnu_eh_frame): Initialize
+ search_table_entries and search_table_encoding.
+
+2014-11-24 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (read_srclines): Check line_range is not zero
+ before usage.
+
+2014-11-23 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_attr.c (dwarf_attr): Check __libdw_find_attr return value.
+ * dwarf_hasattr.c (dwarf_hasattr): Likewise.
+ * dwarf_siblingof.c (dwarf_siblingof): Likewise.
+
+2014-11-23 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getabbrev.c (__libdw_getabbrev): Don't assert on bad DWARF.
+ Set libdw errno and return NULL.
+
+2014-11-24 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h (DW_LANG_C_plus_plus_11): Added.
+ (DW_LANG_C11): Likewise.
+ (DW_LANG_C_plus_plus_14): Likewise.
+ * dwarf_aggregate_size.c (array_size): Handle DW_LANG_C11,
+ DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14 and DW_LANG_Go
+ lower bound.
+ * dwarf_getfuncs.c (dwarf_getfuncs): Set c_cu to true for
+ DW_LANG_C11.
+
+2014-11-26 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h (DW_AT_noreturn): Added.
+
+2014-11-11 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (read_srclines): Do address_size comparison
+ explicitly as uint8_t.
+ (__libdw_getsrclines): Add internal_function to declaration.
+
+2014-09-10 Petr Machata <pmachata@redhat.com>
+
+ * dwarf_macro_getparamcnt.c: New file.
+ * dwarf_macro_param.c: New file.
+ * dwarf_macro_getsrcfiles.c: New file.
+ * Makefile.am (libdw_a_SOURCES): Add the new files.
+ * libdwP.h (struct files_lines_s): New structure.
+ (DWARF_E_INVALID_OPCODE): New enumerator.
+ (struct Dwarf): New fields macro_ops, files_lines.
+ (Dwarf_Macro_Op_Proto, Dwarf_Macro_Op_Table): New structures for
+ keeping macro opcode prototypes in.
+ (Dwarf_Macro_s): Redefine from scratch.
+ (__libdw_getsrclines, __libdw_getcompdir, libdw_macro_nforms): New
+ internal interfaces.
+ * dwarf_error.c (errmsgs): Add a message for
+ DWARF_E_INVALID_OPCODE.
+ * dwarf_end.c (dwarf_end): Destroy struct Dwarf.macro_ops and
+ files_lines.
+ * libdw.h (dwarf_getmacros_off, dwarf_macro_getparamcnt)
+ (dwarf_macro_getsrcfiles, dwarf_macro_param): New public
+ interfaces.
+ * dwarf_getmacros.c (dwarf_getmacros_off): New function,
+ (get_offset_from, macro_op_compare, build_table)
+ (init_macinfo_table, get_macinfo_table, get_table_for_offset)
+ (cache_op_table, read_macros, gnu_macros_getmacros_off)
+ (macro_info_getmacros_off, do_dwarf_getmacros_die): New helper
+ functions.
+ (dwarf_getmacros): Adjust to dispatch to the new interfaces.
+ * dwarf_getsrclines.c (read_srclines): New function with guts
+ taken from dwarf_getsrclines.
+ (__libdw_getsrclines): Likewise.
+ (__libdw_getcompdir, files_lines_compare): New functions.
+ (dwarf_getsrclines): Make it dispatch to the new interfaces.
+ * dwarf_macro_param1.c (dwarf_macro_param1): Adjust to dispatch to
+ the new interfaces.
+ * dwarf_macro_param2.c (dwarf_macro_param2): Likewise.
+ * libdw.map (ELFUTILS_0.161): New. Add dwarf_getmacros_off,
+ dwarf_macro_getsrcfiles, dwarf_macro_getparamcnt, dwarf_macro_param.
+
+2014-10-06 Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am (libdw_a_SOURCES): Add dwarf_peel_type.c.
+ * dwarf_aggregate_size.c (get_type): Use dwarf_peel_type.
+ (aggregate_size): Likewise. Add old and new version.
+ * dwarf_peel_type.c: New file.
+ * libdw.h (dwarf_peel_type): New function declaration.
+ * libdwP.h (dwarf_peel_type): New internal declaration.
+ * libdw.map (ELFUTILS_0.161): New section.
+
+2014-10-15 Petr Machata <pmachata@redhat.com>
+
+ * libdwP.h (struct Dwarf_Files_s.cu): Drop field.
+ * dwarf_getsrclines.c (dwarf_getsrclines): Don't set it.
+
+2014-10-05 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h: Add DW_AT_GNU_deleted.
+
+2014-10-02 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_aggregate_size.c (aggregate_size): Return CU address_size
+ for sizeless DW_TAG_pointer_type, DW_TAG_reference_type or
+ DW_TAG_rvalue_reference_type.
+
+2014-09-12 Petr Machata <pmachata@redhat.com>
+
+ * memory-access.h (read_ubyte_unaligned_inc): Allow only 4- and
+ 8-byte quantities. Consequently, rename to...
+ (read_addr_unaligned_inc): ... this.
+ (read_sbyte_unaligned_inc, read_ubyte_unaligned): Drop.
+ (read_sbyte_unaligned): Drop.
+
+2014-09-10 Petr Machata <pmachata@redhat.com>
+
+ * dwarf_getlocation.c (attr_ok): Also accept
+ DW_AT_GNU_call_site_value, DW_AT_GNU_call_site_data_value,
+ DW_AT_GNU_call_site_target, DW_AT_GNU_call_site_target_clobbered.
+
+2014-08-15 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_cu_die.c: New file.
+ * Makefile.am (libdw_a_SOURCES): Add dwarf_cu_die.c.
+ * libdw.h (dwarf_cu_die): New function declaration.
+ * libdw.map (ELFUTILS_0.160): Add dwarf_cu_die.
+
+2014-08-15 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_cu_getdwarf.c: New file.
+ * Makefile.am (libdw_a_SOURCES): Add dwarf_cu_getdwarf.c.
+ * libdw.h (Dwarf_CU): New typedef.
+ (dwarf_cu_getdwarf): New function declaration.
+ * libdw.map (ELFUTILS_0.160): New. Add dwarf_cu_getdwarf.
+
+2014-06-18 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h: Remove DW_TAG_mutable_type.
+
+2014-05-02 Mark Wielaard <mjw@redhat.com>
+
+ * libdwP.h (__check_build_id): Removed now unused.
+
+2014-05-01 Mark Wielaard <mjw@redhat.com>
+
+ * libdwP.h (struct Dwarf): Remove free_alt.
+ * dwarf_end.c (dwarf_end): Don't check free_alt, don't end alt_dwarf.
+ * dwarf_setalt.c (dwarf_setalt): Don't check or set free_alt.
+
+2014-04-30 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.159): Add dwelf_elf_gnu_build_id.
+
+2014-04-15 Florian Weimer <fweimer@redhat.com>
+
+ * dwarf_begin_elf.c (__check_build_id, try_debugaltlink)
+ (open_debugaltlink): Move to libdwfl.
+ (check_section): Do not locate alternate debuginfo.
+
+2014-04-24 Florian Weimer <fweimer@redhat.com>
+
+ * libdw.map (ELFUTILS_0.159): Export dwelf_dwarf_gnu_debugaltlink.
+
+2014-04-22 Florian Weimer <fweimer@redhat.com>
+
+ * dwarf_getalt.c, dwarf_setalt.c: New files.
+ * Makefile.am (libdw_a_SOURCES): Add them.
+ * libdw.h (dwarf_getalt, dwarf_setalt): Add function declarations.
+ * libdwP.h (dwarf_getalt, dwarf_setalt): Add internal function
+ declarations.
+ * libdw.map (ELFUTILS_0.159): Export the two new functions.
+
+2014-04-15 Florian Weimer <fweimer@redhat.com>
+
+ * libdwP.h (enum IDX_gnu_debugaltlink): New.
+ * dwarf_begin_elf.c (dwarf_scnnames): Increase string size and add
+ .gnu_debugaltlink.
+ (check_section): Obtain .gnu_debugaltlink section from the
+ setiondata array.
+
+2014-04-11 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.159): New. Add dwelf_elf_gnu_debuglink.
+ * Makefile.am (libdw.so): Depend on libdwelf_pic.a.
+ (libdwelf_objects): New variable.
+ (libdw_a_LIBADD): Add libdwelf objects.
+
+2014-04-22 Mark Wielaard <mjw@redhat.com>
+
+ * memory-access.h (get_sleb128_step): Remove undefined behavior
+ of left shifting a signed value. Replace it with a multiplication.
+
+2014-04-13 Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am: Remove !MUDFLAP conditions.
+
+2014-04-09 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_begin_elf.c (check_section): Check for unsigned overflow
+ before calling malloc to uncompress data.
+
+2014-03-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix abort() on missing section headers.
+ * dwarf_begin_elf.c (check_section): Replace abort call by goto err.
+ New label err to return NULL.
+
+2014-02-05 Josh Stone <jistone@redhat.com>
+
+ * dwarf_decl_file.c (dwarf_decl_file): Read the idx as unsigned.
+ * dwarf_decl_line.c (__libdw_attr_intval): Read the line/column as
+ unsigned. Change the range assert to DWARF_E_INVALID_DWARF.
+
+2013-12-30 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): Add dwfl_core_file_attach and
+ dwfl_linux_proc_attach.
+
+2013-12-20 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): Add dwfl_getthread_frames.
+
+2013-12-18 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): Remove dwfl_module_addrsym_elf and
+ dwfl_module_getsym_elf. Add dwfl_module_addrinfo and
+ dwfl_module_getsym_info.
+
+2013-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): Add dwfl_module_getsymtab_first_global.
+
+2013-12-10 Josh Stone <jistone@redhat.com>
+
+ * memory-access.h (get_uleb128_rest_return): Removed.
+ (get_sleb128_rest_return): Removed.
+ (get_uleb128_step): Make this a self-contained block.
+ (get_sleb128_step): Ditto, and use a bitfield to extend signs.
+ (get_uleb128): Make this wholly implemented by __libdw_get_uleb128.
+ (get_sleb128): Make this wholly implemented by __libdw_get_sleb128.
+ (__libdw_get_uleb128): Simplify and inline for all callers.
+ (__libdw_get_sleb128): Ditto.
+ * dwarf_getlocation.c (store_implicit_value): Void the unused uleb128.
+ * memory-access.c: Delete file.
+ * Makefile.am (libdw_a_SOURCES): Remove it.
+ (DEFS): Remove the now unused -DIS_LIBDW.
+
+2013-12-09 Josh Stone <jistone@redhat.com>
+
+ * libdw_form.c (__libdw_form_val_compute_len): Renamed function from
+ __libdw_form_val_len, now handling only non-constant form lengths.
+ * libdwP.h (__libdw_form_val_len): New inlined function.
+
+2013-12-09 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getlocation.c (__libdw_intern_expression): Handle empty
+ location expressions.
+ * dwarf_getlocation_attr.c (dwarf_getlocation_attr): When no
+ location found, return empty location expression.
+ * dwarf_getlocation_implicit_pointer.c
+ (dwarf_getlocation_implicit_pointer): Likewise.
+ (__libdw_empty_loc_attr): New internal function.
+ * libdwP.h (__libdw_empty_loc_attr): Define.
+
+2013-11-27 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): Add dwfl_module_addrsym_elf and
+ dwfl_module_getsym_elf.
+
+2013-11-26 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.156): Move dwfl_attach_state, dwfl_pid,
+ dwfl_thread_dwfl, dwfl_thread_tid, dwfl_frame_thread,
+ dwfl_thread_state_registers, dwfl_thread_state_register_pc,
+ dwfl_getthreads, dwfl_thread_getframes and dwfl_frame_pc to ...
+ (ELFUTILS_0.158): ... here.
+
+2013-11-09 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getaranges.c (dwarf_getaranges): Read segment_size and
+ check that it is zero.
+
+2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * cfi.h (struct Dwarf_Frame_s): Make the comment more specific.
+ * libdw.map (ELFUTILS_0.156): Add dwfl_attach_state, dwfl_pid,
+ dwfl_thread_dwfl, dwfl_thread_tid, dwfl_frame_thread,
+ dwfl_thread_state_registers, dwfl_thread_state_register_pc,
+ dwfl_getthreads, dwfl_thread_getframes and dwfl_frame_pc.
+
+2013-11-01 Michael Forney <mforney@mforney.org>
+
+ * Makefile.am (libdwfl_objects): New definition.
+ (libdw_a_LIBADD): Use libdwfl_objects.
+
+2013-11-01 Michael Forney <mforney@mforney.org>
+
+ * Makefile.am: Use READELF.
+
+2013-10-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): New.
+
+2013-10-10 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getfuncs.c (struct visitor_info): Rename start_offset to
+ start_addr and rename last_offset to last_addr. Now both void *.
+ (tree_visitor): Use start_add and die_addr instead of start_offset
+ and die_offset.
+ (dwarf_getfuncs): Use last_addr instead of last_offset.
+
+2013-10-06 Mark Wielaard <mjw@redhat.com>
+
+ * cfi.c (execute_cfi): Make sure DW_CFA_expression and
+ DW_CFA_val_expression are not used with abi_cfi.
+
+2013-10-03 Josh Stone <jistone@redhat.com>
+
+ * dwarf_formref_die.c (dwarf_formref_die): Don't hash the sig8 here.
+ * libdw_findcu.c (__libdw_intern_next_unit): Since this never revisits
+ a unit, make sure to always hash the sig8 here, so none are missed.
+
+2013-09-29 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getlocation.c (store_implicit_value): Cast op->number2 to
+ uintptr_t before casting to char *.
+ (__libdw_intern_expression): Cast data to uintptr_t before casting
+ to Dwarf_Word.
+ * dwarf_getlocation_attr.c (dwarf_getlocation_attr): Cast
+ op->number2 to uintptr_t before casting to char *.
+
+2013-09-24 Josh Stone <jistone@redhat.com>
+
+ * libdw_visit_scopes.c (classify_die): Removed.
+ (may_have_scopes): New function to replace classify_die. There's no
+ need for full classification; just find tags that may contain scopes.
+ (__libdw_visit_scopes): Use a direct tag comparison for imported
+ units, and use may_have_scopes to test if recursion is needed.
+
+2013-09-20 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getfuncs.c (visitor_info): New struct.
+ (tree_visitor): New function.
+ (dwarf_getfuncs): Use __libdw_visit_scopes with tree_visitor.
+ * libdw.h (dwarf_getfuncs): Expand function documentation.
+
+2013-09-12 Mark Wielaard <mjw@redhat.com>
+
+ * fde.c (intern_fde): Free fde and set libdw errno when start
+ or end could not be read.
+
+2013-08-24 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getlocation.c (store_implicit_value): Don't take data
+ as argument, get block data from op number2. Return false when
+ block data length and op number don't match up.
+ (__libdw_intern_expression): Store start of block for
+ DW_OP_implicit_value and DW_OP_GNU_entry_value instead of
+ relative data offset. Also store block start (including length)
+ for DW_OP_GNU_const_type. Don't pass data to store_implicit_value.
+ * dwarf_getlocation_attr.c: New file.
+ * dwarf_getlocation_die.c: Likewise.
+ * libdw.h (dwarf_getlocation_die): New function definition.
+ (dwarf_getlocation_attr): Likewise.
+ * libdwP.h: Declare internal dwarf_getlocation_die.
+ * libdw.map (ELFUTILS_0.157): Add dwarf_getlocation_die and
+ dwarf_getlocation_attr.
+ * Makefile.am (libdw_a_SOURCES): Add dwarf_getlocation_die.c and
+ dwarf_getlocation_attr.c.
+
+2013-08-23 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getlocation.c (attr_ok): Also accept DW_AT_segment.
+ (attr_base_address): New function.
+ (initial_offset_base): New function.
+ (getlocations_addr): New function. Taken from...
+ (dwarf_getlocation_addr): here. Use new initial_offset_base and
+ getlocations_addr.
+ (dwarf_getlocations): New function.
+ * libdw.h (dwarf_getlocations): New function definition.
+ * libdw.map (ELFUTILS_0.157): New.
+
+2013-07-02 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (dwarf_getsrclines): Add new stack allocation
+ limit MAX_STACK_ALLOC. After MAX_STACK_ALLOC lines use malloc in
+ NEW_LINE macro. Free malloced line records if any at the end.
+
+2013-07-02 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getcfi_elf.c (getcfi_shdr): Check sh_type == SHT_PROGBITS.
+
+2013-06-26 Mark Wielaard <mjw@redhat.com>
+
+ * libdw_visit_scopes.c (__libdw_visit_scopes): Don't reject root
+ DIEs without children. Return an error whenever dwarf_child or
+ dwarf_siblingof return an error. Don't call recurse and increase
+ the depth for an imported unit. Walk the children of an imported
+ unit as if they are logical children of the parent root DIE.
+
+2013-05-03 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (dwarf_getsrclines): Only set end_sequence
+ when nlinelist > 0.
+
+2013-04-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * libdw.map (ELFUTILS_0.156): New.
+
+2013-04-24 Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am: Use AM_CPPFLAGS instead of INCLUDES.
+
+2013-04-10 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_formref_die.c (dwarf_formref_die): Reference size is only
+ equal to address size when we have a DW_FORM_ref_addr for DWARF
+ version 2.
+
+2013-03-25 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (dwarf_getsrclines): Mark highest address as
+ end_sequence.
+
+2013-03-12 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrcfiles.c (dwarf_getsrcfiles): Allow DW_TAG_partial_unit.
+ * dwarf_getsrclines.c (dwarf_getsrclines): Likewise.
+
+2013-02-15 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_formstring.c (dwarf_formstring): Check dbg_ret->sectiondata,
+ not dbg->sectiondata.
+
+2013-01-07 Roland McGrath <roland@hack.frob.com>
+
+ * memory-access.h
+ [ALLOW_UNALIGNED] (read_8ubyte_unaligned_noncvt): New macro.
+ [!ALLOW_UNALIGNED] (read_8ubyte_unaligned_noncvt): New inline function.
+
+2012-12-18 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_begin_elf.c (valid_p): Call Dwarf_Sig8_Hash_free if invalid.
+ (check_section): Likewise on error.
+ (scngrp_read): Likewise.
+ (dwarf_begin_elf): Likewise.
+
+2012-10-09 Petr Machata <pmachata@redhat.com>
+
+ * dwarf_getlocation.c (__libdw_intern_expression): Handle
+ DW_OP_GNU_parameter_ref, DW_OP_GNU_convert, DW_OP_GNU_reinterpret,
+ DW_OP_GNU_regval_type, DW_OP_GNU_entry_value,
+ DW_OP_GNU_deref_type, DW_OP_GNU_const_type.
+
+2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * cfi.c: New include system.h.
+ (execute_cfi) (enough_registers): Clear new memory after realloc.
+
+2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * fde.c (__libdw_find_fde): Change <fde != NULL> to likely. Return
+ DWARF_E_NO_MATCH if .eh_frame_hdr points to FDE which is too short for
+ searched PC.
+
+2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwarf_getlocation.c (__libdw_intern_expression) <cfap>: Make new
+ loclist element DW_OP_call_frame_cfa before decoding the opcodes.
+ Remove the later DW_OP_call_frame_cfa push to RESULT.
+
+2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup.
+ * fde.c (binary_search_fde): Remove always true <address >= start>
+ conditional. Move L initialization upwards.
+
+2012-08-24 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_begin_elf.c (check_section): Only probe for dwz multi files
+ when ENABLE_DWZ is defined.
+ * libdwP.h (__check_build_id): Only declare when ENABLE_DWZ is
+ defined.
+
+2012-08-16 Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am (EXTRA_DIST): Add known-dwarf.h.
+ * dwarf.h (DW_LANG_Go): Update comment.
+ (DW_LANG_Mips_Assembler): Likewise.
+
+2012-06-27 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h: Add DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt.
+ * dwarf_begin.c (dwarf_begin): Add INTDEF.
+ * dwarf_begin_elf.c (__check_build_id): New internal_function.
+ (try_debugaltlink): New function.
+ (open_debugaltlink): Likewise.
+ (check_section): Try open_debugaltlink for .gnu_debugaltlink.
+ * dwarf_end.c (dwarf_end): Free the alternative Dwarf descriptor if
+ necessary.
+ * dwarf_error.c (errmsgs): Add DWARF_E_NO_ALT_DEBUGLINK.
+ * dwarf_formref.c (__libdw_formref): Using DW_FORM_GNU_ref_alt
+ is an error here.
+ * dwarf_formref_die.c (dwarf_formref_die): Handle DW_FORM_GNU_ref_alt.
+ * dwarf_formstring.c (dwarf_formstring): Handle DW_FORM_GNU_strp_alt.
+ * dwarf_formudata.c (__libdw_formptr): Adjust __libdw_read_offset
+ calls.
+ * dwarf_getpubnames.c (get_offsets): Adjust __libdw_read_offset call.
+ * libdwP.h: Add DWARF_E_NO_ALT_DEBUGLINK.
+ (struct Dwarf): Add alt_dwarf and free_alt fields.
+ (__libdw_read_offset): Add dbg_ret argument, use to check with
+ __libdw_offset_in_section.
+ (__check_build_id): New function declaration.
+ (dwarf_begin): Define as INTDECL.
+ * libdw_form.c (__libdw_form_val_len): Handle DW_FORM_GNU_ref_alt
+ and DW_FORM_GNU_strp_alt.
+
+2012-07-19 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h: Add DW_OP_GNU_parameter_ref.
+
+2012-07-24 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h: Correct spelling of DW_LANG_ObjC.
+ * dwarf_aggregate_size.c (array_size): Use correct spelling of
+ DW_LANG_ObjC.
+
+2012-07-24 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h: Add DW_ATE_UTF.
+
+2012-06-27 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf.h: Add DW_MACRO_GNU .debug_macro type encodings.
+
+2012-06-26 Mark Wielaard <mjw@redhat.com>
+
+ * libdwP.h: Add IDX_debug_macro.
+ * dwarf.h: Add DW_AT_GNU_macros.
+ * dwarf_begin_elf.c (dwarf_scnnames): Add .debug_macro.
+ * dwarf_formudata.c (dwarf_formudata): Recognize DW_AT_GNU_macros.
+
+2012-04-27 Mark Wielaard <mjw@redhat.com>
+
+ * libdw/dwarf_highpc.c (dwarf_highpc): Handle DW_AT_high_pc being
+ a constant offset from DW_AT_low_pc.
+
+2012-03-19 Tom Tromey <tromey@redhat.com>
+
+ * libdw_findcu.c (findcu_cb): Move earlier.
+ (__libdw_intern_next_unit): Add new CU to search tree here...
+ (__libdw_findcu): ... not here.
+
2012-01-31 Mark Wielaard <mjw@redhat.com>
* dwarf_formudata.c (dwarf_formudata): Handle DW_FORM_sec_offset.
diff --git a/src/libdw/Makefile b/src/libdw/Makefile
new file mode 100644
index 00000000..4c1acaa5
--- /dev/null
+++ b/src/libdw/Makefile
@@ -0,0 +1,986 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# libdw/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+
+
+
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/elfutils
+pkgincludedir = $(includedir)/elfutils
+pkglibdir = $(libdir)/elfutils
+pkglibexecdir = $(libexecdir)/elfutils
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-unknown-linux-gnu
+host_triplet = x86_64-unknown-linux-gnu
+DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
+ $(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ ChangeLog
+#am__append_1 = -fpic
+noinst_PROGRAMS = $(am__EXEEXT_1)
+subdir = libdw
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \
+ "$(DESTDIR)$(pkgincludedir)"
+LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES)
+ARFLAGS = cru
+AM_V_AR = $(am__v_AR_$(V))
+am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY))
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
+libdw_a_AR = $(AR) $(ARFLAGS)
+libdw_a_DEPENDENCIES = $(addprefix ../libdwfl/,$(libdwfl_objects)) \
+ $(addprefix ../libdwelf/,$(libdwelf_objects))
+am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \
+ dwarf_end.$(OBJEXT) dwarf_getelf.$(OBJEXT) \
+ dwarf_getpubnames.$(OBJEXT) dwarf_getabbrev.$(OBJEXT) \
+ dwarf_tag.$(OBJEXT) dwarf_error.$(OBJEXT) \
+ dwarf_nextcu.$(OBJEXT) dwarf_diename.$(OBJEXT) \
+ dwarf_offdie.$(OBJEXT) dwarf_attr.$(OBJEXT) \
+ dwarf_formstring.$(OBJEXT) dwarf_abbrev_hash.$(OBJEXT) \
+ dwarf_sig8_hash.$(OBJEXT) dwarf_attr_integrate.$(OBJEXT) \
+ dwarf_hasattr_integrate.$(OBJEXT) dwarf_child.$(OBJEXT) \
+ dwarf_haschildren.$(OBJEXT) dwarf_formaddr.$(OBJEXT) \
+ dwarf_formudata.$(OBJEXT) dwarf_formsdata.$(OBJEXT) \
+ dwarf_lowpc.$(OBJEXT) dwarf_entrypc.$(OBJEXT) \
+ dwarf_haspc.$(OBJEXT) dwarf_highpc.$(OBJEXT) \
+ dwarf_ranges.$(OBJEXT) dwarf_formref.$(OBJEXT) \
+ dwarf_formref_die.$(OBJEXT) dwarf_siblingof.$(OBJEXT) \
+ dwarf_dieoffset.$(OBJEXT) dwarf_cuoffset.$(OBJEXT) \
+ dwarf_diecu.$(OBJEXT) dwarf_hasattr.$(OBJEXT) \
+ dwarf_hasform.$(OBJEXT) dwarf_whatform.$(OBJEXT) \
+ dwarf_whatattr.$(OBJEXT) dwarf_bytesize.$(OBJEXT) \
+ dwarf_arrayorder.$(OBJEXT) dwarf_bitsize.$(OBJEXT) \
+ dwarf_bitoffset.$(OBJEXT) dwarf_srclang.$(OBJEXT) \
+ dwarf_getabbrevtag.$(OBJEXT) dwarf_getabbrevcode.$(OBJEXT) \
+ dwarf_abbrevhaschildren.$(OBJEXT) dwarf_getattrcnt.$(OBJEXT) \
+ dwarf_getabbrevattr.$(OBJEXT) dwarf_getsrclines.$(OBJEXT) \
+ dwarf_getsrc_die.$(OBJEXT) dwarf_getscopes.$(OBJEXT) \
+ dwarf_getscopes_die.$(OBJEXT) dwarf_getscopevar.$(OBJEXT) \
+ dwarf_linesrc.$(OBJEXT) dwarf_lineno.$(OBJEXT) \
+ dwarf_lineaddr.$(OBJEXT) dwarf_linecol.$(OBJEXT) \
+ dwarf_linebeginstatement.$(OBJEXT) \
+ dwarf_lineendsequence.$(OBJEXT) dwarf_lineblock.$(OBJEXT) \
+ dwarf_lineprologueend.$(OBJEXT) \
+ dwarf_lineepiloguebegin.$(OBJEXT) dwarf_lineisa.$(OBJEXT) \
+ dwarf_linediscriminator.$(OBJEXT) dwarf_lineop_index.$(OBJEXT) \
+ dwarf_onesrcline.$(OBJEXT) dwarf_formblock.$(OBJEXT) \
+ dwarf_getsrcfiles.$(OBJEXT) dwarf_filesrc.$(OBJEXT) \
+ dwarf_getsrcdirs.$(OBJEXT) dwarf_getlocation.$(OBJEXT) \
+ dwarf_getstring.$(OBJEXT) dwarf_offabbrev.$(OBJEXT) \
+ dwarf_getaranges.$(OBJEXT) dwarf_onearange.$(OBJEXT) \
+ dwarf_getarangeinfo.$(OBJEXT) dwarf_getarange_addr.$(OBJEXT) \
+ dwarf_getattrs.$(OBJEXT) dwarf_formflag.$(OBJEXT) \
+ dwarf_getmacros.$(OBJEXT) dwarf_macro_getparamcnt.$(OBJEXT) \
+ dwarf_macro_opcode.$(OBJEXT) dwarf_macro_param.$(OBJEXT) \
+ dwarf_macro_param1.$(OBJEXT) dwarf_macro_param2.$(OBJEXT) \
+ dwarf_macro_getsrcfiles.$(OBJEXT) dwarf_addrdie.$(OBJEXT) \
+ dwarf_getfuncs.$(OBJEXT) dwarf_decl_file.$(OBJEXT) \
+ dwarf_decl_line.$(OBJEXT) dwarf_decl_column.$(OBJEXT) \
+ dwarf_func_inline.$(OBJEXT) dwarf_getsrc_file.$(OBJEXT) \
+ libdw_findcu.$(OBJEXT) libdw_form.$(OBJEXT) \
+ libdw_alloc.$(OBJEXT) libdw_visit_scopes.$(OBJEXT) \
+ dwarf_entry_breakpoints.$(OBJEXT) dwarf_next_cfi.$(OBJEXT) \
+ cie.$(OBJEXT) fde.$(OBJEXT) cfi.$(OBJEXT) \
+ frame-cache.$(OBJEXT) dwarf_frame_info.$(OBJEXT) \
+ dwarf_frame_cfa.$(OBJEXT) dwarf_frame_register.$(OBJEXT) \
+ dwarf_cfi_addrframe.$(OBJEXT) dwarf_getcfi.$(OBJEXT) \
+ dwarf_getcfi_elf.$(OBJEXT) dwarf_cfi_end.$(OBJEXT) \
+ dwarf_aggregate_size.$(OBJEXT) \
+ dwarf_getlocation_implicit_pointer.$(OBJEXT) \
+ dwarf_getlocation_die.$(OBJEXT) \
+ dwarf_getlocation_attr.$(OBJEXT) dwarf_getalt.$(OBJEXT) \
+ dwarf_setalt.$(OBJEXT) dwarf_cu_getdwarf.$(OBJEXT) \
+ dwarf_cu_die.$(OBJEXT) dwarf_peel_type.$(OBJEXT)
+libdw_a_OBJECTS = $(am_libdw_a_OBJECTS)
+libdw_pic_a_AR = $(AR) $(ARFLAGS)
+libdw_pic_a_LIBADD =
+libdw_pic_a_OBJECTS = $(am_libdw_pic_a_OBJECTS)
+am__EXEEXT_1 = libdw.so$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+am_libdw_so_OBJECTS =
+libdw_so_OBJECTS = $(am_libdw_so_OBJECTS)
+libdw_so_LDADD = $(LDADD)
+AM_V_P = $(am__v_P_$(V))
+am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I. -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \
+ $(libdw_so_SOURCES)
+DIST_SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \
+ $(libdw_so_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing aclocal-1.14
+AMTAR = $${TAR-tar}
+AM_DEFAULT_VERBOSITY = 1
+AR = ar
+AUTOCONF = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing autoconf
+AUTOHEADER = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing autoheader
+AUTOMAKE = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing automake-1.14
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CC_BIARCH = gcc -m32
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEBUGPRED = 0
+DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
+DEPDIR = .deps
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+GETTEXT_MACRO_VERSION = 0.18
+GMSGFMT = /usr/bin/msgfmt
+GMSGFMT_015 = /usr/bin/msgfmt
+GREP = /bin/grep
+HAVE_VALGRIND =
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LDFLAGS =
+LEX = flex
+LEXLIB = -lfl
+LEX_OUTPUT_ROOT = lex.yy
+LIBEBL_SUBDIR = elfutils
+LIBOBJS =
+LIBS =
+LTLIBOBJS =
+MAINT = #
+MAKEINFO = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/missing makeinfo
+MKDIR_P = /bin/mkdir -p
+MODVERSION = Build on enh.mtv.corp.google.com 2015-02-18T19:32:04-0800
+MSGFMT = /usr/bin/msgfmt
+MSGFMT_015 = /usr/bin/msgfmt
+MSGMERGE = /usr/bin/msgmerge
+NM = nm
+OBJEXT = o
+PACKAGE = elfutils
+PACKAGE_BUGREPORT = https://bugzilla.redhat.com/
+PACKAGE_NAME = elfutils
+PACKAGE_STRING = elfutils 0.161
+PACKAGE_TARNAME = elfutils
+PACKAGE_URL =
+PACKAGE_VERSION = 0.161
+PATH_SEPARATOR = :
+RANLIB = ranlib
+READELF = readelf
+SET_MAKE =
+SHELL = /bin/sh
+STRIP =
+USE_NLS = yes
+VERSION = 1
+XGETTEXT = /usr/bin/xgettext
+XGETTEXT_015 = /usr/bin/xgettext
+XGETTEXT_EXTRA_OPTIONS =
+YACC = bison -y
+YFLAGS =
+abs_builddir = /huge-ssd/aosp-arm64/external/elfutils/src/libdw
+abs_srcdir = /huge-ssd/aosp-arm64/external/elfutils/src/libdw
+abs_top_builddir = /huge-ssd/aosp-arm64/external/elfutils/src
+abs_top_srcdir = /huge-ssd/aosp-arm64/external/elfutils/src
+ac_ct_AR = ar
+ac_ct_CC = gcc
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = $${TAR-tar} chof - "$$tardir"
+am__untar = $${TAR-tar} xf -
+base_cpu = none
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-linux-gnu
+build_alias =
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+eu_version = 161
+exec_prefix = ${prefix}
+host = x86_64-unknown-linux-gnu
+host_alias =
+host_cpu = x86_64
+host_os = linux-gnu
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = ${SHELL} /huge-ssd/aosp-arm64/external/elfutils/src/config/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = $(MKDIR_P)
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias =
+top_build_prefix = ../
+top_builddir = ..
+top_srcdir = ..
+zip_LIBS = -lz
+AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
+ -I$(srcdir)/../libelf
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
+ $($(*F)_no_Werror),,-Werror) $(if \
+ $($(*F)_no_Wunused),,-Wunused -Wextra) $($(*F)_CFLAGS) \
+ $(am__append_1)
+COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
+CLEANFILES = *.gcno *.gcda
+textrel_msg = echo "WARNING: TEXTREL found in '$@'"
+#textrel_found = $(textrel_msg)
+textrel_found = $(textrel_msg); exit 1
+textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi
+lib_LIBRARIES = libdw.a
+noinst_LIBRARIES = libdw_pic.a
+include_HEADERS = dwarf.h
+pkginclude_HEADERS = libdw.h
+libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
+ dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \
+ dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
+ dwarf_attr.c dwarf_formstring.c \
+ dwarf_abbrev_hash.c dwarf_sig8_hash.c \
+ dwarf_attr_integrate.c dwarf_hasattr_integrate.c \
+ dwarf_child.c dwarf_haschildren.c dwarf_formaddr.c \
+ dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \
+ dwarf_entrypc.c dwarf_haspc.c dwarf_highpc.c dwarf_ranges.c \
+ dwarf_formref.c dwarf_formref_die.c dwarf_siblingof.c \
+ dwarf_dieoffset.c dwarf_cuoffset.c dwarf_diecu.c \
+ dwarf_hasattr.c dwarf_hasform.c \
+ dwarf_whatform.c dwarf_whatattr.c \
+ dwarf_bytesize.c dwarf_arrayorder.c dwarf_bitsize.c \
+ dwarf_bitoffset.c dwarf_srclang.c dwarf_getabbrevtag.c \
+ dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \
+ dwarf_getattrcnt.c dwarf_getabbrevattr.c \
+ dwarf_getsrclines.c dwarf_getsrc_die.c \
+ dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \
+ dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \
+ dwarf_linecol.c dwarf_linebeginstatement.c \
+ dwarf_lineendsequence.c dwarf_lineblock.c \
+ dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \
+ dwarf_lineisa.c dwarf_linediscriminator.c \
+ dwarf_lineop_index.c \
+ dwarf_onesrcline.c dwarf_formblock.c \
+ dwarf_getsrcfiles.c dwarf_filesrc.c dwarf_getsrcdirs.c \
+ dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \
+ dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \
+ dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \
+ dwarf_getmacros.c dwarf_macro_getparamcnt.c \
+ dwarf_macro_opcode.c dwarf_macro_param.c \
+ dwarf_macro_param1.c dwarf_macro_param2.c \
+ dwarf_macro_getsrcfiles.c \
+ dwarf_addrdie.c dwarf_getfuncs.c \
+ dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \
+ dwarf_func_inline.c dwarf_getsrc_file.c \
+ libdw_findcu.c libdw_form.c libdw_alloc.c \
+ libdw_visit_scopes.c \
+ dwarf_entry_breakpoints.c \
+ dwarf_next_cfi.c \
+ cie.c fde.c cfi.c frame-cache.c \
+ dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \
+ dwarf_cfi_addrframe.c \
+ dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
+ dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \
+ dwarf_getlocation_die.c dwarf_getlocation_attr.c \
+ dwarf_getalt.c dwarf_setalt.c dwarf_cu_getdwarf.c \
+ dwarf_cu_die.c dwarf_peel_type.c
+
+#BUILT_SOURCES = $(srcdir)/known-dwarf.h
+#MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h
+libdw_pic_a_SOURCES =
+am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
+libdw_so_SOURCES =
+libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
+libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects)) \
+ $(addprefix ../libdwelf/,$(libdwelf_objects))
+libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
+noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
+ dwarf_sig8_hash.h cfi.h encoded-value.h
+
+EXTRA_DIST = libdw.map known-dwarf.h
+MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so.$(VERSION)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(top_srcdir)/config/eu.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits libdw/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnits libdw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+$(top_srcdir)/config/eu.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: # $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(libdir)'; $(am__uninstall_files_from_dir)
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+libdw.a: $(libdw_a_OBJECTS) $(libdw_a_DEPENDENCIES) $(EXTRA_libdw_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libdw.a
+ $(AM_V_AR)$(libdw_a_AR) libdw.a $(libdw_a_OBJECTS) $(libdw_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libdw.a
+
+libdw_pic.a: $(libdw_pic_a_OBJECTS) $(libdw_pic_a_DEPENDENCIES) $(EXTRA_libdw_pic_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libdw_pic.a
+ $(AM_V_AR)$(libdw_pic_a_AR) libdw_pic.a $(libdw_pic_a_OBJECTS) $(libdw_pic_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libdw_pic.a
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/cfi.Po
+include ./$(DEPDIR)/cie.Po
+include ./$(DEPDIR)/dwarf_abbrev_hash.Po
+include ./$(DEPDIR)/dwarf_abbrevhaschildren.Po
+include ./$(DEPDIR)/dwarf_addrdie.Po
+include ./$(DEPDIR)/dwarf_aggregate_size.Po
+include ./$(DEPDIR)/dwarf_arrayorder.Po
+include ./$(DEPDIR)/dwarf_attr.Po
+include ./$(DEPDIR)/dwarf_attr_integrate.Po
+include ./$(DEPDIR)/dwarf_begin.Po
+include ./$(DEPDIR)/dwarf_begin_elf.Po
+include ./$(DEPDIR)/dwarf_bitoffset.Po
+include ./$(DEPDIR)/dwarf_bitsize.Po
+include ./$(DEPDIR)/dwarf_bytesize.Po
+include ./$(DEPDIR)/dwarf_cfi_addrframe.Po
+include ./$(DEPDIR)/dwarf_cfi_end.Po
+include ./$(DEPDIR)/dwarf_child.Po
+include ./$(DEPDIR)/dwarf_cu_die.Po
+include ./$(DEPDIR)/dwarf_cu_getdwarf.Po
+include ./$(DEPDIR)/dwarf_cuoffset.Po
+include ./$(DEPDIR)/dwarf_decl_column.Po
+include ./$(DEPDIR)/dwarf_decl_file.Po
+include ./$(DEPDIR)/dwarf_decl_line.Po
+include ./$(DEPDIR)/dwarf_diecu.Po
+include ./$(DEPDIR)/dwarf_diename.Po
+include ./$(DEPDIR)/dwarf_dieoffset.Po
+include ./$(DEPDIR)/dwarf_end.Po
+include ./$(DEPDIR)/dwarf_entry_breakpoints.Po
+include ./$(DEPDIR)/dwarf_entrypc.Po
+include ./$(DEPDIR)/dwarf_error.Po
+include ./$(DEPDIR)/dwarf_filesrc.Po
+include ./$(DEPDIR)/dwarf_formaddr.Po
+include ./$(DEPDIR)/dwarf_formblock.Po
+include ./$(DEPDIR)/dwarf_formflag.Po
+include ./$(DEPDIR)/dwarf_formref.Po
+include ./$(DEPDIR)/dwarf_formref_die.Po
+include ./$(DEPDIR)/dwarf_formsdata.Po
+include ./$(DEPDIR)/dwarf_formstring.Po
+include ./$(DEPDIR)/dwarf_formudata.Po
+include ./$(DEPDIR)/dwarf_frame_cfa.Po
+include ./$(DEPDIR)/dwarf_frame_info.Po
+include ./$(DEPDIR)/dwarf_frame_register.Po
+include ./$(DEPDIR)/dwarf_func_inline.Po
+include ./$(DEPDIR)/dwarf_getabbrev.Po
+include ./$(DEPDIR)/dwarf_getabbrevattr.Po
+include ./$(DEPDIR)/dwarf_getabbrevcode.Po
+include ./$(DEPDIR)/dwarf_getabbrevtag.Po
+include ./$(DEPDIR)/dwarf_getalt.Po
+include ./$(DEPDIR)/dwarf_getarange_addr.Po
+include ./$(DEPDIR)/dwarf_getarangeinfo.Po
+include ./$(DEPDIR)/dwarf_getaranges.Po
+include ./$(DEPDIR)/dwarf_getattrcnt.Po
+include ./$(DEPDIR)/dwarf_getattrs.Po
+include ./$(DEPDIR)/dwarf_getcfi.Po
+include ./$(DEPDIR)/dwarf_getcfi_elf.Po
+include ./$(DEPDIR)/dwarf_getelf.Po
+include ./$(DEPDIR)/dwarf_getfuncs.Po
+include ./$(DEPDIR)/dwarf_getlocation.Po
+include ./$(DEPDIR)/dwarf_getlocation_attr.Po
+include ./$(DEPDIR)/dwarf_getlocation_die.Po
+include ./$(DEPDIR)/dwarf_getlocation_implicit_pointer.Po
+include ./$(DEPDIR)/dwarf_getmacros.Po
+include ./$(DEPDIR)/dwarf_getpubnames.Po
+include ./$(DEPDIR)/dwarf_getscopes.Po
+include ./$(DEPDIR)/dwarf_getscopes_die.Po
+include ./$(DEPDIR)/dwarf_getscopevar.Po
+include ./$(DEPDIR)/dwarf_getsrc_die.Po
+include ./$(DEPDIR)/dwarf_getsrc_file.Po
+include ./$(DEPDIR)/dwarf_getsrcdirs.Po
+include ./$(DEPDIR)/dwarf_getsrcfiles.Po
+include ./$(DEPDIR)/dwarf_getsrclines.Po
+include ./$(DEPDIR)/dwarf_getstring.Po
+include ./$(DEPDIR)/dwarf_hasattr.Po
+include ./$(DEPDIR)/dwarf_hasattr_integrate.Po
+include ./$(DEPDIR)/dwarf_haschildren.Po
+include ./$(DEPDIR)/dwarf_hasform.Po
+include ./$(DEPDIR)/dwarf_haspc.Po
+include ./$(DEPDIR)/dwarf_highpc.Po
+include ./$(DEPDIR)/dwarf_lineaddr.Po
+include ./$(DEPDIR)/dwarf_linebeginstatement.Po
+include ./$(DEPDIR)/dwarf_lineblock.Po
+include ./$(DEPDIR)/dwarf_linecol.Po
+include ./$(DEPDIR)/dwarf_linediscriminator.Po
+include ./$(DEPDIR)/dwarf_lineendsequence.Po
+include ./$(DEPDIR)/dwarf_lineepiloguebegin.Po
+include ./$(DEPDIR)/dwarf_lineisa.Po
+include ./$(DEPDIR)/dwarf_lineno.Po
+include ./$(DEPDIR)/dwarf_lineop_index.Po
+include ./$(DEPDIR)/dwarf_lineprologueend.Po
+include ./$(DEPDIR)/dwarf_linesrc.Po
+include ./$(DEPDIR)/dwarf_lowpc.Po
+include ./$(DEPDIR)/dwarf_macro_getparamcnt.Po
+include ./$(DEPDIR)/dwarf_macro_getsrcfiles.Po
+include ./$(DEPDIR)/dwarf_macro_opcode.Po
+include ./$(DEPDIR)/dwarf_macro_param.Po
+include ./$(DEPDIR)/dwarf_macro_param1.Po
+include ./$(DEPDIR)/dwarf_macro_param2.Po
+include ./$(DEPDIR)/dwarf_next_cfi.Po
+include ./$(DEPDIR)/dwarf_nextcu.Po
+include ./$(DEPDIR)/dwarf_offabbrev.Po
+include ./$(DEPDIR)/dwarf_offdie.Po
+include ./$(DEPDIR)/dwarf_onearange.Po
+include ./$(DEPDIR)/dwarf_onesrcline.Po
+include ./$(DEPDIR)/dwarf_peel_type.Po
+include ./$(DEPDIR)/dwarf_ranges.Po
+include ./$(DEPDIR)/dwarf_setalt.Po
+include ./$(DEPDIR)/dwarf_siblingof.Po
+include ./$(DEPDIR)/dwarf_sig8_hash.Po
+include ./$(DEPDIR)/dwarf_srclang.Po
+include ./$(DEPDIR)/dwarf_tag.Po
+include ./$(DEPDIR)/dwarf_whatattr.Po
+include ./$(DEPDIR)/dwarf_whatform.Po
+include ./$(DEPDIR)/fde.Po
+include ./$(DEPDIR)/frame-cache.Po
+include ./$(DEPDIR)/libdw_alloc.Po
+include ./$(DEPDIR)/libdw_findcu.Po
+include ./$(DEPDIR)/libdw_form.Po
+include ./$(DEPDIR)/libdw_visit_scopes.Po
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# $(AM_V_CC)source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(AM_V_CC_no)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# $(AM_V_CC)source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
+ done
+
+uninstall-pkgincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install-exec: install-exec-am
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \
+ clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS install-pkgincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \
+ uninstall-pkgincludeHEADERS
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am \
+ install-includeHEADERS install-info install-info-am \
+ install-libLIBRARIES install-man install-pdf install-pdf-am \
+ install-pkgincludeHEADERS install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-includeHEADERS \
+ uninstall-libLIBRARIES uninstall-pkgincludeHEADERS
+
+
+%.os: %.c %.o
+ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
+ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
+ rm -f "$(DEPDIR)/$*.Tpo"; \
+ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ fi
+# $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $<
+#$(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h
+# gawk -f $^ > $@.new
+# mv -f $@.new $@
+libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
+ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
+ ../libelf/libelf.so
+# The rpath is necessary for libebl because its $ORIGIN use will
+# not fly in a setuid executable that links in libdw.
+ $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
+ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ -Wl,--version-script,$<,--no-undefined \
+ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+ -ldl $(zip_LIBS)
+ @$(textrel_check)
+ ln -fs $@ $@.$(VERSION)
+
+install: install-am libdw.so
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
+ ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
+ ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
+
+uninstall: uninstall-am
+ rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
+ rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
+ rm -f $(DESTDIR)$(libdir)/libdw.so
+ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/libdw/Makefile.am b/src/libdw/Makefile.am
index 1efda358..887da6b0 100644
--- a/src/libdw/Makefile.am
+++ b/src/libdw/Makefile.am
@@ -1,42 +1,42 @@
## Process this file with automake to create Makefile.in
##
-## Copyright (C) 2002-2010 Red Hat, Inc.
-## This file is part of Red Hat elfutils.
+## Copyright (C) 2002-2010, 2012, 2014 Red Hat, Inc.
+## This file is part of elfutils.
##
-## Red Hat elfutils is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by the
-## Free Software Foundation; version 2 of the License.
+## This file is free software; you can redistribute it and/or modify
+## it under the terms of either
##
-## Red Hat elfutils is distributed in the hope that it will be useful, but
+## * the GNU Lesser General Public License as published by the Free
+## Software Foundation; either version 3 of the License, or (at
+## your option) any later version
+##
+## or
+##
+## * the GNU General Public License as published by the Free
+## Software Foundation; either version 2 of the License, or (at
+## your option) any later version
+##
+## or both in parallel, as here.
+##
+## elfutils is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
-## You should have received a copy of the GNU General Public License along
-## with Red Hat elfutils; if not, write to the Free Software Foundation,
-## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-##
-## Red Hat elfutils is an included package of the Open Invention Network.
-## An included package of the Open Invention Network is a package for which
-## Open Invention Network licensees cross-license their patents. No patent
-## license is granted, either expressly or impliedly, by designation as an
-## included package. Should you wish to participate in the Open Invention
-## Network licensing program, please visit www.openinventionnetwork.com
-## <http://www.openinventionnetwork.com>.
+## You should have received copies of the GNU General Public License and
+## the GNU Lesser General Public License along with this program. If
+## not, see <http://www.gnu.org/licenses/>.
##
include $(top_srcdir)/config/eu.am
-DEFS += -DIS_LIBDW
if BUILD_STATIC
AM_CFLAGS += -fpic
endif
-INCLUDES += -I$(srcdir)/../libelf
+AM_CPPFLAGS += -I$(srcdir)/../libelf
VERSION = 1
lib_LIBRARIES = libdw.a
-if !MUDFLAP
noinst_LIBRARIES = libdw_pic.a
noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
-endif
include_HEADERS = dwarf.h
pkginclude_HEADERS = libdw.h
@@ -71,12 +71,14 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \
dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \
dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \
- dwarf_getmacros.c dwarf_macro_opcode.c dwarf_macro_param1.c \
- dwarf_macro_param2.c dwarf_addrdie.c \
- dwarf_getfuncs.c \
+ dwarf_getmacros.c dwarf_macro_getparamcnt.c \
+ dwarf_macro_opcode.c dwarf_macro_param.c \
+ dwarf_macro_param1.c dwarf_macro_param2.c \
+ dwarf_macro_getsrcfiles.c \
+ dwarf_addrdie.c dwarf_getfuncs.c \
dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \
dwarf_func_inline.c dwarf_getsrc_file.c \
- libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \
+ libdw_findcu.c libdw_form.c libdw_alloc.c \
libdw_visit_scopes.c \
dwarf_entry_breakpoints.c \
dwarf_next_cfi.c \
@@ -84,7 +86,10 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \
dwarf_cfi_addrframe.c \
dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
- dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c
+ dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \
+ dwarf_getlocation_die.c dwarf_getlocation_attr.c \
+ dwarf_getalt.c dwarf_setalt.c dwarf_cu_getdwarf.c \
+ dwarf_cu_die.c dwarf_peel_type.c
if MAINTAINER_MODE
BUILT_SOURCES = $(srcdir)/known-dwarf.h
@@ -94,12 +99,11 @@ $(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h
mv -f $@.new $@
endif
-if !MUDFLAP
libdw_pic_a_SOURCES =
am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
libdw_so_SOURCES =
-libdw.so: $(srcdir)/libdw.map libdw_pic.a \
+libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
../libelf/libelf.so
# The rpath is necessary for libebl because its $ORIGIN use will
@@ -109,7 +113,7 @@ libdw.so: $(srcdir)/libdw.map libdw_pic.a \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-ldl $(zip_LIBS)
- if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ @$(textrel_check)
ln -fs $@ $@.$(VERSION)
install: install-am libdw.so
@@ -123,13 +127,16 @@ uninstall: uninstall-am
rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
rm -f $(DESTDIR)$(libdir)/libdw.so
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
-endif
-libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a))
+libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
+libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
+
+libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
+libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
dwarf_sig8_hash.h cfi.h encoded-value.h
-EXTRA_DIST = libdw.map
+EXTRA_DIST = libdw.map known-dwarf.h
MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so.$(VERSION)
diff --git a/src/libdw/Makefile.in b/src/libdw/Makefile.in
index 6cbfeaaf..5e348ebe 100644
--- a/src/libdw/Makefile.in
+++ b/src/libdw/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -18,6 +17,51 @@
VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -36,16 +80,16 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
- $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog
-@MUDFLAP_TRUE@am__append_1 = -fmudflap
-@BUILD_STATIC_TRUE@am__append_2 = -fpic
-@MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
-@MUDFLAP_TRUE@am_libdw_pic_a_OBJECTS =
+DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
+ $(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ ChangeLog
+@BUILD_STATIC_TRUE@am__append_1 = -fpic
+noinst_PROGRAMS = $(am__EXEEXT_1)
subdir = libdw
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -75,14 +119,23 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \
"$(DESTDIR)$(pkgincludedir)"
LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES)
-AR = ar
ARFLAGS = cru
+AM_V_AR = $(am__v_AR_@AM_V@)
+am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
libdw_a_AR = $(AR) $(ARFLAGS)
-libdw_a_DEPENDENCIES = $(addprefix ../libdwfl/,$(shell $(AR) t \
- ../libdwfl/libdwfl.a))
+libdw_a_DEPENDENCIES = $(addprefix ../libdwfl/,$(libdwfl_objects)) \
+ $(addprefix ../libdwelf/,$(libdwelf_objects))
am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \
dwarf_end.$(OBJEXT) dwarf_getelf.$(OBJEXT) \
dwarf_getpubnames.$(OBJEXT) dwarf_getabbrev.$(OBJEXT) \
@@ -123,14 +176,15 @@ am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \
dwarf_getaranges.$(OBJEXT) dwarf_onearange.$(OBJEXT) \
dwarf_getarangeinfo.$(OBJEXT) dwarf_getarange_addr.$(OBJEXT) \
dwarf_getattrs.$(OBJEXT) dwarf_formflag.$(OBJEXT) \
- dwarf_getmacros.$(OBJEXT) dwarf_macro_opcode.$(OBJEXT) \
+ dwarf_getmacros.$(OBJEXT) dwarf_macro_getparamcnt.$(OBJEXT) \
+ dwarf_macro_opcode.$(OBJEXT) dwarf_macro_param.$(OBJEXT) \
dwarf_macro_param1.$(OBJEXT) dwarf_macro_param2.$(OBJEXT) \
- dwarf_addrdie.$(OBJEXT) dwarf_getfuncs.$(OBJEXT) \
- dwarf_decl_file.$(OBJEXT) dwarf_decl_line.$(OBJEXT) \
- dwarf_decl_column.$(OBJEXT) dwarf_func_inline.$(OBJEXT) \
- dwarf_getsrc_file.$(OBJEXT) libdw_findcu.$(OBJEXT) \
- libdw_form.$(OBJEXT) libdw_alloc.$(OBJEXT) \
- memory-access.$(OBJEXT) libdw_visit_scopes.$(OBJEXT) \
+ dwarf_macro_getsrcfiles.$(OBJEXT) dwarf_addrdie.$(OBJEXT) \
+ dwarf_getfuncs.$(OBJEXT) dwarf_decl_file.$(OBJEXT) \
+ dwarf_decl_line.$(OBJEXT) dwarf_decl_column.$(OBJEXT) \
+ dwarf_func_inline.$(OBJEXT) dwarf_getsrc_file.$(OBJEXT) \
+ libdw_findcu.$(OBJEXT) libdw_form.$(OBJEXT) \
+ libdw_alloc.$(OBJEXT) libdw_visit_scopes.$(OBJEXT) \
dwarf_entry_breakpoints.$(OBJEXT) dwarf_next_cfi.$(OBJEXT) \
cie.$(OBJEXT) fde.$(OBJEXT) cfi.$(OBJEXT) \
frame-cache.$(OBJEXT) dwarf_frame_info.$(OBJEXT) \
@@ -138,54 +192,106 @@ am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \
dwarf_cfi_addrframe.$(OBJEXT) dwarf_getcfi.$(OBJEXT) \
dwarf_getcfi_elf.$(OBJEXT) dwarf_cfi_end.$(OBJEXT) \
dwarf_aggregate_size.$(OBJEXT) \
- dwarf_getlocation_implicit_pointer.$(OBJEXT)
+ dwarf_getlocation_implicit_pointer.$(OBJEXT) \
+ dwarf_getlocation_die.$(OBJEXT) \
+ dwarf_getlocation_attr.$(OBJEXT) dwarf_getalt.$(OBJEXT) \
+ dwarf_setalt.$(OBJEXT) dwarf_cu_getdwarf.$(OBJEXT) \
+ dwarf_cu_die.$(OBJEXT) dwarf_peel_type.$(OBJEXT)
libdw_a_OBJECTS = $(am_libdw_a_OBJECTS)
libdw_pic_a_AR = $(AR) $(ARFLAGS)
libdw_pic_a_LIBADD =
libdw_pic_a_OBJECTS = $(am_libdw_pic_a_OBJECTS)
-@MUDFLAP_FALSE@am__EXEEXT_1 = libdw.so$(EXEEXT)
+am__EXEEXT_1 = libdw.so$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
am_libdw_so_OBJECTS =
libdw_so_OBJECTS = $(am_libdw_so_OBJECTS)
libdw_so_LDADD = $(LDADD)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \
$(libdw_so_SOURCES)
DIST_SOURCES = $(libdw_a_SOURCES) $(libdw_pic_a_SOURCES) \
$(libdw_so_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
HEADERS = $(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
+CC_BIARCH = @CC_BIARCH@
CFLAGS = @CFLAGS@
+CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUGPRED = @DEBUGPRED@
-DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' \
- -DIS_LIBDW
+DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
+EGREP = @EGREP@
EXEEXT = @EXEEXT@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+HAVE_VALGRIND = @HAVE_VALGRIND@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -206,6 +312,7 @@ MODVERSION = @MODVERSION@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
+NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -216,6 +323,7 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
+READELF = @READELF@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -230,6 +338,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
@@ -279,22 +388,20 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
zip_LIBS = @zip_LIBS@
-INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
+AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
-I$(srcdir)/../libelf
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
$($(*F)_no_Werror),,-Werror) $(if \
- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
- $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
- $(am__append_1) $(am__append_2)
-@MUDFLAP_FALSE@libmudflap =
-@MUDFLAP_TRUE@libmudflap = -lmudflap
-COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
- $(COMPILE))
-
+ $($(*F)_no_Wunused),,-Wunused -Wextra) $($(*F)_CFLAGS) \
+ $(am__append_1)
+COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
CLEANFILES = *.gcno *.gcda
-textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+textrel_msg = echo "WARNING: TEXTREL found in '$@'"
+@FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg)
+@FATAL_TEXTREL_TRUE@textrel_found = $(textrel_msg); exit 1
+textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi
lib_LIBRARIES = libdw.a
-@MUDFLAP_FALSE@noinst_LIBRARIES = libdw_pic.a
+noinst_LIBRARIES = libdw_pic.a
include_HEADERS = dwarf.h
pkginclude_HEADERS = libdw.h
libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
@@ -327,12 +434,14 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \
dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \
dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \
- dwarf_getmacros.c dwarf_macro_opcode.c dwarf_macro_param1.c \
- dwarf_macro_param2.c dwarf_addrdie.c \
- dwarf_getfuncs.c \
+ dwarf_getmacros.c dwarf_macro_getparamcnt.c \
+ dwarf_macro_opcode.c dwarf_macro_param.c \
+ dwarf_macro_param1.c dwarf_macro_param2.c \
+ dwarf_macro_getsrcfiles.c \
+ dwarf_addrdie.c dwarf_getfuncs.c \
dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \
dwarf_func_inline.c dwarf_getsrc_file.c \
- libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \
+ libdw_findcu.c libdw_form.c libdw_alloc.c \
libdw_visit_scopes.c \
dwarf_entry_breakpoints.c \
dwarf_next_cfi.c \
@@ -340,18 +449,24 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \
dwarf_cfi_addrframe.c \
dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
- dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c
+ dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \
+ dwarf_getlocation_die.c dwarf_getlocation_attr.c \
+ dwarf_getalt.c dwarf_setalt.c dwarf_cu_getdwarf.c \
+ dwarf_cu_die.c dwarf_peel_type.c
@MAINTAINER_MODE_TRUE@BUILT_SOURCES = $(srcdir)/known-dwarf.h
@MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h
-@MUDFLAP_FALSE@libdw_pic_a_SOURCES =
-@MUDFLAP_FALSE@am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
-@MUDFLAP_FALSE@libdw_so_SOURCES =
-libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a))
+libdw_pic_a_SOURCES =
+am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
+libdw_so_SOURCES =
+libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
+libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects)) \
+ $(addprefix ../libdwelf/,$(libdwelf_objects))
+libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
dwarf_sig8_hash.h cfi.h encoded-value.h
-EXTRA_DIST = libdw.map
+EXTRA_DIST = libdw.map known-dwarf.h
MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so.$(VERSION)
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -379,6 +494,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
+$(top_srcdir)/config/eu.am:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -390,7 +506,6 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
install-libLIBRARIES: $(lib_LIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -398,6 +513,8 @@ install-libLIBRARIES: $(lib_LIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
$(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
@$(POST_INSTALL)
@@ -414,29 +531,26 @@ uninstall-libLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(libdir)' && rm -f "$$files" )"; \
- cd "$(DESTDIR)$(libdir)" && rm -f $$files
+ dir='$(DESTDIR)$(libdir)'; $(am__uninstall_files_from_dir)
clean-libLIBRARIES:
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libdw.a: $(libdw_a_OBJECTS) $(libdw_a_DEPENDENCIES)
- -rm -f libdw.a
- $(libdw_a_AR) libdw.a $(libdw_a_OBJECTS) $(libdw_a_LIBADD)
- $(RANLIB) libdw.a
-libdw_pic.a: $(libdw_pic_a_OBJECTS) $(libdw_pic_a_DEPENDENCIES)
- -rm -f libdw_pic.a
- $(libdw_pic_a_AR) libdw_pic.a $(libdw_pic_a_OBJECTS) $(libdw_pic_a_LIBADD)
- $(RANLIB) libdw_pic.a
+
+libdw.a: $(libdw_a_OBJECTS) $(libdw_a_DEPENDENCIES) $(EXTRA_libdw_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libdw.a
+ $(AM_V_AR)$(libdw_a_AR) libdw.a $(libdw_a_OBJECTS) $(libdw_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libdw.a
+
+libdw_pic.a: $(libdw_pic_a_OBJECTS) $(libdw_pic_a_DEPENDENCIES) $(EXTRA_libdw_pic_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libdw_pic.a
+ $(AM_V_AR)$(libdw_pic_a_AR) libdw_pic.a $(libdw_pic_a_OBJECTS) $(libdw_pic_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libdw_pic.a
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-@MUDFLAP_TRUE@libdw.so$(EXEEXT): $(libdw_so_OBJECTS) $(libdw_so_DEPENDENCIES)
-@MUDFLAP_TRUE@ @rm -f libdw.so$(EXEEXT)
-@MUDFLAP_TRUE@ $(LINK) $(libdw_so_OBJECTS) $(libdw_so_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -461,6 +575,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_cfi_addrframe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_cfi_end.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_child.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_cu_die.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_cu_getdwarf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_cuoffset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_decl_column.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_decl_file.Po@am__quote@
@@ -489,6 +605,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getabbrevattr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getabbrevcode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getabbrevtag.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getalt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getarange_addr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getarangeinfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getaranges.Po@am__quote@
@@ -499,6 +616,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getelf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getfuncs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getlocation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getlocation_attr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getlocation_die.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getlocation_implicit_pointer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getmacros.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getpubnames.Po@am__quote@
@@ -530,7 +649,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_lineprologueend.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_linesrc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_lowpc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_getparamcnt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_getsrcfiles.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_opcode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_param.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_param1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_macro_param2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_next_cfi.Po@am__quote@
@@ -539,7 +661,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_offdie.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_onearange.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_onesrcline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_peel_type.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_ranges.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_setalt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_siblingof.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_sig8_hash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_srclang.Po@am__quote@
@@ -552,25 +676,27 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdw_findcu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdw_form.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdw_visit_scopes.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory-access.Po@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
- test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -584,13 +710,14 @@ uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(includedir)" && rm -f $$files
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
- test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -604,30 +731,17 @@ uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -639,15 +753,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -656,6 +766,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -698,21 +823,23 @@ installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-@MUDFLAP_TRUE@install: $(BUILT_SOURCES)
-@MUDFLAP_TRUE@ $(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
-@MUDFLAP_TRUE@uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
@@ -801,19 +928,20 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \
.MAKE: all check install install-am install-strip
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \
- ctags distclean distclean-compile distclean-generic \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-includeHEADERS install-info \
- install-info-am install-libLIBRARIES install-man install-pdf \
- install-pdf-am install-pkgincludeHEADERS install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
- ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am \
+ install-includeHEADERS install-info install-info-am \
+ install-libLIBRARIES install-man install-pdf install-pdf-am \
+ install-pkgincludeHEADERS install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLIBRARIES uninstall-pkgincludeHEADERS
@@ -828,30 +956,30 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \
@MAINTAINER_MODE_TRUE@$(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h
@MAINTAINER_MODE_TRUE@ gawk -f $^ > $@.new
@MAINTAINER_MODE_TRUE@ mv -f $@.new $@
-@MUDFLAP_FALSE@libdw.so: $(srcdir)/libdw.map libdw_pic.a \
-@MUDFLAP_FALSE@ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
-@MUDFLAP_FALSE@ ../libelf/libelf.so
+libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
+ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
+ ../libelf/libelf.so
# The rpath is necessary for libebl because its $ORIGIN use will
# not fly in a setuid executable that links in libdw.
-@MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
-@MUDFLAP_FALSE@ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
-@MUDFLAP_FALSE@ -Wl,--version-script,$<,--no-undefined \
-@MUDFLAP_FALSE@ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-@MUDFLAP_FALSE@ -ldl $(zip_LIBS)
-@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
-@MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION)
-
-@MUDFLAP_FALSE@install: install-am libdw.so
-@MUDFLAP_FALSE@ $(mkinstalldirs) $(DESTDIR)$(libdir)
-@MUDFLAP_FALSE@ $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
-@MUDFLAP_FALSE@ ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
-@MUDFLAP_FALSE@ ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
-
-@MUDFLAP_FALSE@uninstall: uninstall-am
-@MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
-@MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
-@MUDFLAP_FALSE@ rm -f $(DESTDIR)$(libdir)/libdw.so
-@MUDFLAP_FALSE@ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
+ $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
+ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ -Wl,--version-script,$<,--no-undefined \
+ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+ -ldl $(zip_LIBS)
+ @$(textrel_check)
+ ln -fs $@ $@.$(VERSION)
+
+install: install-am libdw.so
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
+ ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
+ ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
+
+uninstall: uninstall-am
+ rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
+ rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
+ rm -f $(DESTDIR)$(libdir)/libdw.so
+ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/libdw/cfi.c b/src/libdw/cfi.c
index aeb48e69..632e91d3 100644
--- a/src/libdw/cfi.c
+++ b/src/libdw/cfi.c
@@ -1,51 +1,30 @@
/* CFI program execution.
- Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -56,6 +35,7 @@
#include "cfi.h"
#include "memory-access.h"
#include "encoded-value.h"
+#include "system.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -110,6 +90,9 @@ execute_cfi (Dwarf_CFI *cache,
}
else
{
+ eu_static_assert (reg_unspecified == 0);
+ memset (bigger->regs + bigger->nregs, 0,
+ (reg + 1 - bigger->nregs) * sizeof bigger->regs[0]);
bigger->nregs = reg + 1;
fs = bigger;
}
@@ -149,12 +132,15 @@ execute_cfi (Dwarf_CFI *cache,
break;
case DW_CFA_advance_loc2:
+ cfi_assert (program + 2 <= end);
operand = read_2ubyte_unaligned_inc (cache, program);
goto advance_loc;
case DW_CFA_advance_loc4:
+ cfi_assert (program + 4 <= end);
operand = read_4ubyte_unaligned_inc (cache, program);
goto advance_loc;
case DW_CFA_MIPS_advance_loc8:
+ cfi_assert (program + 8 <= end);
operand = read_8ubyte_unaligned_inc (cache, program);
goto advance_loc;
@@ -170,8 +156,9 @@ execute_cfi (Dwarf_CFI *cache,
switch block for the row-copying (LOC-moving) cases above. */
case DW_CFA_def_cfa:
- get_uleb128 (operand, program);
- get_uleb128 (offset, program);
+ get_uleb128 (operand, program, end);
+ cfi_assert (program < end);
+ get_uleb128 (offset, program, end);
def_cfa:
fs->cfa_rule = cfa_offset;
fs->cfa_val_reg = operand;
@@ -182,32 +169,33 @@ execute_cfi (Dwarf_CFI *cache,
continue;
case DW_CFA_def_cfa_register:
- get_uleb128 (regno, program);
+ get_uleb128 (regno, program, end);
require_cfa_offset ();
fs->cfa_val_reg = regno;
continue;
case DW_CFA_def_cfa_sf:
- get_uleb128 (operand, program);
- get_sleb128 (sf_offset, program);
+ get_uleb128 (operand, program, end);
+ cfi_assert (program < end);
+ get_sleb128 (sf_offset, program, end);
offset = sf_offset * cie->data_alignment_factor;
goto def_cfa;
case DW_CFA_def_cfa_offset:
- get_uleb128 (offset, program);
+ get_uleb128 (offset, program, end);
def_cfa_offset:
require_cfa_offset ();
fs->cfa_val_offset = offset;
continue;
case DW_CFA_def_cfa_offset_sf:
- get_sleb128 (sf_offset, program);
+ get_sleb128 (sf_offset, program, end);
offset = sf_offset * cie->data_alignment_factor;
goto def_cfa_offset;
case DW_CFA_def_cfa_expression:
/* DW_FORM_block is a ULEB128 length followed by that many bytes. */
- get_uleb128 (operand, program);
+ get_uleb128 (operand, program, end);
cfi_assert (operand <= (Dwarf_Word) (end - program));
fs->cfa_rule = cfa_expr;
fs->cfa_data.expr.data = (unsigned char *) program;
@@ -216,80 +204,90 @@ execute_cfi (Dwarf_CFI *cache,
continue;
case DW_CFA_undefined:
- get_uleb128 (regno, program);
+ get_uleb128 (regno, program, end);
register_rule (regno, undefined, 0);
continue;
case DW_CFA_same_value:
- get_uleb128 (regno, program);
+ get_uleb128 (regno, program, end);
register_rule (regno, same_value, 0);
continue;
case DW_CFA_offset_extended:
- get_uleb128 (operand, program);
+ get_uleb128 (operand, program, end);
+ cfi_assert (program < end);
case DW_CFA_offset + 0 ... DW_CFA_offset + CFI_PRIMARY_MAX:
- get_uleb128 (offset, program);
+ get_uleb128 (offset, program, end);
offset *= cie->data_alignment_factor;
offset_extended:
register_rule (operand, offset, offset);
continue;
case DW_CFA_offset_extended_sf:
- get_uleb128 (operand, program);
- get_sleb128 (sf_offset, program);
+ get_uleb128 (operand, program, end);
+ get_sleb128 (sf_offset, program, end);
offset_extended_sf:
offset = sf_offset * cie->data_alignment_factor;
goto offset_extended;
case DW_CFA_GNU_negative_offset_extended:
/* GNU extension obsoleted by DW_CFA_offset_extended_sf. */
- get_uleb128 (operand, program);
- get_uleb128 (offset, program);
+ get_uleb128 (operand, program, end);
+ cfi_assert (program < end);
+ get_uleb128 (offset, program, end);
sf_offset = -offset;
goto offset_extended_sf;
case DW_CFA_val_offset:
- get_uleb128 (operand, program);
- get_uleb128 (offset, program);
+ get_uleb128 (operand, program, end);
+ cfi_assert (program < end);
+ get_uleb128 (offset, program, end);
offset *= cie->data_alignment_factor;
val_offset:
register_rule (operand, val_offset, offset);
continue;
case DW_CFA_val_offset_sf:
- get_uleb128 (operand, program);
- get_sleb128 (sf_offset, program);
+ get_uleb128 (operand, program, end);
+ cfi_assert (program < end);
+ get_sleb128 (sf_offset, program, end);
offset = sf_offset * cie->data_alignment_factor;
goto val_offset;
case DW_CFA_register:
- get_uleb128 (regno, program);
- get_uleb128 (operand, program);
+ get_uleb128 (regno, program, end);
+ cfi_assert (program < end);
+ get_uleb128 (operand, program, end);
register_rule (regno, register, operand);
continue;
case DW_CFA_expression:
- get_uleb128 (regno, program);
+ /* Expression rule relies on section data, abi_cfi cannot use it. */
+ assert (! abi_cfi);
+ get_uleb128 (regno, program, end);
offset = program - (const uint8_t *) cache->data->d.d_buf;
/* DW_FORM_block is a ULEB128 length followed by that many bytes. */
- get_uleb128 (operand, program);
+ cfi_assert (program < end);
+ get_uleb128 (operand, program, end);
cfi_assert (operand <= (Dwarf_Word) (end - program));
program += operand;
register_rule (regno, expression, offset);
continue;
case DW_CFA_val_expression:
- get_uleb128 (regno, program);
+ /* Expression rule relies on section data, abi_cfi cannot use it. */
+ assert (! abi_cfi);
+ get_uleb128 (regno, program, end);
/* DW_FORM_block is a ULEB128 length followed by that many bytes. */
offset = program - (const uint8_t *) cache->data->d.d_buf;
- get_uleb128 (operand, program);
+ get_uleb128 (operand, program, end);
cfi_assert (operand <= (Dwarf_Word) (end - program));
program += operand;
register_rule (regno, val_expression, offset);
continue;
case DW_CFA_restore_extended:
- get_uleb128 (operand, program);
+ get_uleb128 (operand, program, end);
case DW_CFA_restore + 0 ... DW_CFA_restore + CFI_PRIMARY_MAX:
if (unlikely (abi_cfi) && likely (opcode == DW_CFA_restore))
@@ -360,7 +358,7 @@ execute_cfi (Dwarf_CFI *cache,
case DW_CFA_GNU_args_size:
/* XXX is this useful for anything? */
- get_uleb128 (operand, program);
+ get_uleb128 (operand, program, end);
continue;
default:
diff --git a/src/libdw/cfi.h b/src/libdw/cfi.h
index ef9cd7e1..98ac6cfa 100644
--- a/src/libdw/cfi.h
+++ b/src/libdw/cfi.h
@@ -1,51 +1,30 @@
/* Internal definitions for libdw CFI interpreter.
- Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2009-2010, 2013 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _UNWINDP_H
#define _UNWINDP_H 1
@@ -171,8 +150,8 @@ struct dwarf_frame_register
Dwarf_Sword value:(sizeof (Dwarf_Sword) * 8 - 3);
};
-/* This holds everything we know about the state of the frame
- at a particular PC location described by an FDE. */
+/* This holds instructions for unwinding frame at a particular PC location
+ described by an FDE. */
struct Dwarf_Frame_s
{
/* This frame description covers PC values in [start, end). */
diff --git a/src/libdw/cie.c b/src/libdw/cie.c
index 7c93f551..1b0aae7c 100644
--- a/src/libdw/cie.c
+++ b/src/libdw/cie.c
@@ -1,51 +1,30 @@
/* CIE reading.
Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf.h b/src/libdw/dwarf.h
index e6a83670..da8cf3a6 100644
--- a/src/libdw/dwarf.h
+++ b/src/libdw/dwarf.h
@@ -1,51 +1,30 @@
/* This file defines standard DWARF types, structures, and macros.
- Copyright (C) 2000-2011 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2000-2011, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _DWARF_H
#define _DWARF_H 1
@@ -108,7 +87,7 @@ enum
DW_TAG_unspecified_type = 0x3b,
DW_TAG_partial_unit = 0x3c,
DW_TAG_imported_unit = 0x3d,
- DW_TAG_mutable_type = 0x3e,
+ /* 0x3e reserved. */
DW_TAG_condition = 0x3f,
DW_TAG_shared_type = 0x40,
DW_TAG_type_unit = 0x41,
@@ -242,6 +221,9 @@ enum
DW_AT_enum_class = 0x6d,
DW_AT_linkage_name = 0x6e,
+ /* DWARF5 attribute values. */
+ DW_AT_noreturn = 0x87,
+
DW_AT_lo_user = 0x2000,
DW_AT_MIPS_fde = 0x2001,
@@ -287,6 +269,8 @@ enum
DW_AT_GNU_all_tail_call_sites = 0x2116,
DW_AT_GNU_all_call_sites = 0x2117,
DW_AT_GNU_all_source_call_sites = 0x2118,
+ DW_AT_GNU_macros = 0x2119,
+ DW_AT_GNU_deleted = 0x211a,
DW_AT_hi_user = 0x3fff
};
@@ -319,7 +303,10 @@ enum
DW_FORM_sec_offset = 0x17,
DW_FORM_exprloc = 0x18,
DW_FORM_flag_present = 0x19,
- DW_FORM_ref_sig8 = 0x20
+ DW_FORM_ref_sig8 = 0x20,
+
+ DW_FORM_GNU_ref_alt = 0x1f20, /* offset in alternate .debuginfo. */
+ DW_FORM_GNU_strp_alt = 0x1f21 /* offset in alternate .debug_str. */
};
@@ -492,6 +479,7 @@ enum
DW_OP_GNU_deref_type = 0xf6,
DW_OP_GNU_convert = 0xf7,
DW_OP_GNU_reinterpret = 0xf9,
+ DW_OP_GNU_parameter_ref = 0xfa,
DW_OP_lo_user = 0xe0, /* Implementation-defined range start. */
DW_OP_hi_user = 0xff /* Implementation-defined range end. */
@@ -517,6 +505,7 @@ enum
DW_ATE_signed_fixed = 0xd,
DW_ATE_unsigned_fixed = 0xe,
DW_ATE_decimal_float = 0xf,
+ DW_ATE_UTF = 0x10,
DW_ATE_lo_user = 0x80,
DW_ATE_hi_user = 0xff
@@ -591,15 +580,19 @@ enum
DW_LANG_Ada95 = 0x000d, /* ISO Ada:1995 */
DW_LANG_Fortran95 = 0x000e, /* ISO Fortran 95 */
DW_LANG_PL1 = 0x000f, /* ISO PL/1:1976 */
- DW_LANG_Objc = 0x0010, /* Objective-C */
+ DW_LANG_ObjC = 0x0010, /* Objective-C */
DW_LANG_ObjC_plus_plus = 0x0011, /* Objective-C++ */
DW_LANG_UPC = 0x0012, /* Unified Parallel C */
DW_LANG_D = 0x0013, /* D */
DW_LANG_Python = 0x0014, /* Python */
- DW_LANG_Go = 0x0016, /* Google's Go (provisionally in DWARF5) */
+ DW_LANG_Go = 0x0016, /* Go */
+ DW_LANG_C_plus_plus_11 = 0x001a, /* ISO C++:2011 */
+ DW_LANG_C11 = 0x001d, /* ISO C:2011 */
+ DW_LANG_C_plus_plus_14 = 0x0021, /* ISO C++:2014 */
+
DW_LANG_lo_user = 0x8000,
- DW_LANG_Mips_Assembler = 0x8001,
+ DW_LANG_Mips_Assembler = 0x8001, /* Assembler */
DW_LANG_hi_user = 0xffff
};
@@ -693,6 +686,21 @@ enum
};
+/* DWARF debug_macro type encodings. GNU/DWARF5 extension. */
+enum
+ {
+ DW_MACRO_GNU_define = 0x01,
+ DW_MACRO_GNU_undef = 0x02,
+ DW_MACRO_GNU_start_file = 0x03,
+ DW_MACRO_GNU_end_file = 0x04,
+ DW_MACRO_GNU_define_indirect = 0x05,
+ DW_MACRO_GNU_undef_indirect = 0x06,
+ DW_MACRO_GNU_transparent_include = 0x07,
+ DW_MACRO_GNU_lo_user = 0xe0,
+ DW_MACRO_GNU_hi_user = 0xff
+ };
+
+
/* DWARF call frame instruction encodings. */
enum
{
diff --git a/src/libdw/dwarf_abbrev_hash.c b/src/libdw/dwarf_abbrev_hash.c
index bec1ceb2..f52f5ad5 100644
--- a/src/libdw/dwarf_abbrev_hash.c
+++ b/src/libdw/dwarf_abbrev_hash.c
@@ -1,52 +1,31 @@
/* Implementation of hash table for DWARF .debug_abbrev section content.
Copyright (C) 2000-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_abbrev_hash.h b/src/libdw/dwarf_abbrev_hash.h
index f124d166..d2f02ccc 100644
--- a/src/libdw/dwarf_abbrev_hash.h
+++ b/src/libdw/dwarf_abbrev_hash.h
@@ -1,52 +1,31 @@
/* Hash table for DWARF .debug_abbrev section content.
Copyright (C) 2000, 2001, 2002 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _DWARF_ABBREV_HASH_H
#define _DWARF_ABBREV_HASH_H 1
diff --git a/src/libdw/dwarf_abbrevhaschildren.c b/src/libdw/dwarf_abbrevhaschildren.c
index 4e42a32b..4a83e31d 100644
--- a/src/libdw/dwarf_abbrevhaschildren.c
+++ b/src/libdw/dwarf_abbrevhaschildren.c
@@ -1,52 +1,31 @@
/* Return true if abbreviation is children flag set.
Copyright (C) 2003 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_addrdie.c b/src/libdw/dwarf_addrdie.c
index 84618721..94eb1480 100644
--- a/src/libdw/dwarf_addrdie.c
+++ b/src/libdw/dwarf_addrdie.c
@@ -1,52 +1,31 @@
/* Return CU DIE containing given address.
Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_aggregate_size.c b/src/libdw/dwarf_aggregate_size.c
index e7420141..667c2743 100644
--- a/src/libdw/dwarf_aggregate_size.c
+++ b/src/libdw/dwarf_aggregate_size.c
@@ -1,51 +1,30 @@
/* Compute size of an aggregate type from DWARF.
- Copyright (C) 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -58,8 +37,13 @@
static Dwarf_Die *
get_type (Dwarf_Die *die, Dwarf_Attribute *attr_mem, Dwarf_Die *type_mem)
{
- return INTUSE(dwarf_formref_die)
+ Dwarf_Die *type = INTUSE(dwarf_formref_die)
(INTUSE(dwarf_attr_integrate) (die, DW_AT_type, attr_mem), type_mem);
+
+ if (INTUSE(dwarf_peel_type) (type, type) != 0)
+ return NULL;
+
+ return type;
}
static int
@@ -119,12 +103,16 @@ array_size (Dwarf_Die *die, Dwarf_Word *size,
case DW_LANG_C:
case DW_LANG_C89:
case DW_LANG_C99:
+ case DW_LANG_C11:
case DW_LANG_C_plus_plus:
- case DW_LANG_Objc:
+ case DW_LANG_C_plus_plus_11:
+ case DW_LANG_C_plus_plus_14:
+ case DW_LANG_ObjC:
case DW_LANG_ObjC_plus_plus:
case DW_LANG_Java:
case DW_LANG_D:
case DW_LANG_UPC:
+ case DW_LANG_Go:
lower = 0;
break;
@@ -219,13 +207,20 @@ aggregate_size (Dwarf_Die *die, Dwarf_Word *size, Dwarf_Die *type_mem)
switch (INTUSE(dwarf_tag) (die))
{
- case DW_TAG_typedef:
case DW_TAG_subrange_type:
return aggregate_size (get_type (die, &attr_mem, type_mem),
size, type_mem); /* Tail call. */
case DW_TAG_array_type:
return array_size (die, size, &attr_mem, type_mem);
+
+ /* Assume references and pointers have pointer size if not given an
+ explicit DW_AT_byte_size. */
+ case DW_TAG_pointer_type:
+ case DW_TAG_reference_type:
+ case DW_TAG_rvalue_reference_type:
+ *size = die->cu->address_size;
+ return 0;
}
/* Most types must give their size directly. */
@@ -238,6 +233,12 @@ dwarf_aggregate_size (die, size)
Dwarf_Word *size;
{
Dwarf_Die type_mem;
+
+ if (INTUSE (dwarf_peel_type) (die, die) != 0)
+ return -1;
+
return aggregate_size (die, size, &type_mem);
}
INTDEF (dwarf_aggregate_size)
+OLD_VERSION (dwarf_aggregate_size, ELFUTILS_0.144)
+NEW_VERSION (dwarf_aggregate_size, ELFUTILS_0.161)
diff --git a/src/libdw/dwarf_arrayorder.c b/src/libdw/dwarf_arrayorder.c
index 4929fb3c..759fa4d8 100644
--- a/src/libdw/dwarf_arrayorder.c
+++ b/src/libdw/dwarf_arrayorder.c
@@ -1,52 +1,31 @@
/* Return array order attribute of DIE.
Copyright (C) 2003, 2005, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_attr.c b/src/libdw/dwarf_attr.c
index d3b03244..f247c1af 100644
--- a/src/libdw/dwarf_attr.c
+++ b/src/libdw/dwarf_attr.c
@@ -1,52 +1,31 @@
/* Return specific DWARF attribute of a DIE.
- Copyright (C) 2003, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003, 2005, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -71,6 +50,6 @@ dwarf_attr (die, search_name, result)
/* Always fill in the CU information. */
result->cu = die->cu;
- return result->code == search_name ? result : NULL;
+ return result->valp != NULL && result->code == search_name ? result : NULL;
}
INTDEF(dwarf_attr)
diff --git a/src/libdw/dwarf_attr_integrate.c b/src/libdw/dwarf_attr_integrate.c
index ce062f5b..812d74b9 100644
--- a/src/libdw/dwarf_attr_integrate.c
+++ b/src/libdw/dwarf_attr_integrate.c
@@ -1,51 +1,30 @@
/* Return specific DWARF attribute of a DIE, integrating indirections.
Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_begin.c b/src/libdw/dwarf_begin.c
index 8a419147..9f3050fd 100644
--- a/src/libdw/dwarf_begin.c
+++ b/src/libdw/dwarf_begin.c
@@ -1,52 +1,31 @@
/* Create descriptor from file descriptor for processing file.
Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -95,7 +74,6 @@ dwarf_begin (fd, cmd)
elf = elf_begin (fd, elfcmd, NULL);
if (elf == NULL)
{
-#ifndef __APPLE__
/* Test why the `elf_begin" call failed. */
struct stat64 st;
@@ -105,9 +83,6 @@ dwarf_begin (fd, cmd)
__libdw_seterrno (DWARF_E_INVALID_FILE);
else
__libdw_seterrno (DWARF_E_IO_ERROR);
-#else
- __libdw_seterrno (DWARF_E_IO_ERROR);
-#endif
}
else
{
@@ -123,3 +98,4 @@ dwarf_begin (fd, cmd)
return result;
}
+INTDEF(dwarf_begin)
diff --git a/src/libdw/dwarf_begin_elf.c b/src/libdw/dwarf_begin_elf.c
index 9ec7d51f..4c49ce21 100644
--- a/src/libdw/dwarf_begin_elf.c
+++ b/src/libdw/dwarf_begin_elf.c
@@ -1,63 +1,46 @@
/* Create descriptor from ELF descriptor for processing file.
- Copyright (C) 2002-2011 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2002-2011, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include "libdwP.h"
@@ -70,7 +53,7 @@
/* Section names. */
-static const char dwarf_scnnames[IDX_last][17] =
+static const char dwarf_scnnames[IDX_last][18] =
{
[IDX_debug_info] = ".debug_info",
[IDX_debug_types] = ".debug_types",
@@ -82,11 +65,12 @@ static const char dwarf_scnnames[IDX_last][17] =
[IDX_debug_pubnames] = ".debug_pubnames",
[IDX_debug_str] = ".debug_str",
[IDX_debug_macinfo] = ".debug_macinfo",
- [IDX_debug_ranges] = ".debug_ranges"
+ [IDX_debug_macro] = ".debug_macro",
+ [IDX_debug_ranges] = ".debug_ranges",
+ [IDX_gnu_debugaltlink] = ".gnu_debugaltlink"
};
#define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
-
static Dwarf *
check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
{
@@ -96,9 +80,9 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
/* Get the section header data. */
shdr = gelf_getshdr (scn, &shdr_mem);
if (shdr == NULL)
- /* This should never happen. If it does something is
- wrong in the libelf library. */
- abort ();
+ /* We may read /proc/PID/mem with only program headers mapped and section
+ headers out of the mapped pages. */
+ goto err;
/* Ignore any SHT_NOBITS sections. Debugging sections should not
have been stripped, but in case of a corrupt file we won't try
@@ -124,13 +108,14 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
{
/* The section name must be valid. Otherwise is the ELF file
invalid. */
+ err:
__libdw_free_zdata (result);
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
__libdw_seterrno (DWARF_E_INVALID_ELF);
free (result);
return NULL;
}
-
/* Recognize the various sections. Most names start with .debug_. */
size_t cnt;
for (cnt = 0; cnt < ndwarf_scnnames; ++cnt)
@@ -174,6 +159,12 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
memcpy (&size, data->d_buf + 4, sizeof size);
size = be64toh (size);
+ /* Check for unsigned overflow so malloc always allocated
+ enough memory for both the Elf_Data header and the
+ uncompressed section data. */
+ if (unlikely (sizeof (Elf_Data) + size < size))
+ break;
+
Elf_Data *zdata = malloc (sizeof (Elf_Data) + size);
if (unlikely (zdata == NULL))
break;
@@ -238,11 +229,34 @@ valid_p (Dwarf *result)
&& unlikely (result->sectiondata[IDX_debug_info] == NULL))
{
__libdw_free_zdata (result);
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
__libdw_seterrno (DWARF_E_NO_DWARF);
free (result);
result = NULL;
}
+ if (result != NULL && result->sectiondata[IDX_debug_loc] != NULL)
+ {
+ result->fake_loc_cu = (Dwarf_CU *) calloc (1, sizeof (Dwarf_CU));
+ if (unlikely (result->fake_loc_cu == NULL))
+ {
+ __libdw_free_zdata (result);
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
+ __libdw_seterrno (DWARF_E_NOMEM);
+ free (result);
+ result = NULL;
+ }
+ else
+ {
+ result->fake_loc_cu->dbg = result;
+ result->fake_loc_cu->startp
+ = result->sectiondata[IDX_debug_loc]->d_buf;
+ result->fake_loc_cu->endp
+ = (result->sectiondata[IDX_debug_loc]->d_buf
+ + result->sectiondata[IDX_debug_loc]->d_size);
+ }
+ }
+
return result;
}
@@ -269,6 +283,7 @@ scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp)
{
/* We cannot read the section content. Fail! */
__libdw_free_zdata (result);
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
free (result);
return NULL;
}
@@ -285,6 +300,7 @@ scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp)
/* A section group refers to a non-existing section. Should
never happen. */
__libdw_free_zdata (result);
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
__libdw_seterrno (DWARF_E_INVALID_ELF);
free (result);
return NULL;
@@ -365,11 +381,13 @@ dwarf_begin_elf (elf, cmd, scngrp)
}
else if (cmd == DWARF_C_WRITE)
{
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
__libdw_seterrno (DWARF_E_UNIMPL);
free (result);
return NULL;
}
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
__libdw_seterrno (DWARF_E_INVALID_CMD);
free (result);
return NULL;
diff --git a/src/libdw/dwarf_bitoffset.c b/src/libdw/dwarf_bitoffset.c
index 3ab14683..1648ecd7 100644
--- a/src/libdw/dwarf_bitoffset.c
+++ b/src/libdw/dwarf_bitoffset.c
@@ -1,52 +1,31 @@
/* Return bit offset attribute of DIE.
Copyright (C) 2003, 2005, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_bitsize.c b/src/libdw/dwarf_bitsize.c
index 67d97dc1..ea9946b8 100644
--- a/src/libdw/dwarf_bitsize.c
+++ b/src/libdw/dwarf_bitsize.c
@@ -1,52 +1,31 @@
/* Return bit size attribute of DIE.
Copyright (C) 2003, 2005, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_bytesize.c b/src/libdw/dwarf_bytesize.c
index 2f2e1985..6499a0ae 100644
--- a/src/libdw/dwarf_bytesize.c
+++ b/src/libdw/dwarf_bytesize.c
@@ -1,52 +1,31 @@
/* Return byte size attribute of DIE.
Copyright (C) 2003, 2005, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_cfi_addrframe.c b/src/libdw/dwarf_cfi_addrframe.c
index 79d0e125..1c0da03e 100644
--- a/src/libdw/dwarf_cfi_addrframe.c
+++ b/src/libdw/dwarf_cfi_addrframe.c
@@ -1,51 +1,30 @@
/* Compute frame state at PC.
Copyright (C) 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_cfi_end.c b/src/libdw/dwarf_cfi_end.c
index 5591e2a9..6eb2ade8 100644
--- a/src/libdw/dwarf_cfi_end.c
+++ b/src/libdw/dwarf_cfi_end.c
@@ -1,51 +1,30 @@
/* Clean up Dwarf_CFI structure.
Copyright (C) 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_child.c b/src/libdw/dwarf_child.c
index 0c2df004..58a438b5 100644
--- a/src/libdw/dwarf_child.c
+++ b/src/libdw/dwarf_child.c
@@ -1,52 +1,31 @@
/* Return child of current DIE.
- Copyright (C) 2003-2011 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2011, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -65,21 +44,11 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
unsigned int *codep, unsigned int *formp)
{
Dwarf *dbg = die->cu->dbg;
- const unsigned char *readp = (unsigned char *) die->addr;
-
- /* First we have to get the abbreviation code so that we can decode
- the data in the DIE. */
- unsigned int abbrev_code;
- get_uleb128 (abbrev_code, readp);
+ const unsigned char *readp;
/* Find the abbreviation entry. */
- Dwarf_Abbrev *abbrevp = die->abbrev;
- if (abbrevp == NULL)
- {
- abbrevp = __libdw_findabbrev (die->cu, abbrev_code);
- die->abbrev = abbrevp ?: DWARF_END_ABBREV;
- }
- if (unlikely (die->abbrev == DWARF_END_ABBREV))
+ Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, &readp);
+ if (unlikely (abbrevp == DWARF_END_ABBREV))
{
invalid_dwarf:
__libdw_seterrno (DWARF_E_INVALID_DWARF);
@@ -91,21 +60,19 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
= ((unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf
+ dbg->sectiondata[IDX_debug_abbrev]->d_size);
- const unsigned char *attrp = die->abbrev->attrp;
+ const unsigned char *attrp = abbrevp->attrp;
while (1)
{
- /* Are we still in bounds? This test needs to be refined. */
- if (unlikely (attrp + 1 >= endp))
+ /* Get attribute name and form. */
+ if (unlikely (attrp >= endp))
goto invalid_dwarf;
-
- /* Get attribute name and form.
-
- XXX We don't check whether this reads beyond the end of the
- section. */
unsigned int attr_name;
- get_uleb128 (attr_name, attrp);
+ get_uleb128 (attr_name, attrp, endp);
+
+ if (unlikely (attrp >= endp))
+ goto invalid_dwarf;
unsigned int attr_form;
- get_uleb128 (attr_form, attrp);
+ get_uleb128 (attr_form, attrp, endp);
/* We can stop if we found the attribute with value zero. */
if (attr_name == 0 && attr_form == 0)
@@ -125,15 +92,14 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
/* Skip over the rest of this attribute (if there is any). */
if (attr_form != 0)
{
- size_t len = __libdw_form_val_len (dbg, die->cu, attr_form, readp);
-
+ size_t len = __libdw_form_val_len (die->cu, attr_form, readp);
if (unlikely (len == (size_t) -1l))
{
readp = NULL;
break;
}
- // XXX We need better boundary checks.
+ // __libdw_form_val_len will have done a bounds check.
readp += len;
}
}
@@ -157,33 +123,32 @@ dwarf_child (die, result)
if (die == NULL)
return -1;
- /* Skip past the last attribute. */
- void *addr = NULL;
-
- /* If we already know there are no children do not search. */
- if (die->abbrev != DWARF_END_ABBREV
- && (die->abbrev == NULL || die->abbrev->has_children))
- addr = __libdw_find_attr (die, INVALID, NULL, NULL);
- if (unlikely (die->abbrev == (Dwarf_Abbrev *) -1l))
- return -1;
+ /* Find the abbreviation entry. */
+ Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, NULL);
+ if (unlikely (abbrevp == DWARF_END_ABBREV))
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
- /* Make sure the DIE really has children. */
- if (! die->abbrev->has_children)
- /* There cannot be any children. */
+ /* If there are no children, do not search. */
+ if (! abbrevp->has_children)
return 1;
+ /* Skip past the last attribute. */
+ void *addr = __libdw_find_attr (die, INVALID, NULL, NULL);
+
if (addr == NULL)
return -1;
/* RESULT can be the same as DIE. So preserve what we need. */
struct Dwarf_CU *cu = die->cu;
- Elf_Data *cu_sec = cu_data (cu);
/* It's kosher (just suboptimal) to have a null entry first thing (7.5.3).
So if this starts with ULEB128 of 0 (even with silly encoding of 0),
it is a kosher null entry and we do not really have any children. */
const unsigned char *code = addr;
- const unsigned char *endp = (cu_sec->d_buf + cu_sec->d_size);
+ const unsigned char *endp = cu->endp;
while (1)
{
if (unlikely (code >= endp)) /* Truncated section. */
diff --git a/src/libdw/dwarf_cu_die.c b/src/libdw/dwarf_cu_die.c
new file mode 100644
index 00000000..48f4176f
--- /dev/null
+++ b/src/libdw/dwarf_cu_die.c
@@ -0,0 +1,68 @@
+/* Internal definitions for libdwarf.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+#include "libdwP.h"
+
+
+Dwarf_Die *
+dwarf_cu_die (cu, result, versionp, abbrev_offsetp, address_sizep,
+ offset_sizep, type_signaturep, type_offsetp)
+ Dwarf_CU *cu;
+ Dwarf_Die *result;
+ Dwarf_Half *versionp;
+ Dwarf_Off *abbrev_offsetp;
+ uint8_t *address_sizep;
+ uint8_t *offset_sizep;
+ uint64_t *type_signaturep;
+ Dwarf_Off *type_offsetp;
+{
+ if (cu == NULL)
+ return NULL;
+
+ *result = CUDIE (cu);
+
+ if (versionp != NULL)
+ *versionp = cu->version;
+ if (abbrev_offsetp != NULL)
+ *abbrev_offsetp = cu->orig_abbrev_offset;
+ if (address_sizep != NULL)
+ *address_sizep = cu->address_size;
+ if (offset_sizep != NULL)
+ *offset_sizep = cu->offset_size;
+ if (type_signaturep != NULL)
+ *type_signaturep = cu->type_sig8;
+ if (type_offsetp != NULL)
+ *type_offsetp = cu->type_offset;
+
+ return result;
+}
diff --git a/src/libdw/dwarf_cu_getdwarf.c b/src/libdw/dwarf_cu_getdwarf.c
new file mode 100644
index 00000000..f8a2e9b9
--- /dev/null
+++ b/src/libdw/dwarf_cu_getdwarf.c
@@ -0,0 +1,47 @@
+/* Retrieve Dwarf descriptor underlying a Dwarf_CU.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "libdwP.h"
+
+
+Dwarf *
+dwarf_cu_getdwarf (cu)
+ Dwarf_CU *cu;
+{
+ if (cu == NULL)
+ /* Some error occurred before. */
+ return NULL;
+
+ return cu->dbg;
+}
diff --git a/src/libdw/dwarf_cuoffset.c b/src/libdw/dwarf_cuoffset.c
index 47653200..3ceffdb0 100644
--- a/src/libdw/dwarf_cuoffset.c
+++ b/src/libdw/dwarf_cuoffset.c
@@ -1,52 +1,31 @@
/* Return offset of DIE in CU.
- Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -62,5 +41,5 @@ dwarf_cuoffset (die)
{
return (die == NULL
? (Dwarf_Off) -1l
- : (die->addr - cu_data (die->cu)->d_buf - die->cu->start));
+ : (Dwarf_Off) (die->addr - die->cu->startp));
}
diff --git a/src/libdw/dwarf_decl_column.c b/src/libdw/dwarf_decl_column.c
index 11ba5d74..08d36b87 100644
--- a/src/libdw/dwarf_decl_column.c
+++ b/src/libdw/dwarf_decl_column.c
@@ -1,52 +1,31 @@
/* Get column number of beginning of given declaration.
Copyright (C) 2005-2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_decl_file.c b/src/libdw/dwarf_decl_file.c
index c81e35b8..5657132f 100644
--- a/src/libdw/dwarf_decl_file.c
+++ b/src/libdw/dwarf_decl_file.c
@@ -1,52 +1,31 @@
/* Return file name containing definition of the given function.
Copyright (C) 2005, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -61,9 +40,9 @@ const char *
dwarf_decl_file (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
- Dwarf_Sword idx = 0;
+ Dwarf_Word idx = 0;
- if (INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr_integrate)
+ if (INTUSE(dwarf_formudata) (INTUSE(dwarf_attr_integrate)
(die, DW_AT_decl_file, &attr_mem),
&idx) != 0)
return NULL;
diff --git a/src/libdw/dwarf_decl_line.c b/src/libdw/dwarf_decl_line.c
index ab64e510..80fae6c9 100644
--- a/src/libdw/dwarf_decl_line.c
+++ b/src/libdw/dwarf_decl_line.c
@@ -1,52 +1,31 @@
/* Get line number of beginning of given function.
Copyright (C) 2005, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -71,15 +50,20 @@ int internal_function
__libdw_attr_intval (Dwarf_Die *die, int *linep, int attval)
{
Dwarf_Attribute attr_mem;
- Dwarf_Sword line;
+ Dwarf_Word line;
- int res = INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr_integrate)
+ int res = INTUSE(dwarf_formudata) (INTUSE(dwarf_attr_integrate)
(die, attval, &attr_mem),
&line);
if (res == 0)
{
- assert (line >= 0 && line <= INT_MAX);
- *linep = line;
+ if (line > INT_MAX)
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ res = -1;
+ }
+ else
+ *linep = line;
}
return res;
diff --git a/src/libdw/dwarf_diecu.c b/src/libdw/dwarf_diecu.c
index cd98cf61..bd9a37ae 100644
--- a/src/libdw/dwarf_diecu.c
+++ b/src/libdw/dwarf_diecu.c
@@ -1,51 +1,30 @@
/* Return CU DIE containing given DIE.
Copyright (C) 2005-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_diename.c b/src/libdw/dwarf_diename.c
index 3b66d12e..050d8f1d 100644
--- a/src/libdw/dwarf_diename.c
+++ b/src/libdw/dwarf_diename.c
@@ -1,52 +1,31 @@
/* Return string in name attribute of DIE.
Copyright (C) 2002, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_dieoffset.c b/src/libdw/dwarf_dieoffset.c
index ac4a84c8..965b2c8d 100644
--- a/src/libdw/dwarf_dieoffset.c
+++ b/src/libdw/dwarf_dieoffset.c
@@ -1,52 +1,31 @@
/* Return offset of DIE.
- Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -62,6 +41,6 @@ dwarf_dieoffset (die)
{
return (die == NULL
? ~0ul
- : (Dwarf_Off) (die->addr - cu_data (die->cu)->d_buf));
+ : (Dwarf_Off) (die->addr - die->cu->startp + die->cu->start));
}
INTDEF(dwarf_dieoffset)
diff --git a/src/libdw/dwarf_end.c b/src/libdw/dwarf_end.c
index 1e733cae..922dc8f3 100644
--- a/src/libdw/dwarf_end.c
+++ b/src/libdw/dwarf_end.c
@@ -1,52 +1,31 @@
/* Release debugging handling context.
- Copyright (C) 2002-2011 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2002-2011, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -114,6 +93,12 @@ dwarf_end (dwarf)
tdestroy (dwarf->cu_tree, cu_free);
tdestroy (dwarf->tu_tree, cu_free);
+ /* Search tree for macro opcode tables. */
+ tdestroy (dwarf->macro_ops, noop_free);
+
+ /* Search tree for decoded .debug_lines units. */
+ tdestroy (dwarf->files_lines, noop_free);
+
struct libdw_memblock *memp = dwarf->mem_tail;
/* The first block is allocated together with the Dwarf object. */
while (memp->prev != NULL)
@@ -132,6 +117,9 @@ dwarf_end (dwarf)
if (dwarf->free_elf)
elf_end (dwarf->elf);
+ /* Free the fake location list CU. */
+ free (dwarf->fake_loc_cu);
+
/* Free the context descriptor. */
free (dwarf);
}
diff --git a/src/libdw/dwarf_entry_breakpoints.c b/src/libdw/dwarf_entry_breakpoints.c
index 1e5c1b81..ffd51697 100644
--- a/src/libdw/dwarf_entry_breakpoints.c
+++ b/src/libdw/dwarf_entry_breakpoints.c
@@ -1,51 +1,30 @@
/* Find entry breakpoint locations for a function.
Copyright (C) 2005-2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_entrypc.c b/src/libdw/dwarf_entrypc.c
index 1719be27..8eb39dbc 100644
--- a/src/libdw/dwarf_entrypc.c
+++ b/src/libdw/dwarf_entrypc.c
@@ -1,51 +1,30 @@
/* Return entry PC attribute of DIE.
Copyright (C) 2003, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_error.c b/src/libdw/dwarf_error.c
index a298a19d..08b691aa 100644
--- a/src/libdw/dwarf_error.c
+++ b/src/libdw/dwarf_error.c
@@ -1,52 +1,31 @@
/* Retrieve ELF descriptor used for DWARF access.
- Copyright (C) 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2002, 2003, 2004, 2005, 2009, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -59,11 +38,7 @@
/* The error number. */
-#ifdef __APPLE__
-static int global_error;
-#else
static __thread int global_error;
-#endif
int
@@ -116,6 +91,8 @@ static const char *errmsgs[] =
[DWARF_E_INVALID_OFFSET] = N_("invalid offset"),
[DWARF_E_NO_DEBUG_RANGES] = N_(".debug_ranges section missing"),
[DWARF_E_INVALID_CFI] = N_("invalid CFI section"),
+ [DWARF_E_NO_ALT_DEBUGLINK] = N_("no alternative debug link found"),
+ [DWARF_E_INVALID_OPCODE] = N_("invalid opcode"),
};
#define nerrmsgs (sizeof (errmsgs) / sizeof (errmsgs[0]))
diff --git a/src/libdw/dwarf_filesrc.c b/src/libdw/dwarf_filesrc.c
index b48340d4..d866ce72 100644
--- a/src/libdw/dwarf_filesrc.c
+++ b/src/libdw/dwarf_filesrc.c
@@ -1,52 +1,31 @@
/* Find source file information.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_formaddr.c b/src/libdw/dwarf_formaddr.c
index a8c786ff..9d4a3887 100644
--- a/src/libdw/dwarf_formaddr.c
+++ b/src/libdw/dwarf_formaddr.c
@@ -1,52 +1,31 @@
/* Return address represented by attribute.
Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_formblock.c b/src/libdw/dwarf_formblock.c
index 4eb815c4..3d56f222 100644
--- a/src/libdw/dwarf_formblock.c
+++ b/src/libdw/dwarf_formblock.c
@@ -1,52 +1,31 @@
/* Return block represented by attribute.
- Copyright (C) 2004-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2004-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -64,29 +43,37 @@ dwarf_formblock (attr, return_block)
if (attr == NULL)
return -1;
- const unsigned char *datap;
+ const unsigned char *datap = attr->valp;
+ const unsigned char *endp = attr->cu->endp;
switch (attr->form)
{
case DW_FORM_block1:
+ if (unlikely (endp - datap < 1))
+ goto invalid;
return_block->length = *(uint8_t *) attr->valp;
return_block->data = attr->valp + 1;
break;
case DW_FORM_block2:
+ if (unlikely (endp - datap < 2))
+ goto invalid;
return_block->length = read_2ubyte_unaligned (attr->cu->dbg, attr->valp);
return_block->data = attr->valp + 2;
break;
case DW_FORM_block4:
+ if (unlikely (endp - datap < 4))
+ goto invalid;
return_block->length = read_4ubyte_unaligned (attr->cu->dbg, attr->valp);
return_block->data = attr->valp + 4;
break;
case DW_FORM_block:
case DW_FORM_exprloc:
- datap = attr->valp;
- get_uleb128 (return_block->length, datap);
+ if (unlikely (endp - datap < 1))
+ goto invalid;
+ get_uleb128 (return_block->length, datap, endp);
return_block->data = (unsigned char *) datap;
break;
@@ -95,12 +82,10 @@ dwarf_formblock (attr, return_block)
return -1;
}
- if (unlikely (cu_data (attr->cu)->d_size
- - (return_block->data
- - (unsigned char *) cu_data (attr->cu)->d_buf)
- < return_block->length))
+ if (unlikely (return_block->length > (size_t) (endp - return_block->data)))
{
/* Block does not fit. */
+ invalid:
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return -1;
}
diff --git a/src/libdw/dwarf_formflag.c b/src/libdw/dwarf_formflag.c
index fb60c8e6..bdc2267a 100644
--- a/src/libdw/dwarf_formflag.c
+++ b/src/libdw/dwarf_formflag.c
@@ -1,52 +1,31 @@
/* Return flag represented by attribute.
Copyright (C) 2004-2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_formref.c b/src/libdw/dwarf_formref.c
index e4d35ae8..25924371 100644
--- a/src/libdw/dwarf_formref.c
+++ b/src/libdw/dwarf_formref.c
@@ -1,52 +1,31 @@
/* Return reference offset represented by attribute.
- Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -60,7 +39,8 @@ __libdw_formref (attr, return_offset)
Dwarf_Attribute *attr;
Dwarf_Off *return_offset;
{
- const unsigned char *datap;
+ const unsigned char *datap = attr->valp;
+ const unsigned char *endp = attr->cu->endp;
if (attr->valp == NULL)
{
@@ -71,28 +51,43 @@ __libdw_formref (attr, return_offset)
switch (attr->form)
{
case DW_FORM_ref1:
+ if (datap + 1 > endp)
+ {
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
*return_offset = *attr->valp;
break;
case DW_FORM_ref2:
+ if (datap + 2 > endp)
+ goto invalid;
*return_offset = read_2ubyte_unaligned (attr->cu->dbg, attr->valp);
break;
case DW_FORM_ref4:
+ if (datap + 4 > endp)
+ goto invalid;
*return_offset = read_4ubyte_unaligned (attr->cu->dbg, attr->valp);
break;
case DW_FORM_ref8:
+ if (datap + 8 > endp)
+ goto invalid;
*return_offset = read_8ubyte_unaligned (attr->cu->dbg, attr->valp);
break;
case DW_FORM_ref_udata:
- datap = attr->valp;
- get_uleb128 (*return_offset, datap);
+ if (datap + 1 > endp)
+ goto invalid;
+ get_uleb128 (*return_offset, datap, endp);
break;
case DW_FORM_ref_addr:
case DW_FORM_ref_sig8:
+ case DW_FORM_GNU_ref_alt:
+ /* These aren't handled by dwarf_formref, only by dwarf_formref_die. */
__libdw_seterrno (DWARF_E_INVALID_REFERENCE);
return -1;
diff --git a/src/libdw/dwarf_formref_die.c b/src/libdw/dwarf_formref_die.c
index 3ec770d2..63f66971 100644
--- a/src/libdw/dwarf_formref_die.c
+++ b/src/libdw/dwarf_formref_die.c
@@ -1,51 +1,30 @@
/* Look up the DIE in a reference-form attribute.
Copyright (C) 2005-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -67,22 +46,32 @@ dwarf_formref_die (attr, result)
struct Dwarf_CU *cu = attr->cu;
Dwarf_Off offset;
- if (attr->form == DW_FORM_ref_addr)
+ if (attr->form == DW_FORM_ref_addr || attr->form == DW_FORM_GNU_ref_alt)
{
/* This has an absolute offset. */
- uint8_t ref_size = (cu->version == 2
+ uint8_t ref_size = (cu->version == 2 && attr->form == DW_FORM_ref_addr
? cu->address_size
: cu->offset_size);
- if (__libdw_read_offset (cu->dbg, IDX_debug_info, attr->valp,
+ Dwarf *dbg_ret = (attr->form == DW_FORM_GNU_ref_alt
+ ? cu->dbg->alt_dwarf : cu->dbg);
+
+ if (dbg_ret == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NO_ALT_DEBUGLINK);
+ return NULL;
+ }
+
+ if (__libdw_read_offset (cu->dbg, dbg_ret, IDX_debug_info, attr->valp,
ref_size, &offset, IDX_debug_info, 0))
return NULL;
- return INTUSE(dwarf_offdie) (cu->dbg, offset, result);
+ return INTUSE(dwarf_offdie) (dbg_ret, offset, result);
}
- Elf_Data *data;
+ const unsigned char *datap;
+ size_t size;
if (attr->form == DW_FORM_ref_sig8)
{
/* This doesn't have an offset, but instead a value we
@@ -101,11 +90,11 @@ dwarf_formref_die (attr, result)
?: DWARF_E_INVALID_REFERENCE);
return NULL;
}
- Dwarf_Sig8_Hash_insert (&cu->dbg->sig8_hash, cu->type_sig8, cu);
}
while (cu->type_sig8 != sig);
- data = cu->dbg->sectiondata[IDX_debug_types];
+ datap = cu->dbg->sectiondata[IDX_debug_types]->d_buf;
+ size = cu->dbg->sectiondata[IDX_debug_types]->d_size;
offset = cu->type_offset;
}
else
@@ -114,17 +103,18 @@ dwarf_formref_die (attr, result)
if (unlikely (__libdw_formref (attr, &offset) != 0))
return NULL;
- data = cu_data (cu);
+ datap = cu->startp;
+ size = cu->endp - cu->startp;
}
- if (unlikely (data->d_size - cu->start <= offset))
+ if (unlikely (offset >= size))
{
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return NULL;
}
memset (result, '\0', sizeof (Dwarf_Die));
- result->addr = (char *) data->d_buf + cu->start + offset;
+ result->addr = (char *) datap + offset;
result->cu = cu;
return result;
}
diff --git a/src/libdw/dwarf_formsdata.c b/src/libdw/dwarf_formsdata.c
index ab7249d1..2380bf43 100644
--- a/src/libdw/dwarf_formsdata.c
+++ b/src/libdw/dwarf_formsdata.c
@@ -1,52 +1,31 @@
/* Return signed constant represented by attribute.
- Copyright (C) 2003, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003, 2005, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -64,34 +43,49 @@ dwarf_formsdata (attr, return_sval)
if (attr == NULL)
return -1;
- const unsigned char *datap;
+ const unsigned char *datap = attr->valp;
+ const unsigned char *endp = attr->cu->endp;
switch (attr->form)
{
case DW_FORM_data1:
+ if (datap + 1 > endp)
+ {
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
*return_sval = *attr->valp;
break;
case DW_FORM_data2:
+ if (datap + 2 > endp)
+ goto invalid;
*return_sval = read_2ubyte_unaligned (attr->cu->dbg, attr->valp);
break;
case DW_FORM_data4:
+ if (datap + 4 > endp)
+ goto invalid;
*return_sval = read_4ubyte_unaligned (attr->cu->dbg, attr->valp);
break;
case DW_FORM_data8:
+ if (datap + 8 > endp)
+ goto invalid;
*return_sval = read_8ubyte_unaligned (attr->cu->dbg, attr->valp);
break;
case DW_FORM_sdata:
- datap = attr->valp;
- get_sleb128 (*return_sval, datap);
+ if (datap + 1 > endp)
+ goto invalid;
+ get_sleb128 (*return_sval, datap, endp);
break;
case DW_FORM_udata:
- datap = attr->valp;
- get_uleb128 (*return_sval, datap);
+ if (datap + 1 > endp)
+ goto invalid;
+ get_uleb128 (*return_sval, datap, endp);
break;
default:
diff --git a/src/libdw/dwarf_formstring.c b/src/libdw/dwarf_formstring.c
index 1dee9b2d..02b56d4a 100644
--- a/src/libdw/dwarf_formstring.c
+++ b/src/libdw/dwarf_formstring.c
@@ -1,52 +1,31 @@
/* Return string associated with given attribute.
- Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2010, 2013 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -70,19 +49,28 @@ dwarf_formstring (attrp)
return (const char *) attrp->valp;
Dwarf *dbg = attrp->cu->dbg;
+ Dwarf *dbg_ret = attrp->form == DW_FORM_GNU_strp_alt ? dbg->alt_dwarf : dbg;
+
+ if (unlikely (dbg_ret == NULL))
+ {
+ __libdw_seterrno (DWARF_E_NO_ALT_DEBUGLINK);
+ return NULL;
+ }
+
- if (unlikely (attrp->form != DW_FORM_strp)
- || dbg->sectiondata[IDX_debug_str] == NULL)
+ if (unlikely (attrp->form != DW_FORM_strp
+ && attrp->form != DW_FORM_GNU_strp_alt)
+ || dbg_ret->sectiondata[IDX_debug_str] == NULL)
{
__libdw_seterrno (DWARF_E_NO_STRING);
return NULL;
}
uint64_t off;
- if (__libdw_read_offset (dbg, cu_sec_idx (attrp->cu), attrp->valp,
+ if (__libdw_read_offset (dbg, dbg_ret, cu_sec_idx (attrp->cu), attrp->valp,
attrp->cu->offset_size, &off, IDX_debug_str, 1))
return NULL;
- return (const char *) dbg->sectiondata[IDX_debug_str]->d_buf + off;
+ return (const char *) dbg_ret->sectiondata[IDX_debug_str]->d_buf + off;
}
INTDEF(dwarf_formstring)
diff --git a/src/libdw/dwarf_formudata.c b/src/libdw/dwarf_formudata.c
index 07efbe0b..a01ff312 100644
--- a/src/libdw/dwarf_formudata.c
+++ b/src/libdw/dwarf_formudata.c
@@ -1,52 +1,31 @@
/* Return unsigned constant represented by attribute.
- Copyright (C) 2003-2012 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2012, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -73,7 +52,8 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
Dwarf_Word offset;
if (attr->form == DW_FORM_sec_offset)
{
- if (__libdw_read_offset (attr->cu->dbg, cu_sec_idx (attr->cu), attr->valp,
+ if (__libdw_read_offset (attr->cu->dbg, attr->cu->dbg,
+ cu_sec_idx (attr->cu), attr->valp,
attr->cu->offset_size, &offset, sec_index, 0))
return NULL;
}
@@ -84,7 +64,8 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
{
case DW_FORM_data4:
case DW_FORM_data8:
- if (__libdw_read_offset (attr->cu->dbg, cu_sec_idx (attr->cu),
+ if (__libdw_read_offset (attr->cu->dbg, attr->cu->dbg,
+ cu_sec_idx (attr->cu),
attr->valp,
attr->form == DW_FORM_data4 ? 4 : 8,
&offset, sec_index, 0))
@@ -120,15 +101,24 @@ dwarf_formudata (attr, return_uval)
if (attr == NULL)
return -1;
- const unsigned char *datap;
+ const unsigned char *datap = attr->valp;
+ const unsigned char *endp = attr->cu->endp;
switch (attr->form)
{
case DW_FORM_data1:
+ if (datap + 1 > endp)
+ {
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
*return_uval = *attr->valp;
break;
case DW_FORM_data2:
+ if (datap + 2 > endp)
+ goto invalid;
*return_uval = read_2ubyte_unaligned (attr->cu->dbg, attr->valp);
break;
@@ -161,13 +151,21 @@ dwarf_formudata (attr, return_uval)
break;
case DW_AT_macro_info:
- /* macptr */
+ /* macptr into .debug_macinfo */
if (__libdw_formptr (attr, IDX_debug_macinfo,
DWARF_E_NO_ENTRY, NULL,
return_uval) == NULL)
return -1;
break;
+ case DW_AT_GNU_macros:
+ /* macptr into .debug_macro */
+ if (__libdw_formptr (attr, IDX_debug_macro,
+ DWARF_E_NO_ENTRY, NULL,
+ return_uval) == NULL)
+ return -1;
+ break;
+
case DW_AT_ranges:
case DW_AT_start_scope:
/* rangelistptr */
@@ -214,13 +212,15 @@ dwarf_formudata (attr, return_uval)
break;
case DW_FORM_sdata:
- datap = attr->valp;
- get_sleb128 (*return_uval, datap);
+ if (datap + 1 > endp)
+ goto invalid;
+ get_sleb128 (*return_uval, datap, endp);
break;
case DW_FORM_udata:
- datap = attr->valp;
- get_uleb128 (*return_uval, datap);
+ if (datap + 1 > endp)
+ goto invalid;
+ get_uleb128 (*return_uval, datap, endp);
break;
default:
diff --git a/src/libdw/dwarf_frame_cfa.c b/src/libdw/dwarf_frame_cfa.c
index 2f3268a8..a9ae7e73 100644
--- a/src/libdw/dwarf_frame_cfa.c
+++ b/src/libdw/dwarf_frame_cfa.c
@@ -1,51 +1,30 @@
/* Get CFA expression for frame.
Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_frame_info.c b/src/libdw/dwarf_frame_info.c
index 4bdd8068..7da46fb0 100644
--- a/src/libdw/dwarf_frame_info.c
+++ b/src/libdw/dwarf_frame_info.c
@@ -1,51 +1,30 @@
/* Get return address register for frame.
Copyright (C) 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_frame_register.c b/src/libdw/dwarf_frame_register.c
index ae0db020..10d2fe49 100644
--- a/src/libdw/dwarf_frame_register.c
+++ b/src/libdw/dwarf_frame_register.c
@@ -1,51 +1,30 @@
/* Get register location expression for frame.
- Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -123,7 +102,9 @@ dwarf_frame_register (fs, regno, ops_mem, ops, nops)
Dwarf_Block block;
const uint8_t *p = fs->cache->data->d.d_buf + reg->value;
- get_uleb128 (block.length, p);
+ const uint8_t *end = (fs->cache->data->d.d_buf
+ + fs->cache->data->d.d_size);
+ get_uleb128 (block.length, p, end);
block.data = (void *) p;
/* Parse the expression into internal form. */
diff --git a/src/libdw/dwarf_func_inline.c b/src/libdw/dwarf_func_inline.c
index 6018691a..bc9db1cf 100644
--- a/src/libdw/dwarf_func_inline.c
+++ b/src/libdw/dwarf_func_inline.c
@@ -1,50 +1,30 @@
/* Convenience functions for handling DWARF descriptions of inline functions.
Copyright (C) 2005,2006 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under an Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) and to distribute linked
- combinations including the two. Non-GPL Code permitted under this
- exception must only link to the code of Red Hat elfutils through those
- well defined interfaces identified in the file named EXCEPTION found in
- the source code files (the "Approved Interfaces"). The files of Non-GPL
- Code may instantiate templates or use macros or inline functions from
- the Approved Interfaces without causing the resulting work to be covered
- by the GNU General Public License. Only Red Hat, Inc. may make changes
- or additions to the list of Approved Interfaces. Red Hat's grant of
- this exception is conditioned upon your not adding any new exceptions.
- If you wish to add a new Approved Interface or exception, please contact
- Red Hat. You must obey the GNU General Public License in all respects
- for all of the Red Hat elfutils code and other code used in conjunction
- with Red Hat elfutils except the Non-GPL Code covered by this exception.
- If you modify this file, you may extend this exception to your version
- of the file, but you are not obligated to do so. If you do not wish to
- provide this exception without modification, you must delete this
- exception statement from your version and license this file solely under
- the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getabbrev.c b/src/libdw/dwarf_getabbrev.c
index 07bf6dfc..0efde45b 100644
--- a/src/libdw/dwarf_getabbrev.c
+++ b/src/libdw/dwarf_getabbrev.c
@@ -1,58 +1,36 @@
/* Get abbreviation at given offset.
- Copyright (C) 2003, 2004, 2005, 2006 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003, 2004, 2005, 2006, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <assert.h>
#include <dwarf.h>
#include "libdwP.h"
@@ -99,9 +77,11 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result)
consists of two parts. The first part is an unsigned LEB128
number representing the attribute's name. The second part is
an unsigned LEB128 number representing the attribute's form. */
+ const unsigned char *end = (dbg->sectiondata[IDX_debug_abbrev]->d_buf
+ + dbg->sectiondata[IDX_debug_abbrev]->d_size);
const unsigned char *start_abbrevp = abbrevp;
unsigned int code;
- get_uleb128 (code, abbrevp);
+ get_uleb128 (code, abbrevp, end);
/* Check whether this code is already in the hash table. */
bool foundit = false;
@@ -118,7 +98,14 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result)
{
foundit = true;
- assert (abb->offset == offset);
+ if (unlikely (abb->offset != offset))
+ {
+ /* A duplicate abbrev code at a different offset,
+ that should never happen. */
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return NULL;
+ }
/* If the caller doesn't need the length we are done. */
if (lengthp == NULL)
@@ -129,7 +116,11 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result)
overwrite its content. This must not be a problem, since the
content better be the same. */
abb->code = code;
- get_uleb128 (abb->tag, abbrevp);
+ if (abbrevp >= end)
+ goto invalid;
+ get_uleb128 (abb->tag, abbrevp, end);
+ if (abbrevp + 1 >= end)
+ goto invalid;
abb->has_children = *abbrevp++ == DW_CHILDREN_yes;
abb->attrp = (unsigned char *) abbrevp;
abb->offset = offset;
@@ -140,8 +131,12 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result)
unsigned int attrform;
do
{
- get_uleb128 (attrname, abbrevp);
- get_uleb128 (attrform, abbrevp);
+ if (abbrevp >= end)
+ goto invalid;
+ get_uleb128 (attrname, abbrevp, end);
+ if (abbrevp >= end)
+ goto invalid;
+ get_uleb128 (attrform, abbrevp, end);
}
while (attrname != 0 && attrform != 0 && ++abb->attrcnt);
diff --git a/src/libdw/dwarf_getabbrevattr.c b/src/libdw/dwarf_getabbrevattr.c
index 05da17c9..574467ce 100644
--- a/src/libdw/dwarf_getabbrevattr.c
+++ b/src/libdw/dwarf_getabbrevattr.c
@@ -1,52 +1,31 @@
/* Get specific attribute of abbreviation.
- Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003, 2004, 2005, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -78,9 +57,10 @@ dwarf_getabbrevattr (abbrev, idx, namep, formp, offsetp)
{
start_attrp = attrp;
- /* Attribute code and form are encoded as ULEB128 values. */
- get_uleb128 (name, attrp);
- get_uleb128 (form, attrp);
+ /* Attribute code and form are encoded as ULEB128 values.i
+ XXX We have no way to bounds check. */
+ get_uleb128 (name, attrp, attrp + len_leb128 (name));
+ get_uleb128 (form, attrp, attrp + len_leb128 (form));
/* If both values are zero the index is out of range. */
if (name == 0 && form == 0)
diff --git a/src/libdw/dwarf_getabbrevcode.c b/src/libdw/dwarf_getabbrevcode.c
index edf492d8..0df90649 100644
--- a/src/libdw/dwarf_getabbrevcode.c
+++ b/src/libdw/dwarf_getabbrevcode.c
@@ -1,52 +1,31 @@
/* Get abbreviation code.
Copyright (C) 2003 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getabbrevtag.c b/src/libdw/dwarf_getabbrevtag.c
index 4f1f72ca..36a5262d 100644
--- a/src/libdw/dwarf_getabbrevtag.c
+++ b/src/libdw/dwarf_getabbrevtag.c
@@ -1,52 +1,31 @@
/* Get abbreviation tag.
Copyright (C) 2003 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getalt.c b/src/libdw/dwarf_getalt.c
new file mode 100644
index 00000000..cc434f03
--- /dev/null
+++ b/src/libdw/dwarf_getalt.c
@@ -0,0 +1,42 @@
+/* Retrieves the DWARF descriptor for debugaltlink data.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libdwP.h"
+
+Dwarf *
+dwarf_getalt (Dwarf *main)
+{
+ if (main == NULL)
+ return NULL;
+ return main->alt_dwarf;
+}
+INTDEF (dwarf_getalt)
diff --git a/src/libdw/dwarf_getarange_addr.c b/src/libdw/dwarf_getarange_addr.c
index 855c855b..fc143de9 100644
--- a/src/libdw/dwarf_getarange_addr.c
+++ b/src/libdw/dwarf_getarange_addr.c
@@ -1,52 +1,31 @@
/* Get address range which includes given address.
Copyright (C) 2004, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getarangeinfo.c b/src/libdw/dwarf_getarangeinfo.c
index 7cefbf71..67b6e671 100644
--- a/src/libdw/dwarf_getarangeinfo.c
+++ b/src/libdw/dwarf_getarangeinfo.c
@@ -1,52 +1,31 @@
/* Return list address ranges.
Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getaranges.c b/src/libdw/dwarf_getaranges.c
index f18d63d0..4953af53 100644
--- a/src/libdw/dwarf_getaranges.c
+++ b/src/libdw/dwarf_getaranges.c
@@ -1,52 +1,31 @@
/* Return list address ranges.
Copyright (C) 2000-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -69,7 +48,9 @@ compare_aranges (const void *a, const void *b)
{
struct arangelist *const *p1 = a, *const *p2 = b;
struct arangelist *l1 = *p1, *l2 = *p2;
- return l1->arange.addr - l2->arange.addr;
+ if (l1->arange.addr != l2->arange.addr)
+ return (l1->arange.addr < l2->arange.addr) ? -1 : 1;
+ return 0;
}
int
@@ -165,9 +146,10 @@ dwarf_getaranges (dbg, aranges, naranges)
if (address_size != 4 && address_size != 8)
goto invalid;
- /* Ignore the segment size value. */
- // XXX Really?
- (void) *readp++;
+ /* We don't actually support segment selectors. */
+ unsigned int segment_size = *readp++;
+ if (segment_size != 0)
+ goto invalid;
/* Round the address to the next multiple of 2*address_size. */
readp += ((2 * address_size - ((readp - hdrstart) % (2 * address_size)))
diff --git a/src/libdw/dwarf_getattrcnt.c b/src/libdw/dwarf_getattrcnt.c
index f85adf0f..72be766e 100644
--- a/src/libdw/dwarf_getattrcnt.c
+++ b/src/libdw/dwarf_getattrcnt.c
@@ -1,52 +1,31 @@
/* Get number of attributes of abbreviation.
Copyright (C) 2003, 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getattrs.c b/src/libdw/dwarf_getattrs.c
index 051dc25f..0da8b5ba 100644
--- a/src/libdw/dwarf_getattrs.c
+++ b/src/libdw/dwarf_getattrs.c
@@ -1,52 +1,31 @@
/* Get attributes of the DIE.
- Copyright (C) 2004, 2005, 2008, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2004, 2005, 2008, 2009, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -65,17 +44,12 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *),
if (unlikely (offset == 1))
return 1;
- const unsigned char *die_addr = die->addr;
+ const unsigned char *die_addr;
- /* Get the abbreviation code. */
- unsigned int u128;
- get_uleb128 (u128, die_addr);
+ /* Find the abbreviation entry. */
+ Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, &die_addr);
- if (die->abbrev == NULL)
- /* Find the abbreviation. */
- die->abbrev = __libdw_findabbrev (die->cu, u128);
-
- if (unlikely (die->abbrev == DWARF_END_ABBREV))
+ if (unlikely (abbrevp == DWARF_END_ABBREV))
{
invalid_dwarf:
__libdw_seterrno (DWARF_E_INVALID_DWARF);
@@ -83,26 +57,28 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *),
}
/* This is where the attributes start. */
- const unsigned char *attrp = die->abbrev->attrp;
- const unsigned char *const offset_attrp = die->abbrev->attrp + offset;
+ const unsigned char *attrp = abbrevp->attrp;
+ const unsigned char *const offset_attrp = abbrevp->attrp + offset;
/* Go over the list of attributes. */
Dwarf *dbg = die->cu->dbg;
+ const unsigned char *endp;
+ endp = ((const unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf
+ + dbg->sectiondata[IDX_debug_abbrev]->d_size);
while (1)
{
/* Are we still in bounds? */
- if (unlikely (attrp
- >= ((unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf
- + dbg->sectiondata[IDX_debug_abbrev]->d_size)))
+ if (unlikely (attrp >= endp))
goto invalid_dwarf;
/* Get attribute name and form. */
Dwarf_Attribute attr;
const unsigned char *remembered_attrp = attrp;
- // XXX Fix bound checks
- get_uleb128 (attr.code, attrp);
- get_uleb128 (attr.form, attrp);
+ get_uleb128 (attr.code, attrp, endp);
+ if (unlikely (attrp >= endp))
+ goto invalid_dwarf;
+ get_uleb128 (attr.form, attrp, endp);
/* We can stop if we found the attribute with value zero. */
if (attr.code == 0 && attr.form == 0)
@@ -125,20 +101,18 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *),
/* Return the offset of the start of the attribute, so that
dwarf_getattrs() can be restarted from this point if the
caller so desires. */
- return remembered_attrp - die->abbrev->attrp;
+ return remembered_attrp - abbrevp->attrp;
}
/* Skip over the rest of this attribute (if there is any). */
if (attr.form != 0)
{
- size_t len = __libdw_form_val_len (dbg, die->cu, attr.form,
- die_addr);
-
+ size_t len = __libdw_form_val_len (die->cu, attr.form, die_addr);
if (unlikely (len == (size_t) -1l))
/* Something wrong with the file. */
return -1l;
- // XXX We need better boundary checks.
+ // __libdw_form_val_len will have done a bounds check.
die_addr += len;
}
}
diff --git a/src/libdw/dwarf_getcfi.c b/src/libdw/dwarf_getcfi.c
index c935631e..a49a9f06 100644
--- a/src/libdw/dwarf_getcfi.c
+++ b/src/libdw/dwarf_getcfi.c
@@ -1,51 +1,30 @@
/* Get CFI from DWARF file.
Copyright (C) 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getcfi_elf.c b/src/libdw/dwarf_getcfi_elf.c
index 64a2a885..61ca60de 100644
--- a/src/libdw/dwarf_getcfi_elf.c
+++ b/src/libdw/dwarf_getcfi_elf.c
@@ -1,51 +1,30 @@
/* Get CFI from ELF file's exception-handling info.
- Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -161,8 +140,8 @@ getcfi_gnu_eh_frame (Elf *elf, const GElf_Ehdr *ehdr, const GElf_Phdr *phdr)
}
Dwarf_Addr eh_frame_ptr;
- size_t search_table_entries;
- uint8_t search_table_encoding;
+ size_t search_table_entries = 0;
+ uint8_t search_table_encoding = 0;
const uint8_t *search_table = parse_eh_frame_hdr (data->d_buf, phdr->p_filesz,
phdr->p_vaddr, ehdr,
&eh_frame_ptr,
@@ -301,8 +280,13 @@ getcfi_shdr (Elf *elf, const GElf_Ehdr *ehdr)
hdr_vaddr = shdr->sh_addr;
}
else if (!strcmp (name, ".eh_frame"))
- return getcfi_scn_eh_frame (elf, ehdr, scn, shdr,
- hdr_scn, hdr_vaddr);
+ {
+ if (shdr->sh_type == SHT_PROGBITS)
+ return getcfi_scn_eh_frame (elf, ehdr, scn, shdr,
+ hdr_scn, hdr_vaddr);
+ else
+ return NULL;
+ }
}
}
diff --git a/src/libdw/dwarf_getelf.c b/src/libdw/dwarf_getelf.c
index daf3b9a7..ecd18592 100644
--- a/src/libdw/dwarf_getelf.c
+++ b/src/libdw/dwarf_getelf.c
@@ -1,52 +1,31 @@
/* Retrieve ELF descriptor used for DWARF access.
Copyright (C) 2002, 2004, 2007 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getfuncs.c b/src/libdw/dwarf_getfuncs.c
index c0352fbf..f79b0a79 100644
--- a/src/libdw/dwarf_getfuncs.c
+++ b/src/libdw/dwarf_getfuncs.c
@@ -1,52 +1,31 @@
/* Get function information.
- Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2005, 2013 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -56,6 +35,63 @@
#include "libdwP.h"
+struct visitor_info
+{
+ /* The user callback of dwarf_getfuncs. */
+ int (*callback) (Dwarf_Die *, void *);
+
+ /* The user arg value to dwarf_getfuncs. */
+ void *arg;
+
+ /* Addr of the DIE offset where to (re)start the search. Zero for all. */
+ void *start_addr;
+
+ /* Last subprogram DIE addr seen. */
+ void *last_addr;
+
+ /* The CU only contains C functions. Allows pruning of most subtrees. */
+ bool c_cu;
+};
+
+static int
+tree_visitor (unsigned int depth __attribute__ ((unused)),
+ struct Dwarf_Die_Chain *chain, void *arg)
+{
+ struct visitor_info *const v = arg;
+ Dwarf_Die *die = &chain->die;
+ void *start_addr = v->start_addr;
+ void *die_addr = die->addr;
+
+ /* Pure C CUs can only contain defining subprogram DIEs as direct
+ children of the CU DIE or as nested function inside a normal C
+ code constructs. */
+ int tag = INTUSE(dwarf_tag) (die);
+ if (v->c_cu
+ && tag != DW_TAG_subprogram
+ && tag != DW_TAG_lexical_block
+ && tag != DW_TAG_inlined_subroutine)
+ {
+ chain->prune = true;
+ return DWARF_CB_OK;
+ }
+
+ /* Skip all DIEs till we found the (re)start addr. */
+ if (start_addr != NULL)
+ {
+ if (die_addr == start_addr)
+ v->start_addr = NULL;
+ return DWARF_CB_OK;
+ }
+
+ /* If this isn't a (defining) subprogram entity, skip DIE. */
+ if (tag != DW_TAG_subprogram
+ || INTUSE(dwarf_hasattr) (die, DW_AT_declaration))
+ return DWARF_CB_OK;
+
+ v->last_addr = die_addr;
+ return (*v->callback) (die, v->arg);
+}
+
ptrdiff_t
dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *),
void *arg, ptrdiff_t offset)
@@ -64,31 +100,19 @@ dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *),
|| INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit))
return -1;
- Dwarf_Die die_mem;
- Dwarf_Die *die;
+ int lang = INTUSE(dwarf_srclang) (cudie);
+ bool c_cu = (lang == DW_LANG_C89
+ || lang == DW_LANG_C
+ || lang == DW_LANG_C99
+ || lang == DW_LANG_C11);
- int res;
- if (offset == 0)
- res = INTUSE(dwarf_child) (cudie, &die_mem);
- else
- {
- die = INTUSE(dwarf_offdie) (cudie->cu->dbg, offset, &die_mem);
- res = INTUSE(dwarf_siblingof) (die, &die_mem);
- }
- die = res != 0 ? NULL : &die_mem;
+ struct visitor_info v = { callback, arg, (void *) offset, NULL, c_cu };
+ struct Dwarf_Die_Chain chain = { .die = CUDIE (cudie->cu),
+ .parent = NULL };
+ int res = __libdw_visit_scopes (0, &chain, &tree_visitor, NULL, &v);
- while (die != NULL)
- {
- if (INTUSE(dwarf_tag) (die) == DW_TAG_subprogram)
- {
- if (callback (die, arg) != DWARF_CB_OK)
- return INTUSE(dwarf_dieoffset) (die);
- }
-
- if (INTUSE(dwarf_siblingof) (die, &die_mem) != 0)
- break;
- }
-
- /* That's all. */
- return 0;
+ if (res == DWARF_CB_ABORT)
+ return (ptrdiff_t) v.last_addr;
+ else
+ return res;
}
diff --git a/src/libdw/dwarf_getlocation.c b/src/libdw/dwarf_getlocation.c
index f7a60f9f..068f3853 100644
--- a/src/libdw/dwarf_getlocation.c
+++ b/src/libdw/dwarf_getlocation.c
@@ -1,52 +1,31 @@
/* Return location expression list.
- Copyright (C) 2000-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -77,6 +56,11 @@ attr_ok (Dwarf_Attribute *attr)
case DW_AT_frame_base:
case DW_AT_return_addr:
case DW_AT_static_link:
+ case DW_AT_segment:
+ case DW_AT_GNU_call_site_value:
+ case DW_AT_GNU_call_site_data_value:
+ case DW_AT_GNU_call_site_target:
+ case DW_AT_GNU_call_site_target_clobbered:
break;
default:
@@ -115,13 +99,15 @@ loc_compare (const void *p1, const void *p2)
/* For each DW_OP_implicit_value, we store a special entry in the cache.
This points us directly to the block data for later fetching. */
static void
-store_implicit_value (Dwarf *dbg, void **cache, Dwarf_Op *op,
- unsigned char *data)
+store_implicit_value (Dwarf *dbg, void **cache, Dwarf_Op *op)
{
struct loc_block_s *block = libdw_alloc (dbg, struct loc_block_s,
sizeof (struct loc_block_s), 1);
+ const unsigned char *data = (const unsigned char *) (uintptr_t) op->number2;
+ // Ignored, equal to op->number. And data length already checked.
+ (void) __libdw_get_uleb128 (&data, data + len_leb128 (Dwarf_Word));
block->addr = op;
- block->data = data + op->number2;
+ block->data = (unsigned char *) data;
block->length = op->number;
(void) tsearch (block, cache, loc_compare);
}
@@ -220,6 +206,13 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
bool cfap, bool valuep,
Dwarf_Op **llbuf, size_t *listlen, int sec_index)
{
+ /* Empty location expressions don't have any ops to intern. */
+ if (block->length == 0)
+ {
+ *listlen = 0;
+ return 0;
+ }
+
/* Check whether we already looked at this list. */
struct loc_s fake = { .addr = block->data };
struct loc_s **found = tfind (&fake, cache, loc_compare);
@@ -245,6 +238,21 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
struct loclist *loclist = NULL;
unsigned int n = 0;
+
+ if (cfap)
+ {
+ /* Synthesize the operation to push the CFA before the expression. */
+ struct loclist *newloc;
+ newloc = (struct loclist *) alloca (sizeof (struct loclist));
+ newloc->atom = DW_OP_call_frame_cfa;
+ newloc->number = 0;
+ newloc->number2 = 0;
+ newloc->offset = -1;
+ newloc->next = loclist;
+ loclist = newloc;
+ ++n;
+ }
+
/* Decode the opcodes. It is possible in some situations to have a
block of size zero. */
while (data < end_data)
@@ -360,6 +368,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
case DW_OP_const4s:
case DW_OP_call4:
+ case DW_OP_GNU_parameter_ref:
if (unlikely (data + 4 > end_data))
goto invalid;
@@ -384,39 +393,43 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
case DW_OP_plus_uconst:
case DW_OP_regx:
case DW_OP_piece:
- /* XXX Check size. */
- get_uleb128 (newloc->number, data);
+ case DW_OP_GNU_convert:
+ case DW_OP_GNU_reinterpret:
+ get_uleb128 (newloc->number, data, end_data);
break;
case DW_OP_consts:
case DW_OP_breg0 ... DW_OP_breg31:
case DW_OP_fbreg:
- /* XXX Check size. */
- get_sleb128 (newloc->number, data);
+ get_sleb128 (newloc->number, data, end_data);
break;
case DW_OP_bregx:
- /* XXX Check size. */
- get_uleb128 (newloc->number, data);
- get_sleb128 (newloc->number2, data);
+ get_uleb128 (newloc->number, data, end_data);
+ if (unlikely (data >= end_data))
+ goto invalid;
+ get_sleb128 (newloc->number2, data, end_data);
break;
case DW_OP_bit_piece:
- /* XXX Check size. */
- get_uleb128 (newloc->number, data);
- get_uleb128 (newloc->number2, data);
+ case DW_OP_GNU_regval_type:
+ get_uleb128 (newloc->number, data, end_data);
+ if (unlikely (data >= end_data))
+ goto invalid;
+ get_uleb128 (newloc->number2, data, end_data);
break;
case DW_OP_implicit_value:
+ case DW_OP_GNU_entry_value:
/* This cannot be used in a CFI expression. */
if (unlikely (dbg == NULL))
goto invalid;
- /* XXX Check size. */
- get_uleb128 (newloc->number, data); /* Block length. */
+ /* start of block inc. len. */
+ newloc->number2 = (Dwarf_Word) (uintptr_t) data;
+ get_uleb128 (newloc->number, data, end_data); /* Block length. */
if (unlikely ((Dwarf_Word) (end_data - data) < newloc->number))
goto invalid;
- newloc->number2 = data - block->data; /* Relative block offset. */
data += newloc->number; /* Skip the block. */
break;
@@ -425,8 +438,32 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
if (__libdw_read_offset_inc (dbg, sec_index, &data, ref_size,
&newloc->number, IDX_debug_info, 0))
return -1;
- /* XXX Check size. */
- get_uleb128 (newloc->number2, data); /* Byte offset. */
+ if (unlikely (data >= end_data))
+ goto invalid;
+ get_uleb128 (newloc->number2, data, end_data); /* Byte offset. */
+ break;
+
+ case DW_OP_GNU_deref_type:
+ if (unlikely (data + 1 >= end_data))
+ goto invalid;
+ newloc->number = *data++;
+ get_uleb128 (newloc->number2, data, end_data);
+ break;
+
+ case DW_OP_GNU_const_type:
+ {
+ size_t size;
+ get_uleb128 (newloc->number, data, end_data);
+ if (unlikely (data >= end_data))
+ goto invalid;
+
+ /* start of block inc. len. */
+ newloc->number2 = (Dwarf_Word) (uintptr_t) data;
+ size = *data++;
+ if (unlikely ((Dwarf_Word) (end_data - data) < size))
+ goto invalid;
+ data += size; /* Skip the block. */
+ }
break;
default:
@@ -437,8 +474,8 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
if (unlikely (n == 0))
{
/* This is not allowed.
-
- XXX Is it? */
+ It would mean an empty location expression, which we handled
+ already as a special case above. */
goto invalid;
}
@@ -455,9 +492,6 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
++n;
}
- if (cfap)
- ++n;
-
/* Allocate the array. */
Dwarf_Op *result;
if (dbg != NULL)
@@ -477,16 +511,6 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
*llbuf = result;
*listlen = n;
- if (cfap)
- {
- /* Synthesize the operation to push the CFA before the expression. */
- --n;
- result[0].atom = DW_OP_call_frame_cfa;
- result[0].number = 0;
- result[0].number2 = 0;
- result[0].offset = -1;
- }
-
do
{
/* We populate the array from the back since the list is backwards. */
@@ -497,7 +521,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
result[n].offset = loclist->offset;
if (result[n].atom == DW_OP_implicit_value)
- store_implicit_value (dbg, cache, &result[n], block->data);
+ store_implicit_value (dbg, cache, &result[n]);
loclist = loclist->next;
}
@@ -530,6 +554,14 @@ static int
getlocation (struct Dwarf_CU *cu, const Dwarf_Block *block,
Dwarf_Op **llbuf, size_t *listlen, int sec_index)
{
+ /* Empty location expressions don't have any ops to intern.
+ Note that synthetic empty_cu doesn't have an associated DWARF dbg. */
+ if (block->length == 0)
+ {
+ *listlen = 0;
+ return 0;
+ }
+
return __libdw_intern_expression (cu->dbg, cu->dbg->other_byte_order,
cu->address_size, (cu->version == 2
? cu->address_size
@@ -560,6 +592,121 @@ dwarf_getlocation (attr, llbuf, listlen)
return getlocation (attr->cu, &block, llbuf, listlen, cu_sec_idx (attr->cu));
}
+static int
+attr_base_address (attr, basep)
+ Dwarf_Attribute *attr;
+ Dwarf_Addr *basep;
+{
+ /* Fetch the CU's base address. */
+ Dwarf_Die cudie = CUDIE (attr->cu);
+
+ /* Find the base address of the compilation unit. It will
+ normally be specified by DW_AT_low_pc. In DWARF-3 draft 4,
+ the base address could be overridden by DW_AT_entry_pc. It's
+ been removed, but GCC emits DW_AT_entry_pc and not DW_AT_lowpc
+ for compilation units with discontinuous ranges. */
+ Dwarf_Attribute attr_mem;
+ if (unlikely (INTUSE(dwarf_lowpc) (&cudie, basep) != 0)
+ && INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (&cudie,
+ DW_AT_entry_pc,
+ &attr_mem),
+ basep) != 0)
+ {
+ if (INTUSE(dwarf_errno) () != 0)
+ return -1;
+
+ /* The compiler provided no base address when it should
+ have. Buggy GCC does this when it used absolute
+ addresses in the location list and no DW_AT_ranges. */
+ *basep = 0;
+ }
+ return 0;
+}
+
+static int
+initial_offset_base (attr, offset, basep)
+ Dwarf_Attribute *attr;
+ ptrdiff_t *offset;
+ Dwarf_Addr *basep;
+{
+ if (attr_base_address (attr, basep) != 0)
+ return -1;
+
+ Dwarf_Word start_offset;
+ if (__libdw_formptr (attr, IDX_debug_loc,
+ DWARF_E_NO_LOCLIST,
+ NULL, &start_offset) == NULL)
+ return -1;
+
+ *offset = start_offset;
+ return 0;
+}
+
+static ptrdiff_t
+getlocations_addr (attr, offset, basep, startp, endp, address,
+ locs, expr, exprlen)
+ Dwarf_Attribute *attr;
+ ptrdiff_t offset;
+ Dwarf_Addr *basep;
+ Dwarf_Addr *startp;
+ Dwarf_Addr *endp;
+ Dwarf_Addr address;
+ Elf_Data *locs;
+ Dwarf_Op **expr;
+ size_t *exprlen;
+{
+ unsigned char *readp = locs->d_buf + offset;
+ unsigned char *readendp = locs->d_buf + locs->d_size;
+
+ next:
+ if (readendp - readp < attr->cu->address_size * 2)
+ {
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
+
+ Dwarf_Addr begin;
+ Dwarf_Addr end;
+
+ switch (__libdw_read_begin_end_pair_inc (attr->cu->dbg, IDX_debug_loc,
+ &readp, attr->cu->address_size,
+ &begin, &end, basep))
+ {
+ case 0: /* got location range. */
+ break;
+ case 1: /* base address setup. */
+ goto next;
+ case 2: /* end of loclist */
+ return 0;
+ default: /* error */
+ return -1;
+ }
+
+ if (readendp - readp < 2)
+ goto invalid;
+
+ /* We have a location expression. */
+ Dwarf_Block block;
+ block.length = read_2ubyte_unaligned_inc (attr->cu->dbg, readp);
+ block.data = readp;
+ if (readendp - readp < (ptrdiff_t) block.length)
+ goto invalid;
+ readp += block.length;
+
+ *startp = *basep + begin;
+ *endp = *basep + end;
+
+ /* If address is minus one we want them all, otherwise only matching. */
+ if (address != (Dwarf_Word) -1 && (address < *startp || address >= *endp))
+ goto next;
+
+ if (getlocation (attr->cu, &block, expr, exprlen, IDX_debug_loc) != 0)
+ return -1;
+
+ return readp - (unsigned char *) locs->d_buf;
+}
+
int
dwarf_getlocation_addr (attr, address, llbufs, listlens, maxlocs)
Dwarf_Attribute *attr;
@@ -598,85 +745,109 @@ dwarf_getlocation_addr (attr, address, llbufs, listlens, maxlocs)
if (result != 1)
return result ?: 1;
- unsigned char *endp;
- unsigned char *readp = __libdw_formptr (attr, IDX_debug_loc,
- DWARF_E_NO_LOCLIST, &endp, NULL);
- if (readp == NULL)
+ Dwarf_Addr base, start, end;
+ Dwarf_Op *expr;
+ size_t expr_len;
+ ptrdiff_t off = 0;
+ size_t got = 0;
+
+ /* This is a true loclistptr, fetch the initial base address and offset. */
+ if (initial_offset_base (attr, &off, &base) != 0)
return -1;
- Dwarf_Addr base = (Dwarf_Addr) -1;
- size_t got = 0;
- while (got < maxlocs)
+ const Elf_Data *d = attr->cu->dbg->sectiondata[IDX_debug_loc];
+ if (d == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NO_LOCLIST);
+ return -1;
+ }
+
+ while (got < maxlocs
+ && (off = getlocations_addr (attr, off, &base, &start, &end,
+ address, d, &expr, &expr_len)) > 0)
{
- if (endp - readp < attr->cu->address_size * 2)
+ /* This one matches the address. */
+ if (llbufs != NULL)
{
- invalid:
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- return -1;
+ llbufs[got] = expr;
+ listlens[got] = expr_len;
}
+ ++got;
+ }
- Dwarf_Addr begin;
- Dwarf_Addr end;
+ /* We might stop early, so off can be zero or positive on success. */
+ if (off < 0)
+ return -1;
- int status
- = __libdw_read_begin_end_pair_inc (attr->cu->dbg, IDX_debug_loc,
- &readp, attr->cu->address_size,
- &begin, &end, &base);
- if (status == 2) /* End of list entry. */
- break;
- else if (status == 1) /* Base address selected. */
- continue;
- else if (status < 0)
- return status;
-
- if (endp - readp < 2)
- goto invalid;
-
- /* We have a location expression. */
- block.length = read_2ubyte_unaligned_inc (attr->cu->dbg, readp);
- block.data = readp;
- if (endp - readp < (ptrdiff_t) block.length)
- goto invalid;
- readp += block.length;
-
- if (base == (Dwarf_Addr) -1)
+ return got;
+}
+
+ptrdiff_t
+dwarf_getlocations (attr, offset, basep, startp, endp, expr, exprlen)
+ Dwarf_Attribute *attr;
+ ptrdiff_t offset;
+ Dwarf_Addr *basep;
+ Dwarf_Addr *startp;
+ Dwarf_Addr *endp;
+ Dwarf_Op **expr;
+ size_t *exprlen;
+{
+ if (! attr_ok (attr))
+ return -1;
+
+ /* 1 is an invalid offset, meaning no more locations. */
+ if (offset == 1)
+ return 0;
+
+ if (offset == 0)
+ {
+ /* If it has a block form, it's a single location expression. */
+ Dwarf_Block block;
+ if (INTUSE(dwarf_formblock) (attr, &block) == 0)
{
- /* Fetch the CU's base address. */
- Dwarf_Die cudie = CUDIE (attr->cu);
-
- /* Find the base address of the compilation unit. It will
- normally be specified by DW_AT_low_pc. In DWARF-3 draft 4,
- the base address could be overridden by DW_AT_entry_pc. It's
- been removed, but GCC emits DW_AT_entry_pc and not DW_AT_lowpc
- for compilation units with discontinuous ranges. */
- Dwarf_Attribute attr_mem;
- if (unlikely (INTUSE(dwarf_lowpc) (&cudie, &base) != 0)
- && INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (&cudie,
- DW_AT_entry_pc,
- &attr_mem),
- &base) != 0)
- {
- if (INTUSE(dwarf_errno) () != 0)
- return -1;
+ if (getlocation (attr->cu, &block, expr, exprlen,
+ cu_sec_idx (attr->cu)) != 0)
+ return -1;
- /* The compiler provided no base address when it should
- have. Buggy GCC does this when it used absolute
- addresses in the location list and no DW_AT_ranges. */
- base = 0;
- }
+ /* This is the one and only location covering everything. */
+ *startp = 0;
+ *endp = -1;
+ return 1;
}
- if (address >= base + begin && address < base + end)
+ int error = INTUSE(dwarf_errno) ();
+ if (unlikely (error != DWARF_E_NO_BLOCK))
{
- /* This one matches the address. */
- if (llbufs != NULL
- && unlikely (getlocation (attr->cu, &block,
- &llbufs[got], &listlens[got],
- IDX_debug_loc) != 0))
- return -1;
- ++got;
+ __libdw_seterrno (error);
+ return -1;
+ }
+
+ int result = check_constant_offset (attr, expr, exprlen);
+ if (result != 1)
+ {
+ if (result == 0)
+ {
+ /* This is the one and only location covering everything. */
+ *startp = 0;
+ *endp = -1;
+ return 1;
+ }
+ return result;
}
+
+ /* We must be looking at a true loclistptr, fetch the initial
+ base address and offset. */
+ if (initial_offset_base (attr, &offset, basep) != 0)
+ return -1;
}
- return got;
+ const Elf_Data *d = attr->cu->dbg->sectiondata[IDX_debug_loc];
+ if (d == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NO_LOCLIST);
+ return -1;
+ }
+
+ return getlocations_addr (attr, offset, basep, startp, endp,
+ (Dwarf_Word) -1, d, expr, exprlen);
}
diff --git a/src/libdw/dwarf_getlocation_attr.c b/src/libdw/dwarf_getlocation_attr.c
new file mode 100644
index 00000000..3229baf6
--- /dev/null
+++ b/src/libdw/dwarf_getlocation_attr.c
@@ -0,0 +1,122 @@
+/* Return DWARF attribute associated with a location expression op.
+ Copyright (C) 2013, 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <dwarf.h>
+#include <libdwP.h>
+
+static Dwarf_CU *
+attr_form_cu (Dwarf_Attribute *attr)
+{
+ /* If the attribute has block/expr form the data comes from the
+ .debug_info from the same cu as the attr. Otherwise it comes from
+ the .debug_loc data section. */
+ switch (attr->form)
+ {
+ case DW_FORM_block1:
+ case DW_FORM_block2:
+ case DW_FORM_block4:
+ case DW_FORM_block:
+ case DW_FORM_exprloc:
+ return attr->cu;
+ default:
+ return attr->cu->dbg->fake_loc_cu;
+ }
+}
+
+int
+dwarf_getlocation_attr (attr, op, result)
+ Dwarf_Attribute *attr;
+ const Dwarf_Op *op;
+ Dwarf_Attribute *result;
+{
+ if (attr == NULL)
+ return -1;
+
+ switch (op->atom)
+ {
+ case DW_OP_implicit_value:
+ result->code = DW_AT_const_value;
+ result->form = DW_FORM_block;
+ result->valp = (unsigned char *) (uintptr_t) op->number2;
+ result->cu = attr_form_cu (attr);
+ break;
+
+ case DW_OP_GNU_entry_value:
+ result->code = DW_AT_location;
+ result->form = DW_FORM_exprloc;
+ result->valp = (unsigned char *) (uintptr_t) op->number2;
+ result->cu = attr_form_cu (attr);
+ break;
+
+ case DW_OP_GNU_const_type:
+ result->code = DW_AT_const_value;
+ result->form = DW_FORM_block1;
+ result->valp = (unsigned char *) (uintptr_t) op->number2;
+ result->cu = attr_form_cu (attr);
+ break;
+
+ case DW_OP_call2:
+ case DW_OP_call4:
+ case DW_OP_call_ref:
+ {
+ Dwarf_Die die;
+ if (INTUSE(dwarf_getlocation_die) (attr, op, &die) != 0)
+ return -1;
+ if (INTUSE(dwarf_attr) (&die, DW_AT_location, result) == NULL)
+ {
+ __libdw_empty_loc_attr (result);
+ return 0;
+ }
+ }
+ break;
+
+ case DW_OP_GNU_implicit_pointer:
+ {
+ Dwarf_Die die;
+ if (INTUSE(dwarf_getlocation_die) (attr, op, &die) != 0)
+ return -1;
+ if (INTUSE(dwarf_attr) (&die, DW_AT_location, result) == NULL
+ && INTUSE(dwarf_attr) (&die, DW_AT_const_value, result) == NULL)
+ {
+ __libdw_empty_loc_attr (result);
+ return 0;
+ }
+ }
+ break;
+
+ default:
+ __libdw_seterrno (DWARF_E_INVALID_ACCESS);
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/libdw/dwarf_getlocation_die.c b/src/libdw/dwarf_getlocation_die.c
new file mode 100644
index 00000000..fa03aac2
--- /dev/null
+++ b/src/libdw/dwarf_getlocation_die.c
@@ -0,0 +1,78 @@
+/* Return DIE associated with a location expression op.
+ Copyright (C) 2013 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <dwarf.h>
+#include <libdwP.h>
+
+int
+dwarf_getlocation_die (attr, op, result)
+ Dwarf_Attribute *attr;
+ const Dwarf_Op *op;
+ Dwarf_Die *result;
+{
+ if (attr == NULL)
+ return -1;
+
+ Dwarf_Off dieoff;
+ switch (op->atom)
+ {
+ case DW_OP_GNU_implicit_pointer:
+ case DW_OP_call_ref:
+ dieoff = op->number;
+ break;
+
+ case DW_OP_GNU_parameter_ref:
+ case DW_OP_GNU_convert:
+ case DW_OP_GNU_reinterpret:
+ case DW_OP_GNU_const_type:
+ case DW_OP_call2:
+ case DW_OP_call4:
+ dieoff = attr->cu->start + op->number;
+ break;
+
+ case DW_OP_GNU_regval_type:
+ case DW_OP_GNU_deref_type:
+ dieoff = attr->cu->start + op->number2;
+ break;
+
+ default:
+ __libdw_seterrno (DWARF_E_INVALID_ACCESS);
+ return -1;
+ }
+
+ if (__libdw_offdie (attr->cu->dbg, dieoff, result,
+ attr->cu->type_offset != 0) == NULL)
+ return -1;
+
+ return 0;
+}
+INTDEF(dwarf_getlocation_die);
diff --git a/src/libdw/dwarf_getlocation_implicit_pointer.c b/src/libdw/dwarf_getlocation_implicit_pointer.c
index 4d9f6b99..f1c16be7 100644
--- a/src/libdw/dwarf_getlocation_implicit_pointer.c
+++ b/src/libdw/dwarf_getlocation_implicit_pointer.c
@@ -1,51 +1,30 @@
/* Return associated attribute for DW_OP_GNU_implicit_pointer.
Copyright (C) 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -55,6 +34,20 @@
#include <dwarf.h>
+static unsigned char empty_exprloc = 0;
+static Dwarf_CU empty_cu = { .startp = &empty_exprloc,
+ .endp = &empty_exprloc + 1 };
+
+void
+internal_function
+__libdw_empty_loc_attr (Dwarf_Attribute *attr)
+{
+ attr->code = DW_AT_location;
+ attr->form = DW_FORM_exprloc;
+ attr->valp = &empty_exprloc;
+ attr->cu = &empty_cu;
+}
+
int
dwarf_getlocation_implicit_pointer (attr, op, result)
Dwarf_Attribute *attr;
@@ -78,8 +71,8 @@ dwarf_getlocation_implicit_pointer (attr, op, result)
if (INTUSE(dwarf_attr) (&die, DW_AT_location, result) == NULL
&& INTUSE(dwarf_attr) (&die, DW_AT_const_value, result) == NULL)
{
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- return -1;
+ __libdw_empty_loc_attr (result);
+ return 0;
}
return 0;
diff --git a/src/libdw/dwarf_getmacros.c b/src/libdw/dwarf_getmacros.c
index b9ec34b9..f9f29961 100644
--- a/src/libdw/dwarf_getmacros.c
+++ b/src/libdw/dwarf_getmacros.c
@@ -1,165 +1,548 @@
/* Get macro information.
- Copyright (C) 2002-2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2002-2009, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <assert.h>
#include <dwarf.h>
+#include <search.h>
+#include <stdlib.h>
#include <string.h>
#include <libdwP.h>
+static int
+get_offset_from (Dwarf_Die *die, int name, Dwarf_Word *retp)
+{
+ /* Get the appropriate attribute. */
+ Dwarf_Attribute attr;
+ if (INTUSE(dwarf_attr) (die, name, &attr) == NULL)
+ return -1;
-ptrdiff_t
-dwarf_getmacros (die, callback, arg, offset)
- Dwarf_Die *die;
- int (*callback) (Dwarf_Macro *, void *);
- void *arg;
- ptrdiff_t offset;
+ /* Offset into the corresponding section. */
+ return INTUSE(dwarf_formudata) (&attr, retp);
+}
+
+static int
+macro_op_compare (const void *p1, const void *p2)
{
- if (die == NULL)
+ const Dwarf_Macro_Op_Table *t1 = (const Dwarf_Macro_Op_Table *) p1;
+ const Dwarf_Macro_Op_Table *t2 = (const Dwarf_Macro_Op_Table *) p2;
+
+ if (t1->offset < t2->offset)
return -1;
+ if (t1->offset > t2->offset)
+ return 1;
+
+ if (t1->sec_index < t2->sec_index)
+ return -1;
+ if (t1->sec_index > t2->sec_index)
+ return 1;
+
+ return 0;
+}
+
+static void
+build_table (Dwarf_Macro_Op_Table *table,
+ Dwarf_Macro_Op_Proto op_protos[static 255])
+{
+ unsigned ct = 0;
+ for (unsigned i = 1; i < 256; ++i)
+ if (op_protos[i - 1].forms != NULL)
+ table->table[table->opcodes[i - 1] = ct++] = op_protos[i - 1];
+ else
+ table->opcodes[i - 1] = 0xff;
+}
+
+#define MACRO_PROTO(NAME, ...) \
+ Dwarf_Macro_Op_Proto NAME = ({ \
+ static const uint8_t proto[] = {__VA_ARGS__}; \
+ (Dwarf_Macro_Op_Proto) {sizeof proto, proto}; \
+ })
+
+enum { macinfo_data_size = offsetof (Dwarf_Macro_Op_Table, table[5]) };
+static unsigned char macinfo_data[macinfo_data_size]
+ __attribute__ ((aligned (__alignof (Dwarf_Macro_Op_Table))));
+
+static __attribute__ ((constructor)) void
+init_macinfo_table (void)
+{
+ MACRO_PROTO (p_udata_str, DW_FORM_udata, DW_FORM_string);
+ MACRO_PROTO (p_udata_udata, DW_FORM_udata, DW_FORM_udata);
+ MACRO_PROTO (p_none);
+
+ Dwarf_Macro_Op_Proto op_protos[255] =
+ {
+ [DW_MACINFO_define - 1] = p_udata_str,
+ [DW_MACINFO_undef - 1] = p_udata_str,
+ [DW_MACINFO_vendor_ext - 1] = p_udata_str,
+ [DW_MACINFO_start_file - 1] = p_udata_udata,
+ [DW_MACINFO_end_file - 1] = p_none,
+ /* If you are adding more elements to this array, increase
+ MACINFO_DATA_SIZE above. */
+ };
+
+ Dwarf_Macro_Op_Table *macinfo_table = (void *) macinfo_data;
+ memset (macinfo_table, 0, sizeof macinfo_data);
+ build_table (macinfo_table, op_protos);
+ macinfo_table->sec_index = IDX_debug_macinfo;
+}
+
+static Dwarf_Macro_Op_Table *
+get_macinfo_table (Dwarf *dbg, Dwarf_Word macoff, Dwarf_Die *cudie)
+{
+ assert (cudie != NULL);
+
+ Dwarf_Attribute attr_mem, *attr
+ = INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list, &attr_mem);
+ Dwarf_Off line_offset = (Dwarf_Off) -1;
+ if (attr != NULL)
+ INTUSE(dwarf_formudata) (attr, &line_offset);
+
+ Dwarf_Macro_Op_Table *table = libdw_alloc (dbg, Dwarf_Macro_Op_Table,
+ macinfo_data_size, 1);
+ memcpy (table, macinfo_data, macinfo_data_size);
+
+ table->offset = macoff;
+ table->sec_index = IDX_debug_macinfo;
+ table->line_offset = line_offset;
+ table->is_64bit = cudie->cu->address_size == 8;
+ table->comp_dir = __libdw_getcompdir (cudie);
+
+ return table;
+}
+
+static Dwarf_Macro_Op_Table *
+get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff,
+ const unsigned char *readp,
+ const unsigned char *const endp,
+ Dwarf_Die *cudie)
+{
+ const unsigned char *startp = readp;
+
+ /* Request at least 3 bytes for header. */
+ if (readp + 3 > endp)
+ {
+ invalid_dwarf:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return NULL;
+ }
- Elf_Data *d = die->cu->dbg->sectiondata[IDX_debug_macinfo];
- if (unlikely (d == NULL) || unlikely (d->d_buf == NULL))
+ uint16_t version = read_2ubyte_unaligned_inc (dbg, readp);
+ if (version != 4)
+ {
+ __libdw_seterrno (DWARF_E_INVALID_VERSION);
+ return NULL;
+ }
+
+ uint8_t flags = *readp++;
+ bool is_64bit = (flags & 0x1) != 0;
+
+ Dwarf_Off line_offset = (Dwarf_Off) -1;
+ if ((flags & 0x2) != 0)
+ {
+ line_offset = read_addr_unaligned_inc (is_64bit ? 8 : 4, dbg, readp);
+ if (readp > endp)
+ goto invalid_dwarf;
+ }
+ else if (cudie != NULL)
+ {
+ Dwarf_Attribute attr_mem, *attr
+ = INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list, &attr_mem);
+ if (attr != NULL)
+ INTUSE(dwarf_formudata) (attr, &line_offset);
+ }
+
+ /* """The macinfo entry types defined in this standard may, but
+ might not, be described in the table""".
+
+ I.e. these may be present. It's tempting to simply skip them,
+ but it's probably more correct to tolerate that a producer tweaks
+ the way certain opcodes are encoded, for whatever reasons. */
+
+ MACRO_PROTO (p_udata_str, DW_FORM_udata, DW_FORM_string);
+ MACRO_PROTO (p_udata_strp, DW_FORM_udata, DW_FORM_strp);
+ MACRO_PROTO (p_udata_udata, DW_FORM_udata, DW_FORM_udata);
+ MACRO_PROTO (p_secoffset, DW_FORM_sec_offset);
+ MACRO_PROTO (p_none);
+
+ Dwarf_Macro_Op_Proto op_protos[255] =
+ {
+ [DW_MACRO_GNU_define - 1] = p_udata_str,
+ [DW_MACRO_GNU_undef - 1] = p_udata_str,
+ [DW_MACRO_GNU_define_indirect - 1] = p_udata_strp,
+ [DW_MACRO_GNU_undef_indirect - 1] = p_udata_strp,
+ [DW_MACRO_GNU_start_file - 1] = p_udata_udata,
+ [DW_MACRO_GNU_end_file - 1] = p_none,
+ [DW_MACRO_GNU_transparent_include - 1] = p_secoffset,
+ /* N.B. DW_MACRO_undef_indirectx, DW_MACRO_define_indirectx
+ should be added when 130313.1 is supported. */
+ };
+
+ if ((flags & 0x4) != 0)
+ {
+ unsigned count = *readp++;
+ for (unsigned i = 0; i < count; ++i)
+ {
+ unsigned opcode = *readp++;
+
+ Dwarf_Macro_Op_Proto e;
+ if (readp >= endp)
+ goto invalid;
+ get_uleb128 (e.nforms, readp, endp);
+ e.forms = readp;
+ op_protos[opcode - 1] = e;
+
+ readp += e.nforms;
+ if (readp > endp)
+ {
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return NULL;
+ }
+ }
+ }
+
+ size_t ct = 0;
+ for (unsigned i = 1; i < 256; ++i)
+ if (op_protos[i - 1].forms != NULL)
+ ++ct;
+
+ /* We support at most 0xfe opcodes defined in the table, as 0xff is
+ a value that means that given opcode is not stored at all. But
+ that should be fine, as opcode 0 is not allocated. */
+ assert (ct < 0xff);
+
+ size_t macop_table_size = offsetof (Dwarf_Macro_Op_Table, table[ct]);
+
+ Dwarf_Macro_Op_Table *table = libdw_alloc (dbg, Dwarf_Macro_Op_Table,
+ macop_table_size, 1);
+
+ *table = (Dwarf_Macro_Op_Table) {
+ .offset = macoff,
+ .sec_index = IDX_debug_macro,
+ .line_offset = line_offset,
+ .header_len = readp - startp,
+ .version = version,
+ .is_64bit = is_64bit,
+
+ /* NULL if CUDIE is NULL or DW_AT_comp_dir is absent. */
+ .comp_dir = __libdw_getcompdir (cudie),
+ };
+ build_table (table, op_protos);
+
+ return table;
+}
+
+static Dwarf_Macro_Op_Table *
+cache_op_table (Dwarf *dbg, int sec_index, Dwarf_Off macoff,
+ const unsigned char *startp,
+ const unsigned char *const endp,
+ Dwarf_Die *cudie)
+{
+ Dwarf_Macro_Op_Table fake = { .offset = macoff, .sec_index = sec_index };
+ Dwarf_Macro_Op_Table **found = tfind (&fake, &dbg->macro_ops,
+ macro_op_compare);
+ if (found != NULL)
+ return *found;
+
+ Dwarf_Macro_Op_Table *table = sec_index == IDX_debug_macro
+ ? get_table_for_offset (dbg, macoff, startp, endp, cudie)
+ : get_macinfo_table (dbg, macoff, cudie);
+
+ if (table == NULL)
+ return NULL;
+
+ Dwarf_Macro_Op_Table **ret = tsearch (table, &dbg->macro_ops,
+ macro_op_compare);
+ if (unlikely (ret == NULL))
+ {
+ __libdw_seterrno (DWARF_E_NOMEM);
+ return NULL;
+ }
+
+ return *ret;
+}
+
+static ptrdiff_t
+read_macros (Dwarf *dbg, int sec_index,
+ Dwarf_Off macoff, int (*callback) (Dwarf_Macro *, void *),
+ void *arg, ptrdiff_t offset, bool accept_0xff,
+ Dwarf_Die *cudie)
+{
+ Elf_Data *d = dbg->sectiondata[sec_index];
+ if (unlikely (d == NULL || d->d_buf == NULL))
{
__libdw_seterrno (DWARF_E_NO_ENTRY);
return -1;
}
- if (offset == 0)
+ if (unlikely (macoff >= d->d_size))
{
- /* Get the appropriate attribute. */
- Dwarf_Attribute attr;
- if (INTUSE(dwarf_attr) (die, DW_AT_macro_info, &attr) == NULL)
- return -1;
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
- /* Offset into the .debug_macinfo section. */
- Dwarf_Word macoff;
- if (INTUSE(dwarf_formudata) (&attr, &macoff) != 0)
- return -1;
+ const unsigned char *const startp = d->d_buf + macoff;
+ const unsigned char *const endp = d->d_buf + d->d_size;
- offset = macoff;
- }
- if (unlikely (offset > (ptrdiff_t) d->d_size))
- goto invalid;
+ Dwarf_Macro_Op_Table *table = cache_op_table (dbg, sec_index, macoff,
+ startp, endp, cudie);
+ if (table == NULL)
+ return -1;
- const unsigned char *readp = d->d_buf + offset;
- const unsigned char *readendp = d->d_buf + d->d_size;
+ if (offset == 0)
+ offset = table->header_len;
- if (readp == readendp)
- return 0;
+ assert (offset >= 0);
+ assert (offset < endp - startp);
+ const unsigned char *readp = startp + offset;
- while (readp < readendp)
+ while (readp < endp)
{
unsigned int opcode = *readp++;
- unsigned int u128;
- unsigned int u128_2 = 0;
- const char *str = NULL;
- const unsigned char *endp;
+ if (opcode == 0)
+ /* Nothing more to do. */
+ return 0;
- switch (opcode)
+ if (unlikely (opcode == 0xff && ! accept_0xff))
{
- case DW_MACINFO_define:
- case DW_MACINFO_undef:
- case DW_MACINFO_vendor_ext:
- /* For the first two opcodes the parameters are
- line, string
- For the latter
- number, string.
- We can treat these cases together. */
- get_uleb128 (u128, readp);
-
- endp = memchr (readp, '\0', readendp - readp);
- if (endp == NULL)
- goto invalid;
+ /* See comment below at dwarf_getmacros for explanation of
+ why we are doing this. */
+ __libdw_seterrno (DWARF_E_INVALID_OPCODE);
+ return -1;
+ }
+
+ unsigned int idx = table->opcodes[opcode - 1];
+ if (idx == 0xff)
+ {
+ __libdw_seterrno (DWARF_E_INVALID_OPCODE);
+ return -1;
+ }
- str = (char *) readp;
- readp = endp + 1;
- break;
+ Dwarf_Macro_Op_Proto *proto = &table->table[idx];
- case DW_MACINFO_start_file:
- /* The two parameters are line and file index. */
- get_uleb128 (u128, readp);
- get_uleb128 (u128_2, readp);
- break;
+ /* A fake CU with bare minimum data to fool dwarf_formX into
+ doing the right thing with the attributes that we put out.
+ We arbitrarily pretend it's version 4. */
+ Dwarf_CU fake_cu = {
+ .dbg = dbg,
+ .version = 4,
+ .offset_size = table->is_64bit ? 8 : 4,
+ .startp = (void *) startp + offset,
+ .endp = (void *) endp,
+ };
- case DW_MACINFO_end_file:
- /* No parameters for this one. */
- u128 = 0;
- break;
+ Dwarf_Attribute attributes[proto->nforms];
+ for (Dwarf_Word i = 0; i < proto->nforms; ++i)
+ {
+ /* We pretend this is a DW_AT_GNU_macros attribute so that
+ DW_FORM_sec_offset forms get correctly interpreted as
+ offset into .debug_macro. */
+ attributes[i].code = DW_AT_GNU_macros;
+ attributes[i].form = proto->forms[i];
+ attributes[i].valp = (void *) readp;
+ attributes[i].cu = &fake_cu;
- case 0:
- /* Nothing more to do. */
- return 0;
+ size_t len = __libdw_form_val_len (&fake_cu, proto->forms[i], readp);
+ if (len == (size_t) -1)
+ return -1;
- default:
- goto invalid;
+ readp += len;
}
- Dwarf_Macro mac;
- mac.opcode = opcode;
- mac.param1 = u128;
- if (str == NULL)
- mac.param2.u = u128_2;
- else
- mac.param2.s = str;
+ Dwarf_Macro macro = {
+ .table = table,
+ .opcode = opcode,
+ .attributes = attributes,
+ };
+
+ if (callback (&macro, arg) != DWARF_CB_OK)
+ return readp - startp;
+ }
+
+ return 0;
+}
+
+/* Token layout:
+
+ - The highest bit is used for distinguishing between callers that
+ know that opcode 0xff may have one of two incompatible meanings.
+ The mask that we use for selecting this bit is
+ DWARF_GETMACROS_START.
+
+ - The rest of the token (31 or 63 bits) encodes address inside the
+ macro unit.
+
+ Besides, token value of 0 signals end of iteration and -1 is
+ reserved for signaling errors. That means it's impossible to
+ represent maximum offset of a .debug_macro unit to new-style
+ callers (which in practice decreases the permissible macro unit
+ size by another 1 byte). */
+
+static ptrdiff_t
+token_from_offset (ptrdiff_t offset, bool accept_0xff)
+{
+ if (offset == -1 || offset == 0)
+ return offset;
+
+ /* Make sure the offset didn't overflow into the flag bit. */
+ if ((offset & DWARF_GETMACROS_START) != 0)
+ {
+ __libdw_seterrno (DWARF_E_TOO_BIG);
+ return -1;
+ }
+
+ if (accept_0xff)
+ offset |= DWARF_GETMACROS_START;
+
+ return offset;
+}
+
+static ptrdiff_t
+offset_from_token (ptrdiff_t token, bool *accept_0xffp)
+{
+ *accept_0xffp = (token & DWARF_GETMACROS_START) != 0;
+ token &= ~DWARF_GETMACROS_START;
+
+ return token;
+}
+
+static ptrdiff_t
+gnu_macros_getmacros_off (Dwarf *dbg, Dwarf_Off macoff,
+ int (*callback) (Dwarf_Macro *, void *),
+ void *arg, ptrdiff_t offset, bool accept_0xff,
+ Dwarf_Die *cudie)
+{
+ assert (offset >= 0);
- if (callback (&mac, arg) != DWARF_CB_OK)
- return readp - (const unsigned char *) d->d_buf;
+ if (macoff >= dbg->sectiondata[IDX_debug_macro]->d_size)
+ {
+ __libdw_seterrno (DWARF_E_INVALID_OFFSET);
+ return -1;
+ }
+
+ return read_macros (dbg, IDX_debug_macro, macoff,
+ callback, arg, offset, accept_0xff, cudie);
+}
+
+static ptrdiff_t
+macro_info_getmacros_off (Dwarf *dbg, Dwarf_Off macoff,
+ int (*callback) (Dwarf_Macro *, void *),
+ void *arg, ptrdiff_t offset, Dwarf_Die *cudie)
+{
+ assert (offset >= 0);
+
+ return read_macros (dbg, IDX_debug_macinfo, macoff,
+ callback, arg, offset, true, cudie);
+}
+
+ptrdiff_t
+dwarf_getmacros_off (Dwarf *dbg, Dwarf_Off macoff,
+ int (*callback) (Dwarf_Macro *, void *),
+ void *arg, ptrdiff_t token)
+{
+ if (dbg == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NO_DWARF);
+ return -1;
+ }
+
+ bool accept_0xff;
+ ptrdiff_t offset = offset_from_token (token, &accept_0xff);
+ assert (accept_0xff);
+
+ offset = gnu_macros_getmacros_off (dbg, macoff, callback, arg, offset,
+ accept_0xff, NULL);
+
+ return token_from_offset (offset, accept_0xff);
+}
+
+ptrdiff_t
+dwarf_getmacros (cudie, callback, arg, token)
+ Dwarf_Die *cudie;
+ int (*callback) (Dwarf_Macro *, void *);
+ void *arg;
+ ptrdiff_t token;
+{
+ if (cudie == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NO_DWARF);
+ return -1;
+ }
+
+ /* This function might be called from a code that expects to see
+ DW_MACINFO_* opcodes, not DW_MACRO_{GNU_,}* ones. It is fine to
+ serve most DW_MACRO_{GNU_,}* opcodes to such code, because those
+ whose values are the same as DW_MACINFO_* ones also have the same
+ behavior. It is not very likely that a .debug_macro section
+ would only use the part of opcode space that it shares with
+ .debug_macinfo, but it is possible. Serving the opcodes that are
+ only valid in DW_MACRO_{GNU_,}* domain is OK as well, because
+ clients in general need to be ready that newer standards define
+ more opcodes, and have coping mechanisms for unfamiliar opcodes.
+
+ The one exception to the above rule is opcode 0xff, which has
+ concrete semantics in .debug_macinfo, but falls into vendor block
+ in .debug_macro, and can be assigned to do whatever. There is
+ some small probability that the two opcodes would look
+ superficially similar enough that a client would be confused and
+ misbehave as a result. For this reason, we refuse to serve
+ through this interface 0xff's originating from .debug_macro
+ unless the TOKEN that we obtained indicates the call originates
+ from a new-style caller. See above for details on what
+ information is encoded into tokens. */
+
+ bool accept_0xff;
+ ptrdiff_t offset = offset_from_token (token, &accept_0xff);
+
+ /* DW_AT_macro_info */
+ if (dwarf_hasattr (cudie, DW_AT_macro_info))
+ {
+ Dwarf_Word macoff;
+ if (get_offset_from (cudie, DW_AT_macro_info, &macoff) != 0)
+ return -1;
+ offset = macro_info_getmacros_off (cudie->cu->dbg, macoff,
+ callback, arg, offset, cudie);
+ }
+ else
+ {
+ /* DW_AT_GNU_macros, DW_AT_macros */
+ Dwarf_Word macoff;
+ if (get_offset_from (cudie, DW_AT_GNU_macros, &macoff) != 0)
+ return -1;
+ offset = gnu_macros_getmacros_off (cudie->cu->dbg, macoff,
+ callback, arg, offset, accept_0xff,
+ cudie);
}
- /* If we come here the termination of the data for the CU is not
- present. */
- invalid:
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- return -1;
+ return token_from_offset (offset, accept_0xff);
}
diff --git a/src/libdw/dwarf_getpubnames.c b/src/libdw/dwarf_getpubnames.c
index 5560a758..19f4eae1 100644
--- a/src/libdw/dwarf_getpubnames.c
+++ b/src/libdw/dwarf_getpubnames.c
@@ -1,52 +1,31 @@
/* Get public symbol information.
Copyright (C) 2002, 2003, 2004, 2005, 2008 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -109,9 +88,11 @@ get_offsets (Dwarf *dbg)
/* Now we know the offset of the first offset/name pair. */
mem[cnt].set_start = readp + 2 + 2 * len_bytes - startp;
mem[cnt].address_len = len_bytes;
- if (mem[cnt].set_start >= dbg->sectiondata[IDX_debug_pubnames]->d_size)
+ size_t max_size = dbg->sectiondata[IDX_debug_pubnames]->d_size;
+ if (mem[cnt].set_start >= max_size
+ || len - (2 + 2 * len_bytes) > max_size - mem[cnt].set_start)
/* Something wrong, the first entry is beyond the end of
- the section. */
+ the section. Or the length of the whole unit is too big. */
break;
/* Read the version. It better be two for now. */
@@ -123,7 +104,8 @@ get_offsets (Dwarf *dbg)
}
/* Get the CU offset. */
- if (__libdw_read_offset (dbg, IDX_debug_pubnames, readp + 2, len_bytes,
+ if (__libdw_read_offset (dbg, dbg, IDX_debug_pubnames,
+ readp + 2, len_bytes,
&mem[cnt].cu_offset, IDX_debug_info, 3))
/* Error has been already set in reader. */
goto err_return;
@@ -143,7 +125,7 @@ get_offsets (Dwarf *dbg)
readp += len;
}
- if (mem == NULL)
+ if (mem == NULL || cnt == 0)
{
__libdw_seterrno (DWARF_E_NO_ENTRY);
return -1;
@@ -204,6 +186,8 @@ dwarf_getpubnames (dbg, callback, arg, offset)
unsigned char *startp
= (unsigned char *) dbg->sectiondata[IDX_debug_pubnames]->d_buf;
+ unsigned char *endp
+ = startp + dbg->sectiondata[IDX_debug_pubnames]->d_size;
unsigned char *readp = startp + offset;
while (1)
{
@@ -215,6 +199,8 @@ dwarf_getpubnames (dbg, callback, arg, offset)
while (1)
{
/* READP points to the next offset/name pair. */
+ if (readp + dbg->pubnames_sets[cnt].address_len > endp)
+ goto invalid_dwarf;
if (dbg->pubnames_sets[cnt].address_len == 4)
gl.die_offset = read_4ubyte_unaligned_inc (dbg, readp);
else
@@ -228,7 +214,14 @@ dwarf_getpubnames (dbg, callback, arg, offset)
gl.die_offset += dbg->pubnames_sets[cnt].cu_offset;
gl.name = (char *) readp;
- readp = (unsigned char *) rawmemchr (gl.name, '\0') + 1;
+ readp = (unsigned char *) memchr (gl.name, '\0', endp - readp);
+ if (unlikely (readp == NULL))
+ {
+ invalid_dwarf:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1l;
+ }
+ readp++;
/* We found name and DIE offset. Report it. */
if (callback (dbg, &gl, arg) != DWARF_CB_OK)
diff --git a/src/libdw/dwarf_getscopes.c b/src/libdw/dwarf_getscopes.c
index 73431ba7..0ca6da0b 100644
--- a/src/libdw/dwarf_getscopes.c
+++ b/src/libdw/dwarf_getscopes.c
@@ -1,51 +1,30 @@
/* Return scope DIEs containing PC address.
Copyright (C) 2005, 2007 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getscopes_die.c b/src/libdw/dwarf_getscopes_die.c
index 07fb9b00..d3615852 100644
--- a/src/libdw/dwarf_getscopes_die.c
+++ b/src/libdw/dwarf_getscopes_die.c
@@ -1,51 +1,30 @@
/* Return scope DIEs containing given DIE.
Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getscopevar.c b/src/libdw/dwarf_getscopevar.c
index 6ce214f5..eb50c0ad 100644
--- a/src/libdw/dwarf_getscopevar.c
+++ b/src/libdw/dwarf_getscopevar.c
@@ -1,51 +1,30 @@
/* Find a named variable or parameter within given scopes.
Copyright (C) 2005-2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getsrc_die.c b/src/libdw/dwarf_getsrc_die.c
index 96aa41fd..1914cdf7 100644
--- a/src/libdw/dwarf_getsrc_die.c
+++ b/src/libdw/dwarf_getsrc_die.c
@@ -1,52 +1,31 @@
/* Find line information for address.
Copyright (C) 2004, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getsrc_file.c b/src/libdw/dwarf_getsrc_file.c
index bc612f6c..5289c7da 100644
--- a/src/libdw/dwarf_getsrc_file.c
+++ b/src/libdw/dwarf_getsrc_file.c
@@ -1,52 +1,31 @@
/* Find line information for given file/line/column triple.
Copyright (C) 2005-2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getsrcdirs.c b/src/libdw/dwarf_getsrcdirs.c
index 74786dd0..47283ec2 100644
--- a/src/libdw/dwarf_getsrcdirs.c
+++ b/src/libdw/dwarf_getsrcdirs.c
@@ -1,51 +1,30 @@
/* Find include directories in source file information.
Copyright (C) 2007 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_getsrcfiles.c b/src/libdw/dwarf_getsrcfiles.c
index ee4de520..4bfc34b8 100644
--- a/src/libdw/dwarf_getsrcfiles.c
+++ b/src/libdw/dwarf_getsrcfiles.c
@@ -1,52 +1,31 @@
/* Return source file information of CU.
- Copyright (C) 2004, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2004, 2005, 2013 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -61,7 +40,8 @@ int
dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles)
{
if (unlikely (cudie == NULL
- || INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit))
+ || (INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit
+ && INTUSE(dwarf_tag) (cudie) != DW_TAG_partial_unit)))
return -1;
int res = -1;
diff --git a/src/libdw/dwarf_getsrclines.c b/src/libdw/dwarf_getsrclines.c
index 6840b2b5..053b30f2 100644
--- a/src/libdw/dwarf_getsrclines.c
+++ b/src/libdw/dwarf_getsrclines.c
@@ -1,52 +1,31 @@
/* Return line number information of CU.
- Copyright (C) 2004-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2004-2010, 2013, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -55,6 +34,8 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include <search.h>
+
#include "dwarf.h"
#include "libdwP.h"
@@ -69,6 +50,7 @@ struct linelist
{
Dwarf_Line line;
struct linelist *next;
+ size_t sequence;
};
@@ -76,346 +58,488 @@ struct linelist
static int
compare_lines (const void *a, const void *b)
{
- Dwarf_Line *const *p1 = a;
- Dwarf_Line *const *p2 = b;
-
- if ((*p1)->addr == (*p2)->addr)
- /* An end_sequence marker precedes a normal record at the same address. */
- return (*p2)->end_sequence - (*p1)->end_sequence;
-
- return (*p1)->addr - (*p2)->addr;
+ struct linelist *const *p1 = a;
+ struct linelist *const *p2 = b;
+ struct linelist *list1 = *p1;
+ struct linelist *list2 = *p2;
+ Dwarf_Line *line1 = &list1->line;
+ Dwarf_Line *line2 = &list2->line;
+
+ if (line1->addr != line2->addr)
+ return (line1->addr < line2->addr) ? -1 : 1;
+
+ /* An end_sequence marker precedes a normal record at the same address. */
+ if (line1->end_sequence != line2->end_sequence)
+ return line2->end_sequence - line1->end_sequence;
+
+ /* Otherwise, the linelist sequence maintains a stable sort. */
+ return (list1->sequence < list2->sequence) ? -1
+ : (list1->sequence > list2->sequence) ? 1
+ : 0;
}
-int
-dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
+static int
+read_srclines (Dwarf *dbg,
+ const unsigned char *linep, const unsigned char *lineendp,
+ const char *comp_dir, unsigned address_size,
+ Dwarf_Lines **linesp, Dwarf_Files **filesp)
{
- if (unlikely (cudie == NULL
- || INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit))
- return -1;
-
int res = -1;
- /* Get the information if it is not already known. */
- struct Dwarf_CU *const cu = cudie->cu;
- if (cu->lines == NULL)
- {
- /* Failsafe mode: no data found. */
- cu->lines = (void *) -1l;
- cu->files = (void *) -1l;
-
- /* The die must have a statement list associated. */
- Dwarf_Attribute stmt_list_mem;
- Dwarf_Attribute *stmt_list = INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list,
- &stmt_list_mem);
+ struct linelist *linelist = NULL;
+ size_t nlinelist = 0;
- /* Get the offset into the .debug_line section. NB: this call
- also checks whether the previous dwarf_attr call failed. */
- const unsigned char *lineendp;
- const unsigned char *linep
- = __libdw_formptr (stmt_list, IDX_debug_line, DWARF_E_NO_DEBUG_LINE,
- (unsigned char **) &lineendp, NULL);
- if (linep == NULL)
- goto out;
-
- /* Get the compilation directory. */
- Dwarf_Attribute compdir_attr_mem;
- Dwarf_Attribute *compdir_attr = INTUSE(dwarf_attr) (cudie,
- DW_AT_comp_dir,
- &compdir_attr_mem);
- const char *comp_dir = INTUSE(dwarf_formstring) (compdir_attr);
-
- if (unlikely (linep + 4 > lineendp))
- {
- invalid_data:
- __libdw_seterrno (DWARF_E_INVALID_DEBUG_LINE);
- goto out;
- }
+ /* If there are a large number of lines don't blow up the stack.
+ Keep track of the last malloced linelist record and free them
+ through the next pointer at the end. */
+#define MAX_STACK_ALLOC 4096
+ struct linelist *malloc_linelist = NULL;
- Dwarf *dbg = cu->dbg;
- Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, linep);
- unsigned int length = 4;
- if (unlikely (unit_length == DWARF3_LENGTH_64_BIT))
- {
- if (unlikely (linep + 8 > lineendp))
- goto invalid_data;
- unit_length = read_8ubyte_unaligned_inc (dbg, linep);
- length = 8;
- }
+ if (unlikely (linep + 4 > lineendp))
+ {
+ invalid_data:
+ __libdw_seterrno (DWARF_E_INVALID_DEBUG_LINE);
+ goto out;
+ }
- /* Check whether we have enough room in the section. */
- if (unit_length < 2 + length + 5 * 1
- || unlikely (linep + unit_length > lineendp))
+ Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, linep);
+ unsigned int length = 4;
+ if (unlikely (unit_length == DWARF3_LENGTH_64_BIT))
+ {
+ if (unlikely (linep + 8 > lineendp))
goto invalid_data;
- lineendp = linep + unit_length;
-
- /* The next element of the header is the version identifier. */
- uint_fast16_t version = read_2ubyte_unaligned_inc (dbg, linep);
- if (unlikely (version < 2) || unlikely (version > 4))
- {
- __libdw_seterrno (DWARF_E_VERSION);
- goto out;
- }
-
- /* Next comes the header length. */
- Dwarf_Word header_length;
- if (length == 4)
- header_length = read_4ubyte_unaligned_inc (dbg, linep);
- else
- header_length = read_8ubyte_unaligned_inc (dbg, linep);
- const unsigned char *header_start = linep;
+ unit_length = read_8ubyte_unaligned_inc (dbg, linep);
+ length = 8;
+ }
- /* Next the minimum instruction length. */
- uint_fast8_t minimum_instr_len = *linep++;
+ /* Check whether we have enough room in the section. */
+ if (unlikely (unit_length > (size_t) (lineendp - linep)
+ || unit_length < 2 + length + 5 * 1))
+ goto invalid_data;
+ lineendp = linep + unit_length;
- /* Next the maximum operations per instruction, in version 4 format. */
- uint_fast8_t max_ops_per_instr = 1;
- if (version >= 4)
- {
- if (unlikely (lineendp - linep < 5))
- goto invalid_data;
- max_ops_per_instr = *linep++;
- if (unlikely (max_ops_per_instr == 0))
- goto invalid_data;
- }
+ /* The next element of the header is the version identifier. */
+ uint_fast16_t version = read_2ubyte_unaligned_inc (dbg, linep);
+ if (unlikely (version < 2) || unlikely (version > 4))
+ {
+ __libdw_seterrno (DWARF_E_VERSION);
+ goto out;
+ }
- /* Then the flag determining the default value of the is_stmt
- register. */
- uint_fast8_t default_is_stmt = *linep++;
+ /* Next comes the header length. */
+ Dwarf_Word header_length;
+ if (length == 4)
+ header_length = read_4ubyte_unaligned_inc (dbg, linep);
+ else
+ header_length = read_8ubyte_unaligned_inc (dbg, linep);
+ const unsigned char *header_start = linep;
- /* Now the line base. */
- int_fast8_t line_base = (int8_t) *linep++;
+ /* Next the minimum instruction length. */
+ uint_fast8_t minimum_instr_len = *linep++;
- /* And the line range. */
- uint_fast8_t line_range = *linep++;
+ /* Next the maximum operations per instruction, in version 4 format. */
+ uint_fast8_t max_ops_per_instr = 1;
+ if (version >= 4)
+ {
+ if (unlikely (lineendp - linep < 5))
+ goto invalid_data;
+ max_ops_per_instr = *linep++;
+ if (unlikely (max_ops_per_instr == 0))
+ goto invalid_data;
+ }
- /* The opcode base. */
- uint_fast8_t opcode_base = *linep++;
+ /* Then the flag determining the default value of the is_stmt
+ register. */
+ uint_fast8_t default_is_stmt = *linep++;
+
+ /* Now the line base. */
+ int_fast8_t line_base = (int8_t) *linep++;
+
+ /* And the line range. */
+ uint_fast8_t line_range = *linep++;
+
+ /* The opcode base. */
+ uint_fast8_t opcode_base = *linep++;
+
+ /* Remember array with the standard opcode length (-1 to account for
+ the opcode with value zero not being mentioned). */
+ const uint8_t *standard_opcode_lengths = linep - 1;
+ if (unlikely (lineendp - linep < opcode_base - 1))
+ goto invalid_data;
+ linep += opcode_base - 1;
+
+ /* First comes the list of directories. Add the compilation
+ directory first since the index zero is used for it. */
+ struct dirlist
+ {
+ const char *dir;
+ size_t len;
+ struct dirlist *next;
+ } comp_dir_elem =
+ {
+ .dir = comp_dir,
+ .len = comp_dir ? strlen (comp_dir) : 0,
+ .next = NULL
+ };
+ struct dirlist *dirlist = &comp_dir_elem;
+ unsigned int ndirlist = 1;
+
+ // XXX Directly construct array to conserve memory?
+ while (*linep != 0)
+ {
+ struct dirlist *new_dir =
+ (struct dirlist *) alloca (sizeof (*new_dir));
- /* Remember array with the standard opcode length (-1 to account for
- the opcode with value zero not being mentioned). */
- const uint8_t *standard_opcode_lengths = linep - 1;
- if (unlikely (lineendp - linep < opcode_base - 1))
+ new_dir->dir = (char *) linep;
+ uint8_t *endp = memchr (linep, '\0', lineendp - linep);
+ if (endp == NULL)
goto invalid_data;
- linep += opcode_base - 1;
-
- /* First comes the list of directories. Add the compilation
- directory first since the index zero is used for it. */
- struct dirlist
- {
- const char *dir;
- size_t len;
- struct dirlist *next;
- } comp_dir_elem =
- {
- .dir = comp_dir,
- .len = comp_dir ? strlen (comp_dir) : 0,
- .next = NULL
- };
- struct dirlist *dirlist = &comp_dir_elem;
- unsigned int ndirlist = 1;
-
- // XXX Directly construct array to conserve memory?
- while (*linep != 0)
- {
- struct dirlist *new_dir =
- (struct dirlist *) alloca (sizeof (*new_dir));
+ new_dir->len = endp - linep;
+ new_dir->next = dirlist;
+ dirlist = new_dir;
+ ++ndirlist;
+ linep = endp + 1;
+ }
+ /* Skip the final NUL byte. */
+ ++linep;
- new_dir->dir = (char *) linep;
- uint8_t *endp = memchr (linep, '\0', lineendp - linep);
- if (endp == NULL)
- goto invalid_data;
- new_dir->len = endp - linep;
- new_dir->next = dirlist;
- dirlist = new_dir;
- ++ndirlist;
- linep = endp + 1;
- }
- /* Skip the final NUL byte. */
- ++linep;
+ /* Rearrange the list in array form. */
+ struct dirlist **dirarray
+ = (struct dirlist **) alloca (ndirlist * sizeof (*dirarray));
+ for (unsigned int n = ndirlist; n-- > 0; dirlist = dirlist->next)
+ dirarray[n] = dirlist;
- /* Rearrange the list in array form. */
- struct dirlist **dirarray
- = (struct dirlist **) alloca (ndirlist * sizeof (*dirarray));
- for (unsigned int n = ndirlist; n-- > 0; dirlist = dirlist->next)
- dirarray[n] = dirlist;
+ /* Now read the files. */
+ struct filelist null_file =
+ {
+ .info =
+ {
+ .name = "???",
+ .mtime = 0,
+ .length = 0
+ },
+ .next = NULL
+ };
+ struct filelist *filelist = &null_file;
+ unsigned int nfilelist = 1;
+
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ while (*linep != 0)
+ {
+ struct filelist *new_file =
+ (struct filelist *) alloca (sizeof (*new_file));
- /* Now read the files. */
- struct filelist null_file =
- {
- .info =
- {
- .name = "???",
- .mtime = 0,
- .length = 0
- },
- .next = NULL
- };
- struct filelist *filelist = &null_file;
- unsigned int nfilelist = 1;
+ /* First comes the file name. */
+ char *fname = (char *) linep;
+ uint8_t *endp = memchr (fname, '\0', lineendp - linep);
+ if (endp == NULL)
+ goto invalid_data;
+ size_t fnamelen = endp - (uint8_t *) fname;
+ linep = endp + 1;
+ /* Then the index. */
+ Dwarf_Word diridx;
if (unlikely (linep >= lineendp))
goto invalid_data;
- while (*linep != 0)
+ get_uleb128 (diridx, linep, lineendp);
+ if (unlikely (diridx >= ndirlist))
{
- struct filelist *new_file =
- (struct filelist *) alloca (sizeof (*new_file));
+ __libdw_seterrno (DWARF_E_INVALID_DIR_IDX);
+ goto out;
+ }
- /* First comes the file name. */
- char *fname = (char *) linep;
- uint8_t *endp = memchr (fname, '\0', lineendp - linep);
- if (endp == NULL)
- goto invalid_data;
- size_t fnamelen = endp - (uint8_t *) fname;
- linep = endp + 1;
+ if (*fname == '/')
+ /* It's an absolute path. */
+ new_file->info.name = fname;
+ else
+ {
+ new_file->info.name = libdw_alloc (dbg, char, 1,
+ dirarray[diridx]->len + 1
+ + fnamelen + 1);
+ char *cp = new_file->info.name;
- /* Then the index. */
- Dwarf_Word diridx;
- get_uleb128 (diridx, linep);
- if (unlikely (diridx >= ndirlist))
+ if (dirarray[diridx]->dir != NULL)
{
- __libdw_seterrno (DWARF_E_INVALID_DIR_IDX);
- goto out;
+ /* This value could be NULL in case the DW_AT_comp_dir
+ was not present. We cannot do much in this case.
+ The easiest thing is to convert the path in an
+ absolute path. */
+ cp = stpcpy (cp, dirarray[diridx]->dir);
}
-
- if (*fname == '/')
- /* It's an absolute path. */
- new_file->info.name = fname;
- else
- {
- new_file->info.name = libdw_alloc (dbg, char, 1,
- dirarray[diridx]->len + 1
- + fnamelen + 1);
- char *cp = new_file->info.name;
-
- if (dirarray[diridx]->dir != NULL)
- {
- /* This value could be NULL in case the DW_AT_comp_dir
- was not present. We cannot do much in this case.
- The easiest thing is to convert the path in an
- absolute path. */
- cp = stpcpy (cp, dirarray[diridx]->dir);
- }
- *cp++ = '/';
- strcpy (cp, fname);
- assert (strlen (new_file->info.name)
- < dirarray[diridx]->len + 1 + fnamelen + 1);
- }
-
- /* Next comes the modification time. */
- get_uleb128 (new_file->info.mtime, linep);
-
- /* Finally the length of the file. */
- get_uleb128 (new_file->info.length, linep);
-
- new_file->next = filelist;
- filelist = new_file;
- ++nfilelist;
+ *cp++ = '/';
+ strcpy (cp, fname);
+ assert (strlen (new_file->info.name)
+ < dirarray[diridx]->len + 1 + fnamelen + 1);
}
- /* Skip the final NUL byte. */
- ++linep;
- /* Consistency check. */
- if (unlikely (linep != header_start + header_length))
- {
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- goto out;
- }
+ /* Next comes the modification time. */
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (new_file->info.mtime, linep, lineendp);
- /* We are about to process the statement program. Initialize the
- state machine registers (see 6.2.2 in the v2.1 specification). */
- Dwarf_Word addr = 0;
- unsigned int op_index = 0;
- unsigned int file = 1;
- int line = 1;
- unsigned int column = 0;
- uint_fast8_t is_stmt = default_is_stmt;
- bool basic_block = false;
- bool prologue_end = false;
- bool epilogue_begin = false;
- unsigned int isa = 0;
- unsigned int discriminator = 0;
-
- /* Apply the "operation advance" from a special opcode
- or DW_LNS_advance_pc (as per DWARF4 6.2.5.1). */
- inline void advance_pc (unsigned int op_advance)
- {
- addr += minimum_instr_len * ((op_index + op_advance)
- / max_ops_per_instr);
- op_index = (op_index + op_advance) % max_ops_per_instr;
- }
+ /* Finally the length of the file. */
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (new_file->info.length, linep, lineendp);
- /* Process the instructions. */
- struct linelist *linelist = NULL;
- unsigned int nlinelist = 0;
+ new_file->next = filelist;
+ filelist = new_file;
+ ++nfilelist;
+ }
+ /* Skip the final NUL byte. */
+ ++linep;
- /* Adds a new line to the matrix.
- We cannot simply define a function because we want to use alloca. */
-#define NEW_LINE(end_seq) \
- do { \
- if (unlikely (add_new_line (alloca (sizeof (struct linelist)), \
- end_seq))) \
- goto invalid_data; \
- } while (0)
+ /* Consistency check. */
+ if (unlikely (linep != header_start + header_length))
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ goto out;
+ }
- inline bool add_new_line (struct linelist *new_line, bool end_sequence)
- {
- /* Set the line information. For some fields we use bitfields,
- so we would lose information if the encoded values are too large.
- Check just for paranoia, and call the data "invalid" if it
- violates our assumptions on reasonable limits for the values. */
+ /* We are about to process the statement program. Initialize the
+ state machine registers (see 6.2.2 in the v2.1 specification). */
+ Dwarf_Word addr = 0;
+ unsigned int op_index = 0;
+ unsigned int file = 1;
+ int line = 1;
+ unsigned int column = 0;
+ uint_fast8_t is_stmt = default_is_stmt;
+ bool basic_block = false;
+ bool prologue_end = false;
+ bool epilogue_begin = false;
+ unsigned int isa = 0;
+ unsigned int discriminator = 0;
+
+ /* Apply the "operation advance" from a special opcode or
+ DW_LNS_advance_pc (as per DWARF4 6.2.5.1). */
+ inline void advance_pc (unsigned int op_advance)
+ {
+ addr += minimum_instr_len * ((op_index + op_advance)
+ / max_ops_per_instr);
+ op_index = (op_index + op_advance) % max_ops_per_instr;
+ }
+
+ /* Process the instructions. */
+
+ /* Adds a new line to the matrix.
+ We cannot simply define a function because we want to use alloca. */
+#define NEW_LINE(end_seq) \
+ do { \
+ struct linelist *ll = (nlinelist < MAX_STACK_ALLOC \
+ ? alloca (sizeof (struct linelist)) \
+ : malloc (sizeof (struct linelist))); \
+ if (nlinelist >= MAX_STACK_ALLOC) \
+ malloc_linelist = ll; \
+ if (unlikely (add_new_line (ll, end_seq))) \
+ goto invalid_data; \
+ } while (0)
+
+ inline bool add_new_line (struct linelist *new_line, bool end_sequence)
+ {
+ new_line->next = linelist;
+ new_line->sequence = nlinelist;
+ linelist = new_line;
+ ++nlinelist;
+
+ /* Set the line information. For some fields we use bitfields,
+ so we would lose information if the encoded values are too large.
+ Check just for paranoia, and call the data "invalid" if it
+ violates our assumptions on reasonable limits for the values. */
#define SET(field) \
- do { \
- new_line->line.field = field; \
- if (unlikely (new_line->line.field != field)) \
- return true; \
- } while (0)
-
- SET (addr);
- SET (op_index);
- SET (file);
- SET (line);
- SET (column);
- SET (is_stmt);
- SET (basic_block);
- SET (end_sequence);
- SET (prologue_end);
- SET (epilogue_begin);
- SET (isa);
- SET (discriminator);
+ do { \
+ new_line->line.field = field; \
+ if (unlikely (new_line->line.field != field)) \
+ return true; \
+ } while (0)
+
+ SET (addr);
+ SET (op_index);
+ SET (file);
+ SET (line);
+ SET (column);
+ SET (is_stmt);
+ SET (basic_block);
+ SET (end_sequence);
+ SET (prologue_end);
+ SET (epilogue_begin);
+ SET (isa);
+ SET (discriminator);
#undef SET
- new_line->next = linelist;
- linelist = new_line;
- ++nlinelist;
+ return false;
+ }
+
+ while (linep < lineendp)
+ {
+ unsigned int opcode;
+ unsigned int u128;
+ int s128;
+
+ /* Read the opcode. */
+ opcode = *linep++;
+
+ /* Is this a special opcode? */
+ if (likely (opcode >= opcode_base))
+ {
+ if (unlikely (line_range == 0))
+ goto invalid_data;
+
+ /* Yes. Handling this is quite easy since the opcode value
+ is computed with
+
+ opcode = (desired line increment - line_base)
+ + (line_range * address advance) + opcode_base
+ */
+ int line_increment = (line_base
+ + (opcode - opcode_base) % line_range);
- return false;
- }
+ /* Perform the increments. */
+ line += line_increment;
+ advance_pc ((opcode - opcode_base) / line_range);
- while (linep < lineendp)
+ /* Add a new line with the current state machine values. */
+ NEW_LINE (0);
+
+ /* Reset the flags. */
+ basic_block = false;
+ prologue_end = false;
+ epilogue_begin = false;
+ discriminator = 0;
+ }
+ else if (opcode == 0)
{
- unsigned int opcode;
- unsigned int u128;
- int s128;
+ /* This an extended opcode. */
+ if (unlikely (lineendp - linep < 2))
+ goto invalid_data;
+
+ /* The length. */
+ uint_fast8_t len = *linep++;
+
+ if (unlikely ((size_t) (lineendp - linep) < len))
+ goto invalid_data;
- /* Read the opcode. */
+ /* The sub-opcode. */
opcode = *linep++;
- /* Is this a special opcode? */
- if (likely (opcode >= opcode_base))
+ switch (opcode)
{
- /* Yes. Handling this is quite easy since the opcode value
- is computed with
+ case DW_LNE_end_sequence:
+ /* Add a new line with the current state machine values.
+ The is the end of the sequence. */
+ NEW_LINE (1);
+
+ /* Reset the registers. */
+ addr = 0;
+ op_index = 0;
+ file = 1;
+ line = 1;
+ column = 0;
+ is_stmt = default_is_stmt;
+ basic_block = false;
+ prologue_end = false;
+ epilogue_begin = false;
+ isa = 0;
+ discriminator = 0;
+ break;
+
+ case DW_LNE_set_address:
+ /* The value is an address. The size is defined as
+ apporiate for the target machine. We use the
+ address size field from the CU header. */
+ op_index = 0;
+ if (unlikely (lineendp - linep < (uint8_t) address_size))
+ goto invalid_data;
+ if (__libdw_read_address_inc (dbg, IDX_debug_line, &linep,
+ address_size, &addr))
+ goto out;
+ break;
+
+ case DW_LNE_define_file:
+ {
+ char *fname = (char *) linep;
+ uint8_t *endp = memchr (linep, '\0', lineendp - linep);
+ if (endp == NULL)
+ goto invalid_data;
+ size_t fnamelen = endp - linep;
+ linep = endp + 1;
+
+ unsigned int diridx;
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (diridx, linep, lineendp);
+ if (unlikely (diridx >= ndirlist))
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DIR_IDX);
+ goto invalid_data;
+ }
+ Dwarf_Word mtime;
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (mtime, linep, lineendp);
+ Dwarf_Word filelength;
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (filelength, linep, lineendp);
+
+ struct filelist *new_file =
+ (struct filelist *) alloca (sizeof (*new_file));
+ if (fname[0] == '/')
+ new_file->info.name = fname;
+ else
+ {
+ new_file->info.name =
+ libdw_alloc (dbg, char, 1, (dirarray[diridx]->len + 1
+ + fnamelen + 1));
+ char *cp = new_file->info.name;
+
+ if (dirarray[diridx]->dir != NULL)
+ /* This value could be NULL in case the
+ DW_AT_comp_dir was not present. We
+ cannot do much in this case. The easiest
+ thing is to convert the path in an
+ absolute path. */
+ cp = stpcpy (cp, dirarray[diridx]->dir);
+ *cp++ = '/';
+ strcpy (cp, fname);
+ }
- opcode = (desired line increment - line_base)
- + (line_range * address advance) + opcode_base
- */
- int line_increment = (line_base
- + (opcode - opcode_base) % line_range);
+ new_file->info.mtime = mtime;
+ new_file->info.length = filelength;
+ new_file->next = filelist;
+ filelist = new_file;
+ ++nfilelist;
+ }
+ break;
+
+ case DW_LNE_set_discriminator:
+ /* Takes one ULEB128 parameter, the discriminator. */
+ if (unlikely (standard_opcode_lengths[opcode] != 1))
+ goto invalid_data;
+
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (discriminator, linep, lineendp);
+ break;
- /* Perform the increments. */
- line += line_increment;
- advance_pc ((opcode - opcode_base) / line_range);
+ default:
+ /* Unknown, ignore it. */
+ if (unlikely ((size_t) (lineendp - (linep - 1)) < len))
+ goto invalid_data;
+ linep += len - 1;
+ break;
+ }
+ }
+ else if (opcode <= DW_LNS_set_isa)
+ {
+ /* This is a known standard opcode. */
+ switch (opcode)
+ {
+ case DW_LNS_copy:
+ /* Takes no argument. */
+ if (unlikely (standard_opcode_lengths[opcode] != 0))
+ goto invalid_data;
/* Add a new line with the current state machine values. */
NEW_LINE (0);
@@ -425,329 +549,333 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
prologue_end = false;
epilogue_begin = false;
discriminator = 0;
- }
- else if (opcode == 0)
- {
- /* This an extended opcode. */
- if (unlikely (lineendp - linep < 2))
+ break;
+
+ case DW_LNS_advance_pc:
+ /* Takes one uleb128 parameter which is added to the
+ address. */
+ if (unlikely (standard_opcode_lengths[opcode] != 1))
goto invalid_data;
- /* The length. */
- uint_fast8_t len = *linep++;
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (u128, linep, lineendp);
+ advance_pc (u128);
+ break;
+
+ case DW_LNS_advance_line:
+ /* Takes one sleb128 parameter which is added to the
+ line. */
+ if (unlikely (standard_opcode_lengths[opcode] != 1))
+ goto invalid_data;
- if (unlikely ((size_t) (lineendp - linep) < len))
+ if (unlikely (linep >= lineendp))
goto invalid_data;
+ get_sleb128 (s128, linep, lineendp);
+ line += s128;
+ break;
- /* The sub-opcode. */
- opcode = *linep++;
-
- switch (opcode)
- {
- case DW_LNE_end_sequence:
- /* Add a new line with the current state machine values.
- The is the end of the sequence. */
- NEW_LINE (1);
-
- /* Reset the registers. */
- addr = 0;
- op_index = 0;
- file = 1;
- line = 1;
- column = 0;
- is_stmt = default_is_stmt;
- basic_block = false;
- prologue_end = false;
- epilogue_begin = false;
- isa = 0;
- discriminator = 0;
- break;
-
- case DW_LNE_set_address:
- /* The value is an address. The size is defined as
- apporiate for the target machine. We use the
- address size field from the CU header. */
- op_index = 0;
- if (unlikely (lineendp - linep < cu->address_size))
- goto invalid_data;
- if (__libdw_read_address_inc (dbg, IDX_debug_line, &linep,
- cu->address_size, &addr))
- goto out;
- break;
+ case DW_LNS_set_file:
+ /* Takes one uleb128 parameter which is stored in file. */
+ if (unlikely (standard_opcode_lengths[opcode] != 1))
+ goto invalid_data;
- case DW_LNE_define_file:
- {
- char *fname = (char *) linep;
- uint8_t *endp = memchr (linep, '\0', lineendp - linep);
- if (endp == NULL)
- goto invalid_data;
- size_t fnamelen = endp - linep;
- linep = endp + 1;
-
- unsigned int diridx;
- get_uleb128 (diridx, linep);
- Dwarf_Word mtime;
- get_uleb128 (mtime, linep);
- Dwarf_Word filelength;
- get_uleb128 (filelength, linep);
-
- struct filelist *new_file =
- (struct filelist *) alloca (sizeof (*new_file));
- if (fname[0] == '/')
- new_file->info.name = fname;
- else
- {
- new_file->info.name =
- libdw_alloc (dbg, char, 1, (dirarray[diridx]->len + 1
- + fnamelen + 1));
- char *cp = new_file->info.name;
-
- if (dirarray[diridx]->dir != NULL)
- /* This value could be NULL in case the
- DW_AT_comp_dir was not present. We
- cannot do much in this case. The easiest
- thing is to convert the path in an
- absolute path. */
- cp = stpcpy (cp, dirarray[diridx]->dir);
- *cp++ = '/';
- strcpy (cp, fname);
- }
-
- new_file->info.mtime = mtime;
- new_file->info.length = filelength;
- new_file->next = filelist;
- filelist = new_file;
- ++nfilelist;
- }
- break;
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (u128, linep, lineendp);
+ file = u128;
+ break;
- case DW_LNE_set_discriminator:
- /* Takes one ULEB128 parameter, the discriminator. */
- if (unlikely (standard_opcode_lengths[opcode] != 1))
- goto invalid_data;
+ case DW_LNS_set_column:
+ /* Takes one uleb128 parameter which is stored in column. */
+ if (unlikely (standard_opcode_lengths[opcode] != 1))
+ goto invalid_data;
- get_uleb128 (discriminator, linep);
- break;
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (u128, linep, lineendp);
+ column = u128;
+ break;
- default:
- /* Unknown, ignore it. */
- if (unlikely ((size_t) (lineendp - (linep - 1)) < len))
- goto invalid_data;
- linep += len - 1;
- break;
- }
- }
- else if (opcode <= DW_LNS_set_isa)
- {
- /* This is a known standard opcode. */
- switch (opcode)
- {
- case DW_LNS_copy:
- /* Takes no argument. */
- if (unlikely (standard_opcode_lengths[opcode] != 0))
- goto invalid_data;
+ case DW_LNS_negate_stmt:
+ /* Takes no argument. */
+ if (unlikely (standard_opcode_lengths[opcode] != 0))
+ goto invalid_data;
- /* Add a new line with the current state machine values. */
- NEW_LINE (0);
+ is_stmt = 1 - is_stmt;
+ break;
- /* Reset the flags. */
- basic_block = false;
- prologue_end = false;
- epilogue_begin = false;
- discriminator = 0;
- break;
+ case DW_LNS_set_basic_block:
+ /* Takes no argument. */
+ if (unlikely (standard_opcode_lengths[opcode] != 0))
+ goto invalid_data;
- case DW_LNS_advance_pc:
- /* Takes one uleb128 parameter which is added to the
- address. */
- if (unlikely (standard_opcode_lengths[opcode] != 1))
- goto invalid_data;
+ basic_block = true;
+ break;
- get_uleb128 (u128, linep);
- advance_pc (u128);
- break;
+ case DW_LNS_const_add_pc:
+ /* Takes no argument. */
+ if (unlikely (standard_opcode_lengths[opcode] != 0))
+ goto invalid_data;
- case DW_LNS_advance_line:
- /* Takes one sleb128 parameter which is added to the
- line. */
- if (unlikely (standard_opcode_lengths[opcode] != 1))
- goto invalid_data;
+ if (unlikely (line_range == 0))
+ goto invalid_data;
- get_sleb128 (s128, linep);
- line += s128;
- break;
+ advance_pc ((255 - opcode_base) / line_range);
+ break;
- case DW_LNS_set_file:
- /* Takes one uleb128 parameter which is stored in file. */
- if (unlikely (standard_opcode_lengths[opcode] != 1))
- goto invalid_data;
+ case DW_LNS_fixed_advance_pc:
+ /* Takes one 16 bit parameter which is added to the
+ address. */
+ if (unlikely (standard_opcode_lengths[opcode] != 1)
+ || unlikely (lineendp - linep < 2))
+ goto invalid_data;
- get_uleb128 (u128, linep);
- file = u128;
- break;
+ addr += read_2ubyte_unaligned_inc (dbg, linep);
+ op_index = 0;
+ break;
- case DW_LNS_set_column:
- /* Takes one uleb128 parameter which is stored in column. */
- if (unlikely (standard_opcode_lengths[opcode] != 1))
- goto invalid_data;
+ case DW_LNS_set_prologue_end:
+ /* Takes no argument. */
+ if (unlikely (standard_opcode_lengths[opcode] != 0))
+ goto invalid_data;
- get_uleb128 (u128, linep);
- column = u128;
- break;
+ prologue_end = true;
+ break;
- case DW_LNS_negate_stmt:
- /* Takes no argument. */
- if (unlikely (standard_opcode_lengths[opcode] != 0))
- goto invalid_data;
+ case DW_LNS_set_epilogue_begin:
+ /* Takes no argument. */
+ if (unlikely (standard_opcode_lengths[opcode] != 0))
+ goto invalid_data;
- is_stmt = 1 - is_stmt;
- break;
+ epilogue_begin = true;
+ break;
- case DW_LNS_set_basic_block:
- /* Takes no argument. */
- if (unlikely (standard_opcode_lengths[opcode] != 0))
- goto invalid_data;
+ case DW_LNS_set_isa:
+ /* Takes one uleb128 parameter which is stored in isa. */
+ if (unlikely (standard_opcode_lengths[opcode] != 1))
+ goto invalid_data;
- basic_block = true;
- break;
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (isa, linep, lineendp);
+ break;
+ }
+ }
+ else
+ {
+ /* This is a new opcode the generator but not we know about.
+ Read the parameters associated with it but then discard
+ everything. Read all the parameters for this opcode. */
+ for (int n = standard_opcode_lengths[opcode]; n > 0; --n)
+ {
+ if (unlikely (linep >= lineendp))
+ goto invalid_data;
+ get_uleb128 (u128, linep, lineendp);
+ }
- case DW_LNS_const_add_pc:
- /* Takes no argument. */
- if (unlikely (standard_opcode_lengths[opcode] != 0))
- goto invalid_data;
+ /* Next round, ignore this opcode. */
+ continue;
+ }
+ }
- advance_pc ((255 - opcode_base) / line_range);
- break;
+ /* Put all the files in an array. */
+ Dwarf_Files *files = libdw_alloc (dbg, Dwarf_Files,
+ sizeof (Dwarf_Files)
+ + nfilelist * sizeof (Dwarf_Fileinfo)
+ + (ndirlist + 1) * sizeof (char *),
+ 1);
+ const char **dirs = (void *) &files->info[nfilelist];
- case DW_LNS_fixed_advance_pc:
- /* Takes one 16 bit parameter which is added to the
- address. */
- if (unlikely (standard_opcode_lengths[opcode] != 1)
- || unlikely (lineendp - linep < 2))
- goto invalid_data;
+ files->nfiles = nfilelist;
+ while (nfilelist-- > 0)
+ {
+ files->info[nfilelist] = filelist->info;
+ filelist = filelist->next;
+ }
+ assert (filelist == NULL);
+
+ /* Put all the directory strings in an array. */
+ files->ndirs = ndirlist;
+ for (unsigned int i = 0; i < ndirlist; ++i)
+ dirs[i] = dirarray[i]->dir;
+ dirs[ndirlist] = NULL;
+
+ /* Pass the file data structure to the caller. */
+ if (filesp != NULL)
+ *filesp = files;
+
+ size_t buf_size = (sizeof (Dwarf_Lines) + (sizeof (Dwarf_Line) * nlinelist));
+ void *buf = libdw_alloc (dbg, Dwarf_Lines, buf_size, 1);
+
+ /* First use the buffer for the pointers, and sort the entries.
+ We'll write the pointers in the end of the buffer, and then
+ copy into the buffer from the beginning so the overlap works. */
+ assert (sizeof (Dwarf_Line) >= sizeof (struct linelist *));
+ struct linelist **sortlines = (buf + buf_size
+ - sizeof (struct linelist **) * nlinelist);
+
+ /* The list is in LIFO order and usually they come in clumps with
+ ascending addresses. So fill from the back to probably start with
+ runs already in order before we sort. */
+ for (size_t i = nlinelist; i-- > 0; )
+ {
+ sortlines[i] = linelist;
+ linelist = linelist->next;
+ }
+ assert (linelist == NULL);
- addr += read_2ubyte_unaligned_inc (dbg, linep);
- op_index = 0;
- break;
+ /* Sort by ascending address. */
+ qsort (sortlines, nlinelist, sizeof sortlines[0], &compare_lines);
- case DW_LNS_set_prologue_end:
- /* Takes no argument. */
- if (unlikely (standard_opcode_lengths[opcode] != 0))
- goto invalid_data;
+ /* Now that they are sorted, put them in the final array.
+ The buffers overlap, so we've clobbered the early elements
+ of SORTLINES by the time we're reading the later ones. */
+ Dwarf_Lines *lines = buf;
+ lines->nlines = nlinelist;
+ for (size_t i = 0; i < nlinelist; ++i)
+ {
+ lines->info[i] = sortlines[i]->line;
+ lines->info[i].files = files;
+ }
- prologue_end = true;
- break;
+ /* Make sure the highest address for the CU is marked as end_sequence.
+ This is required by the DWARF spec, but some compilers forget and
+ dwfl_module_getsrc depends on it. */
+ if (nlinelist > 0)
+ lines->info[nlinelist - 1].end_sequence = 1;
- case DW_LNS_set_epilogue_begin:
- /* Takes no argument. */
- if (unlikely (standard_opcode_lengths[opcode] != 0))
- goto invalid_data;
+ /* Pass the line structure back to the caller. */
+ if (linesp != NULL)
+ *linesp = lines;
- epilogue_begin = true;
- break;
+ /* Success. */
+ res = 0;
- case DW_LNS_set_isa:
- /* Takes one uleb128 parameter which is stored in isa. */
- if (unlikely (standard_opcode_lengths[opcode] != 1))
- goto invalid_data;
+ out:
+ /* Free malloced line records, if any. */
+ for (size_t i = MAX_STACK_ALLOC; i < nlinelist; i++)
+ {
+ struct linelist *ll = malloc_linelist->next;
+ free (malloc_linelist);
+ malloc_linelist = ll;
+ }
- get_uleb128 (isa, linep);
- break;
- }
- }
- else
- {
- /* This is a new opcode the generator but not we know about.
- Read the parameters associated with it but then discard
- everything. Read all the parameters for this opcode. */
- for (int n = standard_opcode_lengths[opcode]; n > 0; --n)
- get_uleb128 (u128, linep);
-
- /* Next round, ignore this opcode. */
- continue;
- }
- }
+ return res;
+}
- /* Put all the files in an array. */
- Dwarf_Files *files = libdw_alloc (dbg, Dwarf_Files,
- sizeof (Dwarf_Files)
- + nfilelist * sizeof (Dwarf_Fileinfo)
- + (ndirlist + 1) * sizeof (char *),
- 1);
- const char **dirs = (void *) &files->info[nfilelist];
+static int
+files_lines_compare (const void *p1, const void *p2)
+{
+ const struct files_lines_s *t1 = p1;
+ const struct files_lines_s *t2 = p2;
- files->nfiles = nfilelist;
- while (nfilelist-- > 0)
- {
- files->info[nfilelist] = filelist->info;
- filelist = filelist->next;
- }
- assert (filelist == NULL);
-
- /* Put all the directory strings in an array. */
- files->ndirs = ndirlist;
- for (unsigned int i = 0; i < ndirlist; ++i)
- dirs[i] = dirarray[i]->dir;
- dirs[ndirlist] = NULL;
-
- /* Remember the referring CU. */
- files->cu = cu;
-
- /* Make the file data structure available through the CU. */
- cu->files = files;
-
- void *buf = libdw_alloc (dbg, Dwarf_Lines, (sizeof (Dwarf_Lines)
- + (sizeof (Dwarf_Line)
- * nlinelist)), 1);
-
- /* First use the buffer for the pointers, and sort the entries.
- We'll write the pointers in the end of the buffer, and then
- copy into the buffer from the beginning so the overlap works. */
- assert (sizeof (Dwarf_Line) >= sizeof (Dwarf_Line *));
- Dwarf_Line **sortlines = (buf + sizeof (Dwarf_Lines)
- + ((sizeof (Dwarf_Line)
- - sizeof (Dwarf_Line *)) * nlinelist));
-
- /* The list is in LIFO order and usually they come in clumps with
- ascending addresses. So fill from the back to probably start with
- runs already in order before we sort. */
- unsigned int i = nlinelist;
- while (i-- > 0)
- {
- sortlines[i] = &linelist->line;
- linelist = linelist->next;
- }
- assert (linelist == NULL);
+ if (t1->debug_line_offset < t2->debug_line_offset)
+ return -1;
+ if (t1->debug_line_offset > t2->debug_line_offset)
+ return 1;
+
+ return 0;
+}
+
+int
+internal_function
+__libdw_getsrclines (Dwarf *dbg, Dwarf_Off debug_line_offset,
+ const char *comp_dir, unsigned address_size,
+ Dwarf_Lines **linesp, Dwarf_Files **filesp)
+{
+ struct files_lines_s fake = { .debug_line_offset = debug_line_offset };
+ struct files_lines_s **found = tfind (&fake, &dbg->files_lines,
+ files_lines_compare);
+ if (found == NULL)
+ {
+ Elf_Data *data = __libdw_checked_get_data (dbg, IDX_debug_line);
+ if (data == NULL
+ || __libdw_offset_in_section (dbg, IDX_debug_line,
+ debug_line_offset, 1) != 0)
+ return -1;
- /* Sort by ascending address. */
- qsort (sortlines, nlinelist, sizeof sortlines[0], &compare_lines);
+ const unsigned char *linep = data->d_buf + debug_line_offset;
+ const unsigned char *lineendp = data->d_buf + data->d_size;
- /* Now that they are sorted, put them in the final array.
- The buffers overlap, so we've clobbered the early elements
- of SORTLINES by the time we're reading the later ones. */
- cu->lines = buf;
- cu->lines->nlines = nlinelist;
- for (i = 0; i < nlinelist; ++i)
+ struct files_lines_s *node = libdw_alloc (dbg, struct files_lines_s,
+ sizeof *node, 1);
+
+ if (read_srclines (dbg, linep, lineendp, comp_dir, address_size,
+ &node->lines, &node->files) != 0)
+ return -1;
+
+ node->debug_line_offset = debug_line_offset;
+
+ found = tsearch (node, &dbg->files_lines, files_lines_compare);
+ if (found == NULL)
{
- cu->lines->info[i] = *sortlines[i];
- cu->lines->info[i].files = files;
+ __libdw_seterrno (DWARF_E_NOMEM);
+ return -1;
}
-
- /* Success. */
- res = 0;
}
- else if (cu->lines != (void *) -1l)
- /* We already have the information. */
- res = 0;
- if (likely (res == 0))
+ if (linesp != NULL)
+ *linesp = (*found)->lines;
+
+ if (filesp != NULL)
+ *filesp = (*found)->files;
+
+ return 0;
+}
+
+/* Get the compilation directory, if any is set. */
+const char *
+__libdw_getcompdir (Dwarf_Die *cudie)
+{
+ Dwarf_Attribute compdir_attr_mem;
+ Dwarf_Attribute *compdir_attr = INTUSE(dwarf_attr) (cudie,
+ DW_AT_comp_dir,
+ &compdir_attr_mem);
+ return INTUSE(dwarf_formstring) (compdir_attr);
+}
+
+int
+dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
+{
+ if (unlikely (cudie == NULL
+ || (INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit
+ && INTUSE(dwarf_tag) (cudie) != DW_TAG_partial_unit)))
+ return -1;
+
+ /* Get the information if it is not already known. */
+ struct Dwarf_CU *const cu = cudie->cu;
+ if (cu->lines == NULL)
{
- *lines = cu->lines;
- *nlines = cu->lines->nlines;
+ /* Failsafe mode: no data found. */
+ cu->lines = (void *) -1l;
+ cu->files = (void *) -1l;
+
+ /* The die must have a statement list associated. */
+ Dwarf_Attribute stmt_list_mem;
+ Dwarf_Attribute *stmt_list = INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list,
+ &stmt_list_mem);
+
+ /* Get the offset into the .debug_line section. NB: this call
+ also checks whether the previous dwarf_attr call failed. */
+ Dwarf_Off debug_line_offset;
+ if (__libdw_formptr (stmt_list, IDX_debug_line, DWARF_E_NO_DEBUG_LINE,
+ NULL, &debug_line_offset) == NULL)
+ return -1;
+
+ if (__libdw_getsrclines (cu->dbg, debug_line_offset,
+ __libdw_getcompdir (cudie),
+ cu->address_size, &cu->lines, &cu->files) < 0)
+ return -1;
}
- out:
+ else if (cu->lines == (void *) -1l)
+ return -1;
+
+ *lines = cu->lines;
+ *nlines = cu->lines->nlines;
// XXX Eventually: unlocking here.
- return res;
+ return 0;
}
INTDEF(dwarf_getsrclines)
diff --git a/src/libdw/dwarf_getstring.c b/src/libdw/dwarf_getstring.c
index d5e7abfd..672bb27e 100644
--- a/src/libdw/dwarf_getstring.c
+++ b/src/libdw/dwarf_getstring.c
@@ -1,52 +1,31 @@
/* Get string.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_hasattr.c b/src/libdw/dwarf_hasattr.c
index b1c4292a..812c09bc 100644
--- a/src/libdw/dwarf_hasattr.c
+++ b/src/libdw/dwarf_hasattr.c
@@ -1,52 +1,31 @@
/* Check whether given DIE has specific attribute.
- Copyright (C) 2003, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003, 2005, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -64,10 +43,43 @@ dwarf_hasattr (die, search_name)
if (die == NULL)
return 0;
- /* Search for the attribute with the given name. */
- unsigned int code;
- (void) __libdw_find_attr (die, search_name, &code, NULL);
+ /* Find the abbreviation entry. */
+ Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, NULL);
+ if (unlikely (abbrevp == DWARF_END_ABBREV))
+ {
+ invalid_dwarf:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return 0;
+ }
+
+ Dwarf *dbg = die->cu->dbg;
+
+ /* Search the name attribute. */
+ unsigned char *const endp
+ = ((unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf
+ + dbg->sectiondata[IDX_debug_abbrev]->d_size);
+
+ const unsigned char *attrp = abbrevp->attrp;
+ while (1)
+ {
+ /* Are we still in bounds? This test needs to be refined. */
+ if (unlikely (attrp >= endp))
+ goto invalid_dwarf;
+
+ /* Get attribute name and form. */
+ unsigned int attr_name;
+ get_uleb128 (attr_name, attrp, endp);
+ unsigned int attr_form;
+ if (unlikely (attrp >= endp))
+ goto invalid_dwarf;
+ get_uleb128 (attr_form, attrp, endp);
+
+ /* We can stop if we found the attribute with value zero. */
+ if (attr_name == 0 || attr_form == 0)
+ return 0;
- return code == search_name;
+ if (attr_name == search_name)
+ return 1;
+ }
}
INTDEF (dwarf_hasattr)
diff --git a/src/libdw/dwarf_hasattr_integrate.c b/src/libdw/dwarf_hasattr_integrate.c
index 806742d6..2d5348cf 100644
--- a/src/libdw/dwarf_hasattr_integrate.c
+++ b/src/libdw/dwarf_hasattr_integrate.c
@@ -1,51 +1,30 @@
/* Check whether DIE has specific attribute, integrating DW_AT_abstract_origin.
Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_haschildren.c b/src/libdw/dwarf_haschildren.c
index d9a47ad2..d0ce51ea 100644
--- a/src/libdw/dwarf_haschildren.c
+++ b/src/libdw/dwarf_haschildren.c
@@ -1,52 +1,31 @@
/* Return string associated with given attribute.
- Copyright (C) 2003, 2005, 2008 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003, 2005, 2008, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -61,25 +40,13 @@ dwarf_haschildren (die)
Dwarf_Die *die;
{
/* Find the abbreviation entry. */
- Dwarf_Abbrev *abbrevp = die->abbrev;
- if (abbrevp != DWARF_END_ABBREV)
- {
- const unsigned char *readp = (unsigned char *) die->addr;
-
- /* First we have to get the abbreviation code so that we can decode
- the data in the DIE. */
- unsigned int abbrev_code;
- get_uleb128 (abbrev_code, readp);
-
- abbrevp = __libdw_findabbrev (die->cu, abbrev_code);
- die->abbrev = abbrevp ?: DWARF_END_ABBREV;
- }
- if (unlikely (die->abbrev == DWARF_END_ABBREV))
+ Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, NULL);
+ if (unlikely (abbrevp == DWARF_END_ABBREV))
{
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return -1;
}
- return die->abbrev->has_children;
+ return abbrevp->has_children;
}
INTDEF (dwarf_haschildren)
diff --git a/src/libdw/dwarf_hasform.c b/src/libdw/dwarf_hasform.c
index 66e0e746..a95ca9ea 100644
--- a/src/libdw/dwarf_hasform.c
+++ b/src/libdw/dwarf_hasform.c
@@ -1,52 +1,31 @@
/* Check whether given attribute has specific form.
Copyright (C) 2003 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_haspc.c b/src/libdw/dwarf_haspc.c
index 58b87b65..47e2b055 100644
--- a/src/libdw/dwarf_haspc.c
+++ b/src/libdw/dwarf_haspc.c
@@ -1,51 +1,30 @@
/* Determine whether a DIE covers a PC address.
Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_highpc.c b/src/libdw/dwarf_highpc.c
index c88e0721..8bf93f03 100644
--- a/src/libdw/dwarf_highpc.c
+++ b/src/libdw/dwarf_highpc.c
@@ -1,52 +1,31 @@
/* Return high PC attribute of DIE.
- Copyright (C) 2003, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003, 2005, 2012 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -61,10 +40,29 @@ dwarf_highpc (die, return_addr)
Dwarf_Die *die;
Dwarf_Addr *return_addr;
{
- Dwarf_Attribute attr_mem;
+ Dwarf_Attribute attr_high_mem;
+ Dwarf_Attribute *attr_high = INTUSE(dwarf_attr) (die, DW_AT_high_pc,
+ &attr_high_mem);
+ if (attr_high == NULL)
+ return -1;
+
+ if (attr_high->form == DW_FORM_addr)
+ return INTUSE(dwarf_formaddr) (attr_high, return_addr);
- return INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_high_pc,
- &attr_mem),
- return_addr);
+ /* DWARF 4 allows high_pc to be a constant offset from low_pc. */
+ Dwarf_Attribute attr_low_mem;
+ if (INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_low_pc,
+ &attr_low_mem),
+ return_addr) == 0)
+ {
+ Dwarf_Word uval;
+ if (INTUSE(dwarf_formudata) (attr_high, &uval) == 0)
+ {
+ *return_addr += uval;
+ return 0;
+ }
+ __libdw_seterrno (DWARF_E_NO_ADDR);
+ }
+ return -1;
}
INTDEF(dwarf_highpc)
diff --git a/src/libdw/dwarf_lineaddr.c b/src/libdw/dwarf_lineaddr.c
index c59dd5d5..4e1952d3 100644
--- a/src/libdw/dwarf_lineaddr.c
+++ b/src/libdw/dwarf_lineaddr.c
@@ -1,52 +1,31 @@
/* Return line address.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_linebeginstatement.c b/src/libdw/dwarf_linebeginstatement.c
index 2a99e675..4854c56b 100644
--- a/src/libdw/dwarf_linebeginstatement.c
+++ b/src/libdw/dwarf_linebeginstatement.c
@@ -1,52 +1,31 @@
/* Return true if record is for beginning of a statement.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lineblock.c b/src/libdw/dwarf_lineblock.c
index 5ad2bb57..e3c7f41a 100644
--- a/src/libdw/dwarf_lineblock.c
+++ b/src/libdw/dwarf_lineblock.c
@@ -1,52 +1,31 @@
/* Return true if record is for beginning of a basic block.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_linecol.c b/src/libdw/dwarf_linecol.c
index 8a1228c2..c667b1b4 100644
--- a/src/libdw/dwarf_linecol.c
+++ b/src/libdw/dwarf_linecol.c
@@ -1,52 +1,31 @@
/* Return column in line.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_linediscriminator.c b/src/libdw/dwarf_linediscriminator.c
index d17a99f2..552205a7 100644
--- a/src/libdw/dwarf_linediscriminator.c
+++ b/src/libdw/dwarf_linediscriminator.c
@@ -1,51 +1,30 @@
/* Return code path discriminator in line record.
Copyright (C) 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lineendsequence.c b/src/libdw/dwarf_lineendsequence.c
index cea86aac..61bde935 100644
--- a/src/libdw/dwarf_lineendsequence.c
+++ b/src/libdw/dwarf_lineendsequence.c
@@ -1,52 +1,31 @@
/* Return true if record is for end of sequence.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lineepiloguebegin.c b/src/libdw/dwarf_lineepiloguebegin.c
index 9d806117..b9147872 100644
--- a/src/libdw/dwarf_lineepiloguebegin.c
+++ b/src/libdw/dwarf_lineepiloguebegin.c
@@ -1,52 +1,31 @@
/* Return true if record is for beginning of epilogue.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lineisa.c b/src/libdw/dwarf_lineisa.c
index 064761e0..30181fc5 100644
--- a/src/libdw/dwarf_lineisa.c
+++ b/src/libdw/dwarf_lineisa.c
@@ -1,51 +1,30 @@
/* Return ISA in line.
Copyright (C) 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lineno.c b/src/libdw/dwarf_lineno.c
index 98840b15..009999c2 100644
--- a/src/libdw/dwarf_lineno.c
+++ b/src/libdw/dwarf_lineno.c
@@ -1,52 +1,31 @@
/* Return line number.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lineop_index.c b/src/libdw/dwarf_lineop_index.c
index 3b433104..9ea4ef4d 100644
--- a/src/libdw/dwarf_lineop_index.c
+++ b/src/libdw/dwarf_lineop_index.c
@@ -1,51 +1,30 @@
/* Return line VLIW operation index.
Copyright (C) 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lineprologueend.c b/src/libdw/dwarf_lineprologueend.c
index c7a05572..6ba8be2f 100644
--- a/src/libdw/dwarf_lineprologueend.c
+++ b/src/libdw/dwarf_lineprologueend.c
@@ -1,52 +1,31 @@
/* Return true if record is for end of prologue.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_linesrc.c b/src/libdw/dwarf_linesrc.c
index 6ecce93f..27b59903 100644
--- a/src/libdw/dwarf_linesrc.c
+++ b/src/libdw/dwarf_linesrc.c
@@ -1,52 +1,31 @@
/* Find line information for address.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_lowpc.c b/src/libdw/dwarf_lowpc.c
index 97ece031..4677aed8 100644
--- a/src/libdw/dwarf_lowpc.c
+++ b/src/libdw/dwarf_lowpc.c
@@ -1,52 +1,31 @@
/* Return low PC attribute of DIE.
Copyright (C) 2003, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_macro_getparamcnt.c b/src/libdw/dwarf_macro_getparamcnt.c
new file mode 100644
index 00000000..e218eb1d
--- /dev/null
+++ b/src/libdw/dwarf_macro_getparamcnt.c
@@ -0,0 +1,43 @@
+/* Return number of parameters of a macro.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libdwP.h"
+
+int
+dwarf_macro_getparamcnt (Dwarf_Macro *macro, size_t *paramcntp)
+{
+ if (macro == NULL)
+ return -1;
+
+ *paramcntp = libdw_macro_nforms (macro);
+ return 0;
+}
diff --git a/src/libdw/dwarf_macro_getsrcfiles.c b/src/libdw/dwarf_macro_getsrcfiles.c
new file mode 100644
index 00000000..cc190437
--- /dev/null
+++ b/src/libdw/dwarf_macro_getsrcfiles.c
@@ -0,0 +1,88 @@
+/* Find line information for a given macro.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libdwP.h"
+
+int
+dwarf_macro_getsrcfiles (Dwarf *dbg, Dwarf_Macro *macro,
+ Dwarf_Files **files, size_t *nfiles)
+{
+ if (macro == NULL)
+ return -1;
+
+ Dwarf_Macro_Op_Table *const table = macro->table;
+ if (table->files == NULL)
+ {
+ Dwarf_Off line_offset = table->line_offset;
+ if (line_offset == (Dwarf_Off) -1)
+ {
+ *files = NULL;
+ *nfiles = 0;
+ return 0;
+ }
+
+ /* If TABLE->comp_dir is NULL that could mean any of the
+ following:
+
+ - The macro unit is not bound to a CU. It's an auxiliary
+ unit used purely for import from other units. In that case
+ there's actually no COMP_DIR value that we could use.
+
+ - The macro unit is bound to a CU, but there's no
+ DW_AT_comp_dir attribute at the CU DIE.
+
+ - The macro unit is bound to a CU, but we don't know that,
+ likely because its iteration was requested through
+ dwarf_getmacros_off interface. This might be legitimate if
+ one macro unit imports another CU's macro unit, but that is
+ unlikely to happen in practice. Most probably this is not
+ legitimate use of the interfaces.
+
+ So when the interfaces are used correctly, COMP_DIR value is
+ always right. That means that we can cache the parsed
+ .debug_line unit without fear that later on someone requests
+ the same unit through dwarf_getsrcfiles, and the file names
+ will be broken. */
+
+ if (__libdw_getsrclines (dbg, line_offset, table->comp_dir,
+ table->is_64bit ? 8 : 4,
+ NULL, &table->files) < 0)
+ table->files = (void *) -1;
+ }
+
+ if (table->files == (void *) -1)
+ return -1;
+
+ *files = table->files;
+ *nfiles = table->files->nfiles;
+ return 0;
+}
diff --git a/src/libdw/dwarf_macro_opcode.c b/src/libdw/dwarf_macro_opcode.c
index c40ebc7c..8607777f 100644
--- a/src/libdw/dwarf_macro_opcode.c
+++ b/src/libdw/dwarf_macro_opcode.c
@@ -1,52 +1,31 @@
/* Return macro opcode.
Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_macro_param.c b/src/libdw/dwarf_macro_param.c
new file mode 100644
index 00000000..bd846a7f
--- /dev/null
+++ b/src/libdw/dwarf_macro_param.c
@@ -0,0 +1,46 @@
+/* Return a given parameter of a macro.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libdwP.h"
+
+int
+dwarf_macro_param (Dwarf_Macro *macro, size_t idx, Dwarf_Attribute *ret)
+{
+ if (macro == NULL)
+ return -1;
+
+ if (idx >= libdw_macro_nforms (macro))
+ return -1;
+
+ *ret = macro->attributes[idx];
+ return 0;
+}
diff --git a/src/libdw/dwarf_macro_param1.c b/src/libdw/dwarf_macro_param1.c
index 409865f5..87ce0035 100644
--- a/src/libdw/dwarf_macro_param1.c
+++ b/src/libdw/dwarf_macro_param1.c
@@ -1,52 +1,31 @@
/* Return first macro parameter.
- Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2005, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -61,7 +40,9 @@ dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp)
if (macro == NULL)
return -1;
- *paramp = macro->param1;
+ Dwarf_Attribute param;
+ if (dwarf_macro_param (macro, 0, &param) != 0)
+ return -1;
- return 0;
+ return dwarf_formudata (&param, paramp);
}
diff --git a/src/libdw/dwarf_macro_param2.c b/src/libdw/dwarf_macro_param2.c
index c1eff939..cc902c99 100644
--- a/src/libdw/dwarf_macro_param2.c
+++ b/src/libdw/dwarf_macro_param2.c
@@ -1,52 +1,31 @@
/* Return second macro parameter.
- Copyright (C) 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2005, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -61,10 +40,16 @@ dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp, const char **strp)
if (macro == NULL)
return -1;
- if (paramp != NULL)
- *paramp = macro->param2.u;
- if (strp != NULL)
- *strp = macro->param2.s;
+ Dwarf_Attribute param;
+ if (dwarf_macro_param (macro, 1, &param) != 0)
+ return -1;
- return 0;
+ if (param.form == DW_FORM_string
+ || param.form == DW_FORM_strp)
+ {
+ *strp = dwarf_formstring (&param);
+ return 0;
+ }
+ else
+ return dwarf_formudata (&param, paramp);
}
diff --git a/src/libdw/dwarf_next_cfi.c b/src/libdw/dwarf_next_cfi.c
index 0e90457d..b5af49e3 100644
--- a/src/libdw/dwarf_next_cfi.c
+++ b/src/libdw/dwarf_next_cfi.c
@@ -1,51 +1,30 @@
/* Advance to next CFI entry.
- Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -191,11 +170,19 @@ dwarf_next_cfi (e_ident, data, eh_frame_p, off, next_off, entry)
bytes += address_size;
}
- get_uleb128 (entry->cie.code_alignment_factor, bytes);
- get_sleb128 (entry->cie.data_alignment_factor, bytes);
+ if (bytes >= limit)
+ goto invalid;
+ get_uleb128 (entry->cie.code_alignment_factor, bytes, limit);
+
+ if (bytes >= limit)
+ goto invalid;
+ get_sleb128 (entry->cie.data_alignment_factor, bytes, limit);
+
+ if (bytes >= limit)
+ goto invalid;
if (version >= 3) /* DWARF 3+ */
- get_uleb128 (entry->cie.return_address_register, bytes);
+ get_uleb128 (entry->cie.return_address_register, bytes, limit);
else /* DWARF 2 */
entry->cie.return_address_register = *bytes++;
@@ -205,7 +192,9 @@ dwarf_next_cfi (e_ident, data, eh_frame_p, off, next_off, entry)
bool sized_augmentation = *ap == 'z';
if (sized_augmentation)
{
- get_uleb128 (entry->cie.augmentation_data_size, bytes);
+ if (bytes >= limit)
+ goto invalid;
+ get_uleb128 (entry->cie.augmentation_data_size, bytes, limit);
if ((Dwarf_Word) (limit - bytes) < entry->cie.augmentation_data_size)
goto invalid;
entry->cie.augmentation_data = bytes;
diff --git a/src/libdw/dwarf_nextcu.c b/src/libdw/dwarf_nextcu.c
index 2e8f4d79..875d8694 100644
--- a/src/libdw/dwarf_nextcu.c
+++ b/src/libdw/dwarf_nextcu.c
@@ -1,52 +1,31 @@
/* Advance to next CU header.
Copyright (C) 2002-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_offabbrev.c b/src/libdw/dwarf_offabbrev.c
index 2cac2794..27cdad64 100644
--- a/src/libdw/dwarf_offabbrev.c
+++ b/src/libdw/dwarf_offabbrev.c
@@ -1,52 +1,31 @@
/* Get abbreviation at given offset.
Copyright (C) 2004, 2005 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_offdie.c b/src/libdw/dwarf_offdie.c
index 4c650cfd..b5dd405d 100644
--- a/src/libdw/dwarf_offdie.c
+++ b/src/libdw/dwarf_offdie.c
@@ -1,52 +1,31 @@
/* Return DIE at given offset.
Copyright (C) 2002-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_onearange.c b/src/libdw/dwarf_onearange.c
index 5a9b9f39..de49f6c1 100644
--- a/src/libdw/dwarf_onearange.c
+++ b/src/libdw/dwarf_onearange.c
@@ -1,52 +1,31 @@
/* Return one of the address range entries.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_onesrcline.c b/src/libdw/dwarf_onesrcline.c
index 3e716304..5d3c3ded 100644
--- a/src/libdw/dwarf_onesrcline.c
+++ b/src/libdw/dwarf_onesrcline.c
@@ -1,52 +1,31 @@
/* Return one of the sources lines of a CU.
Copyright (C) 2004 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_peel_type.c b/src/libdw/dwarf_peel_type.c
new file mode 100644
index 00000000..a110bc54
--- /dev/null
+++ b/src/libdw/dwarf_peel_type.c
@@ -0,0 +1,74 @@
+/* Peel type aliases and qualifier tags from a type DIE.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libdwP.h"
+#include <dwarf.h>
+#include <string.h>
+
+
+int
+dwarf_peel_type (die, result)
+ Dwarf_Die *die;
+ Dwarf_Die *result;
+{
+ int tag;
+
+ /* Ignore previous errors. */
+ if (die == NULL)
+ return -1;
+
+ *result = *die;
+ tag = INTUSE (dwarf_tag) (result);
+ while (tag == DW_TAG_typedef
+ || tag == DW_TAG_const_type
+ || tag == DW_TAG_volatile_type
+ || tag == DW_TAG_restrict_type)
+ {
+ Dwarf_Attribute attr_mem;
+ Dwarf_Attribute *attr = INTUSE (dwarf_attr_integrate) (die, DW_AT_type,
+ &attr_mem);
+ if (attr == NULL)
+ return 1;
+
+ result = INTUSE (dwarf_formref_die) (attr, result);
+ if (result == NULL)
+ return -1;
+
+ tag = INTUSE (dwarf_tag) (result);
+ }
+
+ if (tag == DW_TAG_invalid)
+ return -1;
+
+ return 0;
+}
+INTDEF(dwarf_peel_type)
diff --git a/src/libdw/dwarf_ranges.c b/src/libdw/dwarf_ranges.c
index 50fb6ba2..d9b7293d 100644
--- a/src/libdw/dwarf_ranges.c
+++ b/src/libdw/dwarf_ranges.c
@@ -1,51 +1,30 @@
/* Enumerate the PC ranges covered by a DIE.
Copyright (C) 2005, 2007, 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_setalt.c b/src/libdw/dwarf_setalt.c
new file mode 100644
index 00000000..9bd566ff
--- /dev/null
+++ b/src/libdw/dwarf_setalt.c
@@ -0,0 +1,40 @@
+/* Provides the data referenced by the .gnu_debugaltlink section.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libdwP.h"
+
+void
+dwarf_setalt (Dwarf *main, Dwarf *alt)
+{
+ main->alt_dwarf = alt;
+}
+INTDEF (dwarf_setalt)
diff --git a/src/libdw/dwarf_siblingof.c b/src/libdw/dwarf_siblingof.c
index f8e54c18..27830ea4 100644
--- a/src/libdw/dwarf_siblingof.c
+++ b/src/libdw/dwarf_siblingof.c
@@ -1,52 +1,31 @@
/* Return sibling of given DIE.
- Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -83,8 +62,7 @@ dwarf_siblingof (die, result)
/* That's the address we start looking. */
unsigned char *addr = this_die.addr;
/* End of the buffer. */
- unsigned char *endp
- = ((unsigned char *) cu_data (sibattr.cu)->d_buf + sibattr.cu->end);
+ unsigned char *endp = sibattr.cu->endp;
/* Search for the beginning of the next die on this level. We
must not return the dies for children of the given die. */
@@ -93,7 +71,7 @@ dwarf_siblingof (die, result)
/* Find the end of the DIE or the sibling attribute. */
addr = __libdw_find_attr (&this_die, DW_AT_sibling, &sibattr.code,
&sibattr.form);
- if (sibattr.code == DW_AT_sibling)
+ if (addr != NULL && sibattr.code == DW_AT_sibling)
{
Dwarf_Off offset;
sibattr.valp = addr;
@@ -102,8 +80,7 @@ dwarf_siblingof (die, result)
return -1;
/* Compute the next address. */
- addr = ((unsigned char *) cu_data (sibattr.cu)->d_buf
- + sibattr.cu->start + offset);
+ addr = sibattr.cu->startp + offset;
}
else if (unlikely (addr == NULL)
|| unlikely (this_die.abbrev == DWARF_END_ABBREV))
diff --git a/src/libdw/dwarf_sig8_hash.c b/src/libdw/dwarf_sig8_hash.c
index 53c07eac..043cac78 100644
--- a/src/libdw/dwarf_sig8_hash.c
+++ b/src/libdw/dwarf_sig8_hash.c
@@ -1,51 +1,30 @@
/* Implementation of hash table for DWARF .debug_types section content.
Copyright (C) 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_sig8_hash.h b/src/libdw/dwarf_sig8_hash.h
index 0d8932b5..705ffbcd 100644
--- a/src/libdw/dwarf_sig8_hash.h
+++ b/src/libdw/dwarf_sig8_hash.h
@@ -1,51 +1,30 @@
/* Hash table for DWARF .debug_types section content.
Copyright (C) 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _DWARF_SIG8_HASH_H
#define _DWARF_SIG8_HASH_H 1
diff --git a/src/libdw/dwarf_srclang.c b/src/libdw/dwarf_srclang.c
index 305ffcd0..6cc06ffb 100644
--- a/src/libdw/dwarf_srclang.c
+++ b/src/libdw/dwarf_srclang.c
@@ -1,52 +1,31 @@
/* Return source language attribute of DIE.
Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_tag.c b/src/libdw/dwarf_tag.c
index fa8b384c..0b1a4b08 100644
--- a/src/libdw/dwarf_tag.c
+++ b/src/libdw/dwarf_tag.c
@@ -1,52 +1,31 @@
/* Return tag of given DIE.
- Copyright (C) 2003-2011 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2011, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -103,24 +82,14 @@ int
dwarf_tag (die)
Dwarf_Die *die;
{
- /* Do we already know the abbreviation? */
- if (die->abbrev == NULL)
- {
- /* Get the abbreviation code. */
- unsigned int u128;
- const unsigned char *addr = die->addr;
- get_uleb128 (u128, addr);
-
- /* Find the abbreviation. */
- die->abbrev = __libdw_findabbrev (die->cu, u128);
- }
-
- if (unlikely (die->abbrev == DWARF_END_ABBREV))
+ /* Find the abbreviation entry. */
+ Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, NULL);
+ if (unlikely (abbrevp == DWARF_END_ABBREV))
{
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return DW_TAG_invalid;
}
- return die->abbrev->tag;
+ return abbrevp->tag;
}
INTDEF(dwarf_tag)
diff --git a/src/libdw/dwarf_whatattr.c b/src/libdw/dwarf_whatattr.c
index 9b8bddf1..8fe5535b 100644
--- a/src/libdw/dwarf_whatattr.c
+++ b/src/libdw/dwarf_whatattr.c
@@ -1,52 +1,31 @@
/* Return attribute code of given attribute.
Copyright (C) 2003 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/dwarf_whatform.c b/src/libdw/dwarf_whatform.c
index 8a9076b8..1d0d14b0 100644
--- a/src/libdw/dwarf_whatform.c
+++ b/src/libdw/dwarf_whatform.c
@@ -1,52 +1,31 @@
/* Return form code of given attribute.
Copyright (C) 2003 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/encoded-value.h b/src/libdw/encoded-value.h
index e118a1c4..ae9a38f9 100644
--- a/src/libdw/encoded-value.h
+++ b/src/libdw/encoded-value.h
@@ -1,51 +1,30 @@
/* DW_EH_PE_* support for libdw unwinder.
- Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _ENCODED_VALUE_H
#define _ENCODED_VALUE_H 1
@@ -184,11 +163,13 @@ read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding, const uint8_t **p,
break;
case DW_EH_PE_uleb128:
- get_uleb128 (value, *p);
+ // XXX we trust there is enough data.
+ get_uleb128 (value, *p, *p + len_leb128 (Dwarf_Addr));
break;
case DW_EH_PE_sleb128:
- get_sleb128 (value, *p);
+ // XXX we trust there is enough data.
+ get_sleb128 (value, *p, *p + len_leb128 (Dwarf_Addr));
break;
default:
diff --git a/src/libdw/fde.c b/src/libdw/fde.c
index 5685252b..18a522bd 100644
--- a/src/libdw/fde.c
+++ b/src/libdw/fde.c
@@ -1,51 +1,30 @@
/* FDE reading.
- Copyright (C) 2009-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -104,7 +83,11 @@ intern_fde (Dwarf_CFI *cache, const Dwarf_FDE *entry)
&fde->instructions, &fde->start))
|| unlikely (read_encoded_value (cache, cie->fde_encoding & 0x0f,
&fde->instructions, &fde->end)))
- return NULL;
+ {
+ free (fde);
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return NULL;
+ }
fde->end += fde->start;
fde->cie = cie;
@@ -114,7 +97,7 @@ intern_fde (Dwarf_CFI *cache, const Dwarf_FDE *entry)
/* The CIE augmentation says the FDE has a DW_FORM_block
before its actual instruction stream. */
Dwarf_Word len;
- get_uleb128 (len, fde->instructions);
+ get_uleb128 (len, fde->instructions, fde->instructions_end);
if ((Dwarf_Word) (fde->instructions_end - fde->instructions) < len)
{
free (fde);
@@ -202,32 +185,30 @@ binary_search_fde (Dwarf_CFI *cache, Dwarf_Addr address)
u = idx;
else
{
+ l = idx + 1;
+
Dwarf_Addr fde;
if (unlikely (read_encoded_value (&dummy_cfi,
cache->search_table_encoding, &p,
&fde)))
break;
- if (address >= start)
+
+ /* If this is the last entry, its upper bound is assumed to be
+ the end of the module.
+ XXX really should be end of containing PT_LOAD segment */
+ if (l < cache->search_table_entries)
{
- l = idx + 1;
-
- /* If this is the last entry, its upper bound is assumed to be
- the end of the module.
- XXX really should be end of containing PT_LOAD segment */
- if (l < cache->search_table_entries)
- {
- /* Look at the start address in the following entry. */
- Dwarf_Addr end;
- if (unlikely (read_encoded_value
- (&dummy_cfi, cache->search_table_encoding, &p,
- &end)))
- break;
- if (address >= end)
- continue;
- }
-
- return fde - cache->frame_vaddr;
+ /* Look at the start address in the following entry. */
+ Dwarf_Addr end;
+ if (unlikely (read_encoded_value
+ (&dummy_cfi, cache->search_table_encoding, &p,
+ &end)))
+ break;
+ if (address >= end)
+ continue;
}
+
+ return fde - cache->frame_vaddr;
}
}
@@ -252,12 +233,17 @@ __libdw_find_fde (Dwarf_CFI *cache, Dwarf_Addr address)
if (offset == (Dwarf_Off) -1l)
goto no_match;
struct dwarf_fde *fde = __libdw_fde_by_offset (cache, offset);
- if (unlikely (fde != NULL)
- /* Sanity check the address range. */
- && unlikely (address < fde->start || address >= fde->end))
+ if (likely (fde != NULL))
{
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- return NULL;
+ /* Sanity check the address range. */
+ if (unlikely (address < fde->start))
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return NULL;
+ }
+ /* .eh_frame_hdr does not indicate length covered by FDE. */
+ if (unlikely (address >= fde->end))
+ goto no_match;
}
return fde;
}
diff --git a/src/libdw/frame-cache.c b/src/libdw/frame-cache.c
index f4876638..54a1cc9a 100644
--- a/src/libdw/frame-cache.c
+++ b/src/libdw/frame-cache.c
@@ -1,51 +1,30 @@
/* Frame cache handling.
Copyright (C) 2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/known-dwarf.h b/src/libdw/known-dwarf.h
new file mode 100644
index 00000000..2aeada9b
--- /dev/null
+++ b/src/libdw/known-dwarf.h
@@ -0,0 +1,629 @@
+/* Generated by config/known-dwarf.awk from libdw/dwarf.h contents. */
+
+#define ALL_KNOWN_DW_ACCESS \
+ ONE_KNOWN_DW_ACCESS (private, DW_ACCESS_private) \
+ ONE_KNOWN_DW_ACCESS (protected, DW_ACCESS_protected) \
+ ONE_KNOWN_DW_ACCESS (public, DW_ACCESS_public) \
+ /* End of DW_ACCESS_*. */
+
+#define ALL_KNOWN_DW_AT \
+ ONE_KNOWN_DW_AT (GNU_all_call_sites, DW_AT_GNU_all_call_sites) \
+ ONE_KNOWN_DW_AT (GNU_all_source_call_sites, DW_AT_GNU_all_source_call_sites) \
+ ONE_KNOWN_DW_AT (GNU_all_tail_call_sites, DW_AT_GNU_all_tail_call_sites) \
+ ONE_KNOWN_DW_AT (GNU_call_site_data_value, DW_AT_GNU_call_site_data_value) \
+ ONE_KNOWN_DW_AT (GNU_call_site_target, DW_AT_GNU_call_site_target) \
+ ONE_KNOWN_DW_AT (GNU_call_site_target_clobbered, DW_AT_GNU_call_site_target_clobbered) \
+ ONE_KNOWN_DW_AT (GNU_call_site_value, DW_AT_GNU_call_site_value) \
+ ONE_KNOWN_DW_AT (GNU_deleted, DW_AT_GNU_deleted) \
+ ONE_KNOWN_DW_AT (GNU_exclusive_locks_required, DW_AT_GNU_exclusive_locks_required) \
+ ONE_KNOWN_DW_AT (GNU_guarded, DW_AT_GNU_guarded) \
+ ONE_KNOWN_DW_AT (GNU_guarded_by, DW_AT_GNU_guarded_by) \
+ ONE_KNOWN_DW_AT (GNU_locks_excluded, DW_AT_GNU_locks_excluded) \
+ ONE_KNOWN_DW_AT (GNU_macros, DW_AT_GNU_macros) \
+ ONE_KNOWN_DW_AT (GNU_odr_signature, DW_AT_GNU_odr_signature) \
+ ONE_KNOWN_DW_AT (GNU_pt_guarded, DW_AT_GNU_pt_guarded) \
+ ONE_KNOWN_DW_AT (GNU_pt_guarded_by, DW_AT_GNU_pt_guarded_by) \
+ ONE_KNOWN_DW_AT (GNU_shared_locks_required, DW_AT_GNU_shared_locks_required) \
+ ONE_KNOWN_DW_AT (GNU_tail_call, DW_AT_GNU_tail_call) \
+ ONE_KNOWN_DW_AT (GNU_template_name, DW_AT_GNU_template_name) \
+ ONE_KNOWN_DW_AT (GNU_vector, DW_AT_GNU_vector) \
+ ONE_KNOWN_DW_AT (MIPS_abstract_name, DW_AT_MIPS_abstract_name) \
+ ONE_KNOWN_DW_AT (MIPS_allocatable_dopetype, DW_AT_MIPS_allocatable_dopetype) \
+ ONE_KNOWN_DW_AT (MIPS_assumed_shape_dopetype, DW_AT_MIPS_assumed_shape_dopetype) \
+ ONE_KNOWN_DW_AT (MIPS_assumed_size, DW_AT_MIPS_assumed_size) \
+ ONE_KNOWN_DW_AT (MIPS_clone_origin, DW_AT_MIPS_clone_origin) \
+ ONE_KNOWN_DW_AT (MIPS_epilog_begin, DW_AT_MIPS_epilog_begin) \
+ ONE_KNOWN_DW_AT (MIPS_fde, DW_AT_MIPS_fde) \
+ ONE_KNOWN_DW_AT (MIPS_has_inlines, DW_AT_MIPS_has_inlines) \
+ ONE_KNOWN_DW_AT (MIPS_linkage_name, DW_AT_MIPS_linkage_name) \
+ ONE_KNOWN_DW_AT (MIPS_loop_begin, DW_AT_MIPS_loop_begin) \
+ ONE_KNOWN_DW_AT (MIPS_loop_unroll_factor, DW_AT_MIPS_loop_unroll_factor) \
+ ONE_KNOWN_DW_AT (MIPS_ptr_dopetype, DW_AT_MIPS_ptr_dopetype) \
+ ONE_KNOWN_DW_AT (MIPS_software_pipeline_depth, DW_AT_MIPS_software_pipeline_depth) \
+ ONE_KNOWN_DW_AT (MIPS_stride, DW_AT_MIPS_stride) \
+ ONE_KNOWN_DW_AT (MIPS_stride_byte, DW_AT_MIPS_stride_byte) \
+ ONE_KNOWN_DW_AT (MIPS_stride_elem, DW_AT_MIPS_stride_elem) \
+ ONE_KNOWN_DW_AT (MIPS_tail_loop_begin, DW_AT_MIPS_tail_loop_begin) \
+ ONE_KNOWN_DW_AT (abstract_origin, DW_AT_abstract_origin) \
+ ONE_KNOWN_DW_AT (accessibility, DW_AT_accessibility) \
+ ONE_KNOWN_DW_AT (address_class, DW_AT_address_class) \
+ ONE_KNOWN_DW_AT (allocated, DW_AT_allocated) \
+ ONE_KNOWN_DW_AT (artificial, DW_AT_artificial) \
+ ONE_KNOWN_DW_AT (associated, DW_AT_associated) \
+ ONE_KNOWN_DW_AT (base_types, DW_AT_base_types) \
+ ONE_KNOWN_DW_AT (binary_scale, DW_AT_binary_scale) \
+ ONE_KNOWN_DW_AT (bit_offset, DW_AT_bit_offset) \
+ ONE_KNOWN_DW_AT (bit_size, DW_AT_bit_size) \
+ ONE_KNOWN_DW_AT (bit_stride, DW_AT_bit_stride) \
+ ONE_KNOWN_DW_AT (body_begin, DW_AT_body_begin) \
+ ONE_KNOWN_DW_AT (body_end, DW_AT_body_end) \
+ ONE_KNOWN_DW_AT (byte_size, DW_AT_byte_size) \
+ ONE_KNOWN_DW_AT (byte_stride, DW_AT_byte_stride) \
+ ONE_KNOWN_DW_AT (call_column, DW_AT_call_column) \
+ ONE_KNOWN_DW_AT (call_file, DW_AT_call_file) \
+ ONE_KNOWN_DW_AT (call_line, DW_AT_call_line) \
+ ONE_KNOWN_DW_AT (calling_convention, DW_AT_calling_convention) \
+ ONE_KNOWN_DW_AT (common_reference, DW_AT_common_reference) \
+ ONE_KNOWN_DW_AT (comp_dir, DW_AT_comp_dir) \
+ ONE_KNOWN_DW_AT (const_expr, DW_AT_const_expr) \
+ ONE_KNOWN_DW_AT (const_value, DW_AT_const_value) \
+ ONE_KNOWN_DW_AT (containing_type, DW_AT_containing_type) \
+ ONE_KNOWN_DW_AT (count, DW_AT_count) \
+ ONE_KNOWN_DW_AT (data_bit_offset, DW_AT_data_bit_offset) \
+ ONE_KNOWN_DW_AT (data_location, DW_AT_data_location) \
+ ONE_KNOWN_DW_AT (data_member_location, DW_AT_data_member_location) \
+ ONE_KNOWN_DW_AT (decimal_scale, DW_AT_decimal_scale) \
+ ONE_KNOWN_DW_AT (decimal_sign, DW_AT_decimal_sign) \
+ ONE_KNOWN_DW_AT (decl_column, DW_AT_decl_column) \
+ ONE_KNOWN_DW_AT (decl_file, DW_AT_decl_file) \
+ ONE_KNOWN_DW_AT (decl_line, DW_AT_decl_line) \
+ ONE_KNOWN_DW_AT (declaration, DW_AT_declaration) \
+ ONE_KNOWN_DW_AT (default_value, DW_AT_default_value) \
+ ONE_KNOWN_DW_AT (description, DW_AT_description) \
+ ONE_KNOWN_DW_AT (digit_count, DW_AT_digit_count) \
+ ONE_KNOWN_DW_AT (discr, DW_AT_discr) \
+ ONE_KNOWN_DW_AT (discr_list, DW_AT_discr_list) \
+ ONE_KNOWN_DW_AT (discr_value, DW_AT_discr_value) \
+ ONE_KNOWN_DW_AT (element_list, DW_AT_element_list) \
+ ONE_KNOWN_DW_AT (elemental, DW_AT_elemental) \
+ ONE_KNOWN_DW_AT (encoding, DW_AT_encoding) \
+ ONE_KNOWN_DW_AT (endianity, DW_AT_endianity) \
+ ONE_KNOWN_DW_AT (entry_pc, DW_AT_entry_pc) \
+ ONE_KNOWN_DW_AT (enum_class, DW_AT_enum_class) \
+ ONE_KNOWN_DW_AT (explicit, DW_AT_explicit) \
+ ONE_KNOWN_DW_AT (extension, DW_AT_extension) \
+ ONE_KNOWN_DW_AT (external, DW_AT_external) \
+ ONE_KNOWN_DW_AT (frame_base, DW_AT_frame_base) \
+ ONE_KNOWN_DW_AT (friend, DW_AT_friend) \
+ ONE_KNOWN_DW_AT (high_pc, DW_AT_high_pc) \
+ ONE_KNOWN_DW_AT (identifier_case, DW_AT_identifier_case) \
+ ONE_KNOWN_DW_AT (import, DW_AT_import) \
+ ONE_KNOWN_DW_AT (inline, DW_AT_inline) \
+ ONE_KNOWN_DW_AT (is_optional, DW_AT_is_optional) \
+ ONE_KNOWN_DW_AT (language, DW_AT_language) \
+ ONE_KNOWN_DW_AT (linkage_name, DW_AT_linkage_name) \
+ ONE_KNOWN_DW_AT (location, DW_AT_location) \
+ ONE_KNOWN_DW_AT (low_pc, DW_AT_low_pc) \
+ ONE_KNOWN_DW_AT (lower_bound, DW_AT_lower_bound) \
+ ONE_KNOWN_DW_AT (mac_info, DW_AT_mac_info) \
+ ONE_KNOWN_DW_AT (macro_info, DW_AT_macro_info) \
+ ONE_KNOWN_DW_AT (main_subprogram, DW_AT_main_subprogram) \
+ ONE_KNOWN_DW_AT (member, DW_AT_member) \
+ ONE_KNOWN_DW_AT (mutable, DW_AT_mutable) \
+ ONE_KNOWN_DW_AT (name, DW_AT_name) \
+ ONE_KNOWN_DW_AT (namelist_item, DW_AT_namelist_item) \
+ ONE_KNOWN_DW_AT (noreturn, DW_AT_noreturn) \
+ ONE_KNOWN_DW_AT (object_pointer, DW_AT_object_pointer) \
+ ONE_KNOWN_DW_AT (ordering, DW_AT_ordering) \
+ ONE_KNOWN_DW_AT (picture_string, DW_AT_picture_string) \
+ ONE_KNOWN_DW_AT (priority, DW_AT_priority) \
+ ONE_KNOWN_DW_AT (producer, DW_AT_producer) \
+ ONE_KNOWN_DW_AT (prototyped, DW_AT_prototyped) \
+ ONE_KNOWN_DW_AT (pure, DW_AT_pure) \
+ ONE_KNOWN_DW_AT (ranges, DW_AT_ranges) \
+ ONE_KNOWN_DW_AT (recursive, DW_AT_recursive) \
+ ONE_KNOWN_DW_AT (return_addr, DW_AT_return_addr) \
+ ONE_KNOWN_DW_AT (segment, DW_AT_segment) \
+ ONE_KNOWN_DW_AT (sf_names, DW_AT_sf_names) \
+ ONE_KNOWN_DW_AT (sibling, DW_AT_sibling) \
+ ONE_KNOWN_DW_AT (signature, DW_AT_signature) \
+ ONE_KNOWN_DW_AT (small, DW_AT_small) \
+ ONE_KNOWN_DW_AT (specification, DW_AT_specification) \
+ ONE_KNOWN_DW_AT (src_coords, DW_AT_src_coords) \
+ ONE_KNOWN_DW_AT (src_info, DW_AT_src_info) \
+ ONE_KNOWN_DW_AT (start_scope, DW_AT_start_scope) \
+ ONE_KNOWN_DW_AT (static_link, DW_AT_static_link) \
+ ONE_KNOWN_DW_AT (stmt_list, DW_AT_stmt_list) \
+ ONE_KNOWN_DW_AT (string_length, DW_AT_string_length) \
+ ONE_KNOWN_DW_AT (subscr_data, DW_AT_subscr_data) \
+ ONE_KNOWN_DW_AT (threads_scaled, DW_AT_threads_scaled) \
+ ONE_KNOWN_DW_AT (trampoline, DW_AT_trampoline) \
+ ONE_KNOWN_DW_AT (type, DW_AT_type) \
+ ONE_KNOWN_DW_AT (upper_bound, DW_AT_upper_bound) \
+ ONE_KNOWN_DW_AT (use_UTF8, DW_AT_use_UTF8) \
+ ONE_KNOWN_DW_AT (use_location, DW_AT_use_location) \
+ ONE_KNOWN_DW_AT (variable_parameter, DW_AT_variable_parameter) \
+ ONE_KNOWN_DW_AT (virtuality, DW_AT_virtuality) \
+ ONE_KNOWN_DW_AT (visibility, DW_AT_visibility) \
+ ONE_KNOWN_DW_AT (vtable_elem_location, DW_AT_vtable_elem_location) \
+ /* End of DW_AT_*. */
+
+#define ALL_KNOWN_DW_ATE \
+ ONE_KNOWN_DW_ATE (UTF, DW_ATE_UTF) \
+ ONE_KNOWN_DW_ATE (address, DW_ATE_address) \
+ ONE_KNOWN_DW_ATE (boolean, DW_ATE_boolean) \
+ ONE_KNOWN_DW_ATE (complex_float, DW_ATE_complex_float) \
+ ONE_KNOWN_DW_ATE (decimal_float, DW_ATE_decimal_float) \
+ ONE_KNOWN_DW_ATE (edited, DW_ATE_edited) \
+ ONE_KNOWN_DW_ATE (float, DW_ATE_float) \
+ ONE_KNOWN_DW_ATE (imaginary_float, DW_ATE_imaginary_float) \
+ ONE_KNOWN_DW_ATE (numeric_string, DW_ATE_numeric_string) \
+ ONE_KNOWN_DW_ATE (packed_decimal, DW_ATE_packed_decimal) \
+ ONE_KNOWN_DW_ATE (signed, DW_ATE_signed) \
+ ONE_KNOWN_DW_ATE (signed_char, DW_ATE_signed_char) \
+ ONE_KNOWN_DW_ATE (signed_fixed, DW_ATE_signed_fixed) \
+ ONE_KNOWN_DW_ATE (unsigned, DW_ATE_unsigned) \
+ ONE_KNOWN_DW_ATE (unsigned_char, DW_ATE_unsigned_char) \
+ ONE_KNOWN_DW_ATE (unsigned_fixed, DW_ATE_unsigned_fixed) \
+ ONE_KNOWN_DW_ATE (void, DW_ATE_void) \
+ /* End of DW_ATE_*. */
+
+#define ALL_KNOWN_DW_CC \
+ ONE_KNOWN_DW_CC (nocall, DW_CC_nocall) \
+ ONE_KNOWN_DW_CC (normal, DW_CC_normal) \
+ ONE_KNOWN_DW_CC (program, DW_CC_program) \
+ /* End of DW_CC_*. */
+
+#define ALL_KNOWN_DW_CFA \
+ ONE_KNOWN_DW_CFA (GNU_args_size, DW_CFA_GNU_args_size) \
+ ONE_KNOWN_DW_CFA (GNU_negative_offset_extended, DW_CFA_GNU_negative_offset_extended) \
+ ONE_KNOWN_DW_CFA (GNU_window_save, DW_CFA_GNU_window_save) \
+ ONE_KNOWN_DW_CFA (MIPS_advance_loc8, DW_CFA_MIPS_advance_loc8) \
+ ONE_KNOWN_DW_CFA (advance_loc, DW_CFA_advance_loc) \
+ ONE_KNOWN_DW_CFA (advance_loc1, DW_CFA_advance_loc1) \
+ ONE_KNOWN_DW_CFA (advance_loc2, DW_CFA_advance_loc2) \
+ ONE_KNOWN_DW_CFA (advance_loc4, DW_CFA_advance_loc4) \
+ ONE_KNOWN_DW_CFA (def_cfa, DW_CFA_def_cfa) \
+ ONE_KNOWN_DW_CFA (def_cfa_expression, DW_CFA_def_cfa_expression) \
+ ONE_KNOWN_DW_CFA (def_cfa_offset, DW_CFA_def_cfa_offset) \
+ ONE_KNOWN_DW_CFA (def_cfa_offset_sf, DW_CFA_def_cfa_offset_sf) \
+ ONE_KNOWN_DW_CFA (def_cfa_register, DW_CFA_def_cfa_register) \
+ ONE_KNOWN_DW_CFA (def_cfa_sf, DW_CFA_def_cfa_sf) \
+ ONE_KNOWN_DW_CFA (expression, DW_CFA_expression) \
+ ONE_KNOWN_DW_CFA (extended, DW_CFA_extended) \
+ ONE_KNOWN_DW_CFA (nop, DW_CFA_nop) \
+ ONE_KNOWN_DW_CFA (offset, DW_CFA_offset) \
+ ONE_KNOWN_DW_CFA (offset_extended, DW_CFA_offset_extended) \
+ ONE_KNOWN_DW_CFA (offset_extended_sf, DW_CFA_offset_extended_sf) \
+ ONE_KNOWN_DW_CFA (register, DW_CFA_register) \
+ ONE_KNOWN_DW_CFA (remember_state, DW_CFA_remember_state) \
+ ONE_KNOWN_DW_CFA (restore, DW_CFA_restore) \
+ ONE_KNOWN_DW_CFA (restore_extended, DW_CFA_restore_extended) \
+ ONE_KNOWN_DW_CFA (restore_state, DW_CFA_restore_state) \
+ ONE_KNOWN_DW_CFA (same_value, DW_CFA_same_value) \
+ ONE_KNOWN_DW_CFA (set_loc, DW_CFA_set_loc) \
+ ONE_KNOWN_DW_CFA (undefined, DW_CFA_undefined) \
+ ONE_KNOWN_DW_CFA (val_expression, DW_CFA_val_expression) \
+ ONE_KNOWN_DW_CFA (val_offset, DW_CFA_val_offset) \
+ ONE_KNOWN_DW_CFA (val_offset_sf, DW_CFA_val_offset_sf) \
+ /* End of DW_CFA_*. */
+
+#define ALL_KNOWN_DW_CHILDREN \
+ ONE_KNOWN_DW_CHILDREN (no, DW_CHILDREN_no) \
+ ONE_KNOWN_DW_CHILDREN (yes, DW_CHILDREN_yes) \
+ /* End of DW_CHILDREN_*. */
+
+#define ALL_KNOWN_DW_CIE_ID \
+ ONE_KNOWN_DW_CIE_ID_DESC (32, DW_CIE_ID_32, "In 32-bit format CIE header.") \
+ ONE_KNOWN_DW_CIE_ID_DESC (64, DW_CIE_ID_64, "In 64-bit format CIE header.") \
+ /* End of DW_CIE_ID_*. */
+
+#define ALL_KNOWN_DW_DS \
+ ONE_KNOWN_DW_DS (leading_overpunch, DW_DS_leading_overpunch) \
+ ONE_KNOWN_DW_DS (leading_separate, DW_DS_leading_separate) \
+ ONE_KNOWN_DW_DS (trailing_overpunch, DW_DS_trailing_overpunch) \
+ ONE_KNOWN_DW_DS (trailing_separate, DW_DS_trailing_separate) \
+ ONE_KNOWN_DW_DS (unsigned, DW_DS_unsigned) \
+ /* End of DW_DS_*. */
+
+#define ALL_KNOWN_DW_DSC \
+ ONE_KNOWN_DW_DSC (label, DW_DSC_label) \
+ ONE_KNOWN_DW_DSC (range, DW_DSC_range) \
+ /* End of DW_DSC_*. */
+
+#define ALL_KNOWN_DW_EH_PE \
+ ONE_KNOWN_DW_EH_PE (absptr, DW_EH_PE_absptr) \
+ ONE_KNOWN_DW_EH_PE (aligned, DW_EH_PE_aligned) \
+ ONE_KNOWN_DW_EH_PE (datarel, DW_EH_PE_datarel) \
+ ONE_KNOWN_DW_EH_PE (funcrel, DW_EH_PE_funcrel) \
+ ONE_KNOWN_DW_EH_PE (indirect, DW_EH_PE_indirect) \
+ ONE_KNOWN_DW_EH_PE (omit, DW_EH_PE_omit) \
+ ONE_KNOWN_DW_EH_PE (pcrel, DW_EH_PE_pcrel) \
+ ONE_KNOWN_DW_EH_PE (sdata2, DW_EH_PE_sdata2) \
+ ONE_KNOWN_DW_EH_PE (sdata4, DW_EH_PE_sdata4) \
+ ONE_KNOWN_DW_EH_PE (sdata8, DW_EH_PE_sdata8) \
+ ONE_KNOWN_DW_EH_PE (signed, DW_EH_PE_signed) \
+ ONE_KNOWN_DW_EH_PE (sleb128, DW_EH_PE_sleb128) \
+ ONE_KNOWN_DW_EH_PE (textrel, DW_EH_PE_textrel) \
+ ONE_KNOWN_DW_EH_PE (udata2, DW_EH_PE_udata2) \
+ ONE_KNOWN_DW_EH_PE (udata4, DW_EH_PE_udata4) \
+ ONE_KNOWN_DW_EH_PE (udata8, DW_EH_PE_udata8) \
+ ONE_KNOWN_DW_EH_PE (uleb128, DW_EH_PE_uleb128) \
+ /* End of DW_EH_PE_*. */
+
+#define ALL_KNOWN_DW_END \
+ ONE_KNOWN_DW_END (big, DW_END_big) \
+ ONE_KNOWN_DW_END (default, DW_END_default) \
+ ONE_KNOWN_DW_END (little, DW_END_little) \
+ /* End of DW_END_*. */
+
+#define ALL_KNOWN_DW_FORM \
+ ONE_KNOWN_DW_FORM_DESC (GNU_ref_alt, DW_FORM_GNU_ref_alt, "offset in alternate .debuginfo.") \
+ ONE_KNOWN_DW_FORM_DESC (GNU_strp_alt, DW_FORM_GNU_strp_alt, "offset in alternate .debug_str.") \
+ ONE_KNOWN_DW_FORM (addr, DW_FORM_addr) \
+ ONE_KNOWN_DW_FORM (block, DW_FORM_block) \
+ ONE_KNOWN_DW_FORM (block1, DW_FORM_block1) \
+ ONE_KNOWN_DW_FORM (block2, DW_FORM_block2) \
+ ONE_KNOWN_DW_FORM (block4, DW_FORM_block4) \
+ ONE_KNOWN_DW_FORM (data1, DW_FORM_data1) \
+ ONE_KNOWN_DW_FORM (data2, DW_FORM_data2) \
+ ONE_KNOWN_DW_FORM (data4, DW_FORM_data4) \
+ ONE_KNOWN_DW_FORM (data8, DW_FORM_data8) \
+ ONE_KNOWN_DW_FORM (exprloc, DW_FORM_exprloc) \
+ ONE_KNOWN_DW_FORM (flag, DW_FORM_flag) \
+ ONE_KNOWN_DW_FORM (flag_present, DW_FORM_flag_present) \
+ ONE_KNOWN_DW_FORM (indirect, DW_FORM_indirect) \
+ ONE_KNOWN_DW_FORM (ref1, DW_FORM_ref1) \
+ ONE_KNOWN_DW_FORM (ref2, DW_FORM_ref2) \
+ ONE_KNOWN_DW_FORM (ref4, DW_FORM_ref4) \
+ ONE_KNOWN_DW_FORM (ref8, DW_FORM_ref8) \
+ ONE_KNOWN_DW_FORM (ref_addr, DW_FORM_ref_addr) \
+ ONE_KNOWN_DW_FORM (ref_sig8, DW_FORM_ref_sig8) \
+ ONE_KNOWN_DW_FORM (ref_udata, DW_FORM_ref_udata) \
+ ONE_KNOWN_DW_FORM (sdata, DW_FORM_sdata) \
+ ONE_KNOWN_DW_FORM (sec_offset, DW_FORM_sec_offset) \
+ ONE_KNOWN_DW_FORM (string, DW_FORM_string) \
+ ONE_KNOWN_DW_FORM (strp, DW_FORM_strp) \
+ ONE_KNOWN_DW_FORM (udata, DW_FORM_udata) \
+ /* End of DW_FORM_*. */
+
+#define ALL_KNOWN_DW_ID \
+ ONE_KNOWN_DW_ID (case_insensitive, DW_ID_case_insensitive) \
+ ONE_KNOWN_DW_ID (case_sensitive, DW_ID_case_sensitive) \
+ ONE_KNOWN_DW_ID (down_case, DW_ID_down_case) \
+ ONE_KNOWN_DW_ID (up_case, DW_ID_up_case) \
+ /* End of DW_ID_*. */
+
+#define ALL_KNOWN_DW_INL \
+ ONE_KNOWN_DW_INL (declared_inlined, DW_INL_declared_inlined) \
+ ONE_KNOWN_DW_INL (declared_not_inlined, DW_INL_declared_not_inlined) \
+ ONE_KNOWN_DW_INL (inlined, DW_INL_inlined) \
+ ONE_KNOWN_DW_INL (not_inlined, DW_INL_not_inlined) \
+ /* End of DW_INL_*. */
+
+#define ALL_KNOWN_DW_LANG \
+ ONE_KNOWN_DW_LANG_DESC (Ada83, DW_LANG_Ada83, "ISO Ada:1983") \
+ ONE_KNOWN_DW_LANG_DESC (Ada95, DW_LANG_Ada95, "ISO Ada:1995") \
+ ONE_KNOWN_DW_LANG_DESC (C, DW_LANG_C, "C") \
+ ONE_KNOWN_DW_LANG_DESC (C11, DW_LANG_C11, "ISO C:2011") \
+ ONE_KNOWN_DW_LANG_DESC (C89, DW_LANG_C89, "ISO C:1989") \
+ ONE_KNOWN_DW_LANG_DESC (C99, DW_LANG_C99, "ISO C:1999") \
+ ONE_KNOWN_DW_LANG_DESC (C_plus_plus, DW_LANG_C_plus_plus, "ISO C++:1998") \
+ ONE_KNOWN_DW_LANG_DESC (C_plus_plus_11, DW_LANG_C_plus_plus_11, "ISO C++:2011") \
+ ONE_KNOWN_DW_LANG_DESC (C_plus_plus_14, DW_LANG_C_plus_plus_14, "ISO C++:2014") \
+ ONE_KNOWN_DW_LANG_DESC (Cobol74, DW_LANG_Cobol74, "ISO Cobol:1974") \
+ ONE_KNOWN_DW_LANG_DESC (Cobol85, DW_LANG_Cobol85, "ISO Cobol:1985") \
+ ONE_KNOWN_DW_LANG_DESC (D, DW_LANG_D, "D") \
+ ONE_KNOWN_DW_LANG_DESC (Fortran77, DW_LANG_Fortran77, "ISO FORTRAN 77") \
+ ONE_KNOWN_DW_LANG_DESC (Fortran90, DW_LANG_Fortran90, "ISO Fortran 90") \
+ ONE_KNOWN_DW_LANG_DESC (Fortran95, DW_LANG_Fortran95, "ISO Fortran 95") \
+ ONE_KNOWN_DW_LANG_DESC (Go, DW_LANG_Go, "Go") \
+ ONE_KNOWN_DW_LANG_DESC (Java, DW_LANG_Java, "Java") \
+ ONE_KNOWN_DW_LANG_DESC (Mips_Assembler, DW_LANG_Mips_Assembler, "Assembler") \
+ ONE_KNOWN_DW_LANG_DESC (Modula2, DW_LANG_Modula2, "ISO Modula-2:1996") \
+ ONE_KNOWN_DW_LANG_DESC (ObjC, DW_LANG_ObjC, "Objective-C") \
+ ONE_KNOWN_DW_LANG_DESC (ObjC_plus_plus, DW_LANG_ObjC_plus_plus, "Objective-C++") \
+ ONE_KNOWN_DW_LANG_DESC (PL1, DW_LANG_PL1, "ISO PL/1:1976") \
+ ONE_KNOWN_DW_LANG_DESC (Pascal83, DW_LANG_Pascal83, "ISO Pascal:1983") \
+ ONE_KNOWN_DW_LANG_DESC (Python, DW_LANG_Python, "Python") \
+ ONE_KNOWN_DW_LANG_DESC (UPC, DW_LANG_UPC, "Unified Parallel C") \
+ /* End of DW_LANG_*. */
+
+#define ALL_KNOWN_DW_LNE \
+ ONE_KNOWN_DW_LNE (define_file, DW_LNE_define_file) \
+ ONE_KNOWN_DW_LNE (end_sequence, DW_LNE_end_sequence) \
+ ONE_KNOWN_DW_LNE (set_address, DW_LNE_set_address) \
+ ONE_KNOWN_DW_LNE (set_discriminator, DW_LNE_set_discriminator) \
+ /* End of DW_LNE_*. */
+
+#define ALL_KNOWN_DW_LNS \
+ ONE_KNOWN_DW_LNS (advance_line, DW_LNS_advance_line) \
+ ONE_KNOWN_DW_LNS (advance_pc, DW_LNS_advance_pc) \
+ ONE_KNOWN_DW_LNS (const_add_pc, DW_LNS_const_add_pc) \
+ ONE_KNOWN_DW_LNS (copy, DW_LNS_copy) \
+ ONE_KNOWN_DW_LNS (fixed_advance_pc, DW_LNS_fixed_advance_pc) \
+ ONE_KNOWN_DW_LNS (negate_stmt, DW_LNS_negate_stmt) \
+ ONE_KNOWN_DW_LNS (set_basic_block, DW_LNS_set_basic_block) \
+ ONE_KNOWN_DW_LNS (set_column, DW_LNS_set_column) \
+ ONE_KNOWN_DW_LNS (set_epilogue_begin, DW_LNS_set_epilogue_begin) \
+ ONE_KNOWN_DW_LNS (set_file, DW_LNS_set_file) \
+ ONE_KNOWN_DW_LNS (set_isa, DW_LNS_set_isa) \
+ ONE_KNOWN_DW_LNS (set_prologue_end, DW_LNS_set_prologue_end) \
+ /* End of DW_LNS_*. */
+
+#define ALL_KNOWN_DW_MACINFO \
+ ONE_KNOWN_DW_MACINFO (define, DW_MACINFO_define) \
+ ONE_KNOWN_DW_MACINFO (end_file, DW_MACINFO_end_file) \
+ ONE_KNOWN_DW_MACINFO (start_file, DW_MACINFO_start_file) \
+ ONE_KNOWN_DW_MACINFO (undef, DW_MACINFO_undef) \
+ ONE_KNOWN_DW_MACINFO (vendor_ext, DW_MACINFO_vendor_ext) \
+ /* End of DW_MACINFO_*. */
+
+#define ALL_KNOWN_DW_MACRO_GNU \
+ ONE_KNOWN_DW_MACRO_GNU (define, DW_MACRO_GNU_define) \
+ ONE_KNOWN_DW_MACRO_GNU (define_indirect, DW_MACRO_GNU_define_indirect) \
+ ONE_KNOWN_DW_MACRO_GNU (end_file, DW_MACRO_GNU_end_file) \
+ ONE_KNOWN_DW_MACRO_GNU (start_file, DW_MACRO_GNU_start_file) \
+ ONE_KNOWN_DW_MACRO_GNU (transparent_include, DW_MACRO_GNU_transparent_include) \
+ ONE_KNOWN_DW_MACRO_GNU (undef, DW_MACRO_GNU_undef) \
+ ONE_KNOWN_DW_MACRO_GNU (undef_indirect, DW_MACRO_GNU_undef_indirect) \
+ /* End of DW_MACRO_GNU_*. */
+
+#define ALL_KNOWN_DW_OP \
+ ONE_KNOWN_DW_OP (GNU_const_type, DW_OP_GNU_const_type) \
+ ONE_KNOWN_DW_OP (GNU_convert, DW_OP_GNU_convert) \
+ ONE_KNOWN_DW_OP (GNU_deref_type, DW_OP_GNU_deref_type) \
+ ONE_KNOWN_DW_OP (GNU_encoded_addr, DW_OP_GNU_encoded_addr) \
+ ONE_KNOWN_DW_OP (GNU_entry_value, DW_OP_GNU_entry_value) \
+ ONE_KNOWN_DW_OP (GNU_implicit_pointer, DW_OP_GNU_implicit_pointer) \
+ ONE_KNOWN_DW_OP (GNU_parameter_ref, DW_OP_GNU_parameter_ref) \
+ ONE_KNOWN_DW_OP (GNU_push_tls_address, DW_OP_GNU_push_tls_address) \
+ ONE_KNOWN_DW_OP (GNU_regval_type, DW_OP_GNU_regval_type) \
+ ONE_KNOWN_DW_OP (GNU_reinterpret, DW_OP_GNU_reinterpret) \
+ ONE_KNOWN_DW_OP (GNU_uninit, DW_OP_GNU_uninit) \
+ ONE_KNOWN_DW_OP (abs, DW_OP_abs) \
+ ONE_KNOWN_DW_OP_DESC (addr, DW_OP_addr, "Constant address.") \
+ ONE_KNOWN_DW_OP (and, DW_OP_and) \
+ ONE_KNOWN_DW_OP_DESC (bit_piece, DW_OP_bit_piece, "ULEB128 size and ULEB128 offset in bits.") \
+ ONE_KNOWN_DW_OP_DESC (bra, DW_OP_bra, "Signed 2-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (breg0, DW_OP_breg0, "Base register 0.") \
+ ONE_KNOWN_DW_OP_DESC (breg1, DW_OP_breg1, "Base register 1.") \
+ ONE_KNOWN_DW_OP_DESC (breg10, DW_OP_breg10, "Base register 10.") \
+ ONE_KNOWN_DW_OP_DESC (breg11, DW_OP_breg11, "Base register 11.") \
+ ONE_KNOWN_DW_OP_DESC (breg12, DW_OP_breg12, "Base register 12.") \
+ ONE_KNOWN_DW_OP_DESC (breg13, DW_OP_breg13, "Base register 13.") \
+ ONE_KNOWN_DW_OP_DESC (breg14, DW_OP_breg14, "Base register 14.") \
+ ONE_KNOWN_DW_OP_DESC (breg15, DW_OP_breg15, "Base register 15.") \
+ ONE_KNOWN_DW_OP_DESC (breg16, DW_OP_breg16, "Base register 16.") \
+ ONE_KNOWN_DW_OP_DESC (breg17, DW_OP_breg17, "Base register 17.") \
+ ONE_KNOWN_DW_OP_DESC (breg18, DW_OP_breg18, "Base register 18.") \
+ ONE_KNOWN_DW_OP_DESC (breg19, DW_OP_breg19, "Base register 19.") \
+ ONE_KNOWN_DW_OP_DESC (breg2, DW_OP_breg2, "Base register 2.") \
+ ONE_KNOWN_DW_OP_DESC (breg20, DW_OP_breg20, "Base register 20.") \
+ ONE_KNOWN_DW_OP_DESC (breg21, DW_OP_breg21, "Base register 21.") \
+ ONE_KNOWN_DW_OP_DESC (breg22, DW_OP_breg22, "Base register 22.") \
+ ONE_KNOWN_DW_OP_DESC (breg23, DW_OP_breg23, "Base register 23.") \
+ ONE_KNOWN_DW_OP_DESC (breg24, DW_OP_breg24, "Base register 24.") \
+ ONE_KNOWN_DW_OP_DESC (breg25, DW_OP_breg25, "Base register 25.") \
+ ONE_KNOWN_DW_OP_DESC (breg26, DW_OP_breg26, "Base register 26.") \
+ ONE_KNOWN_DW_OP_DESC (breg27, DW_OP_breg27, "Base register 27.") \
+ ONE_KNOWN_DW_OP_DESC (breg28, DW_OP_breg28, "Base register 28.") \
+ ONE_KNOWN_DW_OP_DESC (breg29, DW_OP_breg29, "Base register 29.") \
+ ONE_KNOWN_DW_OP_DESC (breg3, DW_OP_breg3, "Base register 3.") \
+ ONE_KNOWN_DW_OP_DESC (breg30, DW_OP_breg30, "Base register 30.") \
+ ONE_KNOWN_DW_OP_DESC (breg31, DW_OP_breg31, "Base register 31.") \
+ ONE_KNOWN_DW_OP_DESC (breg4, DW_OP_breg4, "Base register 4.") \
+ ONE_KNOWN_DW_OP_DESC (breg5, DW_OP_breg5, "Base register 5.") \
+ ONE_KNOWN_DW_OP_DESC (breg6, DW_OP_breg6, "Base register 6.") \
+ ONE_KNOWN_DW_OP_DESC (breg7, DW_OP_breg7, "Base register 7.") \
+ ONE_KNOWN_DW_OP_DESC (breg8, DW_OP_breg8, "Base register 8.") \
+ ONE_KNOWN_DW_OP_DESC (breg9, DW_OP_breg9, "Base register 9.") \
+ ONE_KNOWN_DW_OP_DESC (bregx, DW_OP_bregx, "ULEB128 register followed by SLEB128 off.") \
+ ONE_KNOWN_DW_OP (call2, DW_OP_call2) \
+ ONE_KNOWN_DW_OP (call4, DW_OP_call4) \
+ ONE_KNOWN_DW_OP (call_frame_cfa, DW_OP_call_frame_cfa) \
+ ONE_KNOWN_DW_OP (call_ref, DW_OP_call_ref) \
+ ONE_KNOWN_DW_OP_DESC (const1s, DW_OP_const1s, "Signed 1-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (const1u, DW_OP_const1u, "Unsigned 1-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (const2s, DW_OP_const2s, "Signed 2-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (const2u, DW_OP_const2u, "Unsigned 2-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (const4s, DW_OP_const4s, "Signed 4-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (const4u, DW_OP_const4u, "Unsigned 4-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (const8s, DW_OP_const8s, "Signed 8-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (const8u, DW_OP_const8u, "Unsigned 8-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (consts, DW_OP_consts, "Signed LEB128 constant.") \
+ ONE_KNOWN_DW_OP_DESC (constu, DW_OP_constu, "Unsigned LEB128 constant.") \
+ ONE_KNOWN_DW_OP (deref, DW_OP_deref) \
+ ONE_KNOWN_DW_OP_DESC (deref_size, DW_OP_deref_size, "1-byte size of data retrieved.") \
+ ONE_KNOWN_DW_OP (div, DW_OP_div) \
+ ONE_KNOWN_DW_OP (drop, DW_OP_drop) \
+ ONE_KNOWN_DW_OP (dup, DW_OP_dup) \
+ ONE_KNOWN_DW_OP (eq, DW_OP_eq) \
+ ONE_KNOWN_DW_OP_DESC (fbreg, DW_OP_fbreg, "Signed LEB128 offset.") \
+ ONE_KNOWN_DW_OP (form_tls_address, DW_OP_form_tls_address) \
+ ONE_KNOWN_DW_OP (ge, DW_OP_ge) \
+ ONE_KNOWN_DW_OP (gt, DW_OP_gt) \
+ ONE_KNOWN_DW_OP_DESC (implicit_value, DW_OP_implicit_value, "DW_FORM_block follows opcode.") \
+ ONE_KNOWN_DW_OP (le, DW_OP_le) \
+ ONE_KNOWN_DW_OP_DESC (lit0, DW_OP_lit0, "Literal 0.") \
+ ONE_KNOWN_DW_OP_DESC (lit1, DW_OP_lit1, "Literal 1.") \
+ ONE_KNOWN_DW_OP_DESC (lit10, DW_OP_lit10, "Literal 10.") \
+ ONE_KNOWN_DW_OP_DESC (lit11, DW_OP_lit11, "Literal 11.") \
+ ONE_KNOWN_DW_OP_DESC (lit12, DW_OP_lit12, "Literal 12.") \
+ ONE_KNOWN_DW_OP_DESC (lit13, DW_OP_lit13, "Literal 13.") \
+ ONE_KNOWN_DW_OP_DESC (lit14, DW_OP_lit14, "Literal 14.") \
+ ONE_KNOWN_DW_OP_DESC (lit15, DW_OP_lit15, "Literal 15.") \
+ ONE_KNOWN_DW_OP_DESC (lit16, DW_OP_lit16, "Literal 16.") \
+ ONE_KNOWN_DW_OP_DESC (lit17, DW_OP_lit17, "Literal 17.") \
+ ONE_KNOWN_DW_OP_DESC (lit18, DW_OP_lit18, "Literal 18.") \
+ ONE_KNOWN_DW_OP_DESC (lit19, DW_OP_lit19, "Literal 19.") \
+ ONE_KNOWN_DW_OP_DESC (lit2, DW_OP_lit2, "Literal 2.") \
+ ONE_KNOWN_DW_OP_DESC (lit20, DW_OP_lit20, "Literal 20.") \
+ ONE_KNOWN_DW_OP_DESC (lit21, DW_OP_lit21, "Literal 21.") \
+ ONE_KNOWN_DW_OP_DESC (lit22, DW_OP_lit22, "Literal 22.") \
+ ONE_KNOWN_DW_OP_DESC (lit23, DW_OP_lit23, "Literal 23.") \
+ ONE_KNOWN_DW_OP_DESC (lit24, DW_OP_lit24, "Literal 24.") \
+ ONE_KNOWN_DW_OP_DESC (lit25, DW_OP_lit25, "Literal 25.") \
+ ONE_KNOWN_DW_OP_DESC (lit26, DW_OP_lit26, "Literal 26.") \
+ ONE_KNOWN_DW_OP_DESC (lit27, DW_OP_lit27, "Literal 27.") \
+ ONE_KNOWN_DW_OP_DESC (lit28, DW_OP_lit28, "Literal 28.") \
+ ONE_KNOWN_DW_OP_DESC (lit29, DW_OP_lit29, "Literal 29.") \
+ ONE_KNOWN_DW_OP_DESC (lit3, DW_OP_lit3, "Literal 3.") \
+ ONE_KNOWN_DW_OP_DESC (lit30, DW_OP_lit30, "Literal 30.") \
+ ONE_KNOWN_DW_OP_DESC (lit31, DW_OP_lit31, "Literal 31.") \
+ ONE_KNOWN_DW_OP_DESC (lit4, DW_OP_lit4, "Literal 4.") \
+ ONE_KNOWN_DW_OP_DESC (lit5, DW_OP_lit5, "Literal 5.") \
+ ONE_KNOWN_DW_OP_DESC (lit6, DW_OP_lit6, "Literal 6.") \
+ ONE_KNOWN_DW_OP_DESC (lit7, DW_OP_lit7, "Literal 7.") \
+ ONE_KNOWN_DW_OP_DESC (lit8, DW_OP_lit8, "Literal 8.") \
+ ONE_KNOWN_DW_OP_DESC (lit9, DW_OP_lit9, "Literal 9.") \
+ ONE_KNOWN_DW_OP (lt, DW_OP_lt) \
+ ONE_KNOWN_DW_OP (minus, DW_OP_minus) \
+ ONE_KNOWN_DW_OP (mod, DW_OP_mod) \
+ ONE_KNOWN_DW_OP (mul, DW_OP_mul) \
+ ONE_KNOWN_DW_OP (ne, DW_OP_ne) \
+ ONE_KNOWN_DW_OP (neg, DW_OP_neg) \
+ ONE_KNOWN_DW_OP (nop, DW_OP_nop) \
+ ONE_KNOWN_DW_OP (not, DW_OP_not) \
+ ONE_KNOWN_DW_OP (or, DW_OP_or) \
+ ONE_KNOWN_DW_OP (over, DW_OP_over) \
+ ONE_KNOWN_DW_OP_DESC (pick, DW_OP_pick, "1-byte stack index.") \
+ ONE_KNOWN_DW_OP_DESC (piece, DW_OP_piece, "ULEB128 size of piece addressed.") \
+ ONE_KNOWN_DW_OP (plus, DW_OP_plus) \
+ ONE_KNOWN_DW_OP_DESC (plus_uconst, DW_OP_plus_uconst, "Unsigned LEB128 addend.") \
+ ONE_KNOWN_DW_OP (push_object_address, DW_OP_push_object_address) \
+ ONE_KNOWN_DW_OP_DESC (reg0, DW_OP_reg0, "Register 0.") \
+ ONE_KNOWN_DW_OP_DESC (reg1, DW_OP_reg1, "Register 1.") \
+ ONE_KNOWN_DW_OP_DESC (reg10, DW_OP_reg10, "Register 10.") \
+ ONE_KNOWN_DW_OP_DESC (reg11, DW_OP_reg11, "Register 11.") \
+ ONE_KNOWN_DW_OP_DESC (reg12, DW_OP_reg12, "Register 12.") \
+ ONE_KNOWN_DW_OP_DESC (reg13, DW_OP_reg13, "Register 13.") \
+ ONE_KNOWN_DW_OP_DESC (reg14, DW_OP_reg14, "Register 14.") \
+ ONE_KNOWN_DW_OP_DESC (reg15, DW_OP_reg15, "Register 15.") \
+ ONE_KNOWN_DW_OP_DESC (reg16, DW_OP_reg16, "Register 16.") \
+ ONE_KNOWN_DW_OP_DESC (reg17, DW_OP_reg17, "Register 17.") \
+ ONE_KNOWN_DW_OP_DESC (reg18, DW_OP_reg18, "Register 18.") \
+ ONE_KNOWN_DW_OP_DESC (reg19, DW_OP_reg19, "Register 19.") \
+ ONE_KNOWN_DW_OP_DESC (reg2, DW_OP_reg2, "Register 2.") \
+ ONE_KNOWN_DW_OP_DESC (reg20, DW_OP_reg20, "Register 20.") \
+ ONE_KNOWN_DW_OP_DESC (reg21, DW_OP_reg21, "Register 21.") \
+ ONE_KNOWN_DW_OP_DESC (reg22, DW_OP_reg22, "Register 22.") \
+ ONE_KNOWN_DW_OP_DESC (reg23, DW_OP_reg23, "Register 24.") \
+ ONE_KNOWN_DW_OP_DESC (reg24, DW_OP_reg24, "Register 24.") \
+ ONE_KNOWN_DW_OP_DESC (reg25, DW_OP_reg25, "Register 25.") \
+ ONE_KNOWN_DW_OP_DESC (reg26, DW_OP_reg26, "Register 26.") \
+ ONE_KNOWN_DW_OP_DESC (reg27, DW_OP_reg27, "Register 27.") \
+ ONE_KNOWN_DW_OP_DESC (reg28, DW_OP_reg28, "Register 28.") \
+ ONE_KNOWN_DW_OP_DESC (reg29, DW_OP_reg29, "Register 29.") \
+ ONE_KNOWN_DW_OP_DESC (reg3, DW_OP_reg3, "Register 3.") \
+ ONE_KNOWN_DW_OP_DESC (reg30, DW_OP_reg30, "Register 30.") \
+ ONE_KNOWN_DW_OP_DESC (reg31, DW_OP_reg31, "Register 31.") \
+ ONE_KNOWN_DW_OP_DESC (reg4, DW_OP_reg4, "Register 4.") \
+ ONE_KNOWN_DW_OP_DESC (reg5, DW_OP_reg5, "Register 5.") \
+ ONE_KNOWN_DW_OP_DESC (reg6, DW_OP_reg6, "Register 6.") \
+ ONE_KNOWN_DW_OP_DESC (reg7, DW_OP_reg7, "Register 7.") \
+ ONE_KNOWN_DW_OP_DESC (reg8, DW_OP_reg8, "Register 8.") \
+ ONE_KNOWN_DW_OP_DESC (reg9, DW_OP_reg9, "Register 9.") \
+ ONE_KNOWN_DW_OP_DESC (regx, DW_OP_regx, "Unsigned LEB128 register.") \
+ ONE_KNOWN_DW_OP (rot, DW_OP_rot) \
+ ONE_KNOWN_DW_OP (shl, DW_OP_shl) \
+ ONE_KNOWN_DW_OP (shr, DW_OP_shr) \
+ ONE_KNOWN_DW_OP (shra, DW_OP_shra) \
+ ONE_KNOWN_DW_OP_DESC (skip, DW_OP_skip, "Signed 2-byte constant.") \
+ ONE_KNOWN_DW_OP_DESC (stack_value, DW_OP_stack_value, "No operands, special like DW_OP_piece.") \
+ ONE_KNOWN_DW_OP (swap, DW_OP_swap) \
+ ONE_KNOWN_DW_OP (xderef, DW_OP_xderef) \
+ ONE_KNOWN_DW_OP_DESC (xderef_size, DW_OP_xderef_size, "1-byte size of data retrieved.") \
+ ONE_KNOWN_DW_OP (xor, DW_OP_xor) \
+ /* End of DW_OP_*. */
+
+#define ALL_KNOWN_DW_ORD \
+ ONE_KNOWN_DW_ORD (col_major, DW_ORD_col_major) \
+ ONE_KNOWN_DW_ORD (row_major, DW_ORD_row_major) \
+ /* End of DW_ORD_*. */
+
+#define ALL_KNOWN_DW_TAG \
+ ONE_KNOWN_DW_TAG (GNU_BINCL, DW_TAG_GNU_BINCL) \
+ ONE_KNOWN_DW_TAG (GNU_EINCL, DW_TAG_GNU_EINCL) \
+ ONE_KNOWN_DW_TAG (GNU_call_site, DW_TAG_GNU_call_site) \
+ ONE_KNOWN_DW_TAG (GNU_call_site_parameter, DW_TAG_GNU_call_site_parameter) \
+ ONE_KNOWN_DW_TAG (GNU_formal_parameter_pack, DW_TAG_GNU_formal_parameter_pack) \
+ ONE_KNOWN_DW_TAG (GNU_template_parameter_pack, DW_TAG_GNU_template_parameter_pack) \
+ ONE_KNOWN_DW_TAG (GNU_template_template_param, DW_TAG_GNU_template_template_param) \
+ ONE_KNOWN_DW_TAG (MIPS_loop, DW_TAG_MIPS_loop) \
+ ONE_KNOWN_DW_TAG (access_declaration, DW_TAG_access_declaration) \
+ ONE_KNOWN_DW_TAG (array_type, DW_TAG_array_type) \
+ ONE_KNOWN_DW_TAG (base_type, DW_TAG_base_type) \
+ ONE_KNOWN_DW_TAG (catch_block, DW_TAG_catch_block) \
+ ONE_KNOWN_DW_TAG (class_template, DW_TAG_class_template) \
+ ONE_KNOWN_DW_TAG (class_type, DW_TAG_class_type) \
+ ONE_KNOWN_DW_TAG (common_block, DW_TAG_common_block) \
+ ONE_KNOWN_DW_TAG (common_inclusion, DW_TAG_common_inclusion) \
+ ONE_KNOWN_DW_TAG (compile_unit, DW_TAG_compile_unit) \
+ ONE_KNOWN_DW_TAG (condition, DW_TAG_condition) \
+ ONE_KNOWN_DW_TAG (const_type, DW_TAG_const_type) \
+ ONE_KNOWN_DW_TAG (constant, DW_TAG_constant) \
+ ONE_KNOWN_DW_TAG (dwarf_procedure, DW_TAG_dwarf_procedure) \
+ ONE_KNOWN_DW_TAG (entry_point, DW_TAG_entry_point) \
+ ONE_KNOWN_DW_TAG (enumeration_type, DW_TAG_enumeration_type) \
+ ONE_KNOWN_DW_TAG (enumerator, DW_TAG_enumerator) \
+ ONE_KNOWN_DW_TAG (file_type, DW_TAG_file_type) \
+ ONE_KNOWN_DW_TAG (formal_parameter, DW_TAG_formal_parameter) \
+ ONE_KNOWN_DW_TAG (format_label, DW_TAG_format_label) \
+ ONE_KNOWN_DW_TAG (friend, DW_TAG_friend) \
+ ONE_KNOWN_DW_TAG (function_template, DW_TAG_function_template) \
+ ONE_KNOWN_DW_TAG (imported_declaration, DW_TAG_imported_declaration) \
+ ONE_KNOWN_DW_TAG (imported_module, DW_TAG_imported_module) \
+ ONE_KNOWN_DW_TAG (imported_unit, DW_TAG_imported_unit) \
+ ONE_KNOWN_DW_TAG (inheritance, DW_TAG_inheritance) \
+ ONE_KNOWN_DW_TAG (inlined_subroutine, DW_TAG_inlined_subroutine) \
+ ONE_KNOWN_DW_TAG (interface_type, DW_TAG_interface_type) \
+ ONE_KNOWN_DW_TAG (label, DW_TAG_label) \
+ ONE_KNOWN_DW_TAG (lexical_block, DW_TAG_lexical_block) \
+ ONE_KNOWN_DW_TAG (member, DW_TAG_member) \
+ ONE_KNOWN_DW_TAG (module, DW_TAG_module) \
+ ONE_KNOWN_DW_TAG (namelist, DW_TAG_namelist) \
+ ONE_KNOWN_DW_TAG (namelist_item, DW_TAG_namelist_item) \
+ ONE_KNOWN_DW_TAG (namespace, DW_TAG_namespace) \
+ ONE_KNOWN_DW_TAG (packed_type, DW_TAG_packed_type) \
+ ONE_KNOWN_DW_TAG (partial_unit, DW_TAG_partial_unit) \
+ ONE_KNOWN_DW_TAG (pointer_type, DW_TAG_pointer_type) \
+ ONE_KNOWN_DW_TAG (ptr_to_member_type, DW_TAG_ptr_to_member_type) \
+ ONE_KNOWN_DW_TAG (reference_type, DW_TAG_reference_type) \
+ ONE_KNOWN_DW_TAG (restrict_type, DW_TAG_restrict_type) \
+ ONE_KNOWN_DW_TAG (rvalue_reference_type, DW_TAG_rvalue_reference_type) \
+ ONE_KNOWN_DW_TAG (set_type, DW_TAG_set_type) \
+ ONE_KNOWN_DW_TAG (shared_type, DW_TAG_shared_type) \
+ ONE_KNOWN_DW_TAG (string_type, DW_TAG_string_type) \
+ ONE_KNOWN_DW_TAG (structure_type, DW_TAG_structure_type) \
+ ONE_KNOWN_DW_TAG (subprogram, DW_TAG_subprogram) \
+ ONE_KNOWN_DW_TAG (subrange_type, DW_TAG_subrange_type) \
+ ONE_KNOWN_DW_TAG (subroutine_type, DW_TAG_subroutine_type) \
+ ONE_KNOWN_DW_TAG (template_alias, DW_TAG_template_alias) \
+ ONE_KNOWN_DW_TAG (template_type_parameter, DW_TAG_template_type_parameter) \
+ ONE_KNOWN_DW_TAG (template_value_parameter, DW_TAG_template_value_parameter) \
+ ONE_KNOWN_DW_TAG (thrown_type, DW_TAG_thrown_type) \
+ ONE_KNOWN_DW_TAG (try_block, DW_TAG_try_block) \
+ ONE_KNOWN_DW_TAG (type_unit, DW_TAG_type_unit) \
+ ONE_KNOWN_DW_TAG (typedef, DW_TAG_typedef) \
+ ONE_KNOWN_DW_TAG (union_type, DW_TAG_union_type) \
+ ONE_KNOWN_DW_TAG (unspecified_parameters, DW_TAG_unspecified_parameters) \
+ ONE_KNOWN_DW_TAG (unspecified_type, DW_TAG_unspecified_type) \
+ ONE_KNOWN_DW_TAG (variable, DW_TAG_variable) \
+ ONE_KNOWN_DW_TAG (variant, DW_TAG_variant) \
+ ONE_KNOWN_DW_TAG (variant_part, DW_TAG_variant_part) \
+ ONE_KNOWN_DW_TAG (volatile_type, DW_TAG_volatile_type) \
+ ONE_KNOWN_DW_TAG (with_stmt, DW_TAG_with_stmt) \
+ /* End of DW_TAG_*. */
+
+#define ALL_KNOWN_DW_VIRTUALITY \
+ ONE_KNOWN_DW_VIRTUALITY (none, DW_VIRTUALITY_none) \
+ ONE_KNOWN_DW_VIRTUALITY (pure_virtual, DW_VIRTUALITY_pure_virtual) \
+ ONE_KNOWN_DW_VIRTUALITY (virtual, DW_VIRTUALITY_virtual) \
+ /* End of DW_VIRTUALITY_*. */
+
+#define ALL_KNOWN_DW_VIS \
+ ONE_KNOWN_DW_VIS (exported, DW_VIS_exported) \
+ ONE_KNOWN_DW_VIS (local, DW_VIS_local) \
+ ONE_KNOWN_DW_VIS (qualified, DW_VIS_qualified) \
+ /* End of DW_VIS_*. */
diff --git a/src/libdw/libdw.h b/src/libdw/libdw.h
index e001b7a4..b2b22828 100644
--- a/src/libdw/libdw.h
+++ b/src/libdw/libdw.h
@@ -1,51 +1,30 @@
/* Interfaces for libdw.
- Copyright (C) 2002-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2002-2010, 2013, 2014 Red Hat, Inc.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBDW_H
#define _LIBDW_H 1
@@ -53,6 +32,7 @@
#include <gelf.h>
#include <stdbool.h>
#include <stddef.h>
+#include <stdint.h>
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
@@ -133,6 +113,7 @@ typedef struct Dwarf_Aranges_s Dwarf_Aranges;
/* CU representation. */
struct Dwarf_CU;
+typedef struct Dwarf_CU Dwarf_CU;
/* Macro information. */
typedef struct Dwarf_Macro_s Dwarf_Macro;
@@ -281,6 +262,24 @@ extern Dwarf *dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp);
/* Retrieve ELF descriptor used for DWARF access. */
extern Elf *dwarf_getelf (Dwarf *dwarf);
+/* Retieve DWARF descriptor used for a Dwarf_Die or Dwarf_Attribute.
+ A Dwarf_Die or a Dwarf_Attribute is associated with a particular
+ Dwarf_CU handle. This function returns the DWARF descriptor for
+ that Dwarf_CU. */
+extern Dwarf *dwarf_cu_getdwarf (Dwarf_CU *cu);
+
+/* Retrieves the DWARF descriptor for debugaltlink data. Returns NULL
+ if no alternate debug data has been supplied. */
+extern Dwarf *dwarf_getalt (Dwarf *main);
+
+/* Provides the data referenced by the .gnu_debugaltlink section. The
+ caller should check that MAIN and ALT match (i.e., they have the
+ same build ID). It is the responsibility of the caller to ensure
+ that the data referenced by ALT stays valid while it is used by
+ MAIN, until dwarf_setalt is called on MAIN with a different
+ descriptor, or dwarf_end. */
+extern void dwarf_setalt (Dwarf *main, Dwarf *alt);
+
/* Release debugging handling context. */
extern int dwarf_end (Dwarf *dwarf);
@@ -366,6 +365,23 @@ extern Dwarf_Die *dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result,
uint8_t *address_sizep, uint8_t *offset_sizep)
__nonnull_attribute__ (2);
+/* Return the CU DIE and the header info associated with a Dwarf_Die
+ or Dwarf_Attribute. A Dwarf_Die or a Dwarf_Attribute is associated
+ with a particular Dwarf_CU handle. This function returns the CU or
+ type unit DIE and header information for that Dwarf_CU. The
+ returned DIE is either a compile_unit, partial_unit or type_unit.
+ If it is a type_unit, then the type signature and type offset are
+ also provided, otherwise type_offset will be set to zero. See also
+ dwarf_diecu and dwarf_next_unit. */
+extern Dwarf_Die *dwarf_cu_die (Dwarf_CU *cu, Dwarf_Die *result,
+ Dwarf_Half *versionp,
+ Dwarf_Off *abbrev_offsetp,
+ uint8_t *address_sizep,
+ uint8_t *offset_sizep,
+ uint64_t *type_signaturep,
+ Dwarf_Off *type_offsetp)
+ __nonnull_attribute__ (2);
+
/* Return CU DIE containing given address. */
extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr,
Dwarf_Die *result) __nonnull_attribute__ (3);
@@ -383,6 +399,24 @@ extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
__nonnull_attribute__ (2);
+/* For type aliases and qualifier type DIEs follow the DW_AT_type
+ attribute (recursively) and return the underlying type Dwarf_Die.
+ Returns 0 when RESULT contains a Dwarf_Die (possibly equal to the
+ given DIE) that isn't a type alias or qualifier type. Returns 1
+ when RESULT contains a type alias or qualifier Dwarf_Die that
+ couldn't be peeled further (it doesn't have a DW_TAG_type
+ attribute). Returns -1 when an error occured.
+
+ The current DWARF specification defines one type alias tag
+ (DW_TAG_typedef) and three qualifier type tags (DW_TAG_const_type,
+ DW_TAG_volatile_type, DW_TAG_restrict_type). A future version of
+ this function might peel other alias or qualifier type tags if a
+ future DWARF version or GNU extension defines other type aliases or
+ qualifier type tags that don't modify or change the structural
+ layout of the underlying type. */
+extern int dwarf_peel_type (Dwarf_Die *die, Dwarf_Die *result)
+ __nonnull_attribute__ (2);
+
/* Check whether the DIE has children. */
extern int dwarf_haschildren (Dwarf_Die *die) __nonnull_attribute__ (1);
@@ -651,6 +685,22 @@ extern int dwarf_getlocation_addr (Dwarf_Attribute *attr, Dwarf_Addr address,
Dwarf_Op **exprs, size_t *exprlens,
size_t nlocs);
+/* Enumerate the locations ranges and descriptions covered by the
+ given attribute. In the first call OFFSET should be zero and
+ *BASEP need not be initialized. Returns -1 for errors, zero when
+ there are no more locations to report, or a nonzero OFFSET
+ value to pass to the next call. Each subsequent call must preserve
+ *BASEP from the prior call. Successful calls fill in *STARTP and
+ *ENDP with a contiguous address range and *EXPR with a pointer to
+ an array of operations with length *EXPRLEN. If the attribute
+ describes a single location description and not a location list the
+ first call (with OFFSET zero) will return the location description
+ in *EXPR with *STARTP set to zero and *ENDP set to minus one. */
+extern ptrdiff_t dwarf_getlocations (Dwarf_Attribute *attr,
+ ptrdiff_t offset, Dwarf_Addr *basep,
+ Dwarf_Addr *startp, Dwarf_Addr *endp,
+ Dwarf_Op **expr, size_t *exprlen);
+
/* Return the block associated with a DW_OP_implicit_value operation.
The OP pointer must point into an expression that dwarf_getlocation
or dwarf_getlocation_addr has returned given the same ATTR. */
@@ -669,6 +719,29 @@ extern int dwarf_getlocation_implicit_pointer (Dwarf_Attribute *attr,
Dwarf_Attribute *result)
__nonnull_attribute__ (2, 3);
+/* Return the DIE associated with an operation such as
+ DW_OP_GNU_implicit_pointer, DW_OP_GNU_parameter_ref, DW_OP_GNU_convert,
+ DW_OP_GNU_reinterpret, DW_OP_GNU_const_type, DW_OP_GNU_regval_type or
+ DW_OP_GNU_deref_type. The OP pointer must point into an expression that
+ dwarf_getlocation or dwarf_getlocation_addr has returned given the same
+ ATTR. The RESULT is a DIE that expresses a type or value needed by the
+ given OP. */
+extern int dwarf_getlocation_die (Dwarf_Attribute *attr,
+ const Dwarf_Op *op,
+ Dwarf_Die *result)
+ __nonnull_attribute__ (2, 3);
+
+/* Return the attribute expressing a value associated with an operation such
+ as DW_OP_implicit_value, DW_OP_GNU_entry_value or DW_OP_GNU_const_type.
+ The OP pointer must point into an expression that dwarf_getlocation
+ or dwarf_getlocation_addr has returned given the same ATTR.
+ The RESULT is a value expressed by an attribute such as DW_AT_location
+ or DW_AT_const_value. */
+extern int dwarf_getlocation_attr (Dwarf_Attribute *attr,
+ const Dwarf_Op *op,
+ Dwarf_Attribute *result)
+ __nonnull_attribute__ (2, 3);
+
/* Compute the byte-size of a type DIE according to DWARF rules.
For most types, this is just DW_AT_byte_size.
@@ -729,7 +802,16 @@ extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges,
-/* Get functions in CUDIE. */
+/* Get functions in CUDIE. The given callback will be called for all
+ defining DW_TAG_subprograms in the CU DIE tree. If the callback
+ returns DWARF_CB_ABORT the return value can be used as offset argument
+ to resume the function to find all remaining functions (this is not
+ really recommended, since it needs to rewalk the CU DIE tree first till
+ that offset is found again). If the callback returns DWARF_CB_OK
+ dwarf_getfuncs will not return but keep calling the callback for each
+ function DIE it finds. Pass zero for offset on the first call to walk
+ the full CU DIE tree. If no more functions can be found and the callback
+ returned DWARF_CB_OK then the function returns zero. */
extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie,
int (*callback) (Dwarf_Die *, void *),
void *arg, ptrdiff_t offset);
@@ -763,26 +845,95 @@ extern int dwarf_func_inline_instances (Dwarf_Die *func,
extern int dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts);
-/* Call callback function for each of the macro information entry for
- the CU. */
+/* Iterate through the macro unit referenced by CUDIE and call
+ CALLBACK for each macro information entry. To start the iteration,
+ one would pass DWARF_GETMACROS_START for TOKEN.
+
+ The iteration continues while CALLBACK returns DWARF_CB_OK. If the
+ callback returns DWARF_CB_ABORT, the iteration stops and a
+ continuation token is returned, which can be used to restart the
+ iteration at the point where it ended. Returns -1 for errors or 0
+ if there are no more macro entries.
+
+ Note that the Dwarf_Macro pointer passed to the callback is only
+ valid for the duration of the callback invocation.
+
+ For backward compatibility, a token of 0 is accepted for starting
+ the iteration as well, but in that case this interface will refuse
+ to serve opcode 0xff from .debug_macro sections. Such opcode would
+ be considered invalid and would cause dwarf_getmacros to return
+ with error. */
+#define DWARF_GETMACROS_START PTRDIFF_MIN
extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie,
int (*callback) (Dwarf_Macro *, void *),
- void *arg, ptrdiff_t offset)
+ void *arg, ptrdiff_t token)
__nonnull_attribute__ (2);
-/* Return macro opcode. */
+/* This is similar in operation to dwarf_getmacros, but selects the
+ unit to iterate through by offset instead of by CU, and always
+ iterates .debug_macro. This can be used for handling
+ DW_MACRO_GNU_transparent_include's or similar opcodes.
+
+ TOKEN value of DWARF_GETMACROS_START can be used to start the
+ iteration.
+
+ It is not appropriate to obtain macro unit offset by hand from a CU
+ DIE and then request iteration through this interface. The reason
+ for this is that if a dwarf_macro_getsrcfiles is later called,
+ there would be no way to figure out what DW_AT_comp_dir was present
+ on the CU DIE, and file names referenced in either the macro unit
+ itself, or the .debug_line unit that it references, might be wrong.
+ Use dwarf_getmacros. */
+extern ptrdiff_t dwarf_getmacros_off (Dwarf *dbg, Dwarf_Off macoff,
+ int (*callback) (Dwarf_Macro *, void *),
+ void *arg, ptrdiff_t token)
+ __nonnull_attribute__ (3);
+
+/* Get the source files used by the macro entry. You shouldn't assume
+ that Dwarf_Files references will remain valid after MACRO becomes
+ invalid. (Which is to say it's only valid within the
+ dwarf_getmacros* callback.) Returns 0 for success or a negative
+ value in case of an error. */
+extern int dwarf_macro_getsrcfiles (Dwarf *dbg, Dwarf_Macro *macro,
+ Dwarf_Files **files, size_t *nfiles)
+ __nonnull_attribute__ (2, 3, 4);
+
+/* Return macro opcode. That's a constant that can be either from
+ DW_MACINFO_* domain or DW_MACRO_GNU_* domain. The two domains have
+ compatible values, so it's OK to use either of them for
+ comparisons. The only differences is 0xff, which could be either
+ DW_MACINFO_vendor_ext or a vendor-defined DW_MACRO_* constant. One
+ would need to look if the CU DIE which the iteration was requested
+ for has attribute DW_AT_macro_info, or either of DW_AT_GNU_macros
+ or DW_AT_macros to differentiate the two interpretations. */
extern int dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep)
__nonnull_attribute__ (2);
-/* Return first macro parameter. */
+/* Get number of parameters of MACRO and store it to *PARAMCNTP. */
+extern int dwarf_macro_getparamcnt (Dwarf_Macro *macro, size_t *paramcntp);
+
+/* Get IDX-th parameter of MACRO (numbered from zero), and stores it
+ to *ATTRIBUTE. Returns 0 on success or -1 for errors.
+
+ After a successful call, you can query ATTRIBUTE by dwarf_whatform
+ to determine which of the dwarf_formX calls to make to get actual
+ value out of ATTRIBUTE. Note that calling dwarf_whatattr is not
+ meaningful for pseudo-attributes formed this way. */
+extern int dwarf_macro_param (Dwarf_Macro *macro, size_t idx,
+ Dwarf_Attribute *attribute);
+
+/* Return macro parameter with index 0. This will return -1 if the
+ parameter is not an integral value. Use dwarf_macro_param for more
+ general access. */
extern int dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp)
__nonnull_attribute__ (2);
-/* Return second macro parameter. */
+/* Return macro parameter with index 1. This will return -1 if the
+ parameter is not an integral or string value. Use
+ dwarf_macro_param for more general access. */
extern int dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp,
const char **strp);
-
/* Compute what's known about a call frame when the PC is at ADDRESS.
Returns 0 for success or -1 for errors.
On success, *FRAME is a malloc'd pointer. */
diff --git a/src/libdw/libdw.map b/src/libdw/libdw.map
index 1f71d03b..1d4cbb0c 100644
--- a/src/libdw/libdw.map
+++ b/src/libdw/libdw.map
@@ -254,3 +254,71 @@ ELFUTILS_0.149 {
dwfl_dwarf_line;
} ELFUTILS_0.148;
+
+ELFUTILS_0.156 {
+ global:
+ # Replaced ELFUTILS_0.122 version, which has a wrapper without add_p_vaddr.
+ dwfl_report_elf;
+} ELFUTILS_0.149;
+
+ELFUTILS_0.157 {
+ global:
+ dwarf_getlocations;
+ dwarf_getlocation_die;
+ dwarf_getlocation_attr;
+} ELFUTILS_0.156;
+
+ELFUTILS_0.158 {
+ global:
+ # Replaced ELFUTILS_0.146 version, which has a wrapper without executable.
+ dwfl_core_file_report;
+
+ dwfl_attach_state;
+ dwfl_pid;
+ dwfl_thread_dwfl;
+ dwfl_thread_tid;
+ dwfl_frame_thread;
+ dwfl_thread_state_registers;
+ dwfl_thread_state_register_pc;
+ dwfl_getthread_frames;
+ dwfl_getthreads;
+ dwfl_thread_getframes;
+ dwfl_frame_pc;
+
+ dwfl_module_getsymtab_first_global;
+ dwfl_module_addrinfo;
+ dwfl_module_getsym_info;
+
+ dwfl_core_file_attach;
+ dwfl_linux_proc_attach;
+} ELFUTILS_0.157;
+
+ELFUTILS_0.159 {
+ global:
+ dwarf_getalt;
+ dwarf_setalt;
+ dwelf_dwarf_gnu_debugaltlink;
+ dwelf_elf_gnu_debuglink;
+ dwelf_elf_gnu_build_id;
+} ELFUTILS_0.158;
+
+ELFUTILS_0.160 {
+ global:
+ dwarf_cu_getdwarf;
+ dwarf_cu_die;
+} ELFUTILS_0.159;
+
+ELFUTILS_0.161 {
+ global:
+ dwarf_peel_type;
+
+ # Replaced ELFUTILS_0.144 version. Both versions point to the
+ # same implementation, but users of the new symbol version can
+ # presume that it uses dwarf_peel_type.
+ dwarf_aggregate_size;
+
+ dwarf_getmacros_off;
+ dwarf_macro_getsrcfiles;
+ dwarf_macro_getparamcnt;
+ dwarf_macro_param;
+} ELFUTILS_0.160;
diff --git a/src/libdw/libdwP.h b/src/libdw/libdwP.h
index b84bf02c..5ab72194 100644
--- a/src/libdw/libdwP.h
+++ b/src/libdw/libdwP.h
@@ -1,52 +1,31 @@
/* Internal definitions for libdwarf.
- Copyright (C) 2002-2011 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2002-2011, 2013, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBDWP_H
#define _LIBDWP_H 1
@@ -55,6 +34,7 @@
#include <stdbool.h>
#include <libdw.h>
+#include <dwarf.h>
/* gettext helper macros. */
@@ -79,6 +59,14 @@ struct loc_block_s
size_t length;
};
+/* Already decoded .debug_line units. */
+struct files_lines_s
+{
+ Dwarf_Off debug_line_offset;
+ Dwarf_Files *files;
+ Dwarf_Lines *lines;
+};
+
/* Valid indeces for the section data. */
enum
{
@@ -92,7 +80,9 @@ enum
IDX_debug_pubnames,
IDX_debug_str,
IDX_debug_macinfo,
+ IDX_debug_macro,
IDX_debug_ranges,
+ IDX_gnu_debugaltlink,
IDX_last
};
@@ -136,6 +126,8 @@ enum
DWARF_E_INVALID_OFFSET,
DWARF_E_NO_DEBUG_RANGES,
DWARF_E_INVALID_CFI,
+ DWARF_E_NO_ALT_DEBUGLINK,
+ DWARF_E_INVALID_OPCODE,
};
@@ -147,6 +139,9 @@ struct Dwarf
/* The underlying ELF file. */
Elf *elf;
+ /* dwz alternate DWARF file. */
+ Dwarf *alt_dwarf;
+
/* The section data. */
Elf_Data *sectiondata[IDX_last];
@@ -181,12 +176,22 @@ struct Dwarf
Dwarf_Off next_tu_offset;
Dwarf_Sig8_Hash sig8_hash;
+ /* Search tree for .debug_macro operator tables. */
+ void *macro_ops;
+
+ /* Search tree for decoded .debug_line units. */
+ void *files_lines;
+
/* Address ranges. */
Dwarf_Aranges *aranges;
/* Cached info from the CFI section. */
struct Dwarf_CFI_s *cfi;
+ /* Fake loc CU. Used when synthesizing attributes for Dwarf_Ops that
+ came from a location list entry in dwarf_getlocation_attr. */
+ struct Dwarf_CU *fake_loc_cu;
+
/* Internal memory handling. This is basically a simplified
reimplementation of obstacks. Unfortunately the standard obstack
implementation is not usable in libraries. */
@@ -223,7 +228,6 @@ struct Dwarf_Abbrev
/* Files in line information records. */
struct Dwarf_Files_s
{
- struct Dwarf_CU *cu;
unsigned int ndirs;
unsigned int nfiles;
struct Dwarf_Fileinfo_s
@@ -310,6 +314,10 @@ struct Dwarf_CU
/* Known location lists. */
void *locs;
+
+ /* Memory boundaries of this CU. */
+ void *startp;
+ void *endp;
};
/* Compute the offset of a CU's first DIE from its offset. This
@@ -333,25 +341,65 @@ struct Dwarf_CU
((Dwarf_Die) \
{ \
.cu = (fromcu), \
- .addr = ((char *) cu_data (fromcu)->d_buf \
+ .addr = ((char *) fromcu->dbg->sectiondata[cu_sec_idx (fromcu)]->d_buf \
+ DIE_OFFSET_FROM_CU_OFFSET ((fromcu)->start, \
(fromcu)->offset_size, \
(fromcu)->type_offset != 0)) \
}) \
-/* Macro information. */
+/* Prototype of a single .debug_macro operator. */
+typedef struct
+{
+ Dwarf_Word nforms;
+ unsigned char const *forms;
+} Dwarf_Macro_Op_Proto;
+
+/* Prototype table. */
+typedef struct
+{
+ /* Offset of .debug_macro section. */
+ Dwarf_Off offset;
+
+ /* Offset of associated .debug_line section. */
+ Dwarf_Off line_offset;
+
+ /* The source file information. */
+ Dwarf_Files *files;
+
+ /* If this macro unit was opened through dwarf_getmacros or
+ dwarf_getmacros_die, this caches value of DW_AT_comp_dir, if
+ present. */
+ const char *comp_dir;
+
+ /* Header length. */
+ Dwarf_Half header_len;
+
+ uint16_t version;
+ bool is_64bit;
+ uint8_t sec_index; /* IDX_debug_macro or IDX_debug_macinfo. */
+
+ /* Shows where in TABLE each opcode is defined. Since opcode 0 is
+ never used, it stores index of opcode X in X-1'th element. The
+ value of 0xff means not stored at all. */
+ unsigned char opcodes[255];
+
+ /* Individual opcode prototypes. */
+ Dwarf_Macro_Op_Proto table[];
+} Dwarf_Macro_Op_Table;
+
struct Dwarf_Macro_s
{
- unsigned int opcode;
- Dwarf_Word param1;
- union
- {
- Dwarf_Word u;
- const char *s;
- } param2;
+ Dwarf_Macro_Op_Table *table;
+ Dwarf_Attribute *attributes;
+ uint8_t opcode;
};
+static inline Dwarf_Word
+libdw_macro_nforms (Dwarf_Macro *macro)
+{
+ return macro->table->table[macro->table->opcodes[macro->opcode - 1]].nforms;
+}
/* We have to include the file at this point because the inline
functions access internals of the Dwarf structure. */
@@ -404,7 +452,7 @@ extern struct Dwarf_CU *__libdw_intern_next_unit (Dwarf *dbg, bool debug_types)
extern struct Dwarf_CU *__libdw_findcu (Dwarf *dbg, Dwarf_Off offset, bool tu)
__nonnull_attribute__ (1) internal_function;
-/* Return tag of given DIE. */
+/* Get abbreviation with given code. */
extern Dwarf_Abbrev *__libdw_findabbrev (struct Dwarf_CU *cu,
unsigned int code)
__nonnull_attribute__ (1) internal_function;
@@ -415,11 +463,72 @@ extern Dwarf_Abbrev *__libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu,
Dwarf_Abbrev *result)
__nonnull_attribute__ (1) internal_function;
+/* Get abbreviation of given DIE, and optionally set *READP to the DIE memory
+ just past the abbreviation code. */
+static inline Dwarf_Abbrev *
+__nonnull_attribute__ (1)
+__libdw_dieabbrev (Dwarf_Die *die, const unsigned char **readp)
+{
+ /* Do we need to get the abbreviation, or need to read after the code? */
+ if (die->abbrev == NULL || readp != NULL)
+ {
+ /* Get the abbreviation code. */
+ unsigned int code;
+ const unsigned char *addr = die->addr;
+ get_uleb128 (code, addr, die->cu->endp);
+ if (readp != NULL)
+ *readp = addr;
+
+ /* Find the abbreviation. */
+ if (die->abbrev == NULL)
+ die->abbrev = __libdw_findabbrev (die->cu, code);
+ }
+ return die->abbrev;
+}
+
/* Helper functions for form handling. */
-extern size_t __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu,
- unsigned int form,
- const unsigned char *valp)
- __nonnull_attribute__ (1, 2, 4) internal_function;
+extern size_t __libdw_form_val_compute_len (struct Dwarf_CU *cu,
+ unsigned int form,
+ const unsigned char *valp)
+ __nonnull_attribute__ (1, 3) internal_function;
+
+/* Find the length of a form attribute. */
+static inline size_t
+__nonnull_attribute__ (1, 3)
+__libdw_form_val_len (struct Dwarf_CU *cu, unsigned int form,
+ const unsigned char *valp)
+{
+ /* Small lookup table of forms with fixed lengths. Absent indexes are
+ initialized 0, so any truly desired 0 is set to 0x80 and masked. */
+ static const uint8_t form_lengths[] =
+ {
+ [DW_FORM_flag_present] = 0x80,
+ [DW_FORM_data1] = 1, [DW_FORM_ref1] = 1, [DW_FORM_flag] = 1,
+ [DW_FORM_data2] = 2, [DW_FORM_ref2] = 2,
+ [DW_FORM_data4] = 4, [DW_FORM_ref4] = 4,
+ [DW_FORM_data8] = 8, [DW_FORM_ref8] = 8, [DW_FORM_ref_sig8] = 8,
+ };
+
+ /* Return immediately for forms with fixed lengths. */
+ if (form < sizeof form_lengths / sizeof form_lengths[0])
+ {
+ uint8_t len = form_lengths[form];
+ if (len != 0)
+ {
+ const unsigned char *endp = cu->endp;
+ len &= 0x7f; /* Mask to allow 0x80 -> 0. */
+ if (unlikely (len > (size_t) (endp - valp)))
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
+ return len;
+ }
+ }
+
+ /* Other forms require some computation. */
+ return __libdw_form_val_compute_len (cu, form, valp);
+}
/* Helper function for DW_FORM_ref* handling. */
extern int __libdw_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
@@ -600,13 +709,13 @@ __libdw_read_offset_inc (Dwarf *dbg,
}
static inline int
-__libdw_read_offset (Dwarf *dbg,
+__libdw_read_offset (Dwarf *dbg, Dwarf *dbg_ret,
int sec_index, const unsigned char *addr,
int width, Dwarf_Off *ret, int sec_ret,
size_t size)
{
READ_AND_RELOCATE (__libdw_relocate_offset, (*ret));
- return __libdw_offset_in_section (dbg, sec_ret, *ret, size);
+ return __libdw_offset_in_section (dbg_ret, sec_ret, *ret, size);
}
static inline size_t
@@ -615,12 +724,6 @@ cu_sec_idx (struct Dwarf_CU *cu)
return cu->type_offset == 0 ? IDX_debug_info : IDX_debug_types;
}
-static inline Elf_Data *
-cu_data (struct Dwarf_CU *cu)
-{
- return cu->dbg->sectiondata[cu_sec_idx (cu)];
-}
-
/* Read up begin/end pair and increment read pointer.
- If it's normal range record, set up *BEGINP and *ENDP and return 0.
- If it's base address selection record, set up *BASEP and return 1.
@@ -637,12 +740,30 @@ unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
Dwarf_Off *offsetp)
internal_function;
+/* Fills in the given attribute to point at an empty location expression. */
+void __libdw_empty_loc_attr (Dwarf_Attribute *attr)
+ internal_function;
+
+/* Load .debug_line unit at DEBUG_LINE_OFFSET. COMP_DIR is a value of
+ DW_AT_comp_dir or NULL if that attribute is not available. Caches
+ the loaded unit and optionally set *LINESP and/or *FILESP (if not
+ NULL) with loaded information. Returns 0 for success or a negative
+ value for failure. */
+int __libdw_getsrclines (Dwarf *dbg, Dwarf_Off debug_line_offset,
+ const char *comp_dir, unsigned address_size,
+ Dwarf_Lines **linesp, Dwarf_Files **filesp)
+ internal_function
+ __nonnull_attribute__ (1);
+
+/* Load and return value of DW_AT_comp_dir from CUDIE. */
+const char *__libdw_getcompdir (Dwarf_Die *cudie);
/* Aliases to avoid PLTs. */
INTDECL (dwarf_aggregate_size)
INTDECL (dwarf_attr)
INTDECL (dwarf_attr_integrate)
+INTDECL (dwarf_begin)
INTDECL (dwarf_begin_elf)
INTDECL (dwarf_child)
INTDECL (dwarf_dieoffset)
@@ -656,9 +777,11 @@ INTDECL (dwarf_formref_die)
INTDECL (dwarf_formsdata)
INTDECL (dwarf_formstring)
INTDECL (dwarf_formudata)
+INTDECL (dwarf_getalt)
INTDECL (dwarf_getarange_addr)
INTDECL (dwarf_getarangeinfo)
INTDECL (dwarf_getaranges)
+INTDECL (dwarf_getlocation_die)
INTDECL (dwarf_getsrcfiles)
INTDECL (dwarf_getsrclines)
INTDECL (dwarf_hasattr)
@@ -669,7 +792,9 @@ INTDECL (dwarf_lowpc)
INTDECL (dwarf_nextcu)
INTDECL (dwarf_next_unit)
INTDECL (dwarf_offdie)
+INTDECL (dwarf_peel_type)
INTDECL (dwarf_ranges)
+INTDECL (dwarf_setalt)
INTDECL (dwarf_siblingof)
INTDECL (dwarf_srclang)
INTDECL (dwarf_tag)
diff --git a/src/libdw/libdw_alloc.c b/src/libdw/libdw_alloc.c
index 917cb309..a3b7958f 100644
--- a/src/libdw/libdw_alloc.c
+++ b/src/libdw/libdw_alloc.c
@@ -1,52 +1,31 @@
/* Memory handling for libdw.
Copyright (C) 2003, 2004, 2006 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/src/libdw/libdw_findcu.c b/src/libdw/libdw_findcu.c
index 8e5f9e9b..d8da2e38 100644
--- a/src/libdw/libdw_findcu.c
+++ b/src/libdw/libdw_findcu.c
@@ -1,52 +1,31 @@
/* Find CU for given offset.
- Copyright (C) 2003-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2010, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -56,6 +35,31 @@
#include <search.h>
#include "libdwP.h"
+static int
+findcu_cb (const void *arg1, const void *arg2)
+{
+ struct Dwarf_CU *cu1 = (struct Dwarf_CU *) arg1;
+ struct Dwarf_CU *cu2 = (struct Dwarf_CU *) arg2;
+
+ /* Find out which of the two arguments is the search value. It has
+ end offset 0. */
+ if (cu1->end == 0)
+ {
+ if (cu1->start < cu2->start)
+ return -1;
+ if (cu1->start >= cu2->end)
+ return 1;
+ }
+ else
+ {
+ if (cu2->start < cu1->start)
+ return 1;
+ if (cu2->start >= cu1->end)
+ return -1;
+ }
+
+ return 0;
+}
struct Dwarf_CU *
internal_function
@@ -65,6 +69,7 @@ __libdw_intern_next_unit (dbg, debug_types)
{
Dwarf_Off *const offsetp
= debug_types ? &dbg->next_tu_offset : &dbg->next_cu_offset;
+ void **tree = debug_types ? &dbg->tu_tree : &dbg->cu_tree;
Dwarf_Off oldoff = *offsetp;
uint16_t version;
@@ -89,6 +94,12 @@ __libdw_intern_next_unit (dbg, debug_types)
return NULL;
}
+ /* Invalid or truncated debug section data? */
+ Elf_Data *data = dbg->sectiondata[debug_types
+ ? IDX_debug_types : IDX_debug_info];
+ if (unlikely (*offsetp > data->d_size))
+ *offsetp = data->d_size;
+
/* Create an entry for this CU. */
struct Dwarf_CU *newp = libdw_typed_alloc (dbg, struct Dwarf_CU);
@@ -105,34 +116,22 @@ __libdw_intern_next_unit (dbg, debug_types)
newp->lines = NULL;
newp->locs = NULL;
- return newp;
-}
+ if (debug_types)
+ Dwarf_Sig8_Hash_insert (&dbg->sig8_hash, type_sig8, newp);
+ newp->startp = data->d_buf + newp->start;
+ newp->endp = data->d_buf + newp->end;
-static int
-findcu_cb (const void *arg1, const void *arg2)
-{
- struct Dwarf_CU *cu1 = (struct Dwarf_CU *) arg1;
- struct Dwarf_CU *cu2 = (struct Dwarf_CU *) arg2;
-
- /* Find out which of the two arguments is the search value. It has
- end offset 0. */
- if (cu1->end == 0)
- {
- if (cu1->start < cu2->start)
- return -1;
- if (cu1->start >= cu2->end)
- return 1;
- }
- else
+ /* Add the new entry to the search tree. */
+ if (tsearch (newp, tree, findcu_cb) == NULL)
{
- if (cu2->start < cu1->start)
- return 1;
- if (cu2->start >= cu1->end)
- return -1;
+ /* Something went wrong. Undo the operation. */
+ *offsetp = oldoff;
+ __libdw_seterrno (DWARF_E_NOMEM);
+ return NULL;
}
- return 0;
+ return newp;
}
struct Dwarf_CU *
@@ -160,20 +159,10 @@ __libdw_findcu (dbg, start, debug_types)
/* No. Then read more CUs. */
while (1)
{
- Dwarf_Off oldoff = *next_offset;
struct Dwarf_CU *newp = __libdw_intern_next_unit (dbg, debug_types);
if (newp == NULL)
return NULL;
- /* Add the new entry to the search tree. */
- if (tsearch (newp, tree, findcu_cb) == NULL)
- {
- /* Something went wrong. Undo the operation. */
- *next_offset = oldoff;
- __libdw_seterrno (DWARF_E_NOMEM);
- return NULL;
- }
-
/* Is this the one we are looking for? */
if (start < *next_offset)
// XXX Match exact offset.
diff --git a/src/libdw/libdw_form.c b/src/libdw/libdw_form.c
index 219dd793..72e2390c 100644
--- a/src/libdw/libdw_form.c
+++ b/src/libdw/libdw_form.c
@@ -1,52 +1,31 @@
/* Helper functions for form handling.
- Copyright (C) 2003-2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2003-2009, 2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -60,13 +39,16 @@
size_t
internal_function
-__libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form,
- const unsigned char *valp)
+__libdw_form_val_compute_len (struct Dwarf_CU *cu, unsigned int form,
+ const unsigned char *valp)
{
- const unsigned char *saved;
+ const unsigned char *startp = valp;
+ const unsigned char *endp = cu->endp;
Dwarf_Word u128;
size_t result;
+ /* NB: This doesn't cover constant form lengths, which are
+ already handled by the inlined __libdw_form_val_len. */
switch (form)
{
case DW_FORM_addr:
@@ -79,79 +61,71 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form,
case DW_FORM_strp:
case DW_FORM_sec_offset:
+ case DW_FORM_GNU_ref_alt:
+ case DW_FORM_GNU_strp_alt:
result = cu->offset_size;
break;
case DW_FORM_block1:
+ if (unlikely ((size_t) (endp - startp) < 1))
+ goto invalid;
result = *valp + 1;
break;
case DW_FORM_block2:
- result = read_2ubyte_unaligned (dbg, valp) + 2;
+ if (unlikely ((size_t) (endp - startp) < 2))
+ goto invalid;
+ result = read_2ubyte_unaligned (cu->dbg, valp) + 2;
break;
case DW_FORM_block4:
- result = read_4ubyte_unaligned (dbg, valp) + 4;
+ if (unlikely ((size_t) (endp - startp) < 4))
+ goto invalid;
+ result = read_4ubyte_unaligned (cu->dbg, valp) + 4;
break;
case DW_FORM_block:
case DW_FORM_exprloc:
- saved = valp;
- get_uleb128 (u128, valp);
- result = u128 + (valp - saved);
- break;
-
- case DW_FORM_flag_present:
- result = 0;
- break;
-
- case DW_FORM_ref1:
- case DW_FORM_data1:
- case DW_FORM_flag:
- result = 1;
- break;
-
- case DW_FORM_data2:
- case DW_FORM_ref2:
- result = 2;
- break;
-
- case DW_FORM_data4:
- case DW_FORM_ref4:
- result = 4;
- break;
-
- case DW_FORM_data8:
- case DW_FORM_ref8:
- case DW_FORM_ref_sig8:
- result = 8;
+ get_uleb128 (u128, valp, endp);
+ result = u128 + (valp - startp);
break;
case DW_FORM_string:
- result = strlen ((char *) valp) + 1;
- break;
+ {
+ const unsigned char *endstrp = memchr (valp, '\0',
+ (size_t) (endp - startp));
+ if (unlikely (endstrp == NULL))
+ goto invalid;
+ result = (size_t) (endstrp - startp) + 1;
+ break;
+ }
case DW_FORM_sdata:
case DW_FORM_udata:
case DW_FORM_ref_udata:
- saved = valp;
- get_uleb128 (u128, valp);
- result = valp - saved;
+ get_uleb128 (u128, valp, endp);
+ result = valp - startp;
break;
case DW_FORM_indirect:
- saved = valp;
- get_uleb128 (u128, valp);
+ get_uleb128 (u128, valp, endp);
// XXX Is this really correct?
- result = __libdw_form_val_len (dbg, cu, u128, valp);
+ result = __libdw_form_val_len (cu, u128, valp);
if (result != (size_t) -1)
- result += valp - saved;
+ result += valp - startp;
+ else
+ return (size_t) -1;
break;
default:
+ goto invalid;
+ }
+
+ if (unlikely (result > (size_t) (endp - startp)))
+ {
+ invalid:
__libdw_seterrno (DWARF_E_INVALID_DWARF);
- result = (size_t) -1l;
- break;
+ result = (size_t) -1;
}
return result;
diff --git a/src/libdw/libdw_visit_scopes.c b/src/libdw/libdw_visit_scopes.c
index 9c7c3789..487375dc 100644
--- a/src/libdw/libdw_visit_scopes.c
+++ b/src/libdw/libdw_visit_scopes.c
@@ -1,50 +1,30 @@
/* Helper functions to descend DWARF scope trees.
Copyright (C) 2005,2006,2007 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ This file is part of elfutils.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under an Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) and to distribute linked
- combinations including the two. Non-GPL Code permitted under this
- exception must only link to the code of Red Hat elfutils through those
- well defined interfaces identified in the file named EXCEPTION found in
- the source code files (the "Approved Interfaces"). The files of Non-GPL
- Code may instantiate templates or use macros or inline functions from
- the Approved Interfaces without causing the resulting work to be covered
- by the GNU General Public License. Only Red Hat, Inc. may make changes
- or additions to the list of Approved Interfaces. Red Hat's grant of
- this exception is conditioned upon your not adding any new exceptions.
- If you wish to add a new Approved Interface or exception, please contact
- Red Hat. You must obey the GNU General Public License in all respects
- for all of the Red Hat elfutils code and other code used in conjunction
- with Red Hat elfutils except the Non-GPL Code covered by this exception.
- If you modify this file, you may extend this exception to your version
- of the file, but you are not obligated to do so. If you do not wish to
- provide this exception without modification, you must delete this
- exception statement from your version and license this file solely under
- the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -53,10 +33,9 @@
#include "libdwP.h"
#include <dwarf.h>
-enum die_class { ignore, match, match_inline, walk, imported };
-static enum die_class
-classify_die (Dwarf_Die *die)
+static bool
+may_have_scopes (Dwarf_Die *die)
{
switch (INTUSE(dwarf_tag) (die))
{
@@ -68,31 +47,21 @@ classify_die (Dwarf_Die *die)
case DW_TAG_catch_block:
case DW_TAG_try_block:
case DW_TAG_entry_point:
- return match;
case DW_TAG_inlined_subroutine:
- return match_inline;
case DW_TAG_subprogram:
- /* This might be a concrete out-of-line instance of an inline, in
- which case it is not guaranteed to be owned by the right scope and
- we will search for its origin as for DW_TAG_inlined_subroutine. */
- return (INTUSE(dwarf_hasattr) (die, DW_AT_abstract_origin)
- ? match_inline : match);
+ return true;
/* DIEs without addresses that can own DIEs with addresses. */
case DW_TAG_namespace:
case DW_TAG_class_type:
case DW_TAG_structure_type:
- return walk;
-
- /* Special indirection required. */
- case DW_TAG_imported_unit:
- return imported;
+ return true;
/* Other DIEs we have no reason to descend. */
default:
break;
}
- return ignore;
+ return false;
}
int
@@ -104,10 +73,11 @@ __libdw_visit_scopes (depth, root, previsit, postvisit, arg)
void *arg;
{
struct Dwarf_Die_Chain child;
+ int ret;
child.parent = root;
- if (INTUSE(dwarf_child) (&root->die, &child.die) != 0)
- return -1;
+ if ((ret = INTUSE(dwarf_child) (&root->die, &child.die)) != 0)
+ return ret < 0 ? -1 : 0; // Having zero children is legal.
inline int recurse (void)
{
@@ -115,63 +85,63 @@ __libdw_visit_scopes (depth, root, previsit, postvisit, arg)
previsit, postvisit, arg);
}
- do
- {
- child.prune = false;
-
- if (previsit != NULL)
- {
- int result = (*previsit) (depth + 1, &child, arg);
- if (result != DWARF_CB_OK)
- return result;
- }
-
- if (!child.prune)
- switch (classify_die (&child.die))
+ inline int walk_children ()
+ {
+ do
+ {
+ /* For an imported unit, it is logically as if the children of
+ that unit are siblings of the other children. So don't do
+ a full recursion into the imported unit, but just walk the
+ children in place before moving to the next real child. */
+ while (INTUSE(dwarf_tag) (&child.die) == DW_TAG_imported_unit)
{
- case match:
- case match_inline:
- case walk:
- if (INTUSE(dwarf_haschildren) (&child.die))
+ Dwarf_Die orig_child_die = child.die;
+ Dwarf_Attribute attr_mem;
+ Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child.die,
+ DW_AT_import,
+ &attr_mem);
+ if (INTUSE(dwarf_formref_die) (attr, &child.die) != NULL
+ && INTUSE(dwarf_child) (&child.die, &child.die) == 0)
{
- int result = recurse ();
+ int result = walk_children ();
if (result != DWARF_CB_OK)
return result;
}
- break;
-
- case imported:
- {
- /* This imports another compilation unit to appear
- as part of this one, inside the current scope.
- Recurse to search the referenced unit, but without
- recording it as an inner scoping level. */
-
- Dwarf_Attribute attr_mem;
- Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child.die,
- DW_AT_import,
- &attr_mem);
- if (INTUSE(dwarf_formref_die) (attr, &child.die) != NULL)
- {
- int result = recurse ();
- if (result != DWARF_CB_OK)
- return result;
- }
- }
- break;
-
- default:
- break;
+
+ /* Any "real" children left? */
+ if ((ret = INTUSE(dwarf_siblingof) (&orig_child_die,
+ &child.die)) != 0)
+ return ret < 0 ? -1 : 0;
+ };
+
+ child.prune = false;
+
+ if (previsit != NULL)
+ {
+ int result = (*previsit) (depth + 1, &child, arg);
+ if (result != DWARF_CB_OK)
+ return result;
}
- if (postvisit != NULL)
- {
- int result = (*postvisit) (depth + 1, &child, arg);
- if (result != DWARF_CB_OK)
- return result;
- }
- }
- while (INTUSE(dwarf_siblingof) (&child.die, &child.die) == 0);
+ if (!child.prune && may_have_scopes (&child.die)
+ && INTUSE(dwarf_haschildren) (&child.die))
+ {
+ int result = recurse ();
+ if (result != DWARF_CB_OK)
+ return result;
+ }
+
+ if (postvisit != NULL)
+ {
+ int result = (*postvisit) (depth + 1, &child, arg);
+ if (result != DWARF_CB_OK)
+ return result;
+ }
+ }
+ while ((ret = INTUSE(dwarf_siblingof) (&child.die, &child.die)) == 0);
+
+ return ret < 0 ? -1 : 0;
+ }
- return 0;
+ return walk_children ();
}
diff --git a/src/libdw/memory-access.c b/src/libdw/memory-access.c
deleted file mode 100644
index c9a0ca76..00000000
--- a/src/libdw/memory-access.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Out of line functions for memory-access.h macros.
- Copyright (C) 2005, 2006 Red Hat, Inc.
- This file is part of Red Hat elfutils.
-
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
-
- Red Hat elfutils is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include "libdwP.h"
-#include "memory-access.h"
-
-uint64_t
-internal_function
-__libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp)
-{
- unsigned char __b;
- get_uleb128_rest_return (acc, i, addrp);
-}
-
-int64_t
-internal_function
-__libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp)
-{
- unsigned char __b;
- int64_t _v = acc;
- get_sleb128_rest_return (acc, i, addrp);
-}
diff --git a/src/libdw/memory-access.h b/src/libdw/memory-access.h
index b7799e92..a53f7912 100644
--- a/src/libdw/memory-access.h
+++ b/src/libdw/memory-access.h
@@ -1,52 +1,31 @@
/* Unaligned memory access functionality.
- Copyright (C) 2000-2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
+ Copyright (C) 2000-2014 Red Hat, Inc.
+ This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
- Red Hat elfutils is distributed in the hope that it will be useful, but
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- In addition, as a special exception, Red Hat, Inc. gives You the
- additional right to link the code of Red Hat elfutils with code licensed
- under any Open Source Initiative certified open source license
- (http://www.opensource.org/licenses/index.php) which requires the
- distribution of source code with any binary distribution and to
- distribute linked combinations of the two. Non-GPL Code permitted under
- this exception must only link to the code of Red Hat elfutils through
- those well defined interfaces identified in the file named EXCEPTION
- found in the source code files (the "Approved Interfaces"). The files
- of Non-GPL Code may instantiate templates or use macros or inline
- functions from the Approved Interfaces without causing the resulting
- work to be covered by the GNU General Public License. Only Red Hat,
- Inc. may make changes or additions to the list of Approved Interfaces.
- Red Hat's grant of this exception is conditioned upon your not adding
- any new exceptions. If you wish to add a new Approved Interface or
- exception, please contact Red Hat. You must obey the GNU General Public
- License in all respects for all of the Red Hat elfutils code and other
- code used in conjunction with Red Hat elfutils except the Non-GPL Code
- covered by this exception. If you modify this file, you may extend this
- exception to your version of the file, but you are not obligated to do
- so. If you do not wish to provide this exception without modification,
- you must delete this exception statement from your version and license
- this file solely under the GPL without exception.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
#ifndef _MEMORY_ACCESS_H
#define _MEMORY_ACCESS_H 1
@@ -58,90 +37,76 @@
/* Number decoding macros. See 7.6 Variable Length Data. */
-#define get_uleb128_step(var, addr, nth, break) \
- __b = *(addr)++; \
- var |= (uintmax_t) (__b & 0x7f) << (nth * 7); \
- if (likely ((__b & 0x80) == 0)) \
- break
+#define len_leb128(var) ((8 * sizeof (var) + 6) / 7)
-#define get_uleb128(var, addr) \
- do { \
- unsigned char __b; \
- var = 0; \
- get_uleb128_step (var, addr, 0, break); \
- var = __libdw_get_uleb128 (var, 1, &(addr)); \
- } while (0)
+static inline size_t
+__libdw_max_len_leb128 (const unsigned char *addr, const unsigned char *end)
+{
+ const size_t type_len = len_leb128 (uint64_t);
+ const size_t pointer_len = likely (addr < end) ? end - addr : 0;
+ return likely (type_len <= pointer_len) ? type_len : pointer_len;
+}
-#define get_uleb128_rest_return(var, i, addrp) \
+#define get_uleb128_step(var, addr, nth) \
do { \
- for (; i < 10; ++i) \
- { \
- get_uleb128_step (var, *addrp, i, return var); \
- } \
- /* Other implementations set VALUE to UINT_MAX in this \
- case. So we better do this as well. */ \
- return UINT64_MAX; \
+ unsigned char __b = *(addr)++; \
+ (var) |= (typeof (var)) (__b & 0x7f) << ((nth) * 7); \
+ if (likely ((__b & 0x80) == 0)) \
+ return (var); \
} while (0)
-/* The signed case is similar, but we sign-extend the result. */
+static inline uint64_t
+__libdw_get_uleb128 (const unsigned char **addrp, const unsigned char *end)
+{
+ uint64_t acc = 0;
+
+ /* Unroll the first step to help the compiler optimize
+ for the common single-byte case. */
+ get_uleb128_step (acc, *addrp, 0);
+
+ const size_t max = __libdw_max_len_leb128 (*addrp - 1, end);
+ for (size_t i = 1; i < max; ++i)
+ get_uleb128_step (acc, *addrp, i);
+ /* Other implementations set VALUE to UINT_MAX in this
+ case. So we better do this as well. */
+ return UINT64_MAX;
+}
-#define get_sleb128_step(var, addr, nth, break) \
- __b = *(addr)++; \
- _v |= (uint64_t) (__b & 0x7f) << (nth * 7); \
- if (likely ((__b & 0x80) == 0)) \
- { \
- var = (_v << (64 - (nth * 7) - 7)) >> (64 - (nth * 7) - 7); \
- break; \
- } \
- else do {} while (0)
+/* Note, addr needs to me smaller than end. */
+#define get_uleb128(var, addr, end) ((var) = __libdw_get_uleb128 (&(addr), end))
-#define get_sleb128(var, addr) \
- do { \
- unsigned char __b; \
- int64_t _v = 0; \
- get_sleb128_step (var, addr, 0, break); \
- var = __libdw_get_sleb128 (_v, 1, &(addr)); \
- } while (0)
+/* The signed case is similar, but we sign-extend the result. */
-#define get_sleb128_rest_return(var, i, addrp) \
+#define get_sleb128_step(var, addr, nth) \
do { \
- for (; i < 9; ++i) \
+ unsigned char __b = *(addr)++; \
+ if (likely ((__b & 0x80) == 0)) \
{ \
- get_sleb128_step (var, *addrp, i, return var); \
+ struct { signed int i:7; } __s = { .i = __b }; \
+ (var) |= (typeof (var)) __s.i * ((typeof (var)) 1 << ((nth) * 7)); \
+ return (var); \
} \
- __b = *(*addrp)++; \
- if (likely ((__b & 0x80) == 0)) \
- return var | ((uint64_t) __b << 63); \
- else \
- /* Other implementations set VALUE to INT_MAX in this \
- case. So we better do this as well. */ \
- return INT64_MAX; \
+ (var) |= (typeof (var)) (__b & 0x7f) << ((nth) * 7); \
} while (0)
-#ifdef IS_LIBDW
-extern uint64_t __libdw_get_uleb128 (uint64_t acc, unsigned int i,
- const unsigned char **addrp)
- internal_function attribute_hidden;
-extern int64_t __libdw_get_sleb128 (int64_t acc, unsigned int i,
- const unsigned char **addrp)
- internal_function attribute_hidden;
-#else
-static inline uint64_t
-__attribute__ ((unused))
-__libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp)
-{
- unsigned char __b;
- get_uleb128_rest_return (acc, i, addrp);
-}
static inline int64_t
-__attribute__ ((unused))
-__libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp)
+__libdw_get_sleb128 (const unsigned char **addrp, const unsigned char *end)
{
- unsigned char __b;
- int64_t _v = acc;
- get_sleb128_rest_return (acc, i, addrp);
+ int64_t acc = 0;
+
+ /* Unroll the first step to help the compiler optimize
+ for the common single-byte case. */
+ get_sleb128_step (acc, *addrp, 0);
+
+ const size_t max = __libdw_max_len_leb128 (*addrp - 1, end);
+ for (size_t i = 1; i < max; ++i)
+ get_sleb128_step (acc, *addrp, i);
+ /* Other implementations set VALUE to INT_MAX in this
+ case. So we better do this as well. */
+ return INT64_MAX;
}
-#endif
+
+#define get_sleb128(var, addr, end) ((var) = __libdw_get_sleb128 (&(addr), end))
/* We use simple memory access functions in case the hardware allows it.
@@ -168,6 +133,8 @@ __libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp)
? (int32_t) bswap_32 (*((const int32_t *) (Addr))) \
: *((const int32_t *) (Addr)))
+# define read_8ubyte_unaligned_noncvt(Addr) \
+ *((const uint64_t *) (Addr))
# define read_8ubyte_unaligned(Dbg, Addr) \
(unlikely ((Dbg)->other_byte_order) \
? bswap_64 (*((const uint64_t *) (Addr))) \
@@ -244,6 +211,12 @@ read_4sbyte_unaligned_1 (bool other_byte_order, const void *p)
}
static inline uint64_t
+read_8ubyte_unaligned_noncvt (const void *p)
+{
+ const union unaligned *up = p;
+ return up->u8;
+}
+static inline uint64_t
read_8ubyte_unaligned_1 (bool other_byte_order, const void *p)
{
const union unaligned *up = p;
@@ -263,17 +236,6 @@ read_8sbyte_unaligned_1 (bool other_byte_order, const void *p)
#endif /* allow unaligned */
-#define read_ubyte_unaligned(Nbytes, Dbg, Addr) \
- ((Nbytes) == 2 ? read_2ubyte_unaligned (Dbg, Addr) \
- : (Nbytes) == 4 ? read_4ubyte_unaligned (Dbg, Addr) \
- : read_8ubyte_unaligned (Dbg, Addr))
-
-#define read_sbyte_unaligned(Nbytes, Dbg, Addr) \
- ((Nbytes) == 2 ? read_2sbyte_unaligned (Dbg, Addr) \
- : (Nbytes) == 4 ? read_4sbyte_unaligned (Dbg, Addr) \
- : read_8sbyte_unaligned (Dbg, Addr))
-
-
#define read_2ubyte_unaligned_inc(Dbg, Addr) \
({ uint16_t t_ = read_2ubyte_unaligned (Dbg, Addr); \
Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 2); \
@@ -302,14 +264,9 @@ read_8sbyte_unaligned_1 (bool other_byte_order, const void *p)
t_; })
-#define read_ubyte_unaligned_inc(Nbytes, Dbg, Addr) \
- ((Nbytes) == 2 ? read_2ubyte_unaligned_inc (Dbg, Addr) \
- : (Nbytes) == 4 ? read_4ubyte_unaligned_inc (Dbg, Addr) \
- : read_8ubyte_unaligned_inc (Dbg, Addr))
-
-#define read_sbyte_unaligned_inc(Nbytes, Dbg, Addr) \
- ((Nbytes) == 2 ? read_2sbyte_unaligned_inc (Dbg, Addr) \
- : (Nbytes) == 4 ? read_4sbyte_unaligned_inc (Dbg, Addr) \
- : read_8sbyte_unaligned_inc (Dbg, Addr))
+#define read_addr_unaligned_inc(Nbytes, Dbg, Addr) \
+ (assert ((Nbytes) == 4 || (Nbytes) == 8), \
+ ((Nbytes) == 4 ? read_4ubyte_unaligned_inc (Dbg, Addr) \
+ : read_8ubyte_unaligned_inc (Dbg, Addr)))
#endif /* memory-access.h */