aboutsummaryrefslogtreecommitdiff
path: root/contrib/elftoolchain/libdwarf
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/elftoolchain/libdwarf')
-rw-r--r--contrib/elftoolchain/libdwarf/Makefile15
-rw-r--r--contrib/elftoolchain/libdwarf/Version.map13
-rw-r--r--contrib/elftoolchain/libdwarf/_libdwarf.h54
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf.360
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf.h59
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_add_line_entry.35
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_attr.33
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_attr.c39
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_attroffset.386
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_attrval.c3
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_attrval_signed.32
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_child.396
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_cu.c92
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_def_macro.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_die.c158
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_dieoffset.350
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_dump.c94
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_errmsg.c2
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_formblock.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_formflag.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_formref.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_formsig8.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_formudata.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_frame.c6
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_get_AT_name.33
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_get_arange_info.33
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_get_die_infotypes_flag.373
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.35
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_get_ranges.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3116
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_hasattr.35
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_highpc.339
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_lineno.c6
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_loclist.c223
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_loclist_from_expr.336
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3209
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_next_types_section.3134
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_producer_init.34
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_ranges.c4
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_reloc.c6
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_sections.c111
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_set_reloc_application.36
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_whatattr.35
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf.c4
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf.h44
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_abbrev.c6
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_arange.c8
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_attr.c5
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_die.c8
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_elf_init.c69
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_frame.c81
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_info.c130
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_init.c19
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_lineno.c20
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_loc.c108
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_loclist.c130
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_nametbl.c4
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_reloc.c10
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_sections.c25
61 files changed, 582 insertions, 1950 deletions
diff --git a/contrib/elftoolchain/libdwarf/Makefile b/contrib/elftoolchain/libdwarf/Makefile
index d0a5443e6fb9..81b5657a2f72 100644
--- a/contrib/elftoolchain/libdwarf/Makefile
+++ b/contrib/elftoolchain/libdwarf/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile 3097 2014-09-02 22:10:18Z kaiwang27 $
+# $Id: Makefile 2937 2013-04-27 04:48:23Z jkoshy $
TOP= ${.CURDIR}/..
@@ -42,7 +42,6 @@ SRCS= \
dwarf_pubtypes.c \
dwarf_ranges.c \
dwarf_reloc.c \
- dwarf_sections.c \
dwarf_seterror.c \
dwarf_str.c \
dwarf_types.c \
@@ -116,7 +115,6 @@ MAN= dwarf.3 \
dwarf_add_weakname.3 \
dwarf_attr.3 \
dwarf_attrlist.3 \
- dwarf_attroffset.3 \
dwarf_attrval_signed.3 \
dwarf_child.3 \
dwarf_dealloc.3 \
@@ -156,7 +154,6 @@ MAN= dwarf.3 \
dwarf_get_cie_info.3 \
dwarf_get_cie_of_fde.3 \
dwarf_get_cu_die_offset.3 \
- dwarf_get_die_infotypes_flag.3 \
dwarf_get_elf.3 \
dwarf_get_fde_at_pc.3 \
dwarf_get_fde_info_for_all_regs.3 \
@@ -178,7 +175,6 @@ MAN= dwarf.3 \
dwarf_get_relocation_info.3 \
dwarf_get_relocation_info_count.3 \
dwarf_get_section_bytes.3 \
- dwarf_get_section_max_offsets.3 \
dwarf_get_str.3 \
dwarf_get_types.3 \
dwarf_get_vars.3 \
@@ -196,7 +192,6 @@ MAN= dwarf.3 \
dwarf_new_expr.3 \
dwarf_new_fde.3 \
dwarf_next_cu_header.3 \
- dwarf_next_types_section.3 \
dwarf_object_init.3 \
dwarf_producer_init.3 \
dwarf_producer_set_isa.3 \
@@ -225,9 +220,7 @@ MLINKS+= \
dwarf_attrval_signed.3 dwarf_attrval_string.3 \
dwarf_attrval_signed.3 dwarf_attrval_unsigned.3 \
dwarf_child.3 dwarf_offdie.3 \
- dwarf_child.3 dwarf_offdie_b.3 \
dwarf_child.3 dwarf_siblingof.3 \
- dwarf_child.3 dwarf_siblingof_b.3 \
dwarf_dealloc.3 dwarf_fde_cie_list_dealloc.3 \
dwarf_dealloc.3 dwarf_funcs_dealloc.3 \
dwarf_dealloc.3 dwarf_globals_dealloc.3 \
@@ -241,7 +234,6 @@ MLINKS+= \
dwarf_dieoffset.3 dwarf_die_CU_offset.3 \
dwarf_dieoffset.3 dwarf_die_CU_offset_range.3 \
dwarf_dieoffset.3 dwarf_get_cu_die_offset_given_cu_header_offset.3 \
- dwarf_dieoffset.3 dwarf_get_cu_die_offset_given_cu_header_offset_b.3 \
dwarf_finish.3 dwarf_object_finish.3 \
dwarf_formref.3 dwarf_global_formref.3 \
dwarf_formudata.3 dwarf_formsdata.3 \
@@ -281,7 +273,6 @@ MLINKS+= \
dwarf_get_pubtypes.3 dwarf_pubtype_name_offsets.3 \
dwarf_get_pubtypes.3 dwarf_pubtypename.3 \
dwarf_get_ranges.3 dwarf_get_ranges_a.3 \
- dwarf_get_section_max_offsets.3 dwarf_get_section_max_offsets_b.3 \
dwarf_get_types.3 dwarf_type_die_offset.3 \
dwarf_get_types.3 dwarf_type_cu_offset.3 \
dwarf_get_types.3 dwarf_type_name_offsets.3 \
@@ -300,7 +291,6 @@ MLINKS+= \
dwarf_highpc.3 dwarf_bitoffset.3 \
dwarf_highpc.3 dwarf_bitsize.3 \
dwarf_highpc.3 dwarf_bytesize.3 \
- dwarf_highpc.3 dwarf_highpc_b.3 \
dwarf_highpc.3 dwarf_lowpc.3 \
dwarf_highpc.3 dwarf_srclang.3 \
dwarf_lineno.3 dwarf_lineaddr.3 \
@@ -312,9 +302,6 @@ MLINKS+= \
dwarf_lineno.3 dwarf_line_srcfileno.3 \
dwarf_loclist.3 dwarf_loclist_n.3 \
dwarf_loclist_from_expr.3 dwarf_loclist_from_expr_a.3 \
- dwarf_loclist_from_expr.3 dwarf_loclist_from_expr_b.3 \
- dwarf_next_cu_header.3 dwarf_next_cu_header_b.3 \
- dwarf_next_cu_header.3 dwarf_next_cu_header_c.3 \
dwarf_producer_init.3 dwarf_producer_init_b.3 \
dwarf_seterrarg.3 dwarf_seterrhand.3 \
dwarf_set_frame_cfa_value.3 dwarf_set_frame_rule_initial_value.3 \
diff --git a/contrib/elftoolchain/libdwarf/Version.map b/contrib/elftoolchain/libdwarf/Version.map
index 669f70e44dac..6e6548bd9732 100644
--- a/contrib/elftoolchain/libdwarf/Version.map
+++ b/contrib/elftoolchain/libdwarf/Version.map
@@ -1,4 +1,4 @@
-/* $Id: Version.map 3085 2014-09-02 22:08:23Z kaiwang27 $ */
+/* $Id: Version.map 2576 2012-09-13 09:16:11Z jkoshy $ */
R1.0 {
global:
@@ -39,7 +39,6 @@ global:
dwarf_arrayorder;
dwarf_attr;
dwarf_attrlist;
- dwarf_attroffset;
dwarf_attrval_flag;
dwarf_attrval_signed;
dwarf_attrval_string;
@@ -117,8 +116,6 @@ global:
dwarf_get_cie_of_fde;
dwarf_get_cu_die_offset;
dwarf_get_cu_die_offset_given_cu_header_offset;
- dwarf_get_cu_die_offset_given_cu_header_offset_b;
- dwarf_get_die_infotypes_flag;
dwarf_get_elf;
dwarf_get_fde_at_pc;
dwarf_get_fde_info_for_all_regs3;
@@ -142,8 +139,6 @@ global:
dwarf_get_relocation_info;
dwarf_get_relocation_info_count;
dwarf_get_section_bytes;
- dwarf_get_section_max_offsets;
- dwarf_get_section_max_offsets_b;
dwarf_get_str;
dwarf_get_types;
dwarf_get_vars;
@@ -157,7 +152,6 @@ global:
dwarf_hasattr;
dwarf_hasform;
dwarf_highpc;
- dwarf_highpc_b;
dwarf_init;
dwarf_line_srcfileno;
dwarf_lineaddr;
@@ -172,7 +166,6 @@ global:
dwarf_loclist;
dwarf_loclist_from_expr;
dwarf_loclist_from_expr_a;
- dwarf_loclist_from_expr_b;
dwarf_loclist_n;
dwarf_lowpc;
dwarf_new_die;
@@ -180,12 +173,9 @@ global:
dwarf_new_fde;
dwarf_next_cu_header;
dwarf_next_cu_header_b;
- dwarf_next_cu_header_c;
- dwarf_next_types_section;
dwarf_object_finish;
dwarf_object_init;
dwarf_offdie;
- dwarf_offdie_b;
dwarf_producer_finish;
dwarf_producer_init;
dwarf_producer_init_b;
@@ -206,7 +196,6 @@ global:
dwarf_seterrarg;
dwarf_seterrhand;
dwarf_siblingof;
- dwarf_siblingof_b;
dwarf_srcfiles;
dwarf_srclang;
dwarf_srclines;
diff --git a/contrib/elftoolchain/libdwarf/_libdwarf.h b/contrib/elftoolchain/libdwarf/_libdwarf.h
index e6eb496feed1..23f60e8ee267 100644
--- a/contrib/elftoolchain/libdwarf/_libdwarf.h
+++ b/contrib/elftoolchain/libdwarf/_libdwarf.h
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
- * Copyright (c) 2009-2014 Kai Wang
+ * Copyright (c) 2009-2011 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _libdwarf.h 3164 2015-02-19 01:20:12Z kaiwang27 $
+ * $Id: _libdwarf.h 2075 2011-10-27 03:47:28Z jkoshy $
*/
#ifndef __LIBDWARF_H_
@@ -49,7 +49,7 @@
struct _libdwarf_globals {
Dwarf_Handler errhand;
Dwarf_Ptr errarg;
- int applyreloc;
+ int applyrela;
};
extern struct _libdwarf_globals _libdwarf;
@@ -89,7 +89,6 @@ extern struct _libdwarf_globals _libdwarf;
goto gen_fail; \
} while(0)
-typedef struct _Dwarf_CU *Dwarf_CU;
struct _Dwarf_AttrDef {
uint64_t ad_attrib; /* DW_AT_XXX */
@@ -148,6 +147,14 @@ struct _Dwarf_Die {
STAILQ_ENTRY(_Dwarf_Die) die_pro_next; /* Next die in pro-die list. */
};
+struct _Dwarf_Loclist {
+ Dwarf_Locdesc **ll_ldlist; /* Array of Locdesc pointer. */
+ int ll_ldlen; /* Number of Locdesc. */
+ Dwarf_Unsigned ll_offset; /* Offset in .debug_loc section. */
+ Dwarf_Unsigned ll_length; /* Length (in bytes) of the loclist. */
+ TAILQ_ENTRY(_Dwarf_Loclist) ll_next; /* Next loclist in list. */
+};
+
struct _Dwarf_P_Expr_Entry {
Dwarf_Loc ee_loc; /* Location expression. */
Dwarf_Unsigned ee_sym; /* Optional related reloc sym index. */
@@ -190,7 +197,6 @@ struct _Dwarf_LineInfo {
Dwarf_Half li_version; /* Version of line info. */
Dwarf_Unsigned li_hdrlen; /* Length of line info header. */
Dwarf_Small li_minlen; /* Minimum instrutction length. */
- Dwarf_Small li_maxop; /* Maximum operations per inst. */
Dwarf_Small li_defstmt; /* Default value of is_stmt. */
int8_t li_lbase; /* Line base for special opcode. */
Dwarf_Small li_lrange; /* Line range for special opcode. */
@@ -259,8 +265,6 @@ struct _Dwarf_Cie {
Dwarf_Half cie_version; /* CIE version. */
uint8_t *cie_augment; /* CIE augmentation (UTF-8). */
Dwarf_Unsigned cie_ehdata; /* Optional EH Data. */
- uint8_t cie_addrsize; /* Address size. (DWARF4) */
- uint8_t cie_segmentsize; /* Segment size. (DWARF4) */
Dwarf_Unsigned cie_caf; /* Code alignment factor. */
Dwarf_Signed cie_daf; /* Data alignment factor. */
Dwarf_Unsigned cie_ra; /* Return address register. */
@@ -329,14 +333,11 @@ struct _Dwarf_CU {
uint64_t cu_lineno_offset; /* Offset into .debug_lineno. */
uint8_t cu_pointer_size;/* Number of bytes in pointer. */
uint8_t cu_dwarf_size; /* CU section dwarf size. */
- Dwarf_Sig8 cu_type_sig; /* Type unit's signature. */
- uint64_t cu_type_offset; /* Type unit's type offset. */
Dwarf_Off cu_next_offset; /* Offset to the next CU. */
uint64_t cu_1st_offset; /* First DIE offset. */
int cu_pass2; /* Two pass DIE traverse. */
Dwarf_LineInfo cu_lineinfo; /* Ptr to Dwarf_LineInfo. */
Dwarf_Abbrev cu_abbrev_hash; /* Abbrev hash table. */
- Dwarf_Bool cu_is_info; /* Compilation/type unit flag. */
STAILQ_ENTRY(_Dwarf_CU) cu_next; /* Next compilation unit. */
};
@@ -398,21 +399,17 @@ struct _Dwarf_Debug {
Dwarf_Section *dbg_section; /* Dwarf section list. */
Dwarf_Section *dbg_info_sec; /* Pointer to info section. */
Dwarf_Off dbg_info_off; /* Current info section offset. */
- Dwarf_Section *dbg_types_sec; /* Pointer to type section. */
- Dwarf_Off dbg_types_off; /* Current types section offset. */
Dwarf_Unsigned dbg_seccnt; /* Total number of dwarf sections. */
int dbg_mode; /* Access mode. */
int dbg_pointer_size; /* Object address size. */
int dbg_offset_size; /* DWARF offset size. */
int dbg_info_loaded; /* Flag indicating all CU loaded. */
- int dbg_types_loaded; /* Flag indicating all TU loaded. */
Dwarf_Half dbg_machine; /* ELF machine architecture. */
Dwarf_Handler dbg_errhand; /* Error handler. */
Dwarf_Ptr dbg_errarg; /* Argument to the error handler. */
STAILQ_HEAD(, _Dwarf_CU) dbg_cu;/* List of compilation units. */
- STAILQ_HEAD(, _Dwarf_CU) dbg_tu;/* List of type units. */
Dwarf_CU dbg_cu_current; /* Ptr to the current CU. */
- Dwarf_CU dbg_tu_current; /* Ptr to the current TU. */
+ TAILQ_HEAD(, _Dwarf_Loclist) dbg_loclist; /* List of location list. */
Dwarf_NameSec dbg_globals; /* Ptr to pubnames lookup section. */
Dwarf_NameSec dbg_pubtypes; /* Ptr to pubtypes lookup section. */
Dwarf_NameSec dbg_weaks; /* Ptr to weaknames lookup section. */
@@ -535,15 +532,13 @@ int _dwarf_elf_get_section_info(void *, Dwarf_Half,
Dwarf_Obj_Access_Section *, int *);
void _dwarf_expr_cleanup(Dwarf_P_Debug);
int _dwarf_expr_into_block(Dwarf_P_Expr, Dwarf_Error *);
-Dwarf_Section *_dwarf_find_next_types_section(Dwarf_Debug, Dwarf_Section *);
Dwarf_Section *_dwarf_find_section(Dwarf_Debug, const char *);
void _dwarf_frame_cleanup(Dwarf_Debug);
int _dwarf_frame_fde_add_inst(Dwarf_P_Fde, Dwarf_Small,
Dwarf_Unsigned, Dwarf_Unsigned, Dwarf_Error *);
int _dwarf_frame_gen(Dwarf_P_Debug, Dwarf_Error *);
-int _dwarf_frame_get_fop(Dwarf_Debug, uint8_t, uint8_t *,
- Dwarf_Unsigned, Dwarf_Frame_Op **, Dwarf_Signed *,
- Dwarf_Error *);
+int _dwarf_frame_get_fop(Dwarf_Debug, uint8_t *, Dwarf_Unsigned,
+ Dwarf_Frame_Op **, Dwarf_Signed *, Dwarf_Error *);
int _dwarf_frame_get_internal_table(Dwarf_Fde, Dwarf_Addr,
Dwarf_Regtable3 **, Dwarf_Addr *, Dwarf_Error *);
int _dwarf_frame_interal_table_init(Dwarf_Debug, Dwarf_Error *);
@@ -558,12 +553,9 @@ Dwarf_Unsigned _dwarf_get_reloc_type(Dwarf_P_Debug, int);
int _dwarf_get_reloc_size(Dwarf_Debug, Dwarf_Unsigned);
void _dwarf_info_cleanup(Dwarf_Debug);
int _dwarf_info_first_cu(Dwarf_Debug, Dwarf_Error *);
-int _dwarf_info_first_tu(Dwarf_Debug, Dwarf_Error *);
int _dwarf_info_gen(Dwarf_P_Debug, Dwarf_Error *);
-int _dwarf_info_load(Dwarf_Debug, Dwarf_Bool, Dwarf_Bool,
- Dwarf_Error *);
+int _dwarf_info_load(Dwarf_Debug, int, Dwarf_Error *);
int _dwarf_info_next_cu(Dwarf_Debug, Dwarf_Error *);
-int _dwarf_info_next_tu(Dwarf_Debug, Dwarf_Error *);
void _dwarf_info_pro_cleanup(Dwarf_P_Debug);
int _dwarf_init(Dwarf_Debug, Dwarf_Unsigned, Dwarf_Handler,
Dwarf_Ptr, Dwarf_Error *);
@@ -571,19 +563,20 @@ int _dwarf_lineno_gen(Dwarf_P_Debug, Dwarf_Error *);
int _dwarf_lineno_init(Dwarf_Die, uint64_t, Dwarf_Error *);
void _dwarf_lineno_cleanup(Dwarf_LineInfo);
void _dwarf_lineno_pro_cleanup(Dwarf_P_Debug);
-int _dwarf_loc_fill_locdesc(Dwarf_Debug, Dwarf_Locdesc *,
- uint8_t *, uint64_t, uint8_t, uint8_t, uint8_t,
- Dwarf_Error *);
+int _dwarf_loc_fill_locdesc(Dwarf_Debug, Dwarf_Locdesc *, uint8_t *,
+ uint64_t, uint8_t, Dwarf_Error *);
int _dwarf_loc_fill_locexpr(Dwarf_Debug, Dwarf_Locdesc **,
- uint8_t *, uint64_t, uint8_t, uint8_t, uint8_t,
- Dwarf_Error *);
+ uint8_t *, uint64_t, uint8_t, Dwarf_Error *);
int _dwarf_loc_add(Dwarf_Die, Dwarf_Attribute, Dwarf_Error *);
int _dwarf_loc_expr_add_atom(Dwarf_Debug, uint8_t *, uint8_t *,
Dwarf_Small, Dwarf_Unsigned, Dwarf_Unsigned, int *,
Dwarf_Error *);
int _dwarf_loclist_find(Dwarf_Debug, Dwarf_CU, uint64_t,
- Dwarf_Locdesc ***, Dwarf_Signed *, Dwarf_Unsigned *,
- Dwarf_Error *);
+ Dwarf_Loclist *, Dwarf_Error *);
+void _dwarf_loclist_cleanup(Dwarf_Debug);
+void _dwarf_loclist_free(Dwarf_Loclist);
+int _dwarf_loclist_add(Dwarf_Debug, Dwarf_CU, uint64_t,
+ Dwarf_Loclist *, Dwarf_Error *);
void _dwarf_macinfo_cleanup(Dwarf_Debug);
int _dwarf_macinfo_gen(Dwarf_P_Debug, Dwarf_Error *);
int _dwarf_macinfo_init(Dwarf_Debug, Dwarf_Error *);
@@ -640,7 +633,6 @@ void _dwarf_strtab_cleanup(Dwarf_Debug);
int _dwarf_strtab_gen(Dwarf_P_Debug, Dwarf_Error *);
char *_dwarf_strtab_get_table(Dwarf_Debug);
int _dwarf_strtab_init(Dwarf_Debug, Dwarf_Error *);
-void _dwarf_type_unit_cleanup(Dwarf_Debug);
void _dwarf_write_block(void *, uint64_t *, uint8_t *, uint64_t);
int _dwarf_write_block_alloc(uint8_t **, uint64_t *, uint64_t *,
uint8_t *, uint64_t, Dwarf_Error *);
diff --git a/contrib/elftoolchain/libdwarf/dwarf.3 b/contrib/elftoolchain/libdwarf/dwarf.3
index dbb417908094..b32299cd1a11 100644
--- a/contrib/elftoolchain/libdwarf/dwarf.3
+++ b/contrib/elftoolchain/libdwarf/dwarf.3
@@ -21,9 +21,9 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: dwarf.3 3195 2015-05-12 17:22:19Z emaste $
+.\" $Id: dwarf.3 2075 2011-10-27 03:47:28Z jkoshy $
.\"
-.Dd December 21, 2014
+.Dd September 17, 2011
.Os
.Dt DWARF 3
.Sh NAME
@@ -44,7 +44,7 @@ is defined by the DWARF standard, see
.Xr dwarf 4 .
.Pp
The
-.Xr DWARF 3
+.Xr DWARF 3
API has two parts:
.Bl -bullet
.It
@@ -217,8 +217,6 @@ attribute.
Retrieve an attribute descriptor.
.It Fn dwarf_attrlist
Retrieve attribute descriptors for a debugging information entry.
-.It Fn dwarf_attroffset
-Retrieve the section-relative offset of an attribute descriptor.
.It Fn dwarf_attrval_flag
Retrieve a
.Dv DW_AT_FORM_flag
@@ -311,17 +309,10 @@ Retrieve range information from an FDE descriptor.
.El
.It Compilation Units
.Bl -tag -compact
-.It Xo
-.Fn dwarf_get_cu_die_offset_given_cu_header_offset ,
-.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b
-.Xc
+.It Fn dwarf_get_cu_die_offset_given_cu_header_offset
Retrieve the offset of the debugging information entry for a
-compilation or type unit.
-.It Xo
-.Fn dwarf_next_cu_header ,
-.Fn dwarf_next_cu_header_b ,
-.Fn dwarf_next_cu_header_c
-.Xc
+compilation unit.
+.It Fn dwarf_next_cu_header , Fn dwarf_next_cu_header_b
Step through compilation units in a debug context.
.El
.It Debugging Information Entries
@@ -338,18 +329,16 @@ Returns the
attribute for a debugging information entry.
.It Fn dwarf_dieoffset
Retrieves the offset for a debugging information entry.
-.It Fn dwarf_get_die_infotypes_flag
-Indicate the originating section for a debugging information entry.
-.It Fn dwarf_highpc , Fn dwarf_highpc_b
+.It Fn dwarf_highpc
Return the highest PC value for a debugging information entry.
.It Fn dwarf_lowpc
Return the lowest PC value for a debugging information entry.
-.It Fn dwarf_offdie , Fn dwarf_offdie_b
+.It Fn dwarf_offdie
Retrieve a debugging information entry given an offset.
-.It Fn dwarf_siblingof , Fn dwarf_siblingof_b
+.It Fn dwarf_siblingof
Retrieve the sibling descriptor for a debugging information entry.
.It Fn dwarf_srclang
-Retrieve the source language attribute for a debugging information
+Retrive the source language attribute for a debugging information
entry.
.It Fn dwarf_tag
Retrieve the tag for a debugging information entry.
@@ -427,11 +416,7 @@ Return line number information for a compilation unit.
Retrieve a location list entry.
.It Fn dwarf_loclist , Fn dwarf_loclist_n
Retrieve location expressions.
-.It Xo
-.Fn dwarf_loclist_from_expr ,
-.Fn dwarf_loclist_from_expr_a ,
-.Fn dwarf_loclist_from_expr_b
-.Xc
+.It Fn dwarf_loclist_from_expr , Fn dwarf_loclist_from_expr_a
Translate a location expression into a location descriptor.
.El
.It Error Handling
@@ -528,10 +513,6 @@ and
.Bl -tag -compact
.It Fn dwarf_get_pubtypes , Fn dwarf_get_types
Retrieve descriptors for user-defined types.
-.It Fn dwarf_next_types_section
-Step through
-.Dq \&.debug_types
-sections in a debug context.
.It Fn dwarf_pubtype_cu_offset , Fn dwarf_type_cu_offset
Return the offset for the compilation unit for a type.
.It Fn dwarf_pubtype_die_offset , Fn dwarf_type_die_offset
@@ -718,16 +699,9 @@ addition to the per-debug context handlers supported by the SGI/GNU
API, see the subsection
.Sx Error Handling
above.
-.El
-.Ss Extensions
-The following APIs are extensions specific to this implementation:
-.Bl -bullet -compact
-.It
-.Fn dwarf_attroffset
.It
-.Fn dwarf_next_types_section
-.It
-.Fn dwarf_producer_set_isa
+The following API is an extension:
+.Fn dwarf_producer_set_isa .
.El
.Sh SEE ALSO
.Xr elf 3
@@ -742,12 +716,12 @@ The DWARF standard is defined by
The DWARF(3) API originated at Silicon Graphics Inc.
.Pp
A BSD-licensed implementation of a subset of the API was written by
-.An John Birrell Aq Mt jb@FreeBSD.org
+.An "John Birrell" Aq jb@FreeBSD.org
for the FreeBSD project.
The implementation was subsequently revised and completed by
-.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .
+.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.Pp
Manual pages for this implementation were written by
-.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net
+.An "Joseph Koshy" Aq jkoshy@users.sourceforge.net
and
-.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .
+.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
diff --git a/contrib/elftoolchain/libdwarf/dwarf.h b/contrib/elftoolchain/libdwarf/dwarf.h
index c79da96dbb47..b1a3e4ec9670 100644
--- a/contrib/elftoolchain/libdwarf/dwarf.h
+++ b/contrib/elftoolchain/libdwarf/dwarf.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: dwarf.h 3052 2014-05-26 20:36:24Z kaiwang27 $
+ * $Id: dwarf.h 2075 2011-10-27 03:47:28Z jkoshy $
*/
#ifndef _DWARF_H_
@@ -93,19 +93,6 @@
#define DW_TAG_lo_user 0x4080
#define DW_TAG_hi_user 0xffff
-/* GNU extensions. */
-#define DW_TAG_format_label 0x4101
-#define DW_TAG_function_template 0x4102
-#define DW_TAG_class_template 0x4103
-#define DW_TAG_GNU_BINCL 0x4104
-#define DW_TAG_GNU_EINCL 0x4105
-#define DW_TAG_GNU_template_template_parameter 0x4106
-#define DW_TAG_GNU_template_template_param 0x4106
-#define DW_TAG_GNU_template_parameter_pack 0x4107
-#define DW_TAG_GNU_formal_parameter_pack 0x4108
-#define DW_TAG_GNU_call_site 0x4109
-#define DW_TAG_GNU_call_site_parameter 0x410a
-
#define DW_CHILDREN_no 0x00
#define DW_CHILDREN_yes 0x01
@@ -208,32 +195,6 @@
#define DW_AT_lo_user 0x2000
#define DW_AT_hi_user 0x3fff
-/* GNU extensions. */
-#define DW_AT_sf_names 0x2101
-#define DW_AT_src_info 0x2102
-#define DW_AT_mac_info 0x2103
-#define DW_AT_src_coords 0x2104
-#define DW_AT_body_begin 0x2105
-#define DW_AT_body_end 0x2106
-#define DW_AT_GNU_vector 0x2107
-#define DW_AT_GNU_guarded_by 0x2108
-#define DW_AT_GNU_pt_guarded_by 0x2109
-#define DW_AT_GNU_guarded 0x210a
-#define DW_AT_GNU_pt_guarded 0x210b
-#define DW_AT_GNU_locks_excluded 0x210c
-#define DW_AT_GNU_exclusive_locks_required 0x210d
-#define DW_AT_GNU_shared_locks_required 0x210e
-#define DW_AT_GNU_odr_signature 0x210f
-#define DW_AT_GNU_template_name 0x2110
-#define DW_AT_GNU_call_site_value 0x2111
-#define DW_AT_GNU_call_site_data_value 0x2112
-#define DW_AT_GNU_call_site_target 0x2113
-#define DW_AT_GNU_call_site_target_clobbered 0x2114
-#define DW_AT_GNU_tail_call 0x2115
-#define DW_AT_GNU_all_tail_call_sites 0x2116
-#define DW_AT_GNU_all_call_sites 0x2117
-#define DW_AT_GNU_all_source_call_sites 0x2118
-
#define DW_FORM_addr 0x01
#define DW_FORM_block2 0x03
#define DW_FORM_block4 0x04
@@ -259,8 +220,6 @@
#define DW_FORM_exprloc 0x18
#define DW_FORM_flag_present 0x19
#define DW_FORM_ref_sig8 0x20
-#define DW_FORM_GNU_ref_alt 0x1f20
-#define DW_FORM_GNU_strp_alt 0x1f21
#define DW_OP_addr 0x03
#define DW_OP_deref 0x06
@@ -417,23 +376,9 @@
#define DW_OP_implicit_value 0x9e
#define DW_OP_stack_value 0x9f
#define DW_OP_lo_user 0xe0
+#define DW_OP_GNU_push_tls_address 0xe0
#define DW_OP_hi_user 0xff
-/* GNU extensions. */
-#define DW_OP_GNU_push_tls_address 0xe0
-#define DW_OP_GNU_uninit 0xf0
-#define DW_OP_GNU_encoded_addr 0xf1
-#define DW_OP_GNU_implicit_pointer 0xf2
-#define DW_OP_GNU_entry_value 0xf3
-#define DW_OP_GNU_const_type 0xf4
-#define DW_OP_GNU_regval_type 0xf5
-#define DW_OP_GNU_deref_type 0xf6
-#define DW_OP_GNU_convert 0xf7
-#define DW_OP_GNU_reinterpret 0xf9
-#define DW_OP_GNU_parameter_ref 0xfa
-#define DW_OP_GNU_addr_index 0xfb
-#define DW_OP_GNU_const_index 0xfc
-
#define DW_ATE_address 0x1
#define DW_ATE_boolean 0x2
#define DW_ATE_complex_float 0x3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3 b/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3
index 16e807512a44..22377176245a 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_add_line_entry.3 3182 2015-04-10 16:08:10Z emaste $
+.\" $Id: dwarf_add_line_entry.3 2953 2013-06-30 20:21:38Z kaiwang27 $
.\"
.Dd June 30, 2013
.Os
@@ -66,8 +66,7 @@ Valid source file indices are those returned by the function
.Pp
Argument
.Ar off
-specifies a relocatable program address.
-The ELF symbol to be used
+specifies a relocatable program address. The ELF symbol to be used
for relocation is set by a prior call to the function
.Xr dwarf_lne_set_address 3 .
.Pp
diff --git a/contrib/elftoolchain/libdwarf/dwarf_attr.3 b/contrib/elftoolchain/libdwarf/dwarf_attr.3
index 9ba367be5f69..b1e30017a89a 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_attr.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_attr.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_attr.3 3093 2014-09-02 22:09:40Z kaiwang27 $
+.\" $Id: dwarf_attr.3 2072 2011-10-27 03:26:49Z jkoshy $
.\"
.Dd April 8, 2010
.Os
@@ -113,7 +113,6 @@ in argument
.Sh SEE ALSO
.Xr dwarf 3 ,
.Xr dwarf_attrlist 3 ,
-.Xr dwarf_attroffset 3 ,
.Xr dwarf_hasattr 3 ,
.Xr dwarf_hasform 3 ,
.Xr dwarf_whatattr 3 ,
diff --git a/contrib/elftoolchain/libdwarf/dwarf_attr.c b/contrib/elftoolchain/libdwarf/dwarf_attr.c
index a081d7b93a8f..ce40294c6b12 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_attr.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_attr.c
@@ -27,7 +27,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_attr.c 3064 2014-06-06 19:35:55Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_attr.c 2072 2011-10-27 03:26:49Z jkoshy $");
int
dwarf_attr(Dwarf_Die die, Dwarf_Half attr, Dwarf_Attribute *atp,
@@ -114,23 +114,6 @@ dwarf_hasattr(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *ret_bool,
}
int
-dwarf_attroffset(Dwarf_Attribute at, Dwarf_Off *ret_off, Dwarf_Error *error)
-{
- Dwarf_Debug dbg;
-
- dbg = at != NULL ? at->at_die->die_dbg : NULL;
-
- if (at == NULL || ret_off == NULL) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
- return (DW_DLV_ERROR);
- }
-
- *ret_off = at->at_offset;
-
- return (DW_DLV_OK);
-}
-
-int
dwarf_lowpc(Dwarf_Die die, Dwarf_Addr *ret_lowpc, Dwarf_Error *error)
{
Dwarf_Attribute at;
@@ -156,17 +139,8 @@ dwarf_lowpc(Dwarf_Die die, Dwarf_Addr *ret_lowpc, Dwarf_Error *error)
int
dwarf_highpc(Dwarf_Die die, Dwarf_Addr *ret_highpc, Dwarf_Error *error)
{
-
- return (dwarf_highpc_b(die, ret_highpc, NULL, NULL, error));
-}
-
-int
-dwarf_highpc_b(Dwarf_Die die, Dwarf_Addr *ret_highpc, Dwarf_Half *ret_form,
- enum Dwarf_Form_Class *ret_class, Dwarf_Error *error)
-{
Dwarf_Attribute at;
Dwarf_Debug dbg;
- Dwarf_CU cu;
dbg = die != NULL ? die->die_dbg : NULL;
@@ -182,17 +156,6 @@ dwarf_highpc_b(Dwarf_Die die, Dwarf_Addr *ret_highpc, Dwarf_Half *ret_form,
*ret_highpc = at->u[0].u64;
- if (ret_form != NULL) {
- *ret_form = at->at_form;
- }
-
- if (ret_class != NULL) {
- cu = die->die_cu;
- *ret_class = dwarf_get_form_class(cu->cu_version,
- DW_AT_high_pc, cu->cu_length_size == 4 ? 4 : 8,
- at->at_form);
- }
-
return (DW_DLV_OK);
}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_attroffset.3 b/contrib/elftoolchain/libdwarf/dwarf_attroffset.3
deleted file mode 100644
index af24cebab8e9..000000000000
--- a/contrib/elftoolchain/libdwarf/dwarf_attroffset.3
+++ /dev/null
@@ -1,86 +0,0 @@
-.\" Copyright (c) 2014 Kai Wang
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Id: dwarf_attroffset.3 3115 2014-12-20 18:26:46Z jkoshy $
-.\"
-.Dd December 20, 2014
-.Os
-.Dt DWARF_ATTROFFSET 3
-.Sh NAME
-.Nm dwarf_attroffset
-.Nd retrieve the section-relative offset of an attribute descriptor
-.Sh LIBRARY
-.Lb libdwarf
-.Sh SYNOPSIS
-.In libdwarf.h
-.Ft int
-.Fo dwarf_attroffset
-.Fa "Dwarf_Attribute at"
-.Fa "Dwarf_Off *ret_off"
-.Fa "Dwarf_Error *err"
-.Fc
-.Sh DESCRIPTION
-Function
-.Fn dwarf_attroffset
-retrieves the section-relative offset of the attribute descriptor
-referenced by argument
-.Ar at .
-.Pp
-Argument
-.Ar ret_off
-should point to a location that is to hold the returned
-section-relative offset.
-If argument
-.Ar err
-is non-NULL, it is used to return an error descriptor in case of an
-error.
-.Sh RETURN VALUES
-On success, function
-.Fn dwarf_attroffset
-returns
-.Dv DW_DLV_OK .
-.Pp
-In case of an error, it returns
-.Dv DW_DLV_ERROR
-and sets argument
-.Ar err .
-.Sh COMPATIBILITY
-This function is an extension to the
-.Xr DWARF 3
-API.
-.Sh ERRORS
-The
-.Fn dwarf_attroffset
-function may fail with the following errors:
-.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
-.It Bq Er DW_DLE_ARGUMENT
-Either of the arguments
-.Ar at
-or
-.Ar ret_off
-was NULL.
-.El
-.Sh SEE ALSO
-.Xr dwarf 3 ,
-.Xr dwarf_attr 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_attrval.c b/contrib/elftoolchain/libdwarf/dwarf_attrval.c
index 0dd38a491d84..31d19f7b8b21 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_attrval.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_attrval.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_attrval.c 3159 2015-02-15 21:43:27Z emaste $");
+ELFTC_VCSID("$Id: dwarf_attrval.c 2072 2011-10-27 03:26:49Z jkoshy $");
int
dwarf_attrval_flag(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *valp, Dwarf_Error *err)
@@ -125,7 +125,6 @@ dwarf_attrval_signed(Dwarf_Die die, Dwarf_Half attr, Dwarf_Signed *valp, Dwarf_E
break;
case DW_FORM_data4:
*valp = (int32_t) at->u[0].s64;
- break;
case DW_FORM_data8:
case DW_FORM_sdata:
*valp = at->u[0].s64;
diff --git a/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 b/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3
index 93d4ae0596ed..3fd01d0c60f5 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_attrval_signed.3 2980 2014-01-21 20:15:54Z kaiwang27 $
+.\" $Id: dwarf_attrval_signed.3 2072 2011-10-27 03:26:49Z jkoshy $
.\"
.Dd January 18, 2014
.Os
diff --git a/contrib/elftoolchain/libdwarf/dwarf_child.3 b/contrib/elftoolchain/libdwarf/dwarf_child.3
index 1e32e58d4451..57549c01c66e 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_child.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_child.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010,2014 Kai Wang
+.\" Copyright (c) 2010 Kai Wang
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,17 +22,15 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_child.3 3127 2014-12-21 19:09:19Z jkoshy $
+.\" $Id: dwarf_child.3 2122 2011-11-09 15:35:14Z jkoshy $
.\"
-.Dd December 21, 2014
+.Dd November 9, 2011
.Os
.Dt DWARF_CHILD 3
.Sh NAME
.Nm dwarf_child ,
-.Nm dwarf_offdie ,
-.Nm dwarf_offdie_b ,
.Nm dwarf_siblingof ,
-.Nm dwarf_siblingof_b
+.Nm dwarf_offdie
.Nd retrieve DWARF Debugging Information Entry descriptors
.Sh LIBRARY
.Lb libdwarf
@@ -41,21 +39,6 @@
.Ft int
.Fn dwarf_child "Dwarf_Die die" "Dwarf_Die *ret_die" "Dwarf_Error *err"
.Ft int
-.Fo dwarf_offdie
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Off offset"
-.Fa "Dwarf_Die *ret_die"
-.Fa "Dwarf_Error *err"
-.Fc
-.Ft int
-.Fo dwarf_offdie_b
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Off offset"
-.Fa "Dwarf_Bool is_info"
-.Fa "Dwarf_Die *ret_die"
-.Fa "Dwarf_Error *err"
-.Fc
-.Ft int
.Fo dwarf_siblingof
.Fa "Dwarf_Debug dbg"
.Fa "Dwarf_Die die"
@@ -63,11 +46,10 @@
.Fa "Dwarf_Error *err"
.Fc
.Ft int
-.Fo dwarf_siblingof_b
+.Fo dwarf_offdie
.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Die die"
+.Fa "Dwarf_Off offset"
.Fa "Dwarf_Die *ret_die"
-.Fa "Dwarf_Bool is_info"
.Fa "Dwarf_Error *err"
.Fc
.Sh DESCRIPTION
@@ -110,34 +92,6 @@ may be used together to traverse the tree of debugging information
entry descriptors for a compilation unit.
.Pp
Function
-.Fn dwarf_siblingof_b
-is identical to the function
-.Fn dwarf_siblingof
-except that it can retrieve the sibling descriptor from either the
-current compilation unit or type unit.
-If argument
-.Ar is_info
-is non-zero, the function behaves identically to function
-.Fn dwarf_siblingof .
-If argument
-.Ar is_info
-is zero, the descriptor referred by argument
-.Ar die
-should be associated with a debugging information entry in the
-type unit.
-The function will store the sibling of the descriptor in the location
-pointed to by argument
-.Ar ret_die .
-If argument
-.Ar is_info
-is zero and argument
-.Ar die
-is
-.Dv NULL ,
-the first debugging information entry descriptor for the
-current type unit will be returned.
-.Pp
-Function
.Fn dwarf_offdie
retrieves the debugging information entry descriptor at global offset
.Ar offset
@@ -147,31 +101,6 @@ section of the object associated with argument
.Ar dbg .
The returned descriptor is written to the location pointed to by argument
.Ar ret_die .
-.Pp
-Function
-.Fn dwarf_offdie_b
-is identical to the function
-.Fn dwarf_offdie
-except that it can retrieve the debugging information entry descriptor at
-global offset
-.Ar offset
-from either of the
-.Dq .debug_info
-and
-.Dq .debug_types
-sections of the object associated with argument
-.Ar dbg .
-If argument
-.Ar is_info
-is non-zero, the function will retrieve the debugging information
-entry from the
-.Dq .debug_info
-section, otherwise the function will retrieve the debugging
-information entry from the
-.Dq .debug_types
-section.
-The returned descriptor is written to the location pointed to by argument
-.Ar ret_die .
.Ss Memory Management
The memory area used for the
.Vt Dwarf_Die
@@ -199,18 +128,14 @@ argument
if it is not NULL.
.It Bq Er DW_DLV_NO_ENTRY
For functions
-.Fn dwarf_child ,
-.Fn dwarf_siblingof
+.Fn dwarf_child
and
-.Fn dwarf_siblingof_b ,
+.Fn dwarf_siblingof ,
the descriptor denoted by argument
.Ar die
did not have a child or sibling.
-.Pp
-For functions
-.Fn dwarf_offdie
-and
-.Fn dwarf_offdie_b ,
+For function
+.Fn dwarf_offdie ,
there was no debugging information entry at the offset specified by
argument
.Ar offset .
@@ -274,5 +199,4 @@ do {
.Sh SEE ALSO
.Xr dwarf 3 ,
.Xr dwarf_errmsg 3 ,
-.Xr dwarf_get_die_infotypes_flag.3 ,
.Xr dwarf_next_cu_header 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_cu.c b/contrib/elftoolchain/libdwarf/dwarf_cu.c
index d103488d1098..c203dc2f1fc7 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_cu.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_cu.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
- * Copyright (c) 2014 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,15 +26,14 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_cu.c 3041 2014-05-18 15:11:03Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_cu.c 2072 2011-10-27 03:26:49Z jkoshy $");
int
-dwarf_next_cu_header_c(Dwarf_Debug dbg, Dwarf_Bool is_info,
- Dwarf_Unsigned *cu_length, Dwarf_Half *cu_version,
- Dwarf_Off *cu_abbrev_offset, Dwarf_Half *cu_pointer_size,
- Dwarf_Half *cu_offset_size, Dwarf_Half *cu_extension_size,
- Dwarf_Sig8 *type_signature, Dwarf_Unsigned *type_offset,
- Dwarf_Unsigned *cu_next_offset, Dwarf_Error *error)
+dwarf_next_cu_header_b(Dwarf_Debug dbg, Dwarf_Unsigned *cu_length,
+ Dwarf_Half *cu_version, Dwarf_Off *cu_abbrev_offset,
+ Dwarf_Half *cu_pointer_size, Dwarf_Half *cu_offset_size,
+ Dwarf_Half *cu_extension_size, Dwarf_Unsigned *cu_next_offset,
+ Dwarf_Error *error)
{
Dwarf_CU cu;
int ret;
@@ -45,17 +43,10 @@ dwarf_next_cu_header_c(Dwarf_Debug dbg, Dwarf_Bool is_info,
return (DW_DLV_ERROR);
}
- if (is_info) {
- if (dbg->dbg_cu_current == NULL)
- ret = _dwarf_info_first_cu(dbg, error);
- else
- ret = _dwarf_info_next_cu(dbg, error);
- } else {
- if (dbg->dbg_tu_current == NULL)
- ret = _dwarf_info_first_tu(dbg, error);
- else
- ret = _dwarf_info_next_tu(dbg, error);
- }
+ if (dbg->dbg_cu_current == NULL)
+ ret = _dwarf_info_first_cu(dbg, error);
+ else
+ ret = _dwarf_info_next_cu(dbg, error);
if (ret == DW_DLE_NO_ENTRY) {
DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
@@ -63,19 +54,11 @@ dwarf_next_cu_header_c(Dwarf_Debug dbg, Dwarf_Bool is_info,
} else if (ret != DW_DLE_NONE)
return (DW_DLV_ERROR);
- if (is_info) {
- if (dbg->dbg_cu_current == NULL) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
- return (DW_DLV_NO_ENTRY);
- }
- cu = dbg->dbg_cu_current;
- } else {
- if (dbg->dbg_tu_current == NULL) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
- return (DW_DLV_NO_ENTRY);
- }
- cu = dbg->dbg_tu_current;
+ if (dbg->dbg_cu_current == NULL) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
+ return (DW_DLV_NO_ENTRY);
}
+ cu = dbg->dbg_cu_current;
if (cu_length)
*cu_length = cu->cu_length;
@@ -98,32 +81,11 @@ dwarf_next_cu_header_c(Dwarf_Debug dbg, Dwarf_Bool is_info,
*cu_extension_size = 4;
}
if (cu_next_offset)
- *cu_next_offset = cu->cu_next_offset;
-
- if (!is_info) {
- if (type_signature)
- *type_signature = cu->cu_type_sig;
- if (type_offset)
- *type_offset = cu->cu_type_offset;
- }
+ *cu_next_offset = dbg->dbg_cu_current->cu_next_offset;
return (DW_DLV_OK);
}
-
-int
-dwarf_next_cu_header_b(Dwarf_Debug dbg, Dwarf_Unsigned *cu_length,
- Dwarf_Half *cu_version, Dwarf_Off *cu_abbrev_offset,
- Dwarf_Half *cu_pointer_size, Dwarf_Half *cu_offset_size,
- Dwarf_Half *cu_extension_size, Dwarf_Unsigned *cu_next_offset,
- Dwarf_Error *error)
-{
-
- return (dwarf_next_cu_header_c(dbg, 1, cu_length, cu_version,
- cu_abbrev_offset, cu_pointer_size, cu_offset_size,
- cu_extension_size, NULL, NULL, cu_next_offset, error));
-}
-
int
dwarf_next_cu_header(Dwarf_Debug dbg, Dwarf_Unsigned *cu_length,
Dwarf_Half *cu_version, Dwarf_Off *cu_abbrev_offset,
@@ -135,27 +97,3 @@ dwarf_next_cu_header(Dwarf_Debug dbg, Dwarf_Unsigned *cu_length,
cu_abbrev_offset, cu_pointer_size, NULL, NULL, cu_next_offset,
error));
}
-
-int
-dwarf_next_types_section(Dwarf_Debug dbg, Dwarf_Error *error)
-{
-
- /* Free resource allocated for current .debug_types section. */
- _dwarf_type_unit_cleanup(dbg);
- dbg->dbg_types_loaded = 0;
- dbg->dbg_types_off = 0;
-
- /* Reset type unit pointer. */
- dbg->dbg_tu_current = NULL;
-
- /* Search for the next .debug_types section. */
- dbg->dbg_types_sec = _dwarf_find_next_types_section(dbg,
- dbg->dbg_types_sec);
-
- if (dbg->dbg_types_sec == NULL) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
- return (DW_DLV_NO_ENTRY);
- }
-
- return (DW_DLV_OK);
-}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_def_macro.3 b/contrib/elftoolchain/libdwarf/dwarf_def_macro.3
index daa090f29f0a..d4849b12d1ca 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_def_macro.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_def_macro.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_def_macro.3 3182 2015-04-10 16:08:10Z emaste $
+.\" $Id: dwarf_def_macro.3 2122 2011-11-09 15:35:14Z jkoshy $
.\"
.Dd November 9, 2011
.Os
@@ -72,7 +72,7 @@ Argument
.Ar value
should point to a NUL-terminated string containing the value
of the macro.
-If the macro does not have a value, argument
+If the macro doesn't have a value, argument
.Ar value
should be set to NULL.
.Pp
diff --git a/contrib/elftoolchain/libdwarf/dwarf_die.c b/contrib/elftoolchain/libdwarf/dwarf_die.c
index de6351ac608f..055d95209f07 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_die.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_die.c
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
- * Copyright (c) 2009,2011,2014 Kai Wang
+ * Copyright (c) 2009,2011 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,13 +27,12 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_die.c 3039 2014-05-18 15:10:56Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_die.c 2073 2011-10-27 03:30:47Z jkoshy $");
int
dwarf_child(Dwarf_Die die, Dwarf_Die *ret_die, Dwarf_Error *error)
{
Dwarf_Debug dbg;
- Dwarf_Section *ds;
Dwarf_CU cu;
int ret;
@@ -49,9 +48,9 @@ dwarf_child(Dwarf_Die die, Dwarf_Die *ret_die, Dwarf_Error *error)
dbg = die->die_dbg;
cu = die->die_cu;
- ds = cu->cu_is_info ? dbg->dbg_info_sec : dbg->dbg_types_sec;
- ret = _dwarf_die_parse(die->die_dbg, ds, cu, cu->cu_dwarf_size,
- die->die_next_off, cu->cu_next_offset, ret_die, 0, error);
+ ret = _dwarf_die_parse(die->die_dbg, dbg->dbg_info_sec, cu,
+ cu->cu_dwarf_size, die->die_next_off, cu->cu_next_offset,
+ ret_die, 0, error);
if (ret == DW_DLE_NO_ENTRY) {
DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
@@ -63,12 +62,11 @@ dwarf_child(Dwarf_Die die, Dwarf_Die *ret_die, Dwarf_Error *error)
}
int
-dwarf_siblingof_b(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Die *ret_die,
- Dwarf_Bool is_info, Dwarf_Error *error)
+dwarf_siblingof(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Die *ret_die,
+ Dwarf_Error *error)
{
Dwarf_CU cu;
Dwarf_Attribute at;
- Dwarf_Section *ds;
uint64_t offset;
int ret, search_sibling;
@@ -77,27 +75,15 @@ dwarf_siblingof_b(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Die *ret_die,
return (DW_DLV_ERROR);
}
- ds = is_info ? dbg->dbg_info_sec : dbg->dbg_types_sec;
- cu = is_info ? dbg->dbg_cu_current : dbg->dbg_tu_current;
-
- if (cu == NULL) {
+ if ((cu = dbg->dbg_cu_current) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_DIE_NO_CU_CONTEXT);
return (DW_DLV_ERROR);
}
/* Application requests the first DIE in this CU. */
if (die == NULL)
- return (dwarf_offdie_b(dbg, cu->cu_1st_offset, is_info,
- ret_die, error));
-
- /*
- * Check if the `is_info' flag matches the debug section the
- * DIE belongs to.
- */
- if (is_info != die->die_cu->cu_is_info) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
- return (DW_DLV_ERROR);
- }
+ return (dwarf_offdie(dbg, cu->cu_1st_offset, ret_die,
+ error));
/*
* If the DIE doesn't have any children, its sibling sits next
@@ -122,8 +108,9 @@ dwarf_siblingof_b(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Die *ret_die,
}
}
- ret = _dwarf_die_parse(die->die_dbg, ds, cu, cu->cu_dwarf_size, offset,
- cu->cu_next_offset, ret_die, search_sibling, error);
+ ret = _dwarf_die_parse(die->die_dbg, dbg->dbg_info_sec, cu,
+ cu->cu_dwarf_size, offset, cu->cu_next_offset, ret_die,
+ search_sibling, error);
if (ret == DW_DLE_NO_ENTRY) {
DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
@@ -134,31 +121,21 @@ dwarf_siblingof_b(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Die *ret_die,
return (DW_DLV_OK);
}
-
-int
-dwarf_siblingof(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Die *ret_die,
- Dwarf_Error *error)
-{
-
- return (dwarf_siblingof_b(dbg, die, ret_die, 1, error));
-}
-
static int
-_dwarf_search_die_within_cu(Dwarf_Debug dbg, Dwarf_Section *s, Dwarf_CU cu,
- Dwarf_Off offset, Dwarf_Die *ret_die, Dwarf_Error *error)
+_dwarf_search_die_within_cu(Dwarf_Debug dbg, Dwarf_CU cu, Dwarf_Off offset,
+ Dwarf_Die *ret_die, Dwarf_Error *error)
{
assert(dbg != NULL && cu != NULL && ret_die != NULL);
- return (_dwarf_die_parse(dbg, s, cu, cu->cu_dwarf_size,
+ return (_dwarf_die_parse(dbg, dbg->dbg_info_sec, cu, cu->cu_dwarf_size,
offset, cu->cu_next_offset, ret_die, 0, error));
}
int
-dwarf_offdie_b(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Bool is_info,
- Dwarf_Die *ret_die, Dwarf_Error *error)
+dwarf_offdie(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Die *ret_die,
+ Dwarf_Error *error)
{
- Dwarf_Section *ds;
Dwarf_CU cu;
int ret;
@@ -167,13 +144,11 @@ dwarf_offdie_b(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Bool is_info,
return (DW_DLV_ERROR);
}
- ds = is_info ? dbg->dbg_info_sec : dbg->dbg_types_sec;
- cu = is_info ? dbg->dbg_cu_current : dbg->dbg_tu_current;
-
/* First search the current CU. */
- if (cu != NULL) {
+ if (dbg->dbg_cu_current != NULL) {
+ cu = dbg->dbg_cu_current;
if (offset > cu->cu_offset && offset < cu->cu_next_offset) {
- ret = _dwarf_search_die_within_cu(dbg, ds, cu, offset,
+ ret = _dwarf_search_die_within_cu(dbg, cu, offset,
ret_die, error);
if (ret == DW_DLE_NO_ENTRY) {
DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
@@ -185,38 +160,21 @@ dwarf_offdie_b(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Bool is_info,
}
/* Search other CUs. */
- ret = _dwarf_info_load(dbg, 1, is_info, error);
+ ret = _dwarf_info_load(dbg, 1, error);
if (ret != DW_DLE_NONE)
return (DW_DLV_ERROR);
- if (is_info) {
- STAILQ_FOREACH(cu, &dbg->dbg_cu, cu_next) {
- if (offset < cu->cu_offset ||
- offset > cu->cu_next_offset)
- continue;
- ret = _dwarf_search_die_within_cu(dbg, ds, cu, offset,
- ret_die, error);
- if (ret == DW_DLE_NO_ENTRY) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
- return (DW_DLV_NO_ENTRY);
- } else if (ret != DW_DLE_NONE)
- return (DW_DLV_ERROR);
- return (DW_DLV_OK);
- }
- } else {
- STAILQ_FOREACH(cu, &dbg->dbg_tu, cu_next) {
- if (offset < cu->cu_offset ||
- offset > cu->cu_next_offset)
- continue;
- ret = _dwarf_search_die_within_cu(dbg, ds, cu, offset,
- ret_die, error);
- if (ret == DW_DLE_NO_ENTRY) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
- return (DW_DLV_NO_ENTRY);
- } else if (ret != DW_DLE_NONE)
- return (DW_DLV_ERROR);
- return (DW_DLV_OK);
- }
+ STAILQ_FOREACH(cu, &dbg->dbg_cu, cu_next) {
+ if (offset < cu->cu_offset || offset > cu->cu_next_offset)
+ continue;
+ ret = _dwarf_search_die_within_cu(dbg, cu, offset,
+ ret_die, error);
+ if (ret == DW_DLE_NO_ENTRY) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
+ return (DW_DLV_NO_ENTRY);
+ } else if (ret != DW_DLE_NONE)
+ return (DW_DLV_ERROR);
+ return (DW_DLV_OK);
}
DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
@@ -224,14 +182,6 @@ dwarf_offdie_b(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Bool is_info,
}
int
-dwarf_offdie(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Die *ret_die,
- Dwarf_Error *error)
-{
-
- return (dwarf_offdie_b(dbg, offset, 1, ret_die, error));
-}
-
-int
dwarf_tag(Dwarf_Die die, Dwarf_Half *tag, Dwarf_Error *error)
{
Dwarf_Debug dbg;
@@ -343,9 +293,9 @@ dwarf_die_abbrev_code(Dwarf_Die die)
}
int
-dwarf_get_cu_die_offset_given_cu_header_offset_b(Dwarf_Debug dbg,
- Dwarf_Off in_cu_header_offset, Dwarf_Bool is_info,
- Dwarf_Off *out_cu_die_offset, Dwarf_Error *error)
+dwarf_get_cu_die_offset_given_cu_header_offset(Dwarf_Debug dbg,
+ Dwarf_Off in_cu_header_offset, Dwarf_Off *out_cu_die_offset,
+ Dwarf_Error *error)
{
Dwarf_CU cu;
@@ -354,19 +304,10 @@ dwarf_get_cu_die_offset_given_cu_header_offset_b(Dwarf_Debug dbg,
return (DW_DLV_ERROR);
}
- if (is_info) {
- STAILQ_FOREACH(cu, &dbg->dbg_cu, cu_next) {
- if (cu->cu_offset == in_cu_header_offset) {
- *out_cu_die_offset = cu->cu_1st_offset;
- break;
- }
- }
- } else {
- STAILQ_FOREACH(cu, &dbg->dbg_tu, cu_next) {
- if (cu->cu_offset == in_cu_header_offset) {
- *out_cu_die_offset = cu->cu_1st_offset;
- break;
- }
+ STAILQ_FOREACH(cu, &dbg->dbg_cu, cu_next) {
+ if (cu->cu_offset == in_cu_header_offset) {
+ *out_cu_die_offset = cu->cu_1st_offset;
+ break;
}
}
@@ -379,16 +320,6 @@ dwarf_get_cu_die_offset_given_cu_header_offset_b(Dwarf_Debug dbg,
}
int
-dwarf_get_cu_die_offset_given_cu_header_offset(Dwarf_Debug dbg,
- Dwarf_Off in_cu_header_offset, Dwarf_Off *out_cu_die_offset,
- Dwarf_Error *error)
-{
-
- return (dwarf_get_cu_die_offset_given_cu_header_offset_b(dbg,
- in_cu_header_offset, 1, out_cu_die_offset, error));
-}
-
-int
dwarf_get_address_size(Dwarf_Debug dbg, Dwarf_Half *addr_size,
Dwarf_Error *error)
{
@@ -402,12 +333,3 @@ dwarf_get_address_size(Dwarf_Debug dbg, Dwarf_Half *addr_size,
return (DW_DLV_OK);
}
-
-Dwarf_Bool
-dwarf_get_die_infotypes_flag(Dwarf_Die die)
-{
-
- assert(die != NULL);
-
- return (die->die_cu->cu_is_info);
-}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_dieoffset.3 b/contrib/elftoolchain/libdwarf/dwarf_dieoffset.3
index 00b0e71b8389..545bf2699c4d 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_dieoffset.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_dieoffset.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010,2014 Kai Wang
+.\" Copyright (c) 2010 Kai Wang
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,17 +22,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_dieoffset.3 3129 2014-12-21 20:06:26Z jkoshy $
+.\" $Id: dwarf_dieoffset.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
-.Dd December 21, 2014
+.Dd April 17, 2010
.Os
.Dt DWARF_DIEOFFSET 3
.Sh NAME
.Nm dwarf_die_CU_offset ,
.Nm dwarf_die_CU_offset_range ,
.Nm dwarf_dieoffset ,
-.Nm dwarf_get_cu_die_offset_given_cu_header_offset ,
-.Nm dwarf_get_cu_die_offset_given_cu_header_offset_b
+.Nm dwarf_get_cu_die_offset_given_cu_header_offset
.Nd return offsets of DWARF debugging information entries
.Sh LIBRARY
.Lb libdwarf
@@ -64,14 +63,6 @@
.Fa "Dwarf_Off *out_cu_die_offset"
.Fa "Dwarf_Error *err"
.Fc
-.Ft int
-.Fo dwarf_get_cu_die_offset_given_cu_header_offset_b
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Off in_cu_header_offset"
-.Fa "Dwarf_Bool is_info"
-.Fa "Dwarf_Off *out_cu_die_offset"
-.Fa "Dwarf_Error *err"
-.Fc
.Sh DESCRIPTION
These functions are used to retrieve offsets for DWARF debugging
information entries.
@@ -123,7 +114,7 @@ an error.
.Pp
Function
.Fn dwarf_get_cu_die_offset_given_cu_header_offset
-returns the offset for the first debugging information entry for a
+returns the offset for the debugging information entry for a
compilation unit, given an offset to the header of the compilation
unit.
Argument
@@ -140,30 +131,8 @@ If argument
.Ar err
is non-NULL, it will be used to return an error descriptor in case of
an error.
-.Pp
-Function
-.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b
-behaves identically to the function
-.Fn dwarf_get_cu_die_offset_given_cu_header_offset
-when the argument
-.Ar is_info
-is non-zero.
-When the argument
-.Ar is_info
-is zero, function
-.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b
-returns the offset for the first debugging information entry for a
-type unit, given an offset to the header of the type unit in argument
-.Ar in_cu_header_offset .
-Argument
-.Ar out_cu_die_offset
-points to a location that will hold the returned offset.
-If the argument
-.Ar err
-is non-NULL, it will be used to return an error descriptor in case of
-an error.
.Sh RETURN VALUES
-On success, these functions return
+On success, these functions returns
.Dv DW_DLV_OK .
In case of an error, these functions return
.Dv DW_DLV_ERROR
@@ -172,13 +141,11 @@ and set argument
.Pp
Function
.Fn dwarf_get_cu_die_offset_given_cu_header_offset
-and
-.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b
returns
.Dv DW_DLV_NO_ENTRY
and sets argument
.Ar err
-if there is no compilation or type unit located at the
+if there is no compilation unit located at the
offset specified in argument
.Ar in_cu_header_offset .
.Sh ERRORS
@@ -202,5 +169,4 @@ specified an unknown offset.
.Sh SEE ALSO
.Xr dwarf 3 ,
.Xr dwarf_next_cu_header 3 ,
-.Xr dwarf_offdie 3 ,
-.Xr dwarf_offdie_b 3
+.Xr dwarf_offdie 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_dump.c b/contrib/elftoolchain/libdwarf/dwarf_dump.c
index 3219fa4c0c6c..9b5d1f767e1a 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_dump.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_dump.c
@@ -27,7 +27,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_dump.c 3052 2014-05-26 20:36:24Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_dump.c 2073 2011-10-27 03:30:47Z jkoshy $");
int
dwarf_get_ACCESS_name(unsigned access, const char **s)
@@ -250,54 +250,6 @@ dwarf_get_AT_name(unsigned attr, const char **s)
*s = "DW_AT_visibility"; break;
case DW_AT_vtable_elem_location:
*s = "DW_AT_vtable_elem_location"; break;
- case DW_AT_sf_names:
- *s = "DW_AT_sf_names"; break;
- case DW_AT_src_info:
- *s = "DW_AT_src_info"; break;
- case DW_AT_mac_info:
- *s = "DW_AT_mac_info"; break;
- case DW_AT_src_coords:
- *s = "DW_AT_src_coords"; break;
- case DW_AT_body_begin:
- *s = "DW_AT_body_begin"; break;
- case DW_AT_body_end:
- *s = "DW_AT_body_end"; break;
- case DW_AT_GNU_vector:
- *s = "DW_AT_GNU_vector"; break;
- case DW_AT_GNU_guarded_by:
- *s = "DW_AT_GNU_guarded_by"; break;
- case DW_AT_GNU_pt_guarded_by:
- *s = "DW_AT_GNU_pt_guarded_by"; break;
- case DW_AT_GNU_guarded:
- *s = "DW_AT_GNU_guarded"; break;
- case DW_AT_GNU_pt_guarded:
- *s = "DW_AT_GNU_pt_guarded"; break;
- case DW_AT_GNU_locks_excluded:
- *s = "DW_AT_GNU_locks_excluded"; break;
- case DW_AT_GNU_exclusive_locks_required:
- *s = "DW_AT_GNU_exclusive_locks_required"; break;
- case DW_AT_GNU_shared_locks_required:
- *s = "DW_AT_GNU_shared_locks_required"; break;
- case DW_AT_GNU_odr_signature:
- *s = "DW_AT_GNU_odr_signature"; break;
- case DW_AT_GNU_template_name:
- *s = "DW_AT_GNU_template_name"; break;
- case DW_AT_GNU_call_site_value:
- *s = "DW_AT_GNU_call_site_value"; break;
- case DW_AT_GNU_call_site_data_value:
- *s = "DW_AT_GNU_call_site_data_value"; break;
- case DW_AT_GNU_call_site_target:
- *s = "DW_AT_GNU_call_site_target"; break;
- case DW_AT_GNU_call_site_target_clobbered:
- *s = "DW_AT_GNU_call_site_target_clobbered"; break;
- case DW_AT_GNU_tail_call:
- *s = "DW_AT_GNU_tail_call"; break;
- case DW_AT_GNU_all_tail_call_sites:
- *s = "DW_AT_GNU_all_tail_call_sites"; break;
- case DW_AT_GNU_all_call_sites:
- *s = "DW_AT_GNU_all_call_sites"; break;
- case DW_AT_GNU_all_source_call_sites:
- *s = "DW_AT_GNU_all_source_call_sites"; break;
default:
return (DW_DLV_NO_ENTRY);
}
@@ -1142,30 +1094,6 @@ dwarf_get_OP_name(unsigned op, const char **s)
*s = "DW_OP_stack_value"; break;
case DW_OP_GNU_push_tls_address:
*s = "DW_OP_GNU_push_tls_address"; break;
- case DW_OP_GNU_uninit:
- *s = "DW_OP_GNU_uninit"; break;
- case DW_OP_GNU_encoded_addr:
- *s = "DW_OP_GNU_encoded_addr"; break;
- case DW_OP_GNU_implicit_pointer:
- *s = "DW_OP_GNU_implicit_pointer"; break;
- case DW_OP_GNU_entry_value:
- *s = "DW_OP_GNU_entry_value"; break;
- case DW_OP_GNU_const_type:
- *s = "DW_OP_GNU_const_type"; break;
- case DW_OP_GNU_regval_type:
- *s = "DW_OP_GNU_regval_type"; break;
- case DW_OP_GNU_deref_type:
- *s = "DW_OP_GNU_deref_type"; break;
- case DW_OP_GNU_convert:
- *s = "DW_OP_GNU_convert"; break;
- case DW_OP_GNU_reinterpret:
- *s = "DW_OP_GNU_reinterpret"; break;
- case DW_OP_GNU_parameter_ref:
- *s = "DW_OP_GNU_parameter_ref"; break;
- case DW_OP_GNU_addr_index:
- *s = "DW_OP_GNU_addr_index"; break;
- case DW_OP_GNU_const_index:
- *s = "DW_OP_GNU_const_index"; break;
default:
return (DW_DLV_NO_ENTRY);
}
@@ -1316,26 +1244,6 @@ dwarf_get_TAG_name(unsigned tag, const char **s)
*s = "DW_TAG_volatile_type"; break;
case DW_TAG_with_stmt:
*s = "DW_TAG_with_stmt"; break;
- case DW_TAG_format_label:
- *s = "DW_TAG_format_label"; break;
- case DW_TAG_function_template:
- *s = "DW_TAG_function_template"; break;
- case DW_TAG_class_template:
- *s = "DW_TAG_class_template"; break;
- case DW_TAG_GNU_BINCL:
- *s = "DW_TAG_GNU_BINCL"; break;
- case DW_TAG_GNU_EINCL:
- *s = "DW_TAG_GNU_EINCL"; break;
- case DW_TAG_GNU_template_template_param:
- *s = "DW_TAG_GNU_template_template_param"; break;
- case DW_TAG_GNU_template_parameter_pack:
- *s = "DW_TAG_GNU_template_parameter_pack"; break;
- case DW_TAG_GNU_formal_parameter_pack:
- *s = "DW_TAG_GNU_formal_parameter_pack"; break;
- case DW_TAG_GNU_call_site:
- *s = "DW_TAG_GNU_call_site"; break;
- case DW_TAG_GNU_call_site_parameter:
- *s = "DW_TAG_GNU_call_site_parameter"; break;
default:
return (DW_DLV_NO_ENTRY);
}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_errmsg.c b/contrib/elftoolchain/libdwarf/dwarf_errmsg.c
index e300893a61c1..16f8e4bc6ed6 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_errmsg.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_errmsg.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_errmsg.c 2975 2014-01-21 20:08:04Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_errmsg.c 2576 2012-09-13 09:16:11Z jkoshy $");
static const char *_libdwarf_errors[] = {
#define DEFINE_ERROR(N,S) [DW_DLE_##N] = S
diff --git a/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3 b/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3
index 7bcd105f030f..eaeb32039c30 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3
@@ -22,14 +22,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_expand_frame_instructions.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_expand_frame_instructions.3 2122 2011-11-09 15:35:14Z jkoshy $
.\"
.Dd November 9, 2011
.Os
.Dt DWARF_EXPAND_FRAME_INSTRUCTIONS 3
.Sh NAME
.Nm dwarf_expand_frame_instructions
-.Nd expand frame instructions
+.Nd expand frame instructions
.Sh LIBRARY
.Lb libdwarf
.Sh SYNOPSIS
diff --git a/contrib/elftoolchain/libdwarf/dwarf_formblock.3 b/contrib/elftoolchain/libdwarf/dwarf_formblock.3
index 1ffb6e6fec0d..4ae824f68e9a 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_formblock.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_formblock.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_formblock.3 3182 2015-04-10 16:08:10Z emaste $
+.\" $Id: dwarf_formblock.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
.Dd July 23, 2010
.Os
@@ -69,7 +69,7 @@ the DWARF(3) library.
The application should not attempt to free this memory
area.
Portable code may indicate that the memory area is to be freed by
-using
+by using
.Xr dwarf_dealloc 3 .
.Sh RETURN VALUES
Function
diff --git a/contrib/elftoolchain/libdwarf/dwarf_formflag.3 b/contrib/elftoolchain/libdwarf/dwarf_formflag.3
index 2e23b3301661..93d5902c860a 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_formflag.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_formflag.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_formflag.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_formflag.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
.Dd June 21, 2010
.Os
@@ -58,7 +58,7 @@ or
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
-of an error.
+of an error.
.Sh RETURN VALUES
Function
.Fn dwarf_formflag
diff --git a/contrib/elftoolchain/libdwarf/dwarf_formref.3 b/contrib/elftoolchain/libdwarf/dwarf_formref.3
index abde30cfb9e4..9e3458face08 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_formref.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_formref.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_formref.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_formref.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
.Dd June 21, 2010
.Os
@@ -101,7 +101,7 @@ ELF section.
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
-of an error.
+of an error.
.Sh RETURN VALUES
These functions return
.Dv DW_DLV_OK
diff --git a/contrib/elftoolchain/libdwarf/dwarf_formsig8.3 b/contrib/elftoolchain/libdwarf/dwarf_formsig8.3
index a76c1107d9eb..5445324dd7af 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_formsig8.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_formsig8.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_formsig8.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_formsig8.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
.Dd July 24, 2010
.Os
@@ -56,7 +56,7 @@ must be
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
-of an error.
+of an error.
.Sh RETURN VALUES
Function
.Fn dwarf_formsig8
diff --git a/contrib/elftoolchain/libdwarf/dwarf_formudata.3 b/contrib/elftoolchain/libdwarf/dwarf_formudata.3
index 9ed154eebb97..f95fdead898c 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_formudata.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_formudata.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_formudata.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_formudata.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
.Dd June 21, 2010
.Os
@@ -88,7 +88,7 @@ and
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
-of an error.
+of an error.
.Sh RETURN VALUES
These functions return
.Dv DW_DLV_OK
diff --git a/contrib/elftoolchain/libdwarf/dwarf_frame.c b/contrib/elftoolchain/libdwarf/dwarf_frame.c
index 442f232cf092..5ccbbc4aead7 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_frame.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_frame.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_frame.c 3106 2014-12-19 16:00:58Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_frame.c 2073 2011-10-27 03:30:47Z jkoshy $");
int
dwarf_get_fde_list(Dwarf_Debug dbg, Dwarf_Cie **cie_list,
@@ -539,8 +539,8 @@ dwarf_expand_frame_instructions(Dwarf_Cie cie, Dwarf_Ptr instruction,
return (DW_DLV_ERROR);
}
- ret = _dwarf_frame_get_fop(dbg, cie->cie_addrsize, instruction, len,
- ret_oplist, ret_opcnt, error);
+ ret = _dwarf_frame_get_fop(dbg, instruction, len, ret_oplist, ret_opcnt,
+ error);
if (ret != DW_DLE_NONE)
return (DW_DLV_ERROR);
diff --git a/contrib/elftoolchain/libdwarf/dwarf_get_AT_name.3 b/contrib/elftoolchain/libdwarf/dwarf_get_AT_name.3
index 473adc331f3f..5b5d5a1167a8 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_get_AT_name.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_get_AT_name.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_get_AT_name.3 3142 2015-01-29 23:11:14Z jkoshy $
+.\" $Id: dwarf_get_AT_name.3 2071 2011-10-27 03:20:00Z jkoshy $
.\"
.Dd April 22, 2011
.Os
@@ -247,7 +247,6 @@ constants.
.It Fn dwarf_get_VIS_name
.Dv DW_VIS_*
constants.
-.El
.Sh RETURN VALUES
These functions return
.Dv DW_DLV_OK on success.
diff --git a/contrib/elftoolchain/libdwarf/dwarf_get_arange_info.3 b/contrib/elftoolchain/libdwarf/dwarf_get_arange_info.3
index 3878edde19bb..e8dac7810a0d 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_get_arange_info.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_get_arange_info.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_get_arange_info.3 3142 2015-01-29 23:11:14Z jkoshy $
+.\" $Id: dwarf_get_arange_info.3 2134 2011-11-10 08:40:14Z jkoshy $
.\"
.Dd April 16, 2011
.Os
@@ -102,7 +102,6 @@ One of the arguments
or
.Ar cu_die_offset
was NULL.
-.El
.Sh EXAMPLE
To loop through all the address lookup table entries, use:
.Bd -literal -offset indent
diff --git a/contrib/elftoolchain/libdwarf/dwarf_get_die_infotypes_flag.3 b/contrib/elftoolchain/libdwarf/dwarf_get_die_infotypes_flag.3
deleted file mode 100644
index 4f5a19ace367..000000000000
--- a/contrib/elftoolchain/libdwarf/dwarf_get_die_infotypes_flag.3
+++ /dev/null
@@ -1,73 +0,0 @@
-.\" Copyright (c) 2014 Kai Wang
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Id: dwarf_get_die_infotypes_flag.3 3118 2014-12-20 20:30:06Z jkoshy $
-.\"
-.Dd December 20, 2014
-.Os
-.Dt DWARF_GET_DIE_INFOTYPES_FLAG 3
-.Sh NAME
-.Nm dwarf_get_die_infotypes_flag
-.Nd indicate the originating DWARF section for a DIE
-.Sh LIBRARY
-.Lb libdwarf
-.Sh SYNOPSIS
-.In libdwarf.h
-.Ft Dwarf_Bool
-.Fo dwarf_get_die_infotypes_flag
-.Fa "Dwarf_Die die"
-.Fc
-.Sh DESCRIPTION
-Function
-.Fn dwarf_get_die_infotypes_flag
-returns a flag indicating the originating DWARF section for the
-debugging information entry referenced by argument
-.Ar die .
-.Pp
-Argument
-.Ar die
-should reference a valid debugging information entry descriptor.
-.Sh RETURN VALUES
-Function
-.Fn dwarf_get_die_infotypes_flag
-returns a non-zero value if argument
-.Ar die
-originates in the
-.Dq .debug_info
-section.
-.Pp
-It returns zero if argument
-.Ar die
-originates in the
-.Dq .debug_types
-section.
-.Sh ERRORS
-Function
-.Fn dwarf_get_die_infotypes_flag
-always succeeds.
-.Sh SEE ALSO
-.Xr dwarf 3 ,
-.Xr dwarf_next_cu_header_c 3 ,
-.Xr dwarf_offdie_b 3 ,
-.Xr dwarf_siblingof_b 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3 b/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3
index f55d3d68a5bb..014d138a0e23 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_get_fde_info_for_all_regs.3 3182 2015-04-10 16:08:10Z emaste $
+.\" $Id: dwarf_get_fde_info_for_all_regs.3 2071 2011-10-27 03:20:00Z jkoshy $
.\"
.Dd June 4, 2011
.Os
@@ -90,8 +90,7 @@ typedef struct {
For each of the register rules returned,
the
.Va dw_offset_relevant
-field is set to 1 if the register rule has a offset value.
-The
+field is set to 1 if the register rule has a offset value. The
.Va dw_regnum
field is set to the register number associated with the regsiter rule.
The
diff --git a/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3 b/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3
index fd05814a3630..3d468062602c 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_get_fde_info_for_reg.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_get_fde_info_for_reg.3 2071 2011-10-27 03:20:00Z jkoshy $
.\"
.Dd June 4, 2011
.Os
@@ -99,7 +99,7 @@ counter address associated with the register rule found.
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
-of an error.
+of an error.
.Ss COMPATIBILITY
Function
.Fn dwarf_get_fde_info_for_reg
diff --git a/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3 b/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3
index 15bad4dfd7ac..37847a1a9c22 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_get_ranges.3 3182 2015-04-10 16:08:10Z emaste $
+.\" $Id: dwarf_get_ranges.3 2122 2011-11-09 15:35:14Z jkoshy $
.\"
.Dd November 9, 2011
.Os
@@ -137,7 +137,7 @@ For this type of entry, the field
.Va dwr_addr1
is the value of the largest representable address offset, and
.Va dwr_addr2
-is a base address for the beginning and ending address offsets of
+is a base address for the begining and ending address offsets of
subsequent address range entries in the list.
.It Dv DW_RANGES_END
An end of list mark.
diff --git a/contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3 b/contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3
deleted file mode 100644
index 963d4ac3814e..000000000000
--- a/contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3
+++ /dev/null
@@ -1,116 +0,0 @@
-.\" Copyright (c) 2014 Kai Wang
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Id: dwarf_get_section_max_offsets.3 3141 2015-01-29 23:11:10Z jkoshy $
-.\"
-.Dd December 21, 2014
-.Os
-.Dt DWARF_GET_SECTION_MAX_OFFSETS
-.Sh NAME
-.Nm dwarf_get_section_max_offsets ,
-.Nm dwarf_get_section_max_offsets_b
-.Nd return the size of DWARF sections
-.Sh LIBRARY
-.Lb libdwarf
-.Sh SYNOPSIS
-.In libdwarf.h
-.Ft int
-.Fo dwarf_get_section_max_offsets
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Unsigned *debug_info"
-.Fa "Dwarf_Unsigned *debug_abbrev"
-.Fa "Dwarf_Unsigned *debug_line"
-.Fa "Dwarf_Unsigned *debug_loc"
-.Fa "Dwarf_Unsigned *debug_aranges"
-.Fa "Dwarf_Unsigned *debug_macinfo"
-.Fa "Dwarf_Unsigned *debug_pubnames"
-.Fa "Dwarf_Unsigned *debug_str"
-.Fa "Dwarf_Unsigned *debug_frame"
-.Fa "Dwarf_Unsigned *debug_ranges"
-.Fa "Dwarf_Unsigned *debug_pubtypes"
-.Fc
-.Ft int
-.Fo dwarf_get_section_max_offsets_b
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Unsigned *debug_info"
-.Fa "Dwarf_Unsigned *debug_abbrev"
-.Fa "Dwarf_Unsigned *debug_line"
-.Fa "Dwarf_Unsigned *debug_loc"
-.Fa "Dwarf_Unsigned *debug_aranges"
-.Fa "Dwarf_Unsigned *debug_macinfo"
-.Fa "Dwarf_Unsigned *debug_pubnames"
-.Fa "Dwarf_Unsigned *debug_str"
-.Fa "Dwarf_Unsigned *debug_frame"
-.Fa "Dwarf_Unsigned *debug_ranges"
-.Fa "Dwarf_Unsigned *debug_pubtypes"
-.Fa "Dwarf_Unsigned *debug_types"
-.Fc
-.Sh DESCRIPTION
-Function
-.Fn dwarf_get_section_max_offsets_b
-retrieves the sizes of the DWARF sections in a DWARF debug context.
-Argument
-.Ar dbg
-should reference a DWARF debug context allocated using
-.Xr dwarf_init 3 .
-The function stores the size of each DWARF section to the location
-pointed to by the argument corresponding to the section name.
-If a DWARF section does not exist, the location pointed to by the
-argument corresponding to that section will be set to zero.
-.Pp
-A value of NULL may be used for any of the arguments
-.Ar debug_info ,
-.Ar debug_abbrev ,
-.Ar debug_line ,
-.Ar debug_loc ,
-.Ar debug_aranges ,
-.Ar debug_macinfo ,
-.Ar debug_pubnames ,
-.Ar debug_str ,
-.Ar debug_frame ,
-.Ar debug_ranges ,
-.Ar debug_pubtypes
-and
-.Ar debug_types
-if the caller is not interested in the respective section size.
-.Pp
-Function
-.Fn dwarf_get_section_max_offsets
-is identical to function
-.Fn dwarf_get_section_max_offsets_b
-except that it does not provide argument
-.Ar debug_types ,
-and thus cannot return the size of the
-.Dq \&.debug_types
-section.
-.Sh RETURN VALUES
-On success, these functions return
-.Dv DW_DLV_OK .
-If argument
-.Ar dbg
-is NULL, they return
-.Dv DW_DLV_ERROR .
-.Sh SEE ALSO
-.Xr dwarf 3 ,
-.Xr dwarf_init 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_hasattr.3 b/contrib/elftoolchain/libdwarf/dwarf_hasattr.3
index 659887588563..5b4699bd7778 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_hasattr.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_hasattr.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_hasattr.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_hasattr.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
.Dd April 17, 2010
.Os
@@ -64,7 +64,7 @@ If the named attribute is not present, a zero is written instead.
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
-of an error.
+of an error.
.Sh RETURN VALUES
On success, function
.Fn dwarf_hasattr
@@ -85,7 +85,6 @@ Either of argument
or
.Va ret_bool
was NULL.
-.El
.Sh SEE ALSO
.Xr dwarf 3 ,
.Xr dwarf_attr 3 ,
diff --git a/contrib/elftoolchain/libdwarf/dwarf_highpc.3 b/contrib/elftoolchain/libdwarf/dwarf_highpc.3
index 4d31f5c8d1a2..998a3b6ad650 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_highpc.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_highpc.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010,2014 Kai Wang
+.\" Copyright (c) 2010 Kai Wang
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_highpc.3 3092 2014-09-02 22:09:30Z kaiwang27 $
+.\" $Id: dwarf_highpc.3 2073 2011-10-27 03:30:47Z jkoshy $
.\"
-.Dd July 22, 2014
+.Dd April 7, 2010
.Os
.Dt DWARF_HIGHPC 3
.Sh NAME
@@ -33,7 +33,6 @@
.Nm dwarf_bitsize ,
.Nm dwarf_bytesize ,
.Nm dwarf_highpc ,
-.Nm dwarf_highpc_b ,
.Nm dwarf_lowpc ,
.Nm dwarf_srclang
.Nd retrieve the value of a DWARF attribute
@@ -72,14 +71,6 @@
.Fa "Dwarf_Error *err"
.Fc
.Ft int
-.Fo dwarf_highpc_b
-.Fa "Dwarf_Die die"
-.Fa "Dwarf_Addr *ret_highpc"
-.Fa "Dwarf_Half *ret_form"
-.Fa "enum Dwarf_Form_Class *ret_class"
-.Fa "Dwarf_Error *err"
-.Fc
-.Ft int
.Fo dwarf_lowpc
.Fa "Dwarf_Die die"
.Fa "Dwarf_Addr *ret_lowpc"
@@ -123,10 +114,6 @@ attribute value.
Retrieve the
.Dv DW_AT_high_pc
attribute value.
-.It Fn dwarf_highpc_b
-Retrieve the
-.Dv DW_AT_high_pc
-attribute value.
.It Fn dwarf_lowpc
Retrieve the
.Dv DW_AT_low_pc
@@ -136,23 +123,6 @@ Retrieve the
.Dv DW_AT_language
attribute value.
.El
-.Pp
-Function
-.Fn dwarf_highpc_b
-is an enhanced version of function
-.Fn dwarf_highpc .
-It sets the location specified by argument
-.Ar ret_form
-to the form code of the attribute
-.Dv DW_AT_high_pc ,
-and sets the location specified by argument
-.Ar ret_class
-to the class of that form.
-A value of NULL may be used for either of the arguments
-.Ar ret_form
-or
-.Ar ret_class
-if the caller is not interested in the respective value.
.Sh RETURN VALUES
These functions return
.Dv DW_DLV_OK on success.
@@ -189,5 +159,4 @@ had no requested attribute.
.Xr dwarf 3 ,
.Xr dwarf_attr 3 ,
.Xr dwarf_attrlist 3 ,
-.Xr dwarf_hasattr 3 ,
-.Xr dwarf_get_form_class 3
+.Xr dwarf_hasattr 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_lineno.c b/contrib/elftoolchain/libdwarf/dwarf_lineno.c
index cbcc9aeaa69d..d0c24b176b71 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_lineno.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_lineno.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_lineno.c 2983 2014-02-09 00:24:31Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_lineno.c 2074 2011-10-27 03:34:33Z jkoshy $");
int
dwarf_srclines(Dwarf_Die die, Dwarf_Line **linebuf, Dwarf_Signed *linecount,
@@ -75,8 +75,8 @@ dwarf_srclines(Dwarf_Die die, Dwarf_Line **linebuf, Dwarf_Signed *linecount,
return (DW_DLV_OK);
}
- if ((li->li_lnarray = malloc(*linecount * sizeof(Dwarf_Line))) ==
- NULL) {
+ if ((li->li_lnarray = malloc(*linecount *
+ sizeof(struct _Dwarf_Line))) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
return (DW_DLV_ERROR);
}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_loclist.c b/contrib/elftoolchain/libdwarf/dwarf_loclist.c
index e780a87128e5..4696bc52847d 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_loclist.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_loclist.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009,2014 Kai Wang
+ * Copyright (c) 2009 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,37 +26,13 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_loclist.c 3066 2014-06-06 19:36:06Z kaiwang27 $");
-
-static int
-copy_locdesc(Dwarf_Debug dbg, Dwarf_Locdesc *dst, Dwarf_Locdesc *src,
- Dwarf_Error *error)
-{
-
- assert(src != NULL && dst != NULL);
-
- dst->ld_lopc = src->ld_lopc;
- dst->ld_hipc = src->ld_hipc;
- dst->ld_cents = src->ld_cents;
-
- if (dst->ld_cents > 0) {
- dst->ld_s = calloc(dst->ld_cents, sizeof(Dwarf_Loc));
- if (dst->ld_s == NULL) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
- return (DW_DLE_MEMORY);
- }
- memcpy(dst->ld_s, src->ld_s, src->ld_cents *
- sizeof(Dwarf_Loc));
- } else
- dst->ld_s = NULL;
-
- return (DW_DLE_NONE);
-}
+ELFTC_VCSID("$Id: dwarf_loclist.c 2074 2011-10-27 03:34:33Z jkoshy $");
int
dwarf_loclist_n(Dwarf_Attribute at, Dwarf_Locdesc ***llbuf,
Dwarf_Signed *listlen, Dwarf_Error *error)
{
+ Dwarf_Loclist ll;
Dwarf_Debug dbg;
int ret;
@@ -93,41 +69,26 @@ dwarf_loclist_n(Dwarf_Attribute at, Dwarf_Locdesc ***llbuf,
/* FALLTHROUGH */
case DW_FORM_sec_offset:
ret = _dwarf_loclist_find(dbg, at->at_die->die_cu,
- at->u[0].u64, llbuf, listlen, NULL, error);
+ at->u[0].u64, &ll, error);
if (ret == DW_DLE_NO_ENTRY) {
DWARF_SET_ERROR(dbg, error, ret);
return (DW_DLV_NO_ENTRY);
}
if (ret != DW_DLE_NONE)
return (DW_DLV_ERROR);
+ *llbuf = ll->ll_ldlist;
+ *listlen = ll->ll_ldlen;
return (DW_DLV_OK);
case DW_FORM_block:
case DW_FORM_block1:
case DW_FORM_block2:
case DW_FORM_block4:
- case DW_FORM_exprloc:
if (at->at_ld == NULL) {
ret = _dwarf_loc_add(at->at_die, at, error);
if (ret != DW_DLE_NONE)
return (DW_DLV_ERROR);
}
- *llbuf = calloc(1, sizeof(Dwarf_Locdesc *));
- if (*llbuf == NULL) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
- return (DW_DLV_ERROR);
- }
- (*llbuf)[0] = calloc(1, sizeof(Dwarf_Locdesc));
- if ((*llbuf)[0] == NULL) {
- free(*llbuf);
- DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
- return (DW_DLV_ERROR);
- }
- if (copy_locdesc(dbg, (*llbuf)[0], at->at_ld, error) !=
- DW_DLE_NONE) {
- free((*llbuf)[0]);
- free(*llbuf);
- return (DW_DLV_ERROR);
- }
+ *llbuf = &at->at_ld;
*listlen = 1;
return (DW_DLV_OK);
default:
@@ -146,27 +107,75 @@ int
dwarf_loclist(Dwarf_Attribute at, Dwarf_Locdesc **llbuf,
Dwarf_Signed *listlen, Dwarf_Error *error)
{
- Dwarf_Locdesc **_llbuf;
- int i, ret;
-
- ret = dwarf_loclist_n(at, &_llbuf, listlen, error);
- if (ret != DW_DLV_OK)
- return (ret);
+ Dwarf_Loclist ll;
+ Dwarf_Debug dbg;
+ int ret;
- /* Only return the first location description of the list. */
- *llbuf = _llbuf[0];
+ dbg = at != NULL ? at->at_die->die_dbg : NULL;
- /* Free the rest of the list. */
- for (i = 1; i < *listlen; i++) {
- if (_llbuf[i]->ld_s)
- free(_llbuf[i]->ld_s);
- free(_llbuf[i]);
+ if (at == NULL || llbuf == NULL || listlen == NULL) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
+ return (DW_DLV_ERROR);
}
- free(_llbuf);
-
- *listlen = 1;
- return (DW_DLV_OK);
+ switch (at->at_attrib) {
+ case DW_AT_location:
+ case DW_AT_string_length:
+ case DW_AT_return_addr:
+ case DW_AT_data_member_location:
+ case DW_AT_frame_base:
+ case DW_AT_segment:
+ case DW_AT_static_link:
+ case DW_AT_use_location:
+ case DW_AT_vtable_elem_location:
+ switch (at->at_form) {
+ case DW_FORM_data4:
+ case DW_FORM_data8:
+ /*
+ * DW_FORM_data[48] can not be used as section offset
+ * since DWARF4. For DWARF[23], the application needs
+ * to determine if DW_FORM_data[48] is representing
+ * a constant or a section offset.
+ */
+ if (at->at_die->die_cu->cu_version >= 4) {
+ printf("called cu_version >= 4\n");
+ DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
+ return (DW_DLV_NO_ENTRY);
+ }
+ /* FALLTHROUGH */
+ case DW_FORM_sec_offset:
+ ret = _dwarf_loclist_find(at->at_die->die_dbg,
+ at->at_die->die_cu, at->u[0].u64, &ll, error);
+ if (ret == DW_DLE_NO_ENTRY) {
+ DWARF_SET_ERROR(dbg, error, DW_DLV_NO_ENTRY);
+ return (DW_DLV_NO_ENTRY);
+ }
+ if (ret != DW_DLE_NONE)
+ return (DW_DLV_ERROR);
+ *llbuf = ll->ll_ldlist[0];
+ *listlen = 1;
+ return (DW_DLV_OK);
+ case DW_FORM_block:
+ case DW_FORM_block1:
+ case DW_FORM_block2:
+ case DW_FORM_block4:
+ if (at->at_ld == NULL) {
+ ret = _dwarf_loc_add(at->at_die, at, error);
+ if (ret != DW_DLE_NONE)
+ return (DW_DLV_ERROR);
+ }
+ *llbuf = at->at_ld;
+ *listlen = 1;
+ return (DW_DLV_OK);
+ default:
+ DWARF_SET_ERROR(dbg, error, DW_DLE_ATTR_FORM_BAD);
+ return (DW_DLV_ERROR);
+ }
+ default:
+ /* Wrong attr supplied. */
+ DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
+ return (DW_DLV_ERROR);
+ }
}
int
@@ -175,25 +184,19 @@ dwarf_get_loclist_entry(Dwarf_Debug dbg, Dwarf_Unsigned offset,
Dwarf_Unsigned *entry_len, Dwarf_Unsigned *next_entry,
Dwarf_Error *error)
{
- Dwarf_Locdesc *ld, **llbuf;
+ Dwarf_Loclist ll, next_ll;
+ Dwarf_Locdesc *ld;
Dwarf_Section *ds;
- Dwarf_Signed listlen;
int i, ret;
- /*
- * Note that this API sometimes will not work correctly because
- * it assumes that all units have the same pointer size and offset
- * size.
- */
-
if (dbg == NULL || hipc == NULL || lopc == NULL || data == NULL ||
entry_len == NULL || next_entry == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
return (DW_DLV_ERROR);
}
- ret = _dwarf_loclist_find(dbg, STAILQ_FIRST(&dbg->dbg_cu), offset,
- &llbuf, &listlen, entry_len, error);
+ ret = _dwarf_loclist_find(dbg, STAILQ_FIRST(&dbg->dbg_cu), offset, &ll,
+ error);
if (ret == DW_DLE_NO_ENTRY) {
DWARF_SET_ERROR(dbg, error, DW_DLV_NO_ENTRY);
return (DW_DLV_NO_ENTRY);
@@ -201,8 +204,8 @@ dwarf_get_loclist_entry(Dwarf_Debug dbg, Dwarf_Unsigned offset,
return (DW_DLV_ERROR);
*hipc = *lopc = 0;
- for (i = 0; i < listlen; i++) {
- ld = llbuf[i];
+ for (i = 0; i < ll->ll_ldlen; i++) {
+ ld = ll->ll_ldlist[i];
if (i == 0) {
*hipc = ld->ld_hipc;
*lopc = ld->ld_lopc;
@@ -216,8 +219,14 @@ dwarf_get_loclist_entry(Dwarf_Debug dbg, Dwarf_Unsigned offset,
ds = _dwarf_find_section(dbg, ".debug_loc");
assert(ds != NULL);
- *data = (uint8_t *) ds->ds_data + offset;
- *next_entry = offset + *entry_len;
+ *data = (uint8_t *) ds->ds_data + ll->ll_offset;
+ *entry_len = ll->ll_length;
+
+ next_ll = TAILQ_NEXT(ll, ll_next);
+ if (next_ll != NULL)
+ *next_entry = next_ll->ll_offset;
+ else
+ *next_entry = ds->ds_size;
return (DW_DLV_OK);
}
@@ -227,49 +236,30 @@ dwarf_loclist_from_expr(Dwarf_Debug dbg, Dwarf_Ptr bytes_in,
Dwarf_Unsigned bytes_len, Dwarf_Locdesc **llbuf, Dwarf_Signed *listlen,
Dwarf_Error *error)
{
+ Dwarf_Locdesc *ld;
+ int ret;
- return (dwarf_loclist_from_expr_a(dbg, bytes_in, bytes_len,
- dbg->dbg_pointer_size, llbuf, listlen, error));
-}
+ if (dbg == NULL || bytes_in == NULL || bytes_len == 0 ||
+ llbuf == NULL || listlen == NULL) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
+ return (DW_DLV_ERROR);
+ }
-int
-dwarf_loclist_from_expr_a(Dwarf_Debug dbg, Dwarf_Ptr bytes_in,
- Dwarf_Unsigned bytes_len, Dwarf_Half addr_size, Dwarf_Locdesc **llbuf,
- Dwarf_Signed *listlen, Dwarf_Error *error)
-{
- Dwarf_Half offset_size;
- Dwarf_Small version;
+ ret = _dwarf_loc_fill_locexpr(dbg, &ld, bytes_in, bytes_len,
+ dbg->dbg_pointer_size, error);
+ if (ret != DW_DLE_NONE)
+ return (DW_DLV_ERROR);
- /*
- * Obtain offset size and DWARF version from the current
- * Compilation Unit or Type Unit. These values are needed
- * for correctly parsing DW_OP_GNU_implicit_pointer operator.
- *
- * Note that dwarf_loclist_from_expr_b() should be used instead
- * if the application knows correct values for offset size
- * and DWARF version.
- */
- if (dbg->dbg_cu_current) {
- offset_size = dbg->dbg_cu_current->cu_length_size == 4 ? 4 : 8;
- version = dbg->dbg_cu_current->cu_version;
- } else if (dbg->dbg_tu_current) {
- offset_size = dbg->dbg_tu_current->cu_length_size == 4 ? 4 : 8;
- version = dbg->dbg_tu_current->cu_version;
- } else {
- /* Default values if no CU/TU context. */
- offset_size = 4;
- version = 2; /* DWARF2 */
- }
+ *llbuf = ld;
+ *listlen = 1;
- return (dwarf_loclist_from_expr_b(dbg, bytes_in, bytes_len, addr_size,
- offset_size, version, llbuf, listlen, error));
+ return (DW_DLV_OK);
}
int
-dwarf_loclist_from_expr_b(Dwarf_Debug dbg, Dwarf_Ptr bytes_in,
- Dwarf_Unsigned bytes_len, Dwarf_Half addr_size, Dwarf_Half offset_size,
- Dwarf_Small version, Dwarf_Locdesc **llbuf, Dwarf_Signed *listlen,
- Dwarf_Error *error)
+dwarf_loclist_from_expr_a(Dwarf_Debug dbg, Dwarf_Ptr bytes_in,
+ Dwarf_Unsigned bytes_len, Dwarf_Half addr_size, Dwarf_Locdesc **llbuf,
+ Dwarf_Signed *listlen, Dwarf_Error *error)
{
Dwarf_Locdesc *ld;
int ret;
@@ -285,13 +275,8 @@ dwarf_loclist_from_expr_b(Dwarf_Debug dbg, Dwarf_Ptr bytes_in,
return (DW_DLV_ERROR);
}
- if (offset_size != 4 && offset_size != 8) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
- return (DW_DLV_ERROR);
- }
-
ret = _dwarf_loc_fill_locexpr(dbg, &ld, bytes_in, bytes_len, addr_size,
- offset_size, version, error);
+ error);
if (ret != DW_DLE_NONE)
return (DW_DLV_ERROR);
diff --git a/contrib/elftoolchain/libdwarf/dwarf_loclist_from_expr.3 b/contrib/elftoolchain/libdwarf/dwarf_loclist_from_expr.3
index d0eb88c464d2..d317f7e28004 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_loclist_from_expr.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_loclist_from_expr.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2011,2014 Kai Wang
+.\" Copyright (c) 2011 Kai Wang
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,15 +22,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_loclist_from_expr.3 3129 2014-12-21 20:06:26Z jkoshy $
+.\" $Id: dwarf_loclist_from_expr.3 2074 2011-10-27 03:34:33Z jkoshy $
.\"
-.Dd December 21, 2014
+.Dd July 6, 2011
.Os
.Dt DWARF_LOCLIST_FROM_EXPR 3
.Sh NAME
.Nm dwarf_loclist_from_expr ,
-.Nm dwarf_loclist_from_expr_a ,
-.Nm dwarf_loclist_from_expr_b
+.Nm dwarf_loclist_from_expr_a
.Nd translate DWARF location expression bytes
.Sh LIBRARY
.Lb libdwarf
@@ -55,18 +54,6 @@
.Fa "Dwarf_Signed *listlen"
.Fa "Dwarf_Error *err"
.Fc
-.Ft int
-.Fo dwarf_loclist_from_expr_b
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Ptr bytes_in"
-.Fa "Dwarf_Unsigned bytes_len"
-.Fa "Dwarf_Half addr_size"
-.Fa "Dwarf_Half offset_size"
-.Fa "Dwarf_Small version"
-.Fa "Dwarf_Locdesc **llbuf"
-.Fa "Dwarf_Signed *listlen"
-.Fa "Dwarf_Error *error"
-.Fc
.Sh DESCRIPTION
Function
.Fn dwarf_loclist_from_expr
@@ -117,21 +104,6 @@ except that it requires one additional argument
.Ar addr_size ,
which specifies the address size to use when translating the location
expression bytes.
-.Pp
-Function
-.Fn dwarf_loclist_from_expr_b
-is identical to function
-.Fn dwarf_loclist_from_expr_a
-except that it requires two additional arguments for translating the
-location expression bytes.
-Argument
-.Ar offset_size
-specifies the offset size, and argument
-.Ar version
-specifies the DWARF version.
-These values are required to correctly translate the
-.Dv DW_OP_GNU_implicit_pointer
-opcode.
.Ss Memory Management
The memory area used for the descriptor returned in argument
.Ar llbuf
diff --git a/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3 b/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3
index f68867d7f21e..5be00b8ec4ee 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010,2014 Kai Wang
+.\" Copyright (c) 2010 Kai Wang
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,15 +22,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_next_cu_header.3 3182 2015-04-10 16:08:10Z emaste $
+.\" $Id: dwarf_next_cu_header.3 2074 2011-10-27 03:34:33Z jkoshy $
.\"
-.Dd December 21, 2014
+.Dd July 24, 2010
.Os
.Dt DWARF_NEXT_CU_HEADER 3
.Sh NAME
.Nm dwarf_next_cu_header ,
-.Nm dwarf_next_cu_header_b ,
-.Nm dwarf_next_cu_header_c
+.Nm dwarf_next_cu_header_b
.Nd step through compilation units in a DWARF debug context
.Sh LIBRARY
.Lb libdwarf
@@ -58,71 +57,33 @@
.Fa "Dwarf_Unsigned *cu_next_offset"
.Fa "Dwarf_Error *err"
.Fc
-.Ft int
-.Fo dwarf_next_cu_header_c
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Bool is_info"
-.Fa "Dwarf_Unsigned *cu_length"
-.Fa "Dwarf_Half *cu_version"
-.Fa "Dwarf_Off *cu_abbrev_offset"
-.Fa "Dwarf_Half *cu_pointer_size"
-.Fa "Dwarf_Half *cu_offset_size"
-.Fa "Dwarf_Half *cu_extension_size"
-.Fa "Dwarf_Sig8 *type_signature"
-.Fa "Dwarf_Unsigned *type_offset"
-.Fa "Dwarf_Unsigned *cu_next_offset"
-.Fa "Dwarf_Error *err"
-.Fc
.Sh DESCRIPTION
-These functions are used to step through compilation or type units
+These functions are used to step through compilation unit contexts
associated with a DWARF debug context, optionally returning information
about the unit.
.Pp
Function
-.Fn dwarf_next_cu_header_c
-is the API recommended for new application code.
-Function
-.Fn dwarf_next_cu_header
-and
.Fn dwarf_next_cu_header_b
-can only operate on compilation units associated with the
-.Dq \&.debug_info
-section.
-They are less general than function
-.Fn dwarf_next_cu_header_c ,
-and are deprecated for use by new application code.
-.Pp
+is the API recommended for new application code.
Argument
.Ar dbg
should reference a DWARF debug context allocated using
.Xr dwarf_init 3 .
-If argument
-.Ar is_info
-is set to 1,
-the function returns information for compilation units found in the
-.Dq \&.debug_info
-section.
-If argument
-.Ar is_info
-is set to 0,
-the function returns information for type units found in the
-.Dq \&.debug_types
-sections.
Argument
.Ar cu_length
should point to a location that will be set to the
-length of the compilation or type unit.
+length of the compilation unit.
Argument
.Ar cu_version
should point to a location that will be set to the
-version number for the compilation or type unit.
+version number for the compilation unit.
Argument
.Ar cu_abbrev_offset
should point to a location that will be set to the
starting offset (in the
.Dq .debug_abbrev
section) of the set of debugging information entry abbreviations
-associated with this compilation or type unit.
+associated with this compilation unit.
Argument
.Ar cu_pointer_size
should point to a location that will be set to the
@@ -131,7 +92,7 @@ underlying object being debugged.
Argument
.Ar cu_offset_size
should point to a location that will be set to the
-size in bytes for a DWARF offset in the compilation or type unit.
+size in bytes for a DWARF offset in the compilation unit.
Argument
.Ar cu_extension_size
is only needed for processing MIPS/IRIX objects that use
@@ -139,26 +100,10 @@ a non-standard DWARF format.
It should point to a location that will be set to 4 for normal
objects and to 0 for non-standard ones.
Argument
-.Ar type_signature
-and
-.Ar type_offset
-is only needed for processing type units.
-Argument
-.Ar type_signature
-should point to a location that will be set to the 64-bit unique signature
-of the type described in the type unit.
-Argument
-.Ar type_offset
-should point to a location that will be set to the offset of the debugging
-information entry that describes the type.
-Argument
.Ar cu_next_offset
should point to a location that will be set to the
offset of the next compilation unit header in the
.Dq \&.debug_info
-section,
-or the offset of the next type unit header in the
-.Dq \&.debug_types
section.
Argument
.Ar err
@@ -166,23 +111,42 @@ should point to a location that will hold an error descriptor in case
of an error.
.Pp
Function
-.Fn dwarf_next_cu_header_b
-is identical to function
-.Fn dwarf_next_cu_header_c
-except that it does not provide arguments
-.Ar is_info ,
-.Ar type_signature
-and
-.Ar type_offset .
-.Pp
-Function
.Fn dwarf_next_cu_header
-is identical to function
-.Fn dwarf_next_cu_header_b
-except that it does not provide arguments
-.Ar cu_offset_size
-and
-.Ar cu_extension_size .
+is less general than
+.Fn dwarf_next_cu_header_b ,
+and is deprecated for use by new application code.
+Argument
+.Ar dbg
+should reference a DWARF debug context allocated using
+.Xr dwarf_init 3 .
+Argument
+.Ar cu_length
+should point to a location that will be set to the
+length of the compilation unit.
+Argument
+.Ar cu_version
+should point to a location that will be set to the
+version number for the compilation unit.
+Argument
+.Ar cu_abbrev_offset
+should point to a location that will be set to the
+starting offset in the
+.Dq .debug_abbrev
+section of the set of debugging information entry abbreviations
+associated with this compilation unit.
+Argument
+.Ar cu_pointer_size
+should point to a location that will be set to the
+size of an address in bytes for the machine architecture of the
+underlying debugging object.
+Argument
+.Ar cu_next_offset
+should point to a location that will be set to the
+offset of the next compilation unit.
+Argument
+.Ar err
+should point to a location that will hold an error descriptor in case
+of an error.
.Pp
A value of NULL may be used for any of the arguments
.Ar cu_length ,
@@ -191,78 +155,30 @@ A value of NULL may be used for any of the arguments
.Ar cu_pointer_size ,
.Ar cu_offset_size ,
.Ar cu_extension_size ,
-.Ar type_signature ,
-.Ar type_offset ,
.Ar cu_next_offset
and
.Ar err
if the caller is not interested in the respective value.
.Ss Iterating Through Compilation Units in a Debug Context
.Pp
-The first call to function
-.Fn dwarf_next_cu_header_c
-for a given debug context with argument
-.Ar is_info
-set to 1 will return information about the first
-compilation unit in the
-.Dq \&.debug_info
-section.
-Subsequent calls to the function will iterate through the remaining
-compilation units in the section.
-On stepping past the last compilation unit in the section,
-function
-.Fn dwarf_next_cu_header_c
-returns
-.Dv DW_DLV_NO_ENTRY
-and resets its internal state.
-The next call to the function will restart from the first compilation
-unit in the section.
-.Ss Iterating Through Type Units in a Debug Context
-When a DWARF debug context is allocated using
-.Xr dwarf_init 3 ,
-an internal pointer associated with the context will point to the first
-.Dq \&.debug_types
-section found in the debug object.
-The first call to function
-.Fn dwarf_next_cu_header_c
-for the debug context with argument
-.Ar is_info
-set to 0 will return information about the first
-type unit in that
-.Dq \&.debug_types
-section.
-Subsequent calls to the function will iterate through the remaining
-type units in the section.
-On stepping past the last type unit in the debug context,
-function
-.Fn dwarf_next_cu_header_c
-returns
-.Dv DW_DLV_NO_ENTRY
-and resets its internal state.
-The next call to the function will restart from the first type
-unit in the
-.Dq \&.debug_types
-section.
-.Pp
-If the debug object contains multiple
-.Dq \&.debug_types
-sections, the function
-.Fn dwarf_next_types_section
-can be called to move the internal pointer to the next
-.Dq \&.debug_types
-section.
-As a result, subsequent calls of the function
-.Fn dwarf_next_cu_header_c
-will operate on the new
-.Dq \&.debug_types
-section.
-Function
-.Fn dwarf_next_types_section
-returns
+The first call to functions
+.Fn dwarf_next_cu_header_b
+and
+.Fn dwarf_next_cu_header
+for a given debug context will return information about the first
+compilation unit in the debug context.
+Subsequent calls to these functions will iterate through the remaining
+compilation units in the debug context.
+On stepping past the last compilation unit in the debug context,
+functions
+.Fn dwarf_next_cu_header
+and
+.Fn dwarf_next_cu_header_b
+return
.Dv DW_DLV_NO_ENTRY
-when there are no more
-.Dq \&.debug_types
-sections left in the debug object.
+and reset their internal state.
+The next call to these functions will restart from the first compilation
+unit in the debug context.
.Sh RETURN VALUES
On success, these functions return
.Dv DW_DLV_OK .
@@ -284,5 +200,4 @@ was NULL.
.Xr dwarf 3 ,
.Xr dwarf_get_cu_die_offset_given_cu_header_offset 3 ,
.Xr dwarf_init 3 ,
-.Xr dwarf_next_types_section 3 ,
.Xr dwarf_siblingof 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_next_types_section.3 b/contrib/elftoolchain/libdwarf/dwarf_next_types_section.3
deleted file mode 100644
index 98ff70d82668..000000000000
--- a/contrib/elftoolchain/libdwarf/dwarf_next_types_section.3
+++ /dev/null
@@ -1,134 +0,0 @@
-.\" Copyright (c) 2014 Kai Wang
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Id: dwarf_next_types_section.3 3116 2014-12-20 18:26:55Z jkoshy $
-.\"
-.Dd December 20, 2014
-.Os
-.Dt DWARF_NEXT_TYPES_SECTION 3
-.Sh NAME
-.Nm dwarf_next_types_section
-.Nd step through .debug_types sections in a debug context
-.Sh LIBRARY
-.Lb libdwarf
-.Sh SYNOPSIS
-.In libdwarf.h
-.Ft int
-.Fo dwarf_next_types_section
-.Fa "Dwarf_Debug dbg"
-.Fa "Dwarf_Error *err"
-.Fc
-.Sh DESCRIPTION
-Function
-.Fn dwarf_next_types_section
-steps through the
-.Dq \&.debug_types
-sections found in a debug context.
-.Pp
-Argument
-.Ar dbg
-should reference a DWARF debug context allocated using
-.Xr dwarf_init 3 .
-Argument
-.Ar err
-should point to a location that will hold an error descriptor in case
-of an error.
-.Pp
-When a DWARF debug context is allocated using
-.Xr dwarf_init 3 ,
-an internal pointer associated with the context will point to the
-first
-.Dq \&.debug_types
-section present in the debug object.
-When the application calls function
-.Fn dwarf_next_types_section ,
-this internal pointer will move to the next
-.Dq \&.debug_types
-section present.
-On stepping past the last
-.Dq \&.debug_types
-section left in the debug context, function
-.Fn dwarf_next_types_section
-returns
-.Dv DW_DLV_NO_ENTRY .
-The next call to the function will restart from the first
-.Dq \&.debug_types
-section in the debug context.
-.Pp
-Application code should call function
-.Xr dwarf_next_cu_header_c 3
-to iterate though the type units associated with the current
-.Dq \&.debug_types
-section.
-.Sh RETURN VALUES
-On success, function
-.Fn dwarf_next_types_section
-returns
-.Dv DW_DLV_OK .
-.Pp
-In case of an error, it returns
-.Dv DW_DLV_ERROR
-and sets argument
-.Ar err .
-When there are no more
-.Dq \&.debug_types
-sections left to traverse, it returns
-.Dv DW_DLV_NO_ENTRY .
-.Sh COMPATIBILITY
-This function is an extension to the
-.Xr DWARF 3
-API.
-.Sh ERRORS
-The
-.Fn dwarf_next_types_section
-function may fail with the following errors:
-.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
-.It Bq Er DW_DLE_ARGUMENT
-Argument
-.Va dbg
-was NULL.
-.El
-.Sh EXAMPLES
-To iterate though every type unit in all the
-.Dq \&.debug_types
-sections found in a debug context:
-.Bd -literal -offset indent
-Dwarf_Debug dbg;
-Dwarf_Sig8 sig8;
-Dwarf_Unsigned typeoff;
-Dwarf_Error de;
-
-\&... allocate dbg using dwarf_init() etc ...
-
-do {
- while ((ret = dwarf_next_cu_header_c(dbg, 0, NULL, NULL, NULL,
- NULL, NULL, NULL, &sig8, &typeoff, NULL, &de)) == DW_DLV_OK) {
- /* Access DIEs etc ... */
- }
-} while (dwarf_next_types_section(dbg, &de) == DW_DLV_OK);
-.Ed
-.Sh SEE ALSO
-.Xr dwarf 3 ,
-.Xr dwarf_init 3 ,
-.Xr dwarf_next_cu_header_c 3
diff --git a/contrib/elftoolchain/libdwarf/dwarf_producer_init.3 b/contrib/elftoolchain/libdwarf/dwarf_producer_init.3
index b8ca6a9ce657..717335e45119 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_producer_init.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_producer_init.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_producer_init.3 3182 2015-04-10 16:08:10Z emaste $
+.\" $Id: dwarf_producer_init.3 2074 2011-10-27 03:34:33Z jkoshy $
.\"
.Dd August 20, 2011
.Os
@@ -58,7 +58,7 @@ descriptor representing a DWARF producer instance.
.Pp
The argument
.Ar errhand
-should contain the address of a function to be called in case of an
+should contain the adddress of a function to be called in case of an
error.
If this argument is
.Dv NULL ,
diff --git a/contrib/elftoolchain/libdwarf/dwarf_ranges.c b/contrib/elftoolchain/libdwarf/dwarf_ranges.c
index 2e01da553f7e..9ad60832350d 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_ranges.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_ranges.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_ranges.c 3029 2014-04-21 23:26:02Z kaiwang27 $");
+ELFTC_VCSID("$Id: dwarf_ranges.c 2075 2011-10-27 03:47:28Z jkoshy $");
static int
_dwarf_get_ranges(Dwarf_Debug dbg, Dwarf_CU cu, Dwarf_Off off,
@@ -63,7 +63,7 @@ dwarf_get_ranges(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Ranges **ranges,
}
if (!dbg->dbg_info_loaded) {
- if (_dwarf_info_load(dbg, 1, 1, error) != DW_DLE_NONE)
+ if (_dwarf_info_load(dbg, 1, error) != DW_DLE_NONE)
return (DW_DLV_ERROR);
}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_reloc.c b/contrib/elftoolchain/libdwarf/dwarf_reloc.c
index 0430e4db49ce..5e96db3c6fd8 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_reloc.c
+++ b/contrib/elftoolchain/libdwarf/dwarf_reloc.c
@@ -26,15 +26,15 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: dwarf_reloc.c 3161 2015-02-15 21:43:36Z emaste $");
+ELFTC_VCSID("$Id: dwarf_reloc.c 2075 2011-10-27 03:47:28Z jkoshy $");
int
dwarf_set_reloc_application(int apply)
{
int oldapply;
- oldapply = _libdwarf.applyreloc;
- _libdwarf.applyreloc = apply;
+ oldapply = _libdwarf.applyrela;
+ _libdwarf.applyrela = apply;
return (oldapply);
}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_sections.c b/contrib/elftoolchain/libdwarf/dwarf_sections.c
deleted file mode 100644
index d3c1379378fe..000000000000
--- a/contrib/elftoolchain/libdwarf/dwarf_sections.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * Copyright (c) 2014 Kai Wang
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "_libdwarf.h"
-
-ELFTC_VCSID("$Id: dwarf_sections.c 3036 2014-05-05 19:19:31Z kaiwang27 $");
-
-#define SET(N, V) \
- do { \
- if ((N) != NULL) \
- *(N) = (V); \
- } while (0)
-
-int
-dwarf_get_section_max_offsets_b(Dwarf_Debug dbg, Dwarf_Unsigned *debug_info,
- Dwarf_Unsigned *debug_abbrev, Dwarf_Unsigned *debug_line,
- Dwarf_Unsigned *debug_loc, Dwarf_Unsigned *debug_aranges,
- Dwarf_Unsigned *debug_macinfo, Dwarf_Unsigned *debug_pubnames,
- Dwarf_Unsigned *debug_str, Dwarf_Unsigned *debug_frame,
- Dwarf_Unsigned *debug_ranges, Dwarf_Unsigned *debug_pubtypes,
- Dwarf_Unsigned *debug_types)
-{
- const char *n;
- Dwarf_Unsigned sz;
- int i;
-
- if (dbg == NULL)
- return (DW_DLV_ERROR);
-
- SET(debug_info, 0);
- SET(debug_abbrev, 0);
- SET(debug_line, 0);
- SET(debug_loc, 0);
- SET(debug_aranges, 0);
- SET(debug_macinfo, 0);
- SET(debug_pubnames, 0);
- SET(debug_str, 0);
- SET(debug_frame, 0);
- SET(debug_ranges, 0);
- SET(debug_pubtypes, 0);
- SET(debug_types, 0);
-
- for (i = 0; (Dwarf_Unsigned) i < dbg->dbg_seccnt; i++) {
- n = dbg->dbg_section[i].ds_name;
- sz = dbg->dbg_section[i].ds_size;
- if (!strcmp(n, ".debug_info"))
- SET(debug_info, sz);
- else if (!strcmp(n, ".debug_abbrev"))
- SET(debug_abbrev, sz);
- else if (!strcmp(n, ".debug_line"))
- SET(debug_line, sz);
- else if (!strcmp(n, ".debug_loc"))
- SET(debug_loc, sz);
- else if (!strcmp(n, ".debug_aranges"))
- SET(debug_aranges, sz);
- else if (!strcmp(n, ".debug_macinfo"))
- SET(debug_macinfo, sz);
- else if (!strcmp(n, ".debug_pubnames"))
- SET(debug_pubnames, sz);
- else if (!strcmp(n, ".debug_str"))
- SET(debug_str, sz);
- else if (!strcmp(n, ".debug_frame"))
- SET(debug_frame, sz);
- else if (!strcmp(n, ".debug_ranges"))
- SET(debug_ranges, sz);
- else if (!strcmp(n, ".debug_pubtypes"))
- SET(debug_pubtypes, sz);
- else if (!strcmp(n, ".debug_types"))
- SET(debug_types, sz);
- }
-
- return (DW_DLV_OK);
-}
-
-int
-dwarf_get_section_max_offsets(Dwarf_Debug dbg, Dwarf_Unsigned *debug_info,
- Dwarf_Unsigned *debug_abbrev, Dwarf_Unsigned *debug_line,
- Dwarf_Unsigned *debug_loc, Dwarf_Unsigned *debug_aranges,
- Dwarf_Unsigned *debug_macinfo, Dwarf_Unsigned *debug_pubnames,
- Dwarf_Unsigned *debug_str, Dwarf_Unsigned *debug_frame,
- Dwarf_Unsigned *debug_ranges, Dwarf_Unsigned *debug_pubtypes)
-{
-
- return (dwarf_get_section_max_offsets(dbg, debug_info, debug_abbrev,
- debug_line, debug_loc, debug_aranges, debug_macinfo,
- debug_pubnames, debug_str, debug_frame, debug_ranges,
- debug_pubtypes));
-}
diff --git a/contrib/elftoolchain/libdwarf/dwarf_set_reloc_application.3 b/contrib/elftoolchain/libdwarf/dwarf_set_reloc_application.3
index db40cbb2522a..d53c746d1be2 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_set_reloc_application.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_set_reloc_application.3
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_set_reloc_application.3 3161 2015-02-15 21:43:36Z emaste $
+.\" $Id: dwarf_set_reloc_application.3 2075 2011-10-27 03:47:28Z jkoshy $
.\"
-.Dd February 11, 2015
+.Dd June 26, 2011
.Os
.Dt DWARF_SET_RELOC_APPLICATION 3
.Sh NAME
@@ -47,8 +47,6 @@ handled by the DWARF(3) library.
If the argument
.Ar apply
holds a non-zero value, the library will process all the relevant
-.Dq ".rel"
-and
.Dq ".rela"
relocation sections and will apply the relocation records found to
their corresponding DWARF sections.
diff --git a/contrib/elftoolchain/libdwarf/dwarf_whatattr.3 b/contrib/elftoolchain/libdwarf/dwarf_whatattr.3
index d7f6dd4e38b9..7c9a6d04bfcb 100644
--- a/contrib/elftoolchain/libdwarf/dwarf_whatattr.3
+++ b/contrib/elftoolchain/libdwarf/dwarf_whatattr.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dwarf_whatattr.3 3181 2015-04-10 13:22:51Z emaste $
+.\" $Id: dwarf_whatattr.3 2075 2011-10-27 03:47:28Z jkoshy $
.\"
.Dd May 22, 2010
.Os
@@ -51,7 +51,7 @@ and writes it to the location pointed to by argument
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
-of an error.
+of an error.
.Sh RETURN VALUES
On success, function
.Fn dwarf_whatattr
@@ -72,7 +72,6 @@ Either of argument
or
.Va retcode
was NULL.
-.El
.Sh SEE ALSO
.Xr dwarf 3 ,
.Xr dwarf_attr 3 ,
diff --git a/contrib/elftoolchain/libdwarf/libdwarf.c b/contrib/elftoolchain/libdwarf/libdwarf.c
index b2406cb73fb9..5f487624717f 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf.c
@@ -26,10 +26,10 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf.c 3161 2015-02-15 21:43:36Z emaste $");
+ELFTC_VCSID("$Id: libdwarf.c 2070 2011-10-27 03:05:32Z jkoshy $");
struct _libdwarf_globals _libdwarf = {
.errhand = NULL,
.errarg = NULL,
- .applyreloc = 1
+ .applyrela = 1
};
diff --git a/contrib/elftoolchain/libdwarf/libdwarf.h b/contrib/elftoolchain/libdwarf/libdwarf.h
index 0cb8b1ae8cbc..105a0e7d96d2 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf.h
+++ b/contrib/elftoolchain/libdwarf/libdwarf.h
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
- * Copyright (c) 2009-2011,2014 Kai Wang
+ * Copyright (c) 2009-2011 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: libdwarf.h 3174 2015-03-27 17:13:41Z emaste $
+ * $Id: libdwarf.h 2576 2012-09-13 09:16:11Z jkoshy $
*/
#ifndef _LIBDWARF_H_
@@ -47,6 +47,7 @@ typedef struct _Dwarf_ArangeSet *Dwarf_ArangeSet;
typedef struct _Dwarf_Attribute *Dwarf_Attribute;
typedef struct _Dwarf_Attribute *Dwarf_P_Attribute;
typedef struct _Dwarf_AttrDef *Dwarf_AttrDef;
+typedef struct _Dwarf_CU *Dwarf_CU;
typedef struct _Dwarf_Cie *Dwarf_Cie;
typedef struct _Dwarf_Cie *Dwarf_P_Cie;
typedef struct _Dwarf_Debug *Dwarf_Debug;
@@ -59,6 +60,7 @@ typedef struct _Dwarf_FrameSec *Dwarf_FrameSec;
typedef struct _Dwarf_Line *Dwarf_Line;
typedef struct _Dwarf_LineFile *Dwarf_LineFile;
typedef struct _Dwarf_LineInfo *Dwarf_LineInfo;
+typedef struct _Dwarf_Loclist *Dwarf_Loclist;
typedef struct _Dwarf_MacroSet *Dwarf_MacroSet;
typedef struct _Dwarf_NamePair *Dwarf_NamePair;
typedef struct _Dwarf_NamePair *Dwarf_Func;
@@ -439,14 +441,11 @@ enum Dwarf_ISA {
DW_ISA_SPARC,
DW_ISA_X86,
DW_ISA_X86_64,
- DW_ISA_AARCH64,
DW_ISA_MAX
};
/* Function prototype definitions. */
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
Dwarf_P_Attribute dwarf_add_AT_comp_dir(Dwarf_P_Die, char *, Dwarf_Error *);
Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die, Dwarf_Signed,
Dwarf_Error *);
@@ -520,7 +519,6 @@ int dwarf_attr(Dwarf_Die, Dwarf_Half, Dwarf_Attribute *,
Dwarf_Error *);
int dwarf_attrlist(Dwarf_Die, Dwarf_Attribute **,
Dwarf_Signed *, Dwarf_Error *);
-int dwarf_attroffset(Dwarf_Attribute, Dwarf_Off *, Dwarf_Error *);
int dwarf_attrval_flag(Dwarf_Die, Dwarf_Half, Dwarf_Bool *,
Dwarf_Error *);
int dwarf_attrval_signed(Dwarf_Die, Dwarf_Half, Dwarf_Signed *,
@@ -628,9 +626,6 @@ int dwarf_get_cu_die_offset(Dwarf_Arange, Dwarf_Off *,
Dwarf_Error *);
int dwarf_get_cu_die_offset_given_cu_header_offset(Dwarf_Debug,
Dwarf_Off, Dwarf_Off *, Dwarf_Error *);
-int dwarf_get_cu_die_offset_given_cu_header_offset_b(Dwarf_Debug,
- Dwarf_Off, Dwarf_Bool, Dwarf_Off *, Dwarf_Error *);
-Dwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die);
int dwarf_get_elf(Dwarf_Debug, Elf **, Dwarf_Error *);
int dwarf_get_fde_at_pc(Dwarf_Fde *, Dwarf_Addr, Dwarf_Fde *,
Dwarf_Addr *, Dwarf_Addr *, Dwarf_Error *);
@@ -683,16 +678,6 @@ int dwarf_get_relocation_info_count(Dwarf_P_Debug, Dwarf_Unsigned *,
int *, Dwarf_Error *);
Dwarf_Ptr dwarf_get_section_bytes(Dwarf_P_Debug, Dwarf_Signed,
Dwarf_Signed *, Dwarf_Unsigned *, Dwarf_Error *);
-int dwarf_get_section_max_offsets(Dwarf_Debug, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Unsigned *, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Unsigned *, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Unsigned *, Dwarf_Unsigned *,
- Dwarf_Unsigned *);
-int dwarf_get_section_max_offsets_b(Dwarf_Debug, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Unsigned *, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Unsigned *, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Unsigned *, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Unsigned *);
int dwarf_get_str(Dwarf_Debug, Dwarf_Off, char **, Dwarf_Signed *,
Dwarf_Error *);
int dwarf_get_types(Dwarf_Debug, Dwarf_Type **, Dwarf_Signed *,
@@ -715,8 +700,6 @@ int dwarf_hasattr(Dwarf_Die, Dwarf_Half, Dwarf_Bool *,
int dwarf_hasform(Dwarf_Attribute, Dwarf_Half, Dwarf_Bool *,
Dwarf_Error *);
int dwarf_highpc(Dwarf_Die, Dwarf_Addr *, Dwarf_Error *);
-int dwarf_highpc_b(Dwarf_Die, Dwarf_Addr *, Dwarf_Half *,
- enum Dwarf_Form_Class *, Dwarf_Error *);
int dwarf_init(int, int, Dwarf_Handler, Dwarf_Ptr, Dwarf_Debug *,
Dwarf_Error *);
int dwarf_line_srcfileno(Dwarf_Line, Dwarf_Unsigned *,
@@ -739,10 +722,6 @@ int dwarf_loclist_from_expr(Dwarf_Debug, Dwarf_Ptr, Dwarf_Unsigned,
int dwarf_loclist_from_expr_a(Dwarf_Debug, Dwarf_Ptr,
Dwarf_Unsigned, Dwarf_Half, Dwarf_Locdesc **,
Dwarf_Signed *, Dwarf_Error *);
-int dwarf_loclist_from_expr_b(Dwarf_Debug, Dwarf_Ptr,
- Dwarf_Unsigned, Dwarf_Half, Dwarf_Half,
- Dwarf_Small, Dwarf_Locdesc **, Dwarf_Signed *,
- Dwarf_Error *);
int dwarf_loclist_n(Dwarf_Attribute, Dwarf_Locdesc ***,
Dwarf_Signed *, Dwarf_Error *);
int dwarf_lowpc(Dwarf_Die, Dwarf_Addr *, Dwarf_Error *);
@@ -756,18 +735,11 @@ int dwarf_next_cu_header(Dwarf_Debug, Dwarf_Unsigned *,
int dwarf_next_cu_header_b(Dwarf_Debug, Dwarf_Unsigned *,
Dwarf_Half *, Dwarf_Off *, Dwarf_Half *, Dwarf_Half *,
Dwarf_Half *, Dwarf_Unsigned *, Dwarf_Error *);
-int dwarf_next_cu_header_c(Dwarf_Debug, Dwarf_Bool,
- Dwarf_Unsigned *, Dwarf_Half *, Dwarf_Off *, Dwarf_Half *,
- Dwarf_Half *, Dwarf_Half *, Dwarf_Sig8 *, Dwarf_Unsigned *,
- Dwarf_Unsigned *, Dwarf_Error *);
-int dwarf_next_types_section(Dwarf_Debug, Dwarf_Error *);
int dwarf_object_finish(Dwarf_Debug, Dwarf_Error *);
int dwarf_object_init(Dwarf_Obj_Access_Interface *, Dwarf_Handler,
Dwarf_Ptr, Dwarf_Debug *, Dwarf_Error *);
int dwarf_offdie(Dwarf_Debug, Dwarf_Off, Dwarf_Die *,
Dwarf_Error *);
-int dwarf_offdie_b(Dwarf_Debug, Dwarf_Off, Dwarf_Bool, Dwarf_Die *,
- Dwarf_Error *);
Dwarf_Unsigned dwarf_producer_finish(Dwarf_P_Debug, Dwarf_Error *);
Dwarf_P_Debug dwarf_producer_init(Dwarf_Unsigned, Dwarf_Callback_Func,
Dwarf_Handler, Dwarf_Ptr, Dwarf_Error *);
@@ -793,8 +765,6 @@ int dwarf_set_reloc_application(int);
Dwarf_Ptr dwarf_seterrarg(Dwarf_Debug, Dwarf_Ptr);
Dwarf_Handler dwarf_seterrhand(Dwarf_Debug, Dwarf_Handler);
int dwarf_siblingof(Dwarf_Debug, Dwarf_Die, Dwarf_Die *, Dwarf_Error *);
-int dwarf_siblingof_b(Dwarf_Debug, Dwarf_Die, Dwarf_Die *, Dwarf_Bool,
- Dwarf_Error *);
int dwarf_srcfiles(Dwarf_Die, char ***, Dwarf_Signed *, Dwarf_Error *);
int dwarf_srclang(Dwarf_Die, Dwarf_Unsigned *, Dwarf_Error *);
int dwarf_srclines(Dwarf_Die, Dwarf_Line **, Dwarf_Signed *,
@@ -833,8 +803,6 @@ int dwarf_whatattr(Dwarf_Attribute, Dwarf_Half *, Dwarf_Error *);
int dwarf_whatform(Dwarf_Attribute, Dwarf_Half *, Dwarf_Error *);
int dwarf_whatform_direct(Dwarf_Attribute, Dwarf_Half *,
Dwarf_Error *);
-#ifdef __cplusplus
-}
-#endif
+__END_DECLS
#endif /* !_LIBDWARF_H_ */
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c b/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c
index abcc2fda9580..f4a395df0360 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c
@@ -27,7 +27,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_abbrev.c 3136 2014-12-24 16:04:38Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_abbrev.c 2070 2011-10-27 03:05:32Z jkoshy $");
int
_dwarf_abbrev_add(Dwarf_CU cu, uint64_t entry, uint64_t tag, uint8_t children,
@@ -180,9 +180,7 @@ _dwarf_abbrev_find(Dwarf_CU cu, uint64_t entry, Dwarf_Abbrev *abp,
/* Load and search the abbrev table. */
ds = _dwarf_find_section(cu->cu_dbg, ".debug_abbrev");
- if (ds == NULL)
- return (DW_DLE_NO_ENTRY);
-
+ assert(ds != NULL);
offset = cu->cu_abbrev_offset_cur;
while (offset < ds->ds_size) {
ret = _dwarf_abbrev_parse(cu->cu_dbg, cu, &offset, &ab, error);
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_arange.c b/contrib/elftoolchain/libdwarf/libdwarf_arange.c
index eefb63ba6b10..75434f6ae20b 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_arange.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_arange.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_arange.c 3029 2014-04-21 23:26:02Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_arange.c 2070 2011-10-27 03:05:32Z jkoshy $");
void
_dwarf_arange_cleanup(Dwarf_Debug dbg)
@@ -67,7 +67,7 @@ _dwarf_arange_init(Dwarf_Debug dbg, Dwarf_Error *error)
return (DW_DLE_NONE);
if (!dbg->dbg_info_loaded) {
- ret = _dwarf_info_load(dbg, 1, 1, error);
+ ret = _dwarf_info_load(dbg, 1, error);
if (ret != DW_DLE_NONE)
return (ret);
}
@@ -137,8 +137,8 @@ _dwarf_arange_init(Dwarf_Debug dbg, Dwarf_Error *error)
/* Build arange array. */
if (dbg->dbg_arange_cnt > 0) {
- if ((dbg->dbg_arange_array = malloc(dbg->dbg_arange_cnt *
- sizeof(Dwarf_Arange))) == NULL) {
+ if ((dbg->dbg_arange_array = malloc(dbg->dbg_arange_cnt *
+ sizeof(struct _Dwarf_Arange))) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
ret = DW_DLE_MEMORY;
goto fail_cleanup;
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_attr.c b/contrib/elftoolchain/libdwarf/libdwarf_attr.c
index dfbbc484c352..a7fb71cd1f24 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_attr.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_attr.c
@@ -27,7 +27,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_attr.c 3064 2014-06-06 19:35:55Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_attr.c 2966 2013-09-21 14:40:14Z kaiwang27 $");
int
_dwarf_attr_alloc(Dwarf_Die die, Dwarf_Attribute *atp, Dwarf_Error *error)
@@ -106,7 +106,6 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, uint64_t *offsetp,
ret = DW_DLE_NONE;
memset(&atref, 0, sizeof(atref));
atref.at_die = die;
- atref.at_offset = *offsetp;
atref.at_attrib = ad->ad_attrib;
atref.at_form = indirect ? form : ad->ad_form;
atref.at_indirect = indirect;
@@ -163,7 +162,7 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, uint64_t *offsetp,
if (cu->cu_version == 2)
atref.u[0].u64 = dbg->read(ds->ds_data, offsetp,
cu->cu_pointer_size);
- else
+ else if (cu->cu_version == 3)
atref.u[0].u64 = dbg->read(ds->ds_data, offsetp,
dwarf_size);
break;
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_die.c b/contrib/elftoolchain/libdwarf/libdwarf_die.c
index b7796d3cb6b0..4572875ed0d7 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_die.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_die.c
@@ -27,7 +27,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_die.c 3039 2014-05-18 15:10:56Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_die.c 2948 2013-05-30 21:25:52Z kaiwang27 $");
int
_dwarf_die_alloc(Dwarf_Debug dbg, Dwarf_Die *ret_die, Dwarf_Error *error)
@@ -81,7 +81,6 @@ Dwarf_Die
_dwarf_die_find(Dwarf_Die die, Dwarf_Unsigned off)
{
Dwarf_Debug dbg;
- Dwarf_Section *ds;
Dwarf_CU cu;
Dwarf_Die die1;
Dwarf_Error de;
@@ -89,10 +88,9 @@ _dwarf_die_find(Dwarf_Die die, Dwarf_Unsigned off)
cu = die->die_cu;
dbg = die->die_dbg;
- ds = cu->cu_is_info ? dbg->dbg_info_sec : dbg->dbg_types_sec;
- ret = _dwarf_die_parse(dbg, ds, cu, cu->cu_dwarf_size, off,
- cu->cu_next_offset, &die1, 0, &de);
+ ret = _dwarf_die_parse(dbg, dbg->dbg_info_sec, cu, cu->cu_dwarf_size,
+ off, cu->cu_next_offset, &die1, 0, &de);
if (ret == DW_DLE_NONE)
return (die1);
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c b/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
index af2d370b980c..1e374f2d793e 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_elf_init.c 3161 2015-02-15 21:43:36Z emaste $");
+ELFTC_VCSID("$Id: libdwarf_elf_init.c 2972 2013-12-23 06:46:04Z kaiwang27 $");
static const char *debug_name[] = {
".debug_abbrev",
@@ -50,46 +50,32 @@ static const char *debug_name[] = {
};
static void
-_dwarf_elf_write_reloc(Dwarf_Debug dbg, Elf_Data *symtab_data, int endian,
- void *buf, uint64_t offset, GElf_Xword r_info, GElf_Sxword r_addend)
-{
- GElf_Sym sym;
- int size;
-
- if (gelf_getsym(symtab_data, GELF_R_SYM(r_info), &sym) == NULL)
- return;
- if ((size = _dwarf_get_reloc_size(dbg, GELF_R_TYPE(r_info))) == 0)
- return; /* Unknown or non-absolute relocation. */
- if (endian == ELFDATA2MSB)
- _dwarf_write_msb(buf, &offset, sym.st_value + r_addend, size);
- else
- _dwarf_write_lsb(buf, &offset, sym.st_value + r_addend, size);
-}
-
-static void
-_dwarf_elf_apply_rel_reloc(Dwarf_Debug dbg, void *buf, Elf_Data *rel_data,
+_dwarf_elf_apply_reloc(Dwarf_Debug dbg, void *buf, Elf_Data *rel_data,
Elf_Data *symtab_data, int endian)
{
- GElf_Rel rel;
- int j;
+ Dwarf_Unsigned type;
+ GElf_Rela rela;
+ GElf_Sym sym;
+ size_t symndx;
+ uint64_t offset;
+ int size, j;
j = 0;
- while (gelf_getrel(rel_data, j++, &rel) != NULL)
- _dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
- rel.r_offset, rel.r_info, 0);
-}
+ while (gelf_getrela(rel_data, j++, &rela) != NULL) {
+ symndx = GELF_R_SYM(rela.r_info);
+ type = GELF_R_TYPE(rela.r_info);
-static void
-_dwarf_elf_apply_rela_reloc(Dwarf_Debug dbg, void *buf, Elf_Data *rel_data,
- Elf_Data *symtab_data, int endian)
-{
- GElf_Rela rela;
- int j;
+ if (gelf_getsym(symtab_data, symndx, &sym) == NULL)
+ continue;
- j = 0;
- while (gelf_getrela(rel_data, j++, &rela) != NULL)
- _dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
- rela.r_offset, rela.r_info, rela.r_addend);
+ offset = rela.r_offset;
+ size = _dwarf_get_reloc_size(dbg, type);
+
+ if (endian == ELFDATA2MSB)
+ _dwarf_write_msb(buf, &offset, rela.r_addend, size);
+ else
+ _dwarf_write_lsb(buf, &offset, rela.r_addend, size);
+ }
}
static int
@@ -118,8 +104,7 @@ _dwarf_elf_relocate(Dwarf_Debug dbg, Elf *elf, Dwarf_Elf_Data *ed, size_t shndx,
return (DW_DLE_ELF);
}
- if ((sh.sh_type != SHT_REL && sh.sh_type != SHT_RELA) ||
- sh.sh_size == 0)
+ if (sh.sh_type != SHT_RELA || sh.sh_size == 0)
continue;
if (sh.sh_info == shndx && sh.sh_link == symtab) {
@@ -140,12 +125,8 @@ _dwarf_elf_relocate(Dwarf_Debug dbg, Elf *elf, Dwarf_Elf_Data *ed, size_t shndx,
}
memcpy(ed->ed_alloc, ed->ed_data->d_buf,
ed->ed_data->d_size);
- if (sh.sh_type == SHT_REL)
- _dwarf_elf_apply_rel_reloc(dbg, ed->ed_alloc,
- rel, symtab_data, eh.e_ident[EI_DATA]);
- else
- _dwarf_elf_apply_rela_reloc(dbg, ed->ed_alloc,
- rel, symtab_data, eh.e_ident[EI_DATA]);
+ _dwarf_elf_apply_reloc(dbg, ed->ed_alloc, rel,
+ symtab_data, eh.e_ident[EI_DATA]);
return (DW_DLE_NONE);
}
@@ -301,7 +282,7 @@ _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_Error *error)
}
}
- if (_libdwarf.applyreloc) {
+ if (_libdwarf.applyrela) {
if (_dwarf_elf_relocate(dbg, elf,
&e->eo_data[j], elf_ndxscn(scn), symtab_ndx,
symtab_data, error) != DW_DLE_NONE)
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_frame.c b/contrib/elftoolchain/libdwarf/libdwarf_frame.c
index dd331379a4fd..375d64f5f66f 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_frame.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_frame.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2011,2014 Kai Wang
+ * Copyright (c) 2009-2011 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_frame.c 3106 2014-12-19 16:00:58Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_frame.c 2529 2012-07-29 23:31:12Z kaiwang27 $");
static int
_dwarf_frame_find_cie(Dwarf_FrameSec fs, Dwarf_Unsigned offset,
@@ -49,9 +49,8 @@ _dwarf_frame_find_cie(Dwarf_FrameSec fs, Dwarf_Unsigned offset,
}
static int
-_dwarf_frame_read_lsb_encoded(Dwarf_Debug dbg, Dwarf_Cie cie, uint64_t *val,
- uint8_t *data, uint64_t *offsetp, uint8_t encode, Dwarf_Addr pc,
- Dwarf_Error *error)
+_dwarf_frame_read_lsb_encoded(Dwarf_Debug dbg, uint64_t *val, uint8_t *data,
+ uint64_t *offsetp, uint8_t encode, Dwarf_Addr pc, Dwarf_Error *error)
{
uint8_t application;
@@ -63,7 +62,7 @@ _dwarf_frame_read_lsb_encoded(Dwarf_Debug dbg, Dwarf_Cie cie, uint64_t *val,
switch (encode) {
case DW_EH_PE_absptr:
- *val = dbg->read(data, offsetp, cie->cie_addrsize);
+ *val = dbg->read(data, offsetp, dbg->dbg_pointer_size);
break;
case DW_EH_PE_uleb128:
*val = _dwarf_read_uleb128(data, offsetp);
@@ -150,7 +149,7 @@ _dwarf_frame_parse_lsb_cie_augment(Dwarf_Debug dbg, Dwarf_Cie cie,
/* Skip two augments in augment data. */
encode = *augdata_p++;
offset = 0;
- ret = _dwarf_frame_read_lsb_encoded(dbg, cie, &val,
+ ret = _dwarf_frame_read_lsb_encoded(dbg, &val,
augdata_p, &offset, encode, 0, error);
if (ret != DW_DLE_NONE)
return (ret);
@@ -234,18 +233,6 @@ _dwarf_frame_add_cie(Dwarf_Debug dbg, Dwarf_FrameSec fs, Dwarf_Section *ds,
cie->cie_ehdata = dbg->read(ds->ds_data, off,
dbg->dbg_pointer_size);
- /* DWARF4 added "address_size" and "segment_size". */
- if (cie->cie_version == 4) {
- cie->cie_addrsize = dbg->read(ds->ds_data, off, 1);
- cie->cie_segmentsize = dbg->read(ds->ds_data, off, 1);
- } else {
- /*
- * Otherwise (DWARF[23]) we just set CIE addrsize to the
- * debug context pointer size.
- */
- cie->cie_addrsize = dbg->dbg_pointer_size;
- }
-
cie->cie_caf = _dwarf_read_uleb128(ds->ds_data, off);
cie->cie_daf = _dwarf_read_sleb128(ds->ds_data, off);
@@ -358,9 +345,8 @@ _dwarf_frame_add_fde(Dwarf_Debug dbg, Dwarf_FrameSec fs, Dwarf_Section *ds,
* The FDE PC start/range for .eh_frame is encoded according
* to the LSB spec's extension to DWARF2.
*/
- ret = _dwarf_frame_read_lsb_encoded(dbg, cie, &val,
- ds->ds_data, off, cie->cie_fde_encode, ds->ds_addr + *off,
- error);
+ ret = _dwarf_frame_read_lsb_encoded(dbg, &val, ds->ds_data,
+ off, cie->cie_fde_encode, ds->ds_addr + *off, error);
if (ret != DW_DLE_NONE)
return (ret);
fde->fde_initloc = val;
@@ -368,16 +354,16 @@ _dwarf_frame_add_fde(Dwarf_Debug dbg, Dwarf_FrameSec fs, Dwarf_Section *ds,
* FDE PC range should not be relative value to anything.
* So pass 0 for pc value.
*/
- ret = _dwarf_frame_read_lsb_encoded(dbg, cie, &val,
- ds->ds_data, off, cie->cie_fde_encode, 0, error);
+ ret = _dwarf_frame_read_lsb_encoded(dbg, &val, ds->ds_data,
+ off, cie->cie_fde_encode, 0, error);
if (ret != DW_DLE_NONE)
return (ret);
fde->fde_adrange = val;
} else {
fde->fde_initloc = dbg->read(ds->ds_data, off,
- cie->cie_addrsize);
+ dbg->dbg_pointer_size);
fde->fde_adrange = dbg->read(ds->ds_data, off,
- cie->cie_addrsize);
+ dbg->dbg_pointer_size);
}
/* Optional FDE augmentation data for .eh_frame section. (ignored) */
@@ -544,9 +530,9 @@ fail_cleanup:
}
static int
-_dwarf_frame_run_inst(Dwarf_Debug dbg, Dwarf_Regtable3 *rt, uint8_t addr_size,
- uint8_t *insts, Dwarf_Unsigned len, Dwarf_Unsigned caf, Dwarf_Signed daf,
- Dwarf_Addr pc, Dwarf_Addr pc_req, Dwarf_Addr *row_pc, Dwarf_Error *error)
+_dwarf_frame_run_inst(Dwarf_Debug dbg, Dwarf_Regtable3 *rt, uint8_t *insts,
+ Dwarf_Unsigned len, Dwarf_Unsigned caf, Dwarf_Signed daf, Dwarf_Addr pc,
+ Dwarf_Addr pc_req, Dwarf_Addr *row_pc, Dwarf_Error *error)
{
Dwarf_Regtable3 *init_rt, *saved_rt;
uint8_t *p, *pe;
@@ -646,7 +632,7 @@ _dwarf_frame_run_inst(Dwarf_Debug dbg, Dwarf_Regtable3 *rt, uint8_t addr_size,
switch (low6) {
case DW_CFA_set_loc:
- pc = dbg->decode(&p, addr_size);
+ pc = dbg->decode(&p, dbg->dbg_pointer_size);
#ifdef FRAME_DEBUG
printf("DW_CFA_set_loc(pc=%#jx)\n", pc);
#endif
@@ -912,13 +898,14 @@ program_done:
}
static int
-_dwarf_frame_convert_inst(Dwarf_Debug dbg, uint8_t addr_size, uint8_t *insts,
- Dwarf_Unsigned len, Dwarf_Unsigned *count, Dwarf_Frame_Op *fop,
- Dwarf_Frame_Op3 *fop3, Dwarf_Error *error)
+_dwarf_frame_convert_inst(Dwarf_Debug dbg, uint8_t *insts, Dwarf_Unsigned len,
+ Dwarf_Unsigned *count, Dwarf_Frame_Op *fop, Dwarf_Frame_Op3 *fop3,
+ Dwarf_Error *error)
{
uint8_t *p, *pe;
uint8_t high2, low6;
uint64_t reg, reg2, uoff, soff, blen;
+ int ret;
#define SET_BASE_OP(x) \
do { \
@@ -983,6 +970,7 @@ _dwarf_frame_convert_inst(Dwarf_Debug dbg, uint8_t addr_size, uint8_t *insts,
} \
} while(0)
+ ret = DW_DLE_NONE;
*count = 0;
p = insts;
@@ -1032,7 +1020,7 @@ _dwarf_frame_convert_inst(Dwarf_Debug dbg, uint8_t addr_size, uint8_t *insts,
switch (low6) {
case DW_CFA_set_loc:
- uoff = dbg->decode(&p, addr_size);
+ uoff = dbg->decode(&p, dbg->dbg_pointer_size);
SET_OFFSET(uoff);
break;
case DW_CFA_advance_loc1:
@@ -1115,16 +1103,15 @@ _dwarf_frame_convert_inst(Dwarf_Debug dbg, uint8_t addr_size, uint8_t *insts,
}
int
-_dwarf_frame_get_fop(Dwarf_Debug dbg, uint8_t addr_size, uint8_t *insts,
- Dwarf_Unsigned len, Dwarf_Frame_Op **ret_oplist, Dwarf_Signed *ret_opcnt,
- Dwarf_Error *error)
+_dwarf_frame_get_fop(Dwarf_Debug dbg, uint8_t *insts, Dwarf_Unsigned len,
+ Dwarf_Frame_Op **ret_oplist, Dwarf_Signed *ret_opcnt, Dwarf_Error *error)
{
Dwarf_Frame_Op *oplist;
Dwarf_Unsigned count;
int ret;
- ret = _dwarf_frame_convert_inst(dbg, addr_size, insts, len, &count,
- NULL, NULL, error);
+ ret = _dwarf_frame_convert_inst(dbg, insts, len, &count, NULL, NULL,
+ error);
if (ret != DW_DLE_NONE)
return (ret);
@@ -1133,8 +1120,8 @@ _dwarf_frame_get_fop(Dwarf_Debug dbg, uint8_t addr_size, uint8_t *insts,
return (DW_DLE_MEMORY);
}
- ret = _dwarf_frame_convert_inst(dbg, addr_size, insts, len, &count,
- oplist, NULL, error);
+ ret = _dwarf_frame_convert_inst(dbg, insts, len, &count, oplist, NULL,
+ error);
if (ret != DW_DLE_NONE) {
free(oplist);
return (ret);
@@ -1214,17 +1201,17 @@ _dwarf_frame_get_internal_table(Dwarf_Fde fde, Dwarf_Addr pc_req,
/* Run initial instructions in CIE. */
cie = fde->fde_cie;
assert(cie != NULL);
- ret = _dwarf_frame_run_inst(dbg, rt, cie->cie_addrsize,
- cie->cie_initinst, cie->cie_instlen, cie->cie_caf, cie->cie_daf, 0,
- ~0ULL, &row_pc, error);
+ ret = _dwarf_frame_run_inst(dbg, rt, cie->cie_initinst,
+ cie->cie_instlen, cie->cie_caf, cie->cie_daf, 0, ~0ULL,
+ &row_pc, error);
if (ret != DW_DLE_NONE)
return (ret);
/* Run instructions in FDE. */
if (pc_req >= fde->fde_initloc) {
- ret = _dwarf_frame_run_inst(dbg, rt, cie->cie_addrsize,
- fde->fde_inst, fde->fde_instlen, cie->cie_caf,
- cie->cie_daf, fde->fde_initloc, pc_req, &row_pc, error);
+ ret = _dwarf_frame_run_inst(dbg, rt, fde->fde_inst,
+ fde->fde_instlen, cie->cie_caf, cie->cie_daf,
+ fde->fde_initloc, pc_req, &row_pc, error);
if (ret != DW_DLE_NONE)
return (ret);
}
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_info.c b/contrib/elftoolchain/libdwarf/libdwarf_info.c
index 74765930aaed..dc82b7ddfde8 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_info.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_info.c
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
- * Copyright (c) 2010,2011,2014 Kai Wang
+ * Copyright (c) 2010,2011 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_info.c 3136 2014-12-24 16:04:38Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_info.c 2942 2013-05-04 23:03:54Z kaiwang27 $");
int
_dwarf_info_first_cu(Dwarf_Debug dbg, Dwarf_Error *error)
@@ -46,7 +46,7 @@ _dwarf_info_first_cu(Dwarf_Debug dbg, Dwarf_Error *error)
return (DW_DLE_NO_ENTRY);
dbg->dbg_info_off = 0;
- ret = _dwarf_info_load(dbg, 0, 1, error);
+ ret = _dwarf_info_load(dbg, 0, error);
if (ret != DW_DLE_NONE)
return (ret);
@@ -56,32 +56,6 @@ _dwarf_info_first_cu(Dwarf_Debug dbg, Dwarf_Error *error)
}
int
-_dwarf_info_first_tu(Dwarf_Debug dbg, Dwarf_Error *error)
-{
- Dwarf_CU tu;
- int ret;
-
- assert(dbg->dbg_tu_current == NULL);
- tu = STAILQ_FIRST(&dbg->dbg_tu);
- if (tu != NULL) {
- dbg->dbg_tu_current = tu;
- return (DW_DLE_NONE);
- }
-
- if (dbg->dbg_types_loaded)
- return (DW_DLE_NO_ENTRY);
-
- dbg->dbg_types_off = 0;
- ret = _dwarf_info_load(dbg, 0, 0, error);
- if (ret != DW_DLE_NONE)
- return (ret);
-
- dbg->dbg_tu_current = STAILQ_FIRST(&dbg->dbg_tu);
-
- return (DW_DLE_NONE);
-}
-
-int
_dwarf_info_next_cu(Dwarf_Debug dbg, Dwarf_Error *error)
{
Dwarf_CU cu;
@@ -99,7 +73,7 @@ _dwarf_info_next_cu(Dwarf_Debug dbg, Dwarf_Error *error)
return (DW_DLE_NO_ENTRY);
}
- ret = _dwarf_info_load(dbg, 0, 1, error);
+ ret = _dwarf_info_load(dbg, 0, error);
if (ret != DW_DLE_NONE)
return (ret);
@@ -109,35 +83,7 @@ _dwarf_info_next_cu(Dwarf_Debug dbg, Dwarf_Error *error)
}
int
-_dwarf_info_next_tu(Dwarf_Debug dbg, Dwarf_Error *error)
-{
- Dwarf_CU cu;
- int ret;
-
- assert(dbg->dbg_tu_current != NULL);
- cu = STAILQ_NEXT(dbg->dbg_tu_current, cu_next);
- if (cu != NULL) {
- dbg->dbg_tu_current = cu;
- return (DW_DLE_NONE);
- }
-
- if (dbg->dbg_types_loaded) {
- dbg->dbg_tu_current = NULL;
- return (DW_DLE_NO_ENTRY);
- }
-
- ret = _dwarf_info_load(dbg, 0, 0, error);
- if (ret != DW_DLE_NONE)
- return (ret);
-
- dbg->dbg_tu_current = STAILQ_NEXT(dbg->dbg_tu_current, cu_next);
-
- return (DW_DLE_NONE);
-}
-
-int
-_dwarf_info_load(Dwarf_Debug dbg, Dwarf_Bool load_all, Dwarf_Bool is_info,
- Dwarf_Error *error)
+_dwarf_info_load(Dwarf_Debug dbg, int load_all, Dwarf_Error *error)
{
Dwarf_CU cu;
Dwarf_Section *ds;
@@ -147,23 +93,12 @@ _dwarf_info_load(Dwarf_Debug dbg, Dwarf_Bool load_all, Dwarf_Bool is_info,
uint64_t offset;
ret = DW_DLE_NONE;
+ if (dbg->dbg_info_loaded)
+ return (DW_DLE_NONE);
- if (is_info) {
- if (dbg->dbg_info_loaded)
- return (ret);
- offset = dbg->dbg_info_off;
- ds = dbg->dbg_info_sec;
- if (ds == NULL)
- return (DW_DLE_NO_ENTRY);
- } else {
- if (dbg->dbg_types_loaded)
- return (ret);
- offset = dbg->dbg_types_off;
- ds = dbg->dbg_types_sec;
- if (ds == NULL)
- return (DW_DLE_NO_ENTRY);
- }
-
+ offset = dbg->dbg_info_off;
+ ds = dbg->dbg_info_sec;
+ assert(ds != NULL);
while (offset < ds->ds_size) {
if ((cu = calloc(1, sizeof(struct _Dwarf_CU))) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
@@ -171,7 +106,6 @@ _dwarf_info_load(Dwarf_Debug dbg, Dwarf_Bool load_all, Dwarf_Bool is_info,
}
cu->cu_dbg = dbg;
- cu->cu_is_info = is_info;
cu->cu_offset = offset;
length = dbg->read(ds->ds_data, &offset, 4);
@@ -195,10 +129,7 @@ _dwarf_info_load(Dwarf_Debug dbg, Dwarf_Bool load_all, Dwarf_Bool is_info,
/* Compute the offset to the next compilation unit: */
next_offset = offset + length;
- if (is_info)
- dbg->dbg_info_off = next_offset;
- else
- dbg->dbg_types_off = next_offset;
+ dbg->dbg_info_off = next_offset;
/* Initialise the compilation unit. */
cu->cu_length = length;
@@ -210,20 +141,8 @@ _dwarf_info_load(Dwarf_Debug dbg, Dwarf_Bool load_all, Dwarf_Bool is_info,
cu->cu_pointer_size = dbg->read(ds->ds_data, &offset, 1);
cu->cu_next_offset = next_offset;
- /* .debug_types extra fields. */
- if (!is_info) {
- memcpy(cu->cu_type_sig.signature,
- (char *) ds->ds_data + offset, 8);
- offset += 8;
- cu->cu_type_offset = dbg->read(ds->ds_data, &offset,
- dwarf_size);
- }
-
/* Add the compilation unit to the list. */
- if (is_info)
- STAILQ_INSERT_TAIL(&dbg->dbg_cu, cu, cu_next);
- else
- STAILQ_INSERT_TAIL(&dbg->dbg_tu, cu, cu_next);
+ STAILQ_INSERT_TAIL(&dbg->dbg_cu, cu, cu_next);
if (cu->cu_version < 2 || cu->cu_version > 4) {
DWARF_SET_ERROR(dbg, error, DW_DLE_VERSION_STAMP_ERROR);
@@ -239,13 +158,8 @@ _dwarf_info_load(Dwarf_Debug dbg, Dwarf_Bool load_all, Dwarf_Bool is_info,
break;
}
- if (is_info) {
- if ((Dwarf_Unsigned) dbg->dbg_info_off >= ds->ds_size)
- dbg->dbg_info_loaded = 1;
- } else {
- if ((Dwarf_Unsigned) dbg->dbg_types_off >= ds->ds_size)
- dbg->dbg_types_loaded = 1;
- }
+ if ((Dwarf_Unsigned) dbg->dbg_info_off >= ds->ds_size)
+ dbg->dbg_info_loaded = 1;
return (ret);
}
@@ -266,22 +180,6 @@ _dwarf_info_cleanup(Dwarf_Debug dbg)
}
free(cu);
}
-
- _dwarf_type_unit_cleanup(dbg);
-}
-
-void
-_dwarf_type_unit_cleanup(Dwarf_Debug dbg)
-{
- Dwarf_CU cu, tcu;
-
- assert(dbg != NULL && dbg->dbg_mode == DW_DLC_READ);
-
- STAILQ_FOREACH_SAFE(cu, &dbg->dbg_tu, cu_next, tcu) {
- STAILQ_REMOVE(&dbg->dbg_tu, cu, _Dwarf_CU, cu_next);
- _dwarf_abbrev_cleanup(cu);
- free(cu);
- }
}
int
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_init.c b/contrib/elftoolchain/libdwarf/libdwarf_init.c
index b85c87c59af0..71d596699d58 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_init.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_init.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_init.c 3136 2014-12-24 16:04:38Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_init.c 2948 2013-05-30 21:25:52Z kaiwang27 $");
static int
_dwarf_consumer_init(Dwarf_Debug dbg, Dwarf_Error *error)
@@ -69,8 +69,7 @@ _dwarf_consumer_init(Dwarf_Debug dbg, Dwarf_Error *error)
dbg->dbg_seccnt = cnt;
- if ((dbg->dbg_section = calloc(cnt + 1, sizeof(Dwarf_Section))) ==
- NULL) {
+ if ((dbg->dbg_section = calloc(cnt, sizeof(Dwarf_Section))) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
return (DW_DLE_MEMORY);
}
@@ -91,12 +90,13 @@ _dwarf_consumer_init(Dwarf_Debug dbg, Dwarf_Error *error)
return (ret);
}
}
- dbg->dbg_section[cnt].ds_name = NULL;
-
- dbg->dbg_info_sec = _dwarf_find_section(dbg, ".debug_info");
- /* Try to find the optional DWARF4 .debug_types section. */
- dbg->dbg_types_sec = _dwarf_find_next_types_section(dbg, NULL);
+ if (_dwarf_find_section(dbg, ".debug_abbrev") == NULL ||
+ ((dbg->dbg_info_sec = _dwarf_find_section(dbg, ".debug_info")) ==
+ NULL)) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_DEBUG_INFO_NULL);
+ return (DW_DLE_DEBUG_INFO_NULL);
+ }
/* Initialise call frame API related parameters. */
_dwarf_frame_params_init(dbg);
@@ -210,10 +210,10 @@ _dwarf_init(Dwarf_Debug dbg, Dwarf_Unsigned pro_flags, Dwarf_Handler errhand,
dbg->dbg_errarg = errarg;
STAILQ_INIT(&dbg->dbg_cu);
- STAILQ_INIT(&dbg->dbg_tu);
STAILQ_INIT(&dbg->dbg_rllist);
STAILQ_INIT(&dbg->dbg_aslist);
STAILQ_INIT(&dbg->dbg_mslist);
+ TAILQ_INIT(&dbg->dbg_loclist);
if (dbg->dbg_mode == DW_DLC_READ || dbg->dbg_mode == DW_DLC_RDWR) {
ret = _dwarf_consumer_init(dbg, error);
@@ -270,6 +270,7 @@ _dwarf_consumer_deinit(Dwarf_Debug dbg)
assert(dbg != NULL && dbg->dbg_mode == DW_DLC_READ);
_dwarf_info_cleanup(dbg);
+ _dwarf_loclist_cleanup(dbg);
_dwarf_ranges_cleanup(dbg);
_dwarf_frame_cleanup(dbg);
_dwarf_arange_cleanup(dbg);
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_lineno.c b/contrib/elftoolchain/libdwarf/libdwarf_lineno.c
index d0ff5f8e80da..8bb3c85f3dee 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_lineno.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_lineno.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_lineno.c 3164 2015-02-19 01:20:12Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_lineno.c 2972 2013-12-23 06:46:04Z kaiwang27 $");
static int
_dwarf_lineno_add_file(Dwarf_LineInfo li, uint8_t **p, const char *compdir,
@@ -87,8 +87,9 @@ _dwarf_lineno_run_program(Dwarf_CU cu, Dwarf_LineInfo li, uint8_t *p,
{
Dwarf_Debug dbg;
Dwarf_Line ln, tln;
- uint64_t address, file, line, column, opsize;
+ uint64_t address, file, line, column, isa, opsize;
int is_stmt, basic_block, end_sequence;
+ int prologue_end, epilogue_begin;
int ret;
#define RESET_REGISTERS \
@@ -100,6 +101,8 @@ _dwarf_lineno_run_program(Dwarf_CU cu, Dwarf_LineInfo li, uint8_t *p,
is_stmt = li->li_defstmt; \
basic_block = 0; \
end_sequence = 0; \
+ prologue_end = 0; \
+ epilogue_begin = 0; \
} while(0)
#define APPEND_ROW \
@@ -178,6 +181,8 @@ _dwarf_lineno_run_program(Dwarf_CU cu, Dwarf_LineInfo li, uint8_t *p,
case DW_LNS_copy:
APPEND_ROW;
basic_block = 0;
+ prologue_end = 0;
+ epilogue_begin = 0;
break;
case DW_LNS_advance_pc:
address += _dwarf_decode_uleb128(&p) *
@@ -205,11 +210,13 @@ _dwarf_lineno_run_program(Dwarf_CU cu, Dwarf_LineInfo li, uint8_t *p,
address += dbg->decode(&p, 2);
break;
case DW_LNS_set_prologue_end:
+ prologue_end = 1;
break;
case DW_LNS_set_epilogue_begin:
+ epilogue_begin = 1;
break;
case DW_LNS_set_isa:
- (void) _dwarf_decode_uleb128(&p);
+ isa = _dwarf_decode_uleb128(&p);
break;
default:
/* Unrecognized extened opcodes. What to do? */
@@ -226,6 +233,8 @@ _dwarf_lineno_run_program(Dwarf_CU cu, Dwarf_LineInfo li, uint8_t *p,
address += ADDRESS(*p);
APPEND_ROW;
basic_block = 0;
+ prologue_end = 0;
+ epilogue_begin = 0;
p++;
}
}
@@ -315,8 +324,6 @@ _dwarf_lineno_init(Dwarf_Die die, uint64_t offset, Dwarf_Error *error)
li->li_hdrlen = dbg->read(ds->ds_data, &offset, dwarf_size);
hdroff = offset;
li->li_minlen = dbg->read(ds->ds_data, &offset, 1);
- if (li->li_version == 4)
- li->li_maxop = dbg->read(ds->ds_data, &offset, 1);
li->li_defstmt = dbg->read(ds->ds_data, &offset, 1);
li->li_lbase = dbg->read(ds->ds_data, &offset, 1);
li->li_lrange = dbg->read(ds->ds_data, &offset, 1);
@@ -475,7 +482,7 @@ _dwarf_lineno_gen_program(Dwarf_P_Debug dbg, Dwarf_P_Section ds,
Dwarf_Unsigned address, file, line, spc;
Dwarf_Unsigned addr0, maddr;
Dwarf_Signed line0, column;
- int is_stmt, basic_block;
+ int is_stmt, basic_block, end_sequence;
int need_copy;
int ret;
@@ -487,6 +494,7 @@ _dwarf_lineno_gen_program(Dwarf_P_Debug dbg, Dwarf_P_Section ds,
column = 0; \
is_stmt = li->li_defstmt; \
basic_block = 0; \
+ end_sequence = 0; \
} while(0)
li = dbg->dbgp_lineinfo;
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_loc.c b/contrib/elftoolchain/libdwarf/libdwarf_loc.c
index c2d3f5cc6662..ea366fb0768e 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_loc.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_loc.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
- * Copyright (c) 2014 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_loc.c 3070 2014-06-23 03:08:33Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_loc.c 2070 2011-10-27 03:05:32Z jkoshy $");
/*
* Given an array of bytes of length 'len' representing a
@@ -39,12 +38,12 @@ ELFTC_VCSID("$Id: libdwarf_loc.c 3070 2014-06-23 03:08:33Z kaiwang27 $");
*/
static int
_dwarf_loc_fill_loc(Dwarf_Debug dbg, Dwarf_Locdesc *lbuf, uint8_t pointer_size,
- uint8_t offset_size, uint8_t version, uint8_t *p, int len)
+ uint8_t *p, int len)
{
int count;
uint64_t operand1;
uint64_t operand2;
- uint8_t *ps, *pe, s;
+ uint8_t *ps, *pe;
count = 0;
ps = p;
@@ -166,47 +165,35 @@ _dwarf_loc_fill_loc(Dwarf_Debug dbg, Dwarf_Locdesc *lbuf, uint8_t pointer_size,
case DW_OP_ne:
case DW_OP_nop:
- case DW_OP_push_object_address:
case DW_OP_form_tls_address:
case DW_OP_call_frame_cfa:
case DW_OP_stack_value:
case DW_OP_GNU_push_tls_address:
- case DW_OP_GNU_uninit:
break;
/* Operations with 1-byte operands. */
case DW_OP_const1u:
+ case DW_OP_const1s:
case DW_OP_pick:
case DW_OP_deref_size:
case DW_OP_xderef_size:
operand1 = *p++;
break;
- case DW_OP_const1s:
- operand1 = (int8_t) *p++;
- break;
-
/* Operations with 2-byte operands. */
case DW_OP_call2:
case DW_OP_const2u:
+ case DW_OP_const2s:
case DW_OP_bra:
case DW_OP_skip:
operand1 = dbg->decode(&p, 2);
break;
- case DW_OP_const2s:
- operand1 = (int16_t) dbg->decode(&p, 2);
- break;
-
/* Operations with 4-byte operands. */
case DW_OP_call4:
case DW_OP_const4u:
- case DW_OP_GNU_parameter_ref:
- operand1 = dbg->decode(&p, 4);
- break;
-
case DW_OP_const4s:
- operand1 = (int32_t) dbg->decode(&p, 4);
+ operand1 = dbg->decode(&p, 4);
break;
/* Operations with 8-byte operands. */
@@ -220,9 +207,6 @@ _dwarf_loc_fill_loc(Dwarf_Debug dbg, Dwarf_Locdesc *lbuf, uint8_t pointer_size,
case DW_OP_plus_uconst:
case DW_OP_regx:
case DW_OP_piece:
- case DW_OP_GNU_deref_type:
- case DW_OP_GNU_convert:
- case DW_OP_GNU_reinterpret:
operand1 = _dwarf_decode_uleb128(&p);
break;
@@ -268,7 +252,6 @@ _dwarf_loc_fill_loc(Dwarf_Debug dbg, Dwarf_Locdesc *lbuf, uint8_t pointer_size,
* Oeration with two unsigned LEB128 operands.
*/
case DW_OP_bit_piece:
- case DW_OP_GNU_regval_type:
operand1 = _dwarf_decode_uleb128(&p);
operand2 = _dwarf_decode_uleb128(&p);
break;
@@ -284,14 +267,10 @@ _dwarf_loc_fill_loc(Dwarf_Debug dbg, Dwarf_Locdesc *lbuf, uint8_t pointer_size,
/*
* Operation with an unsigned LEB128 operand
- * representing the size of a block, followed
- * by the block content.
- *
- * Store the size of the block in the operand1
- * and a pointer to the block in the operand2.
+ * followed by a block. Store a pointer to the
+ * block in the operand2.
*/
case DW_OP_implicit_value:
- case DW_OP_GNU_entry_value:
operand1 = _dwarf_decode_uleb128(&p);
operand2 = (Dwarf_Unsigned) (uintptr_t) p;
p += operand1;
@@ -299,59 +278,25 @@ _dwarf_loc_fill_loc(Dwarf_Debug dbg, Dwarf_Locdesc *lbuf, uint8_t pointer_size,
/* Target address size operand. */
case DW_OP_addr:
- case DW_OP_GNU_addr_index:
- case DW_OP_GNU_const_index:
operand1 = dbg->decode(&p, pointer_size);
break;
- /* Offset size operand. */
- case DW_OP_call_ref:
- operand1 = dbg->decode(&p, offset_size);
- break;
-
- /*
- * The first byte is address byte length, followed by
- * the address value. If the length is 0, the address
- * size is the same as target pointer size.
- */
- case DW_OP_GNU_encoded_addr:
- s = *p++;
- if (s == 0)
- s = pointer_size;
- operand1 = dbg->decode(&p, s);
- break;
-
- /*
- * Operand1: DIE offset (size depending on DWARF version)
- * DWARF2: pointer size
- * DWARF{3,4}: offset size
- *
- * Operand2: SLEB128
- */
- case DW_OP_GNU_implicit_pointer:
- if (version == 2)
- operand1 = dbg->decode(&p, pointer_size);
- else
- operand1 = dbg->decode(&p, offset_size);
- operand2 = _dwarf_decode_sleb128(&p);
- break;
-
/*
- * Operand1: DIE offset (ULEB128)
- * Operand2: pointer to a block. The block's first byte
- * is its size.
+ * XXX Opcode DW_OP_call_ref has an operand with size
+ * "dwarf_size". Here we use dbg->dbg_offset_size
+ * as "dwarf_size" to be compatible with SGI libdwarf.
+ * However note that dbg->dbg_offset_size is just
+ * a "guess" value so the parsing result of
+ * DW_OP_call_ref might not be correct at all. XXX
*/
- case DW_OP_GNU_const_type:
- operand1 = _dwarf_decode_uleb128(&p);
- operand2 = (Dwarf_Unsigned) (uintptr_t) p;
- s = *p++;
- p += s;
+ case DW_OP_call_ref:
+ operand1 = dbg->decode(&p, dbg->dbg_offset_size);
break;
/* All other operations cause an error. */
default:
count = -1;
- goto done;
+ break;
}
if (lbuf != NULL) {
@@ -362,7 +307,6 @@ _dwarf_loc_fill_loc(Dwarf_Debug dbg, Dwarf_Locdesc *lbuf, uint8_t pointer_size,
count++;
}
-done:
return (count);
}
@@ -617,8 +561,7 @@ _dwarf_loc_expr_add_atom(Dwarf_Debug dbg, uint8_t *out, uint8_t *end,
int
_dwarf_loc_fill_locdesc(Dwarf_Debug dbg, Dwarf_Locdesc *llbuf, uint8_t *in,
- uint64_t in_len, uint8_t pointer_size, uint8_t offset_size,
- uint8_t version, Dwarf_Error *error)
+ uint64_t in_len, uint8_t pointer_size, Dwarf_Error *error)
{
int num;
@@ -627,8 +570,8 @@ _dwarf_loc_fill_locdesc(Dwarf_Debug dbg, Dwarf_Locdesc *llbuf, uint8_t *in,
assert(in_len > 0);
/* Compute the number of locations. */
- if ((num = _dwarf_loc_fill_loc(dbg, NULL, pointer_size, offset_size,
- version, in, in_len)) < 0) {
+ if ((num = _dwarf_loc_fill_loc(dbg, NULL, pointer_size, in, in_len)) <
+ 0) {
DWARF_SET_ERROR(dbg, error, DW_DLE_LOC_EXPR_BAD);
return (DW_DLE_LOC_EXPR_BAD);
}
@@ -642,16 +585,14 @@ _dwarf_loc_fill_locdesc(Dwarf_Debug dbg, Dwarf_Locdesc *llbuf, uint8_t *in,
return (DW_DLE_MEMORY);
}
- (void) _dwarf_loc_fill_loc(dbg, llbuf, pointer_size, offset_size,
- version, in, in_len);
+ (void) _dwarf_loc_fill_loc(dbg, llbuf, pointer_size, in, in_len);
return (DW_DLE_NONE);
}
int
_dwarf_loc_fill_locexpr(Dwarf_Debug dbg, Dwarf_Locdesc **ret_llbuf, uint8_t *in,
- uint64_t in_len, uint8_t pointer_size, uint8_t offset_size,
- uint8_t version, Dwarf_Error *error)
+ uint64_t in_len, uint8_t pointer_size, Dwarf_Error *error)
{
Dwarf_Locdesc *llbuf;
int ret;
@@ -665,7 +606,7 @@ _dwarf_loc_fill_locexpr(Dwarf_Debug dbg, Dwarf_Locdesc **ret_llbuf, uint8_t *in,
llbuf->ld_s = NULL;
ret = _dwarf_loc_fill_locdesc(dbg, llbuf, in, in_len, pointer_size,
- offset_size, version, error);
+ error);
if (ret != DW_DLE_NONE) {
free(llbuf);
return (ret);
@@ -694,8 +635,7 @@ _dwarf_loc_add(Dwarf_Die die, Dwarf_Attribute at, Dwarf_Error *error)
assert(dbg != NULL);
ret = _dwarf_loc_fill_locexpr(dbg, &at->at_ld, at->u[1].u8p,
- at->u[0].u64, cu->cu_pointer_size, cu->cu_length_size == 4 ? 4 : 8,
- cu->cu_version, error);
+ at->u[0].u64, cu->cu_pointer_size, error);
return (ret);
}
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_loclist.c b/contrib/elftoolchain/libdwarf/libdwarf_loclist.c
index bb3e39f6c899..8030e9a67852 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_loclist.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_loclist.c
@@ -26,11 +26,11 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_loclist.c 3061 2014-06-02 00:42:41Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_loclist.c 2972 2013-12-23 06:46:04Z kaiwang27 $");
static int
_dwarf_loclist_add_locdesc(Dwarf_Debug dbg, Dwarf_CU cu, Dwarf_Section *ds,
- Dwarf_Unsigned *off, Dwarf_Locdesc **ld, Dwarf_Signed *ldlen,
+ uint64_t *off, Dwarf_Locdesc **ld, uint64_t *ldlen,
Dwarf_Unsigned *total_len, Dwarf_Error *error)
{
uint64_t start, end;
@@ -75,7 +75,6 @@ _dwarf_loclist_add_locdesc(Dwarf_Debug dbg, Dwarf_CU cu, Dwarf_Section *ds,
if (ld != NULL) {
ret = _dwarf_loc_fill_locdesc(dbg, ld[i],
ds->ds_data + *off, len, cu->cu_pointer_size,
- cu->cu_length_size == 4 ? 4 : 8, cu->cu_version,
error);
if (ret != DW_DLE_NONE)
return (ret);
@@ -92,15 +91,37 @@ _dwarf_loclist_add_locdesc(Dwarf_Debug dbg, Dwarf_CU cu, Dwarf_Section *ds,
int
_dwarf_loclist_find(Dwarf_Debug dbg, Dwarf_CU cu, uint64_t lloff,
- Dwarf_Locdesc ***ret_llbuf, Dwarf_Signed *listlen,
- Dwarf_Unsigned *entry_len, Dwarf_Error *error)
+ Dwarf_Loclist *ret_ll, Dwarf_Error *error)
+{
+ Dwarf_Loclist ll;
+ int ret;
+
+ assert(ret_ll != NULL);
+ ret = DW_DLE_NONE;
+
+ TAILQ_FOREACH(ll, &dbg->dbg_loclist, ll_next)
+ if (ll->ll_offset == lloff)
+ break;
+
+ if (ll == NULL)
+ ret = _dwarf_loclist_add(dbg, cu, lloff, ret_ll, error);
+ else
+ *ret_ll = ll;
+
+ return (ret);
+}
+
+int
+_dwarf_loclist_add(Dwarf_Debug dbg, Dwarf_CU cu, uint64_t lloff,
+ Dwarf_Loclist *ret_ll, Dwarf_Error *error)
{
- Dwarf_Locdesc **llbuf;
Dwarf_Section *ds;
- Dwarf_Signed ldlen;
- Dwarf_Unsigned off;
+ Dwarf_Loclist ll, tll;
+ uint64_t ldlen;
int i, ret;
+ ret = DW_DLE_NONE;
+
if ((ds = _dwarf_find_section(dbg, ".debug_loc")) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
return (DW_DLE_NO_ENTRY);
@@ -111,55 +132,98 @@ _dwarf_loclist_find(Dwarf_Debug dbg, Dwarf_CU cu, uint64_t lloff,
return (DW_DLE_NO_ENTRY);
}
+ if ((ll = malloc(sizeof(struct _Dwarf_Loclist))) == NULL) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
+ return (DW_DLE_MEMORY);
+ }
+
+ ll->ll_offset = lloff;
+
/* Get the number of locdesc the first round. */
- off = lloff;
- ret = _dwarf_loclist_add_locdesc(dbg, cu, ds, &off, NULL, &ldlen,
+ ret = _dwarf_loclist_add_locdesc(dbg, cu, ds, &lloff, NULL, &ldlen,
NULL, error);
if (ret != DW_DLE_NONE)
- return (ret);
-
- if (ldlen == 0)
- return (DW_DLE_NO_ENTRY);
+ goto fail_cleanup;
/*
* Dwarf_Locdesc list memory is allocated in this way (one more level
* of indirect) to make the loclist API be compatible with SGI libdwarf.
*/
- if ((llbuf = calloc(ldlen, sizeof(Dwarf_Locdesc *))) == NULL) {
- DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
- return (DW_DLE_MEMORY);
- }
- for (i = 0; i < ldlen; i++) {
- if ((llbuf[i] = calloc(1, sizeof(Dwarf_Locdesc))) == NULL) {
+ ll->ll_ldlen = ldlen;
+ if (ldlen != 0) {
+ if ((ll->ll_ldlist = calloc(ldlen, sizeof(Dwarf_Locdesc *))) ==
+ NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
ret = DW_DLE_MEMORY;
goto fail_cleanup;
}
- }
+ for (i = 0; (uint64_t) i < ldlen; i++) {
+ if ((ll->ll_ldlist[i] =
+ calloc(1, sizeof(Dwarf_Locdesc))) == NULL) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
+ ret = DW_DLE_MEMORY;
+ goto fail_cleanup;
+ }
+ }
+ } else
+ ll->ll_ldlist = NULL;
- off = lloff;
+ lloff = ll->ll_offset;
/* Fill in locdesc. */
- ret = _dwarf_loclist_add_locdesc(dbg, cu, ds, &off, llbuf, NULL,
- entry_len, error);
+ ret = _dwarf_loclist_add_locdesc(dbg, cu, ds, &lloff, ll->ll_ldlist,
+ NULL, &ll->ll_length, error);
if (ret != DW_DLE_NONE)
goto fail_cleanup;
- *ret_llbuf = llbuf;
- *listlen = ldlen;
+ /* Insert to the queue. Sort by offset. */
+ TAILQ_FOREACH(tll, &dbg->dbg_loclist, ll_next)
+ if (tll->ll_offset > ll->ll_offset) {
+ TAILQ_INSERT_BEFORE(tll, ll, ll_next);
+ break;
+ }
+
+ if (tll == NULL)
+ TAILQ_INSERT_TAIL(&dbg->dbg_loclist, ll, ll_next);
+ *ret_ll = ll;
return (DW_DLE_NONE);
fail_cleanup:
- if (llbuf != NULL) {
- for (i = 0; i < ldlen; i++) {
- if (llbuf[i]->ld_s)
- free(llbuf[i]->ld_s);
- free(llbuf[i]);
+ _dwarf_loclist_free(ll);
+
+ return (ret);
+}
+
+void
+_dwarf_loclist_free(Dwarf_Loclist ll)
+{
+ int i;
+
+ if (ll == NULL)
+ return;
+
+ if (ll->ll_ldlist != NULL) {
+ for (i = 0; i < ll->ll_ldlen; i++) {
+ if (ll->ll_ldlist[i]->ld_s)
+ free(ll->ll_ldlist[i]->ld_s);
+ free(ll->ll_ldlist[i]);
}
- free(llbuf);
+ free(ll->ll_ldlist);
}
+ free(ll);
+}
- return (ret);
+void
+_dwarf_loclist_cleanup(Dwarf_Debug dbg)
+{
+ Dwarf_Loclist ll, tll;
+
+ assert(dbg != NULL && dbg->dbg_mode == DW_DLC_READ);
+
+ TAILQ_FOREACH_SAFE(ll, &dbg->dbg_loclist, ll_next, tll) {
+ TAILQ_REMOVE(&dbg->dbg_loclist, ll, ll_next);
+ _dwarf_loclist_free(ll);
+ }
}
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_nametbl.c b/contrib/elftoolchain/libdwarf/libdwarf_nametbl.c
index 661b56f1c9c8..158aca34ad43 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_nametbl.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_nametbl.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_nametbl.c 3029 2014-04-21 23:26:02Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_nametbl.c 2070 2011-10-27 03:05:32Z jkoshy $");
void
_dwarf_nametbl_cleanup(Dwarf_NameSec *nsp)
@@ -103,7 +103,7 @@ _dwarf_nametbl_init(Dwarf_Debug dbg, Dwarf_NameSec *namesec, Dwarf_Section *ds,
nt->nt_cu_length = dbg->read(ds->ds_data, &offset, dwarf_size);
if (!dbg->dbg_info_loaded) {
- ret = _dwarf_info_load(dbg, 1, 1, error);
+ ret = _dwarf_info_load(dbg, 1, error);
if (ret != DW_DLE_NONE)
goto fail_cleanup;
}
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_reloc.c b/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
index 96bb785845fe..ea916772aadb 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_reloc.c 3149 2015-02-15 19:00:06Z emaste $");
+ELFTC_VCSID("$Id: libdwarf_reloc.c 2948 2013-05-30 21:25:52Z kaiwang27 $");
Dwarf_Unsigned
_dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64)
@@ -35,8 +35,6 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64)
assert(dbg != NULL);
switch (dbg->dbgp_isa) {
- case DW_ISA_AARCH64:
- return (is64 ? R_AARCH64_ABS64 : R_AARCH64_ABS32);
case DW_ISA_X86:
return (R_386_32);
case DW_ISA_X86_64:
@@ -64,12 +62,6 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, Dwarf_Unsigned rel_type)
switch (dbg->dbg_machine) {
case EM_NONE:
break;
- case EM_AARCH64:
- if (rel_type == R_AARCH64_ABS32)
- return (4);
- else if (rel_type == R_AARCH64_ABS64)
- return (8);
- break;
case EM_ARM:
if (rel_type == R_ARM_ABS32)
return (4);
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_sections.c b/contrib/elftoolchain/libdwarf/libdwarf_sections.c
index 24d5db839e49..3ac30b251e02 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_sections.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_sections.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_sections.c 3041 2014-05-18 15:11:03Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_sections.c 2379 2012-01-05 02:08:20Z jkoshy $");
#define _SECTION_INIT_SIZE 128
@@ -212,7 +212,7 @@ _dwarf_find_section(Dwarf_Debug dbg, const char *name)
Dwarf_Section *ds;
Dwarf_Half i;
- assert(dbg != NULL && name != NULL);
+ assert(name != NULL);
for (i = 0; i < dbg->dbg_seccnt; i++) {
ds = &dbg->dbg_section[i];
@@ -223,27 +223,6 @@ _dwarf_find_section(Dwarf_Debug dbg, const char *name)
return (NULL);
}
-Dwarf_Section *
-_dwarf_find_next_types_section(Dwarf_Debug dbg, Dwarf_Section *ds)
-{
-
- assert(dbg != NULL);
-
- if (ds == NULL)
- return (_dwarf_find_section(dbg, ".debug_types"));
-
- assert(ds->ds_name != NULL);
-
- do {
- ds++;
- if (ds->ds_name != NULL &&
- !strcmp(ds->ds_name, ".debug_types"))
- return (ds);
- } while (ds->ds_name != NULL);
-
- return (NULL);
-}
-
Dwarf_P_Section
_dwarf_pro_find_section(Dwarf_P_Debug dbg, const char *name)
{