Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/FreeBSD]: src/external/bsd/libdwarf/dist Import libdwarf from FreeBSD 8....



details:   https://anonhg.NetBSD.org/src/rev/fd2616fcee5e
branches:  FreeBSD
changeset: 319380:fd2616fcee5e
user:      darran <darran%NetBSD.org@localhost>
date:      Wed Dec 23 00:03:21 2009 +0000

description:
Import libdwarf from FreeBSD 8.0-RC1.
ok tls@.

diffstat:

 external/bsd/libdwarf/dist/Makefile        |   30 +
 external/bsd/libdwarf/dist/_libdwarf.h     |  170 +++++
 external/bsd/libdwarf/dist/dwarf.h         |  480 +++++++++++++++
 external/bsd/libdwarf/dist/dwarf_abbrev.c  |   73 ++
 external/bsd/libdwarf/dist/dwarf_attr.c    |   94 +++
 external/bsd/libdwarf/dist/dwarf_attrval.c |  272 ++++++++
 external/bsd/libdwarf/dist/dwarf_cu.c      |   70 ++
 external/bsd/libdwarf/dist/dwarf_dealloc.c |   43 +
 external/bsd/libdwarf/dist/dwarf_die.c     |  193 ++++++
 external/bsd/libdwarf/dist/dwarf_dump.c    |  894 +++++++++++++++++++++++++++++
 external/bsd/libdwarf/dist/dwarf_errmsg.c  |   78 ++
 external/bsd/libdwarf/dist/dwarf_errno.c   |   40 +
 external/bsd/libdwarf/dist/dwarf_finish.c  |  100 +++
 external/bsd/libdwarf/dist/dwarf_form.c    |   49 +
 external/bsd/libdwarf/dist/dwarf_init.c    |  750 ++++++++++++++++++++++++
 external/bsd/libdwarf/dist/dwarf_loc.c     |  615 +++++++++++++++++++
 external/bsd/libdwarf/dist/libdwarf.h      |  164 +++++
 17 files changed, 4115 insertions(+), 0 deletions(-)

diffs (truncated from 4183 to 300 lines):

diff -r dacd78036141 -r fd2616fcee5e external/bsd/libdwarf/dist/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libdwarf/dist/Makefile       Wed Dec 23 00:03:21 2009 +0000
@@ -0,0 +1,30 @@
+# $FreeBSD: src/lib/libdwarf/Makefile,v 1.2.2.1 2009/08/03 08:13:06 kensmith Exp $
+
+LIB=   dwarf
+
+SRCS=  \
+       dwarf_abbrev.c          \
+       dwarf_attr.c            \
+       dwarf_attrval.c         \
+       dwarf_cu.c              \
+       dwarf_dealloc.c         \
+       dwarf_die.c             \
+       dwarf_dump.c            \
+       dwarf_errmsg.c          \
+       dwarf_errno.c           \
+       dwarf_finish.c          \
+       dwarf_form.c            \
+       dwarf_init.c            \
+       dwarf_loc.c
+
+INCS=  dwarf.h libdwarf.h
+
+CFLAGS+=       -I. -I${.CURDIR}
+
+SHLIB_MAJOR=   2
+
+WARNS?=        6
+
+WITHOUT_MAN=   yes
+
+.include <bsd.lib.mk>
diff -r dacd78036141 -r fd2616fcee5e external/bsd/libdwarf/dist/_libdwarf.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libdwarf/dist/_libdwarf.h    Wed Dec 23 00:03:21 2009 +0000
@@ -0,0 +1,170 @@
+/*     $NetBSD: _libdwarf.h,v 1.1.1.1 2009/12/23 00:03:27 darran Exp $ */
+
+/*-
+ * Copyright (c) 2007 John Birrell (jb%freebsd.org@localhost)
+ * 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.
+ *
+ * $FreeBSD: src/lib/libdwarf/_libdwarf.h,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
+ */
+
+#ifndef        __LIBDWARF_H_
+#define        __LIBDWARF_H_
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <stdio.h>
+#include <gelf.h>
+#include "dwarf.h"
+#include "libdwarf.h"
+
+#define DWARF_debug_abbrev             0
+#define DWARF_debug_aranges            1
+#define DWARF_debug_frame              2
+#define DWARF_debug_info               3
+#define DWARF_debug_line               4
+#define DWARF_debug_pubnames           5
+#define DWARF_eh_frame                 6
+#define DWARF_debug_macinfo            7
+#define DWARF_debug_str                        8
+#define DWARF_debug_loc                        9
+#define DWARF_debug_pubtypes           10
+#define DWARF_debug_ranges             11
+#define DWARF_debug_static_func                12
+#define DWARF_debug_static_vars                13
+#define DWARF_debug_types              14
+#define DWARF_debug_weaknames          15
+#define DWARF_symtab                   16
+#define DWARF_strtab                   17
+#define DWARF_DEBUG_SNAMES             18
+
+#define DWARF_DIE_HASH_SIZE            8191
+
+#define        DWARF_SET_ERROR(_e, _err)       do {            \
+       _e->err_error = _err;                           \
+       _e->elf_error = 0;                              \
+       _e->err_func  = __func__;                       \
+       _e->err_line  = __LINE__;                       \
+       _e->err_msg[0] = '\0';                          \
+       } while (0)
+
+#define        DWARF_SET_ELF_ERROR(_e, _err)   do {            \
+       _e->err_error = DWARF_E_ELF;                    \
+       _e->elf_error = _err;                           \
+       _e->err_func  = __func__;                       \
+       _e->err_line  = __LINE__;                       \
+       _e->err_msg[0] = '\0';                          \
+       } while (0)
+
+struct _Dwarf_AttrValue {
+       uint64_t        av_attrib;      /* DW_AT_ */
+       uint64_t        av_form;        /* DW_FORM_ */
+       union {
+               uint64_t        u64;
+               int64_t         s64;
+               const char      *s;
+               uint8_t         *u8p;
+       } u[2];                         /* Value. */
+       STAILQ_ENTRY(_Dwarf_AttrValue)
+                       av_next;        /* Next attribute value. */
+};
+
+struct _Dwarf_Die {
+       int             die_level;      /* Parent-child level. */
+       uint64_t        die_offset;     /* DIE offset in section. */
+       uint64_t        die_abnum;      /* Abbrev number. */
+       Dwarf_Abbrev    die_a;          /* Abbrev pointer. */
+       Dwarf_CU        die_cu;         /* Compilation unit pointer. */
+       const char      *die_name;      /* Ptr to the name string. */
+       STAILQ_HEAD(, _Dwarf_AttrValue)
+                       die_attrval;    /* List of attribute values. */
+       STAILQ_ENTRY(_Dwarf_Die)
+                       die_next;       /* Next die in list. */
+       STAILQ_ENTRY(_Dwarf_Die)
+                       die_hash;       /* Next die in hash table. */
+};
+
+struct _Dwarf_Attribute {
+       uint64_t        at_attrib;      /* DW_AT_ */
+       uint64_t        at_form;        /* DW_FORM_ */
+       STAILQ_ENTRY(_Dwarf_Attribute)
+                       at_next;        /* Next attribute. */
+};
+
+struct _Dwarf_Abbrev {
+       uint64_t        a_entry;        /* Abbrev entry. */
+       uint64_t        a_tag;          /* Tag: DW_TAG_ */
+       uint8_t         a_children;     /* DW_CHILDREN_no or DW_CHILDREN_yes */
+       STAILQ_HEAD(, _Dwarf_Attribute)
+                       a_attrib;       /* List of attributes. */
+       STAILQ_ENTRY(_Dwarf_Abbrev)
+                       a_next;         /* Next abbrev. */
+};
+
+struct _Dwarf_CU {
+       uint64_t        cu_offset;      /* Offset to the this compilation unit. */
+       uint32_t        cu_length;      /* Length of CU data. */
+       uint32_t        cu_header_length;
+                                       /* Length of the CU header. */
+       uint16_t        cu_version;     /* DWARF version. */
+       uint64_t        cu_abbrev_offset;
+                                       /* Offset into .debug_abbrev. */
+       uint8_t         cu_pointer_size;
+                                       /* Number of bytes in pointer. */
+       uint64_t        cu_next_offset;
+                                       /* Offset to the next compilation unit. */
+       STAILQ_HEAD(, _Dwarf_Abbrev)
+                       cu_abbrev;      /* List of abbrevs. */
+       STAILQ_HEAD(, _Dwarf_Die)
+                       cu_die;         /* List of dies. */
+       STAILQ_HEAD(, _Dwarf_Die)
+                       cu_die_hash[DWARF_DIE_HASH_SIZE];
+                                       /* Hash of dies. */
+       STAILQ_ENTRY(_Dwarf_CU)
+                       cu_next;        /* Next compilation unit. */
+};
+
+typedef struct _Dwarf_section {
+       Elf_Scn         *s_scn;         /* Section pointer. */
+       GElf_Shdr       s_shdr;         /* Copy of the section header. */
+       char            *s_sname;       /* Ptr to the section name. */
+       uint32_t        s_shnum;        /* Section number. */
+       Elf_Data        *s_data;        /* Section data. */
+} Dwarf_section;
+
+struct _Dwarf_Debug {
+       Elf             *dbg_elf;       /* Ptr to the ELF handle. */
+       GElf_Ehdr       dbg_ehdr;       /* Copy of the ELF header. */
+       int             dbg_elf_close;  /* True if elf_end() required. */
+       int             dbg_mode;       /* Access mode. */
+       size_t          dbg_stnum;      /* Section header string table section number. */
+       int             dbg_offsize;    /* DWARF offset size. */
+       Dwarf_section   dbg_s[DWARF_DEBUG_SNAMES];
+                                       /* Array of section information. */
+       STAILQ_HEAD(, _Dwarf_CU)
+                       dbg_cu;         /* List of compilation units. */
+       Dwarf_CU        dbg_cu_current;
+                                       /* Ptr to the current compilation unit. */
+};
+
+#endif /* !__LIBDWARF_H_ */
diff -r dacd78036141 -r fd2616fcee5e external/bsd/libdwarf/dist/dwarf.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libdwarf/dist/dwarf.h        Wed Dec 23 00:03:21 2009 +0000
@@ -0,0 +1,480 @@
+/*     $NetBSD: dwarf.h,v 1.1.1.1 2009/12/23 00:03:27 darran Exp $     */
+
+/*-
+ * Copyright (c) 2007 John Birrell (jb%freebsd.org@localhost)
+ * 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.
+ *
+ * $FreeBSD: src/lib/libdwarf/dwarf.h,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
+ */
+
+#ifndef        _DWARF_H_
+#define        _DWARF_H_
+
+#define DW_TAG_array_type              0x01
+#define DW_TAG_class_type              0x02
+#define DW_TAG_entry_point             0x03
+#define DW_TAG_enumeration_type                0x04
+#define DW_TAG_formal_parameter                0x05
+#define DW_TAG_imported_declaration    0x08
+#define DW_TAG_label                   0x0a
+#define DW_TAG_lexical_block           0x0b
+#define DW_TAG_member                  0x0d
+#define DW_TAG_pointer_type            0x0f
+#define DW_TAG_reference_type          0x10
+#define DW_TAG_compile_unit            0x11
+#define DW_TAG_string_type             0x12
+#define DW_TAG_structure_type          0x13
+#define DW_TAG_subroutine_type         0x15
+#define DW_TAG_typedef                 0x16
+#define DW_TAG_union_type              0x17
+#define DW_TAG_unspecified_parameters  0x18
+#define DW_TAG_variant                 0x19
+#define DW_TAG_common_block            0x1a
+#define DW_TAG_common_inclusion                0x1b
+#define DW_TAG_inheritance             0x1c
+#define DW_TAG_inlined_subroutine      0x1d
+#define DW_TAG_module                  0x1e
+#define DW_TAG_ptr_to_member_type      0x1f
+#define DW_TAG_set_type                        0x20
+#define DW_TAG_subrange_type           0x21
+#define DW_TAG_with_stmt               0x22
+#define DW_TAG_access_declaration      0x23
+#define DW_TAG_base_type               0x24
+#define DW_TAG_catch_block             0x25
+#define DW_TAG_const_type              0x26
+#define DW_TAG_constant                        0x27
+#define DW_TAG_enumerator              0x28
+#define DW_TAG_friend                  0x2a
+#define DW_TAG_namelist                        0x2b
+#define DW_TAG_namelist_item           0x2c
+#define DW_TAG_packed_type             0x2d
+#define DW_TAG_subprogram              0x2e
+#define DW_TAG_template_type_parameter 0x2f
+#define DW_TAG_template_type_param     0x2f
+#define DW_TAG_template_value_parameter        0x30
+#define DW_TAG_template_value_param    0x30
+#define DW_TAG_thrown_type             0x31
+#define DW_TAG_try_block               0x32
+#define DW_TAG_variant_part            0x33
+#define DW_TAG_variable                        0x34
+#define DW_TAG_volatile_type           0x35
+#define DW_TAG_dwarf_procedure          0x36
+#define DW_TAG_restrict_type            0x37
+#define DW_TAG_interface_type           0x38
+#define DW_TAG_namespace                0x39
+#define DW_TAG_imported_module          0x3a
+#define DW_TAG_unspecified_type         0x3b
+#define DW_TAG_partial_unit             0x3c



Home | Main Index | Thread Index | Old Index