From owner-svn-src-all@FreeBSD.ORG Mon Dec 29 19:16:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F3F0E79; Mon, 29 Dec 2014 19:16:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66F5B1DB6; Mon, 29 Dec 2014 19:16:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBTJGkbM001219; Mon, 29 Dec 2014 19:16:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBTJGf3G001189; Mon, 29 Dec 2014 19:16:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201412291916.sBTJGf3G001189@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Dec 2014 19:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276371 - in head: contrib/elftoolchain/common contrib/elftoolchain/elfcopy contrib/elftoolchain/libdwarf contrib/elftoolchain/libelf contrib/elftoolchain/libelftc contrib/elftoolchain/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Dec 2014 19:16:46 -0000 Author: emaste Date: Mon Dec 29 19:16:40 2014 New Revision: 276371 URL: https://svnweb.freebsd.org/changeset/base/276371 Log: Update elftoolchain to upstream rev 3130 This includes a number of libdwarf improvements (particularly DWARF4 related) and updates to elftoolchain tools such as strip(1). It also includes a large number of miscellaneous fixes (memory leaks, sign and cast warnings, integer overflow and underflow, etc.). This is a merge of r276167,276170-276172 from the projects/elftoolchain-update-r3130 branch. Sponsored by: The FreeBSD Foundation Added: head/contrib/elftoolchain/libdwarf/dwarf_attroffset.3 - copied unchanged from r276167, projects/elftoolchain-update-r3130/contrib/elftoolchain/libdwarf/dwarf_attroffset.3 head/contrib/elftoolchain/libdwarf/dwarf_get_die_infotypes_flag.3 - copied unchanged from r276167, projects/elftoolchain-update-r3130/contrib/elftoolchain/libdwarf/dwarf_get_die_infotypes_flag.3 head/contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3 - copied unchanged from r276167, projects/elftoolchain-update-r3130/contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3 head/contrib/elftoolchain/libdwarf/dwarf_next_types_section.3 - copied unchanged from r276167, projects/elftoolchain-update-r3130/contrib/elftoolchain/libdwarf/dwarf_next_types_section.3 head/contrib/elftoolchain/libdwarf/dwarf_sections.c - copied unchanged from r276167, projects/elftoolchain-update-r3130/contrib/elftoolchain/libdwarf/dwarf_sections.c Modified: head/contrib/elftoolchain/common/Makefile head/contrib/elftoolchain/common/elfdefinitions.h head/contrib/elftoolchain/elfcopy/archive.c head/contrib/elftoolchain/elfcopy/main.c head/contrib/elftoolchain/elfcopy/sections.c head/contrib/elftoolchain/elfcopy/segments.c head/contrib/elftoolchain/elfcopy/symbols.c head/contrib/elftoolchain/libdwarf/Makefile head/contrib/elftoolchain/libdwarf/Version.map head/contrib/elftoolchain/libdwarf/_libdwarf.h head/contrib/elftoolchain/libdwarf/dwarf.3 head/contrib/elftoolchain/libdwarf/dwarf.h head/contrib/elftoolchain/libdwarf/dwarf_attr.3 head/contrib/elftoolchain/libdwarf/dwarf_attr.c head/contrib/elftoolchain/libdwarf/dwarf_attrval.c head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 head/contrib/elftoolchain/libdwarf/dwarf_child.3 head/contrib/elftoolchain/libdwarf/dwarf_cu.c head/contrib/elftoolchain/libdwarf/dwarf_die.c head/contrib/elftoolchain/libdwarf/dwarf_dieoffset.3 head/contrib/elftoolchain/libdwarf/dwarf_dump.c head/contrib/elftoolchain/libdwarf/dwarf_errmsg.c head/contrib/elftoolchain/libdwarf/dwarf_frame.c head/contrib/elftoolchain/libdwarf/dwarf_highpc.3 head/contrib/elftoolchain/libdwarf/dwarf_lineno.c head/contrib/elftoolchain/libdwarf/dwarf_loclist.c head/contrib/elftoolchain/libdwarf/dwarf_loclist_from_expr.3 head/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3 head/contrib/elftoolchain/libdwarf/dwarf_ranges.c head/contrib/elftoolchain/libdwarf/libdwarf.h head/contrib/elftoolchain/libdwarf/libdwarf_arange.c head/contrib/elftoolchain/libdwarf/libdwarf_attr.c head/contrib/elftoolchain/libdwarf/libdwarf_die.c head/contrib/elftoolchain/libdwarf/libdwarf_frame.c head/contrib/elftoolchain/libdwarf/libdwarf_info.c head/contrib/elftoolchain/libdwarf/libdwarf_init.c head/contrib/elftoolchain/libdwarf/libdwarf_lineno.c head/contrib/elftoolchain/libdwarf/libdwarf_loc.c head/contrib/elftoolchain/libdwarf/libdwarf_loclist.c head/contrib/elftoolchain/libdwarf/libdwarf_nametbl.c head/contrib/elftoolchain/libdwarf/libdwarf_sections.c head/contrib/elftoolchain/libelf/_libelf.h head/contrib/elftoolchain/libelf/_libelf_ar.h head/contrib/elftoolchain/libelf/elf.3 head/contrib/elftoolchain/libelf/elf_data.c head/contrib/elftoolchain/libelf/elf_errmsg.c head/contrib/elftoolchain/libelf/elf_flag.c head/contrib/elftoolchain/libelf/elf_memory.c head/contrib/elftoolchain/libelf/elf_next.c head/contrib/elftoolchain/libelf/elf_open.c head/contrib/elftoolchain/libelf/elf_rand.c head/contrib/elftoolchain/libelf/elf_rawfile.c head/contrib/elftoolchain/libelf/elf_scn.c head/contrib/elftoolchain/libelf/elf_strptr.c head/contrib/elftoolchain/libelf/elf_update.c head/contrib/elftoolchain/libelf/gelf_cap.c head/contrib/elftoolchain/libelf/gelf_dyn.c head/contrib/elftoolchain/libelf/gelf_ehdr.c head/contrib/elftoolchain/libelf/gelf_move.c head/contrib/elftoolchain/libelf/gelf_phdr.c head/contrib/elftoolchain/libelf/gelf_rel.c head/contrib/elftoolchain/libelf/gelf_rela.c head/contrib/elftoolchain/libelf/gelf_shdr.c head/contrib/elftoolchain/libelf/gelf_sym.c head/contrib/elftoolchain/libelf/gelf_syminfo.c head/contrib/elftoolchain/libelf/gelf_symshndx.c head/contrib/elftoolchain/libelf/libelf.h head/contrib/elftoolchain/libelf/libelf_align.c head/contrib/elftoolchain/libelf/libelf_ar.c head/contrib/elftoolchain/libelf/libelf_ar_util.c head/contrib/elftoolchain/libelf/libelf_checksum.c head/contrib/elftoolchain/libelf/libelf_convert.m4 head/contrib/elftoolchain/libelf/libelf_data.c head/contrib/elftoolchain/libelf/libelf_ehdr.c head/contrib/elftoolchain/libelf/libelf_extended.c head/contrib/elftoolchain/libelf/libelf_memory.c head/contrib/elftoolchain/libelf/libelf_open.c head/contrib/elftoolchain/libelf/libelf_phdr.c head/contrib/elftoolchain/libelf/libelf_xlate.c head/contrib/elftoolchain/libelftc/elftc_copyfile.c head/contrib/elftoolchain/libelftc/elftc_demangle.c head/contrib/elftoolchain/libelftc/libelftc.h head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c head/contrib/elftoolchain/nm/nm.c head/contrib/elftoolchain/readelf/readelf.1 head/contrib/elftoolchain/readelf/readelf.c head/contrib/elftoolchain/strings/strings.c head/lib/libdwarf/Makefile head/lib/libelftc/elftc_version.c Directory Properties: head/ (props changed) head/contrib/elftoolchain/ (props changed) Modified: head/contrib/elftoolchain/common/Makefile ============================================================================== --- head/contrib/elftoolchain/common/Makefile Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/common/Makefile Mon Dec 29 19:16:40 2014 (r276371) @@ -1,4 +1,4 @@ -# $Id: Makefile 2606 2012-10-02 17:52:57Z jkoshy $ +# $Id: Makefile 3022 2014-04-17 18:05:58Z jkoshy $ TOP= .. @@ -12,4 +12,7 @@ all depend obj: clean clobber: rm -f ${CLEANFILES} +cleandepend: + rm -f .depend + .include "${TOP}/mk/elftoolchain.inc.mk" Modified: head/contrib/elftoolchain/common/elfdefinitions.h ============================================================================== --- head/contrib/elftoolchain/common/elfdefinitions.h Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/common/elfdefinitions.h Mon Dec 29 19:16:40 2014 (r276371) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 2950 2013-06-15 13:36:02Z jkoshy $ + * $Id: elfdefinitions.h 3110 2014-12-20 08:32:46Z kaiwang27 $ */ /* @@ -821,7 +821,8 @@ enum { EM__LAST__ }; -/* Older synonyms. */ +/* Other synonyms. */ +#define EM_AMD64 EM_X86_64 #define EM_ARC_A5 EM_ARC_COMPACT /* @@ -2114,11 +2115,11 @@ typedef struct { /* 64-bit entry. */ typedef struct { - Elf64_Word l_name; - Elf64_Word l_time_stamp; - Elf64_Word l_checksum; - Elf64_Word l_version; - Elf64_Word l_flags; + Elf64_Word l_name; /* The name of a shared object. */ + Elf64_Word l_time_stamp; /* 32-bit timestamp. */ + Elf64_Word l_checksum; /* Checksum of visible symbols, sizes. */ + Elf64_Word l_version; /* Interface version string index. */ + Elf64_Word l_flags; /* Flags (LL_*). */ } Elf64_Lib; #define _ELF_DEFINE_LL_FLAGS() \ @@ -2366,12 +2367,12 @@ typedef struct { /* 64 bit PHDR entry. */ typedef struct { Elf64_Word p_type; /* Type of segment. */ - Elf64_Word p_flags; /* File offset to segment. */ - Elf64_Off p_offset; /* Virtual address in memory. */ - Elf64_Addr p_vaddr; /* Physical address (if relevant). */ - Elf64_Addr p_paddr; /* Size of segment in file. */ - Elf64_Xword p_filesz; /* Size of segment in memory. */ - Elf64_Xword p_memsz; /* Segment flags. */ + Elf64_Word p_flags; /* Segment flags. */ + Elf64_Off p_offset; /* File offset to segment. */ + Elf64_Addr p_vaddr; /* Virtual address in memory. */ + Elf64_Addr p_paddr; /* Physical address (if relevant). */ + Elf64_Xword p_filesz; /* Size of segment in file. */ + Elf64_Xword p_memsz; /* Size of segment in memory. */ Elf64_Xword p_align; /* Alignment constraints. */ } Elf64_Phdr; @@ -2455,11 +2456,11 @@ typedef struct { typedef struct { Elf64_Word st_name; /* index of symbol's name */ - unsigned char st_info; /* value for the symbol */ - unsigned char st_other; /* size of associated data */ - Elf64_Half st_shndx; /* type and binding attributes */ - Elf64_Addr st_value; /* visibility */ - Elf64_Xword st_size; /* index of related section */ + unsigned char st_info; /* type and binding attributes */ + unsigned char st_other; /* visibility */ + Elf64_Half st_shndx; /* index of related section */ + Elf64_Addr st_value; /* value for the symbol */ + Elf64_Xword st_size; /* size of associated data */ } Elf64_Sym; #define ELF32_ST_BIND(I) ((I) >> 4) Modified: head/contrib/elftoolchain/elfcopy/archive.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/archive.c Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/elfcopy/archive.c Mon Dec 29 19:16:40 2014 (r276371) @@ -40,7 +40,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: archive.c 2370 2011-12-29 12:48:12Z jkoshy $"); +ELFTC_VCSID("$Id: archive.c 3102 2014-10-29 21:09:01Z jkoshy $"); #define _ARMAG_LEN 8 /* length of ar magic string */ #define _ARHDR_LEN 60 /* length of ar header */ @@ -350,7 +350,6 @@ ac_detect_ar(int ifd) r = -1; if ((a = archive_read_new()) == NULL) return (0); - archive_read_support_filter_none(a); archive_read_support_format_ar(a); if (archive_read_open_fd(a, ifd, 10240) == ARCHIVE_OK) r = archive_read_next_header(a, &entry); @@ -386,7 +385,6 @@ ac_read_objs(struct elfcopy *ecp, int if err(EXIT_FAILURE, "lseek failed"); if ((a = archive_read_new()) == NULL) errx(EXIT_FAILURE, "%s", archive_error_string(a)); - archive_read_support_filter_none(a); archive_read_support_format_ar(a); AC(archive_read_open_fd(a, ifd, 10240)); for(;;) { @@ -449,7 +447,6 @@ ac_write_objs(struct elfcopy *ecp, int o if ((a = archive_write_new()) == NULL) errx(EXIT_FAILURE, "%s", archive_error_string(a)); archive_write_set_format_ar_svr4(a); - archive_write_add_filter_none(a); AC(archive_write_open_fd(a, ofd)); /* Write the archive symbol table, even if it's empty. */ Modified: head/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/main.c Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/elfcopy/main.c Mon Dec 29 19:16:40 2014 (r276371) @@ -40,7 +40,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 2970 2013-12-01 15:22:12Z kaiwang27 $"); +ELFTC_VCSID("$Id: main.c 3111 2014-12-20 08:33:01Z kaiwang27 $"); enum options { Modified: head/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/sections.c Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/elfcopy/sections.c Mon Dec 29 19:16:40 2014 (r276371) @@ -35,7 +35,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: sections.c 2358 2011-12-19 18:22:32Z kaiwang27 $"); +ELFTC_VCSID("$Id: sections.c 3126 2014-12-21 08:03:31Z kaiwang27 $"); static void add_gnu_debuglink(struct elfcopy *ecp); static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc); @@ -372,6 +372,14 @@ create_scn(struct elfcopy *ecp) is_remove_reloc_sec(ecp, ish.sh_info)) continue; + /* + * Section groups should be removed if symbol table will + * be removed. (section group's signature stored in symbol + * table) + */ + if (ish.sh_type == SHT_GROUP && ecp->strip == STRIP_ALL) + continue; + /* Get section flags set by user. */ sec_flags = get_section_flags(ecp, name); Modified: head/contrib/elftoolchain/elfcopy/segments.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/segments.c Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/elfcopy/segments.c Mon Dec 29 19:16:40 2014 (r276371) @@ -35,7 +35,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: segments.c 2542 2012-08-12 16:14:15Z kaiwang27 $"); +ELFTC_VCSID("$Id: segments.c 3113 2014-12-20 08:33:29Z kaiwang27 $"); static void insert_to_inseg_list(struct segment *seg, struct section *sec); @@ -73,13 +73,15 @@ add_to_inseg_list(struct elfcopy *ecp, s */ loadable = 0; STAILQ_FOREACH(seg, &ecp->v_seg, seg_list) { - if (s->off < seg->off) + if (s->off < seg->off || (s->vma < seg->addr && !s->pseudo)) continue; if (s->off + s->sz > seg->off + seg->fsz && s->type != SHT_NOBITS) continue; if (s->off + s->sz > seg->off + seg->msz) continue; + if (s->vma + s->sz > seg->addr + seg->msz) + continue; insert_to_inseg_list(seg, s); if (seg->type == PT_LOAD) @@ -97,7 +99,7 @@ adjust_addr(struct elfcopy *ecp) struct section *s, *s0; struct segment *seg; struct sec_action *sac; - uint64_t dl, lma, old_vma, start, end; + uint64_t dl, lma, start, end; int found, i; /* @@ -114,8 +116,6 @@ adjust_addr(struct elfcopy *ecp) s->lma += ecp->change_addr; if (!s->pseudo) { - old_vma = s->vma; - /* Apply global VMA adjustment. */ if (ecp->change_addr != 0) s->vma += ecp->change_addr; Modified: head/contrib/elftoolchain/elfcopy/symbols.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/symbols.c Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/elfcopy/symbols.c Mon Dec 29 19:16:40 2014 (r276371) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: symbols.c 2971 2013-12-01 15:22:21Z kaiwang27 $"); +ELFTC_VCSID("$Id: symbols.c 3019 2014-04-17 14:53:40Z jkoshy $"); /* Symbol table buffer structure. */ struct symbuf { @@ -300,7 +300,7 @@ generate_symbols(struct elfcopy *ecp) GElf_Sym sym; Elf_Data* id; Elf_Scn *is; - size_t ishstrndx, namelen, ndx, nsyms, sc, symndx; + size_t ishstrndx, namelen, ndx, sc, symndx; int ec, elferr, i; if (elf_getshstrndx(ecp->ein, &ishstrndx) == 0) @@ -320,7 +320,6 @@ generate_symbols(struct elfcopy *ecp) st_buf->lcap = 64; st_buf->lsz = 1; /* '\0' at start. */ st_buf->gsz = 0; - nsyms = 0; ecp->symtab->sz = 0; ecp->strtab->sz = 0; Modified: head/contrib/elftoolchain/libdwarf/Makefile ============================================================================== --- head/contrib/elftoolchain/libdwarf/Makefile Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/Makefile Mon Dec 29 19:16:40 2014 (r276371) @@ -1,4 +1,4 @@ -# $Id: Makefile 2937 2013-04-27 04:48:23Z jkoshy $ +# $Id: Makefile 3097 2014-09-02 22:10:18Z kaiwang27 $ TOP= ${.CURDIR}/.. @@ -42,6 +42,7 @@ SRCS= \ dwarf_pubtypes.c \ dwarf_ranges.c \ dwarf_reloc.c \ + dwarf_sections.c \ dwarf_seterror.c \ dwarf_str.c \ dwarf_types.c \ @@ -115,6 +116,7 @@ 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 \ @@ -154,6 +156,7 @@ 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 \ @@ -175,6 +178,7 @@ 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 \ @@ -192,6 +196,7 @@ 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 \ @@ -220,7 +225,9 @@ 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 \ @@ -234,6 +241,7 @@ 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 \ @@ -273,6 +281,7 @@ 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 \ @@ -291,6 +300,7 @@ 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 \ @@ -302,6 +312,9 @@ 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 \ Modified: head/contrib/elftoolchain/libdwarf/Version.map ============================================================================== --- head/contrib/elftoolchain/libdwarf/Version.map Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/Version.map Mon Dec 29 19:16:40 2014 (r276371) @@ -1,4 +1,4 @@ -/* $Id: Version.map 2576 2012-09-13 09:16:11Z jkoshy $ */ +/* $Id: Version.map 3085 2014-09-02 22:08:23Z kaiwang27 $ */ R1.0 { global: @@ -39,6 +39,7 @@ global: dwarf_arrayorder; dwarf_attr; dwarf_attrlist; + dwarf_attroffset; dwarf_attrval_flag; dwarf_attrval_signed; dwarf_attrval_string; @@ -116,6 +117,8 @@ 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; @@ -139,6 +142,8 @@ 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; @@ -152,6 +157,7 @@ global: dwarf_hasattr; dwarf_hasform; dwarf_highpc; + dwarf_highpc_b; dwarf_init; dwarf_line_srcfileno; dwarf_lineaddr; @@ -166,6 +172,7 @@ 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; @@ -173,9 +180,12 @@ 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; @@ -196,6 +206,7 @@ global: dwarf_seterrarg; dwarf_seterrhand; dwarf_siblingof; + dwarf_siblingof_b; dwarf_srcfiles; dwarf_srclang; dwarf_srclines; Modified: head/contrib/elftoolchain/libdwarf/_libdwarf.h ============================================================================== --- head/contrib/elftoolchain/libdwarf/_libdwarf.h Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/_libdwarf.h Mon Dec 29 19:16:40 2014 (r276371) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2007 John Birrell (jb@freebsd.org) - * Copyright (c) 2009-2011 Kai Wang + * Copyright (c) 2009-2014 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 2075 2011-10-27 03:47:28Z jkoshy $ + * $Id: _libdwarf.h 3106 2014-12-19 16:00:58Z kaiwang27 $ */ #ifndef __LIBDWARF_H_ @@ -89,6 +89,7 @@ extern struct _libdwarf_globals _libdwar goto gen_fail; \ } while(0) +typedef struct _Dwarf_CU *Dwarf_CU; struct _Dwarf_AttrDef { uint64_t ad_attrib; /* DW_AT_XXX */ @@ -147,14 +148,6 @@ 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. */ @@ -265,6 +258,8 @@ 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. */ @@ -333,11 +328,14 @@ 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. */ }; @@ -399,17 +397,21 @@ 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. */ - TAILQ_HEAD(, _Dwarf_Loclist) dbg_loclist; /* List of location list. */ + Dwarf_CU dbg_tu_current; /* Ptr to the current TU. */ 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. */ @@ -532,13 +534,15 @@ int _dwarf_elf_get_section_info(void *, 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 *, Dwarf_Unsigned, - Dwarf_Frame_Op **, Dwarf_Signed *, 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_internal_table(Dwarf_Fde, Dwarf_Addr, Dwarf_Regtable3 **, Dwarf_Addr *, Dwarf_Error *); int _dwarf_frame_interal_table_init(Dwarf_Debug, Dwarf_Error *); @@ -553,9 +557,12 @@ Dwarf_Unsigned _dwarf_get_reloc_type(Dwa 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, int, Dwarf_Error *); +int _dwarf_info_load(Dwarf_Debug, Dwarf_Bool, Dwarf_Bool, + 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 *); @@ -563,20 +570,19 @@ int _dwarf_lineno_gen(Dwarf_P_Debug, Dw 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, Dwarf_Error *); +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_locexpr(Dwarf_Debug, Dwarf_Locdesc **, - uint8_t *, uint64_t, uint8_t, Dwarf_Error *); + uint8_t *, uint64_t, uint8_t, uint8_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_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 *); + Dwarf_Locdesc ***, Dwarf_Signed *, Dwarf_Unsigned *, + 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 *); @@ -633,6 +639,7 @@ 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 *); Modified: head/contrib/elftoolchain/libdwarf/dwarf.3 ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf.3 Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/dwarf.3 Mon Dec 29 19:16:40 2014 (r276371) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: dwarf.3 2075 2011-10-27 03:47:28Z jkoshy $ +.\" $Id: dwarf.3 3130 2014-12-21 20:06:29Z jkoshy $ .\" -.Dd September 17, 2011 +.Dd December 21, 2014 .Os .Dt DWARF 3 .Sh NAME @@ -217,6 +217,8 @@ 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 @@ -309,10 +311,17 @@ Retrieve range information from an FDE d .El .It Compilation Units .Bl -tag -compact -.It Fn dwarf_get_cu_die_offset_given_cu_header_offset +.It Xo +.Fn dwarf_get_cu_die_offset_given_cu_header_offset , +.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b +.Xc Retrieve the offset of the debugging information entry for a -compilation unit. -.It Fn dwarf_next_cu_header , Fn dwarf_next_cu_header_b +compilation or type unit. +.It Xo +.Fn dwarf_next_cu_header , +.Fn dwarf_next_cu_header_b , +.Fn dwarf_next_cu_header_c +.Xc Step through compilation units in a debug context. .El .It Debugging Information Entries @@ -329,13 +338,15 @@ Returns the attribute for a debugging information entry. .It Fn dwarf_dieoffset Retrieves the offset for a debugging information entry. -.It Fn dwarf_highpc +.It Fn dwarf_get_die_infotypes_flag +Indicate the originating section for a debugging information entry. +.It Fn dwarf_highpc , Fn dwarf_highpc_b 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 +.It Fn dwarf_offdie , Fn dwarf_offdie_b Retrieve a debugging information entry given an offset. -.It Fn dwarf_siblingof +.It Fn dwarf_siblingof , Fn dwarf_siblingof_b Retrieve the sibling descriptor for a debugging information entry. .It Fn dwarf_srclang Retrive the source language attribute for a debugging information @@ -416,7 +427,11 @@ Return line number information for a com Retrieve a location list entry. .It Fn dwarf_loclist , Fn dwarf_loclist_n Retrieve location expressions. -.It Fn dwarf_loclist_from_expr , Fn dwarf_loclist_from_expr_a +.It Xo +.Fn dwarf_loclist_from_expr , +.Fn dwarf_loclist_from_expr_a , +.Fn dwarf_loclist_from_expr_b +.Xc Translate a location expression into a location descriptor. .El .It Error Handling @@ -513,6 +528,10 @@ 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 @@ -699,9 +718,16 @@ addition to the per-debug context handle 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 -The following API is an extension: -.Fn dwarf_producer_set_isa . +.Fn dwarf_next_types_section +.It +.Fn dwarf_producer_set_isa .El .Sh SEE ALSO .Xr elf 3 Modified: head/contrib/elftoolchain/libdwarf/dwarf.h ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf.h Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/dwarf.h Mon Dec 29 19:16:40 2014 (r276371) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dwarf.h 2075 2011-10-27 03:47:28Z jkoshy $ + * $Id: dwarf.h 3052 2014-05-26 20:36:24Z kaiwang27 $ */ #ifndef _DWARF_H_ @@ -93,6 +93,19 @@ #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 @@ -195,6 +208,32 @@ #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 @@ -220,6 +259,8 @@ #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 @@ -376,9 +417,23 @@ #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 Modified: head/contrib/elftoolchain/libdwarf/dwarf_attr.3 ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attr.3 Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/dwarf_attr.3 Mon Dec 29 19:16:40 2014 (r276371) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_attr.3 2072 2011-10-27 03:26:49Z jkoshy $ +.\" $Id: dwarf_attr.3 3093 2014-09-02 22:09:40Z kaiwang27 $ .\" .Dd April 8, 2010 .Os @@ -113,6 +113,7 @@ 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 , Modified: head/contrib/elftoolchain/libdwarf/dwarf_attr.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attr.c Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/dwarf_attr.c Mon Dec 29 19:16:40 2014 (r276371) @@ -27,7 +27,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_attr.c 2072 2011-10-27 03:26:49Z jkoshy $"); +ELFTC_VCSID("$Id: dwarf_attr.c 3064 2014-06-06 19:35:55Z kaiwang27 $"); int dwarf_attr(Dwarf_Die die, Dwarf_Half attr, Dwarf_Attribute *atp, @@ -114,6 +114,23 @@ dwarf_hasattr(Dwarf_Die die, Dwarf_Half } 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; @@ -139,8 +156,17 @@ dwarf_lowpc(Dwarf_Die die, Dwarf_Addr *r 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; @@ -156,6 +182,17 @@ dwarf_highpc(Dwarf_Die die, Dwarf_Addr * *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); } Copied: head/contrib/elftoolchain/libdwarf/dwarf_attroffset.3 (from r276167, projects/elftoolchain-update-r3130/contrib/elftoolchain/libdwarf/dwarf_attroffset.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/libdwarf/dwarf_attroffset.3 Mon Dec 29 19:16:40 2014 (r276371, copy of r276167, projects/elftoolchain-update-r3130/contrib/elftoolchain/libdwarf/dwarf_attroffset.3) @@ -0,0 +1,86 @@ +.\" 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 Modified: head/contrib/elftoolchain/libdwarf/dwarf_attrval.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attrval.c Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/dwarf_attrval.c Mon Dec 29 19:16:40 2014 (r276371) @@ -26,7 +26,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_attrval.c 2072 2011-10-27 03:26:49Z jkoshy $"); +ELFTC_VCSID("$Id: dwarf_attrval.c 2977 2014-01-21 20:13:31Z kaiwang27 $"); int dwarf_attrval_flag(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *valp, Dwarf_Error *err) Modified: head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Mon Dec 29 19:16:40 2014 (r276371) @@ -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 2072 2011-10-27 03:26:49Z jkoshy $ +.\" $Id: dwarf_attrval_signed.3 2980 2014-01-21 20:15:54Z kaiwang27 $ .\" .Dd January 18, 2014 .Os Modified: head/contrib/elftoolchain/libdwarf/dwarf_child.3 ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_child.3 Mon Dec 29 19:04:17 2014 (r276370) +++ head/contrib/elftoolchain/libdwarf/dwarf_child.3 Mon Dec 29 19:16:40 2014 (r276371) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2010 Kai Wang +.\" Copyright (c) 2010,2014 Kai Wang .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,15 +22,17 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_child.3 2122 2011-11-09 15:35:14Z jkoshy $ +.\" $Id: dwarf_child.3 3127 2014-12-21 19:09:19Z jkoshy $ .\" -.Dd November 9, 2011 +.Dd December 21, 2014 .Os .Dt DWARF_CHILD 3 .Sh NAME .Nm dwarf_child , +.Nm dwarf_offdie , +.Nm dwarf_offdie_b , .Nm dwarf_siblingof , -.Nm dwarf_offdie +.Nm dwarf_siblingof_b .Nd retrieve DWARF Debugging Information Entry descriptors .Sh LIBRARY .Lb libdwarf @@ -39,6 +41,21 @@ .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 *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***