summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-05-01 01:52:03 +0000
committeremaste <emaste@FreeBSD.org>2017-05-01 01:52:03 +0000
commitf0bd9b16be9a08f7efde72adaa5de8a67048dc72 (patch)
tree4039f487800151cdf340a56e107ed863f9f8a97b
parente5748c4457aeca479eab2224c7567dc48fab0b6e (diff)
downloadFreeBSD-src-f0bd9b16be9a08f7efde72adaa5de8a67048dc72.zip
FreeBSD-src-f0bd9b16be9a08f7efde72adaa5de8a67048dc72.tar.gz
MFC r317075: Update ELF Tool Chain to upstream r3520
Highlights of changes between r3490 and r3520: - Improve C++ demangling - Improve compatibility with Binutils tools wrt. error messages - Handle additional types/sections/etc. in readelf and elfdump - addr2line, cxxfilt: use setvbuf to set line buffering for filter use Also MFC r317076, version bump. Sponsored by: The FreeBSD Foundation
-rw-r--r--contrib/elftoolchain/addr2line/addr2line.c10
-rw-r--r--contrib/elftoolchain/ar/os.FreeBSD.mk2
-rw-r--r--contrib/elftoolchain/common/elfdefinitions.h10
-rw-r--r--contrib/elftoolchain/cxxfilt/cxxfilt.c3
-rw-r--r--contrib/elftoolchain/elfcopy/main.c7
-rw-r--r--contrib/elftoolchain/elfcopy/os.FreeBSD.mk4
-rw-r--r--contrib/elftoolchain/elfcopy/pe.c2
-rw-r--r--contrib/elftoolchain/elfcopy/symbols.c4
-rw-r--r--contrib/elftoolchain/elfdump/elfdump.c8
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf.h22
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_attrval.c2
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_attrval_signed.32
-rw-r--r--contrib/elftoolchain/libdwarf/dwarf_dump.c38
-rw-r--r--contrib/elftoolchain/libelf/gelf_newehdr.311
-rw-r--r--contrib/elftoolchain/libelf/gelf_newphdr.311
-rw-r--r--contrib/elftoolchain/libelftc/elftc_bfd_find_target.34
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_bfdtarget.c2
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_dem_arm.c173
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c191
-rw-r--r--contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c358
-rw-r--r--contrib/elftoolchain/nm/nm.c4
-rw-r--r--contrib/elftoolchain/readelf/readelf.c54
-rw-r--r--contrib/elftoolchain/strings/strings.c2
-rw-r--r--lib/libelftc/elftc_version.c2
24 files changed, 501 insertions, 425 deletions
diff --git a/contrib/elftoolchain/addr2line/addr2line.c b/contrib/elftoolchain/addr2line/addr2line.c
index 55f450d..9c3a764 100644
--- a/contrib/elftoolchain/addr2line/addr2line.c
+++ b/contrib/elftoolchain/addr2line/addr2line.c
@@ -40,7 +40,7 @@
#include "uthash.h"
#include "_elftc.h"
-ELFTC_VCSID("$Id: addr2line.c 3446 2016-05-03 01:31:17Z emaste $");
+ELFTC_VCSID("$Id: addr2line.c 3499 2016-11-25 16:06:29Z emaste $");
struct Func {
char *name;
@@ -720,11 +720,11 @@ main(int argc, char **argv)
if (argc > 0)
for (i = 0; i < argc; i++)
translate(dbg, e, argv[i]);
- else
- while (fgets(line, sizeof(line), stdin) != NULL) {
+ else {
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ while (fgets(line, sizeof(line), stdin) != NULL)
translate(dbg, e, line);
- fflush(stdout);
- }
+ }
dwarf_finish(dbg, &de);
diff --git a/contrib/elftoolchain/ar/os.FreeBSD.mk b/contrib/elftoolchain/ar/os.FreeBSD.mk
new file mode 100644
index 0000000..c29af70
--- /dev/null
+++ b/contrib/elftoolchain/ar/os.FreeBSD.mk
@@ -0,0 +1,2 @@
+DPADD+= ${LIBBZ2}
+LDADD+= -lbz2
diff --git a/contrib/elftoolchain/common/elfdefinitions.h b/contrib/elftoolchain/common/elfdefinitions.h
index 7460bb6..810da8d 100644
--- a/contrib/elftoolchain/common/elfdefinitions.h
+++ b/contrib/elftoolchain/common/elfdefinitions.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $
+ * $Id: elfdefinitions.h 3515 2017-01-24 22:04:22Z emaste $
*/
/*
@@ -153,6 +153,8 @@ _ELF_DEFINE_DT(DT_SUNW_FILTER, 0x6000000FUL, \
"offset of string naming standard filtees") \
_ELF_DEFINE_DT(DT_SUNW_CAP, 0x60000010UL, \
"address of hardware capabilities section") \
+_ELF_DEFINE_DT(DT_SUNW_ASLR, 0x60000023UL, \
+ "Address Space Layout Randomization flag") \
_ELF_DEFINE_DT(DT_HIOS, 0x6FFFF000UL, \
"end of OS-specific types") \
_ELF_DEFINE_DT(DT_VALRNGLO, 0x6FFFFD00UL, \
@@ -919,6 +921,12 @@ _ELF_DEFINE_PT(PT_GNU_STACK, 0x6474E551UL, \
"Stack flags") \
_ELF_DEFINE_PT(PT_GNU_RELRO, 0x6474E552UL, \
"Segment becomes read-only after relocation") \
+_ELF_DEFINE_PT(PT_OPENBSD_RANDOMIZE,0x65A3DBE6UL, \
+ "Segment filled with random data") \
+_ELF_DEFINE_PT(PT_OPENBSD_WXNEEDED, 0x65A3DBE7UL, \
+ "Program violates W^X") \
+_ELF_DEFINE_PT(PT_OPENBSD_BOOTDATA, 0x65A41BE6UL, \
+ "Boot data") \
_ELF_DEFINE_PT(PT_SUNWBSS, 0x6FFFFFFAUL, \
"A Solaris .SUNW_bss section") \
_ELF_DEFINE_PT(PT_SUNWSTACK, 0x6FFFFFFBUL, \
diff --git a/contrib/elftoolchain/cxxfilt/cxxfilt.c b/contrib/elftoolchain/cxxfilt/cxxfilt.c
index c6d737a..9a051fb 100644
--- a/contrib/elftoolchain/cxxfilt/cxxfilt.c
+++ b/contrib/elftoolchain/cxxfilt/cxxfilt.c
@@ -35,7 +35,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: cxxfilt.c 3454 2016-05-07 17:11:05Z kaiwang27 $");
+ELFTC_VCSID("$Id: cxxfilt.c 3499 2016-11-25 16:06:29Z emaste $");
#define STRBUFSZ 8192
@@ -175,6 +175,7 @@ main(int argc, char **argv)
} else {
p = 0;
for (;;) {
+ setvbuf(stdout, NULL, _IOLBF, 0);
c = fgetc(stdin);
if (c == EOF || !(isalnum(c) || strchr(".$_", c))) {
if (p > 0) {
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index e5cb06b..e8e1875 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/contrib/elftoolchain/elfcopy/main.c
@@ -39,7 +39,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: main.c 3446 2016-05-03 01:31:17Z emaste $");
+ELFTC_VCSID("$Id: main.c 3520 2017-04-17 01:47:52Z kaiwang27 $");
enum options
{
@@ -285,6 +285,7 @@ create_elf(struct elfcopy *ecp)
size_t ishnum;
ecp->flags |= SYMTAB_INTACT;
+ ecp->flags &= ~SYMTAB_EXIST;
/* Create EHDR. */
if (gelf_getehdr(ecp->ein, &ieh) == NULL)
@@ -499,6 +500,10 @@ free_elf(struct elfcopy *ecp)
}
}
+ ecp->symtab = NULL;
+ ecp->strtab = NULL;
+ ecp->shstrtab = NULL;
+
if (ecp->secndx != NULL) {
free(ecp->secndx);
ecp->secndx = NULL;
diff --git a/contrib/elftoolchain/elfcopy/os.FreeBSD.mk b/contrib/elftoolchain/elfcopy/os.FreeBSD.mk
new file mode 100644
index 0000000..389cb59
--- /dev/null
+++ b/contrib/elftoolchain/elfcopy/os.FreeBSD.mk
@@ -0,0 +1,4 @@
+.if !defined(LIBELF_AR)
+DPADD+= ${LIBBZ2}
+LDADD+= -lbz2
+.endif
diff --git a/contrib/elftoolchain/elfcopy/pe.c b/contrib/elftoolchain/elfcopy/pe.c
index 0e02e0b..f7fba1a 100644
--- a/contrib/elftoolchain/elfcopy/pe.c
+++ b/contrib/elftoolchain/elfcopy/pe.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $");
+ELFTC_VCSID("$Id: pe.c 3508 2016-12-27 06:19:39Z kaiwang27 $");
/* Convert ELF object to Portable Executable (PE). */
void
diff --git a/contrib/elftoolchain/elfcopy/symbols.c b/contrib/elftoolchain/elfcopy/symbols.c
index 299ae56..df615d8 100644
--- a/contrib/elftoolchain/elfcopy/symbols.c
+++ b/contrib/elftoolchain/elfcopy/symbols.c
@@ -34,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: symbols.c 3446 2016-05-03 01:31:17Z emaste $");
+ELFTC_VCSID("$Id: symbols.c 3520 2017-04-17 01:47:52Z kaiwang27 $");
/* Backwards compatibility for systems with older ELF definitions. */
#ifndef STB_GNU_UNIQUE
@@ -676,6 +676,8 @@ create_symtab(struct elfcopy *ecp)
sy = ecp->symtab;
st = ecp->strtab;
+ assert(sy != NULL && st != NULL);
+
/*
* Set section index map for .symtab and .strtab. We need to set
* these map because otherwise symbols which refer to .symtab and
diff --git a/contrib/elftoolchain/elfdump/elfdump.c b/contrib/elftoolchain/elfdump/elfdump.c
index 2ce9469..2e8620c 100644
--- a/contrib/elftoolchain/elfdump/elfdump.c
+++ b/contrib/elftoolchain/elfdump/elfdump.c
@@ -50,7 +50,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $");
+ELFTC_VCSID("$Id: elfdump.c 3497 2016-10-17 20:57:22Z emaste $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h"
@@ -223,9 +223,9 @@ d_tags(uint64_t tag)
case 0x6ffffff0: return "DT_GNU_VERSYM";
/* 0x70000000 - 0x7fffffff processor-specific semantics */
case 0x70000000: return "DT_IA_64_PLT_RESERVE";
- case 0x7ffffffd: return "DT_SUNW_AUXILIARY";
- case 0x7ffffffe: return "DT_SUNW_USED";
- case 0x7fffffff: return "DT_SUNW_FILTER";
+ case DT_AUXILIARY: return "DT_AUXILIARY";
+ case DT_USED: return "DT_USED";
+ case DT_FILTER: return "DT_FILTER";
}
snprintf(unknown_buf, sizeof(unknown_buf),
diff --git a/contrib/elftoolchain/libdwarf/dwarf.h b/contrib/elftoolchain/libdwarf/dwarf.h
index f3b85ff..6322568 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 3494 2016-09-20 17:16:13Z emaste $
*/
#ifndef _DWARF_H_
@@ -208,6 +208,25 @@
#define DW_AT_lo_user 0x2000
#define DW_AT_hi_user 0x3fff
+/* SGI/MIPS extensions. */
+#define DW_AT_MIPS_fde 0x2001
+#define DW_AT_MIPS_loop_begin 0x2002
+#define DW_AT_MIPS_tail_loop_begin 0x2003
+#define DW_AT_MIPS_epilog_begin 0x2004
+#define DW_AT_MIPS_loop_unroll_factor 0x2005
+#define DW_AT_MIPS_software_pipeline_depth 0x2006
+#define DW_AT_MIPS_linkage_name 0x2007
+#define DW_AT_MIPS_stride 0x2008
+#define DW_AT_MIPS_abstract_name 0x2009
+#define DW_AT_MIPS_clone_origin 0x200a
+#define DW_AT_MIPS_has_inlines 0x200b
+#define DW_AT_MIPS_stride_byte 0x200c
+#define DW_AT_MIPS_stride_elem 0x200d
+#define DW_AT_MIPS_ptr_dopetype 0x200e
+#define DW_AT_MIPS_allocatable_dopetype 0x200f
+#define DW_AT_MIPS_assumed_shape_dopetype 0x2010
+#define DW_AT_MIPS_assumed_size 0x2011
+
/* GNU extensions. */
#define DW_AT_sf_names 0x2101
#define DW_AT_src_info 0x2102
@@ -505,6 +524,7 @@
#define DW_LANG_UPC 0x0012
#define DW_LANG_D 0x0013
#define DW_LANG_lo_user 0x8000
+#define DW_LANG_Mips_Assembler 0x8001
#define DW_LANG_hi_user 0xffff
#define DW_ID_case_sensitive 0x00
diff --git a/contrib/elftoolchain/libdwarf/dwarf_attrval.c b/contrib/elftoolchain/libdwarf/dwarf_attrval.c
index 19a4fd9..9a2f791 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 3509 2016-12-29 03:58:41Z emaste $");
int
dwarf_attrval_flag(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *valp, Dwarf_Error *err)
diff --git a/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 b/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3
index 4c129dc..c9416bc 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 3509 2016-12-29 03:58:41Z emaste $
.\"
.Dd December 26, 2016
.Os
diff --git a/contrib/elftoolchain/libdwarf/dwarf_dump.c b/contrib/elftoolchain/libdwarf/dwarf_dump.c
index 03b6d6c..aa7ef1d 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 3494 2016-09-20 17:16:13Z emaste $");
int
dwarf_get_ACCESS_name(unsigned access, const char **s)
@@ -262,6 +262,40 @@ dwarf_get_AT_name(unsigned attr, const char **s)
*s = "DW_AT_body_begin"; break;
case DW_AT_body_end:
*s = "DW_AT_body_end"; break;
+ case DW_AT_MIPS_fde:
+ *s = "DW_AT_MIPS_fde"; break;
+ case DW_AT_MIPS_loop_begin:
+ *s = "DW_AT_MIPS_loop_begin"; break;
+ case DW_AT_MIPS_tail_loop_begin:
+ *s = "DW_AT_MIPS_tail_loop_begin"; break;
+ case DW_AT_MIPS_epilog_begin:
+ *s = "DW_AT_MIPS_epilog_begin"; break;
+ case DW_AT_MIPS_loop_unroll_factor:
+ *s = "DW_AT_MIPS_loop_unroll_factor"; break;
+ case DW_AT_MIPS_software_pipeline_depth:
+ *s = "DW_AT_MIPS_software_pipeline_depth"; break;
+ case DW_AT_MIPS_linkage_name:
+ *s = "DW_AT_MIPS_linkage_name"; break;
+ case DW_AT_MIPS_stride:
+ *s = "DW_AT_MIPS_stride"; break;
+ case DW_AT_MIPS_abstract_name:
+ *s = "DW_AT_MIPS_abstract_name"; break;
+ case DW_AT_MIPS_clone_origin:
+ *s = "DW_AT_MIPS_clone_origin"; break;
+ case DW_AT_MIPS_has_inlines:
+ *s = "DW_AT_MIPS_has_inlines"; break;
+ case DW_AT_MIPS_stride_byte:
+ *s = "DW_AT_MIPS_stride_byte"; break;
+ case DW_AT_MIPS_stride_elem:
+ *s = "DW_AT_MIPS_stride_elem"; break;
+ case DW_AT_MIPS_ptr_dopetype:
+ *s = "DW_AT_MIPS_ptr_dopetype"; break;
+ case DW_AT_MIPS_allocatable_dopetype:
+ *s = "DW_AT_MIPS_allocatable_dopetype"; break;
+ case DW_AT_MIPS_assumed_shape_dopetype:
+ *s = "DW_AT_MIPS_assumed_shape_dopetype"; break;
+ case DW_AT_MIPS_assumed_size:
+ *s = "DW_AT_MIPS_assumed_size"; break;
case DW_AT_GNU_vector:
*s = "DW_AT_GNU_vector"; break;
case DW_AT_GNU_guarded_by:
@@ -756,6 +790,8 @@ dwarf_get_LANG_name(unsigned lang, const char **s)
*s = "DW_LANG_D"; break;
case DW_LANG_lo_user:
*s = "DW_LANG_lo_user"; break;
+ case DW_LANG_Mips_Assembler:
+ *s = "DW_LANG_Mips_Assembler"; break;
case DW_LANG_hi_user:
*s = "DW_LANG_hi_user"; break;
default:
diff --git a/contrib/elftoolchain/libelf/gelf_newehdr.3 b/contrib/elftoolchain/libelf/gelf_newehdr.3
index 180fea9..cba9de0 100644
--- a/contrib/elftoolchain/libelf/gelf_newehdr.3
+++ b/contrib/elftoolchain/libelf/gelf_newehdr.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: gelf_newehdr.3 189 2008-07-20 10:38:08Z jkoshy $
+.\" $Id: gelf_newehdr.3 3500 2016-12-04 11:08:44Z jkoshy $
.\"
.Dd October 22, 2007
.Os
@@ -127,6 +127,15 @@ flag on ELF descriptor
.Sh RETURN VALUES
These functions return a pointer to a translated header descriptor
if successful, or NULL on failure.
+.Sh COMPATIBILITY
+The
+.Fn gelf_newehdr
+function uses a type of
+.Ft "void *"
+for its returned value.
+This differs from some other implementations of the ELF(3) API, which use an
+.Ft "unsigned long"
+return type.
.Sh ERRORS
These functions can fail with the following errors:
.Bl -tag -width "[ELF_E_RESOURCE]"
diff --git a/contrib/elftoolchain/libelf/gelf_newphdr.3 b/contrib/elftoolchain/libelf/gelf_newphdr.3
index 931385e..27e561d 100644
--- a/contrib/elftoolchain/libelf/gelf_newphdr.3
+++ b/contrib/elftoolchain/libelf/gelf_newphdr.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: gelf_newphdr.3 189 2008-07-20 10:38:08Z jkoshy $
+.\" $Id: gelf_newphdr.3 3500 2016-12-04 11:08:44Z jkoshy $
.\"
.Dd October 22, 2007
.Os
@@ -97,6 +97,15 @@ will no longer be valid.
.Sh RETURN VALUES
The functions a valid pointer if successful, or NULL in case an error
was encountered.
+.Sh COMPATIBILITY
+The
+.Fn gelf_newphdr
+function uses a type of
+.Ft "void *"
+for its returned value.
+This differs from some other implementations of the ELF(3) API, which use an
+.Ft "unsigned long"
+return type.
.Sh ERRORS
These functions may fail with the following errors:
.Bl -tag -width "[ELF_E_RESOURCE]"
diff --git a/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 b/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
index a287339..302c319 100644
--- a/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
+++ b/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elftc_bfd_find_target.3 3488 2016-08-24 18:15:57Z emaste $
+.\" $Id: elftc_bfd_find_target.3 3516 2017-02-10 02:33:08Z emaste $
.\"
.Dd November 30, 2011
.Os
@@ -74,6 +74,7 @@ Known descriptor names and their properties include:
.It Li elf32-littlearm Ta ELF Ta LSB Ta 32
.It Li elf32-littlemips Ta ELF Ta LSB Ta 32
.It Li elf32-powerpc Ta ELF Ta MSB Ta 32
+.It Li elf32-powerpc-freebsd Ta ELF Ta MSB Ta 32
.It Li elf32-powerpcle Ta ELF Ta LSB Ta 32
.It Li elf32-sh Ta ELF Ta MSB Ta 32
.It Li elf32-shl Ta ELF Ta LSB Ta 32
@@ -94,6 +95,7 @@ Known descriptor names and their properties include:
.It Li elf64-littleaarch64 Ta ELF Ta LSB Ta 64
.It Li elf64-littlemips Ta ELF Ta LSB Ta 64
.It Li elf64-powerpc Ta ELF Ta MSB Ta 64
+.It Li elf64-powerpc-freebsd Ta ELF Ta MSB Ta 64
.It Li elf64-powerpcle Ta ELF Ta LSB Ta 64
.It Li elf64-sh64 Ta ELF Ta MSB Ta 64
.It Li elf64-sh64l Ta ELF Ta LSB Ta 64
diff --git a/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c b/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
index 43b9480..12cb168 100644
--- a/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
+++ b/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
@@ -30,7 +30,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $");
+ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3516 2017-02-10 02:33:08Z emaste $");
struct _Elftc_Bfd_Target _libelftc_targets[] = {
diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
index 012819e..5550505 100644
--- a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
+++ b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
@@ -37,7 +37,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_dem_arm.c 3447 2016-05-03 13:32:23Z emaste $");
+ELFTC_VCSID("$Id: libelftc_dem_arm.c 3513 2016-12-29 07:04:22Z kaiwang27 $");
/**
* @file cpp_demangle_arm.c
@@ -68,6 +68,7 @@ struct demangle_data {
};
#define SIMPLE_HASH(x,y) (64 * x + y)
+#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s)))
#define CPP_DEMANGLE_ARM_TRY 128
static void dest_cstring(struct cstring *);
@@ -137,7 +138,7 @@ cpp_demangle_ARM(const char *org)
++d.p;
/* start argument types */
- if (vector_str_push(&d.vec, "(", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, "(") == false)
goto clean;
for (;;) {
@@ -169,21 +170,21 @@ cpp_demangle_ARM(const char *org)
goto clean;
if (d.ptr == true) {
- if (vector_str_push(&d.vec, "*", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, "*") == false)
goto clean;
d.ptr = false;
}
if (d.ref == true) {
- if (vector_str_push(&d.vec, "&", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, "&") == false)
goto clean;
d.ref = false;
}
if (d.cnst == true) {
- if (vector_str_push(&d.vec, " const", 6) == false)
+ if (VEC_PUSH_STR(&d.vec, " const") == false)
goto clean;
d.cnst = false;
@@ -210,7 +211,7 @@ cpp_demangle_ARM(const char *org)
free(arg);
- if (vector_str_push(&d.vec, ", ", 2) == false)
+ if (VEC_PUSH_STR(&d.vec, ", ") == false)
goto clean;
if (++try > CPP_DEMANGLE_ARM_TRY)
@@ -218,7 +219,7 @@ cpp_demangle_ARM(const char *org)
}
/* end argument types */
- if (vector_str_push(&d.vec, ")", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, ")") == false)
goto clean;
flat:
@@ -323,11 +324,10 @@ push_CTDT(const char *s, size_t l, struct vector_str *v)
return (false);
assert(v->size > 1);
- if (vector_str_push(v, v->container[v->size - 2],
- strlen(v->container[v->size - 2])) == false)
+ if (VEC_PUSH_STR(v, v->container[v->size - 2]) == false)
return (false);
- if (vector_str_push(v, "()", 2) == false)
+ if (VEC_PUSH_STR(v, "()") == false)
return (false);
return (true);
@@ -429,7 +429,7 @@ read_func(struct demangle_data *d)
if (read_class(d) == false)
return (false);
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
return (false);
}
@@ -486,7 +486,7 @@ read_func_name(struct demangle_data *d)
if (read_qual_name(d) == false)
goto clean;
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
goto clean;
if (vector_str_push(&d->vec, op_name, len) == false)
@@ -508,7 +508,7 @@ read_func_name(struct demangle_data *d)
if (read_class(d) == false)
goto clean;
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
goto clean;
if (vector_str_push(&d->vec, op_name, len) == false)
@@ -553,7 +553,7 @@ read_func_ptr(struct demangle_data *d)
}
if (fptr.ptr == true) {
- if (vector_str_push(&fptr.vec, "*", 1) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, "*") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -563,7 +563,7 @@ read_func_ptr(struct demangle_data *d)
}
if (fptr.ref == true) {
- if (vector_str_push(&fptr.vec, "&", 1) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, "&") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -573,7 +573,7 @@ read_func_ptr(struct demangle_data *d)
}
if (fptr.cnst == true) {
- if (vector_str_push(&fptr.vec, " const", 6) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, " const") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -585,7 +585,7 @@ read_func_ptr(struct demangle_data *d)
if (*fptr.p == '_')
break;
- if (vector_str_push(&fptr.vec, ", ", 2) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, ", ") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -636,7 +636,7 @@ read_func_ptr(struct demangle_data *d)
free(rtn_type);
- if (vector_str_push(&d->vec, " (*)(", 5) == false) {
+ if (VEC_PUSH_STR(&d->vec, " (*)(") == false) {
free(arg_type);
return (false);
@@ -650,7 +650,7 @@ read_func_ptr(struct demangle_data *d)
free(arg_type);
- return (vector_str_push(&d->vec, ")", 1));
+ return (VEC_PUSH_STR(&d->vec, ")"));
}
static bool
@@ -689,7 +689,7 @@ read_memptr(struct demangle_data *d)
if (vector_str_push(&d->vec, mptr_str, len) == false)
goto clean;
- if (vector_str_push(&d->vec, "::*", 3) == false)
+ if (VEC_PUSH_STR(&d->vec, "::*") == false)
goto clean;
rtn = true;
@@ -712,108 +712,102 @@ read_op(struct demangle_data *d)
switch (SIMPLE_HASH(*(d->p), *(d->p+1))) {
case SIMPLE_HASH('m', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator*", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator*"));
case SIMPLE_HASH('d', 'v') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator/", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator/"));
case SIMPLE_HASH('m', 'd') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator%", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator%"));
case SIMPLE_HASH('p', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator+", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator+"));
case SIMPLE_HASH('m', 'i') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator-", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator-"));
case SIMPLE_HASH('l', 's') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator<<", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator<<"));
case SIMPLE_HASH('r', 's') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator>>", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator>>"));
case SIMPLE_HASH('e', 'q') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator==", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator=="));
case SIMPLE_HASH('n', 'e') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator!=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator!="));
case SIMPLE_HASH('l', 't') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator<", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator<"));
case SIMPLE_HASH('g', 't') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator>", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator>"));
case SIMPLE_HASH('l', 'e') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator<=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator<="));
case SIMPLE_HASH('g', 'e') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator>=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator>="));
case SIMPLE_HASH('a', 'd') :
d->p += 2;
if (*d->p == 'v') {
++d->p;
- return (vector_str_push(&d->vec, "operator/=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator/="));
} else
- return (vector_str_push(&d->vec, "operator&", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator&"));
case SIMPLE_HASH('o', 'r') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator|", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator|"));
case SIMPLE_HASH('e', 'r') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator^", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator^"));
case SIMPLE_HASH('a', 'a') :
d->p += 2;
if (*d->p == 'd') {
++d->p;
- return (vector_str_push(&d->vec, "operator&=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator&="));
} else
- return (vector_str_push(&d->vec, "operator&&",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator&&"));
case SIMPLE_HASH('o', 'o') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator||", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator||"));
case SIMPLE_HASH('n', 't') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator!", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator!"));
case SIMPLE_HASH('c', 'o') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator~", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator~"));
case SIMPLE_HASH('p', 'p') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator++", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator++"));
case SIMPLE_HASH('m', 'm') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator--", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator--"));
case SIMPLE_HASH('a', 's') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator=", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator="));
case SIMPLE_HASH('r', 'f') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator->", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator->"));
case SIMPLE_HASH('a', 'p') :
/* apl */
if (*(d->p + 2) != 'l')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator+=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator+="));
case SIMPLE_HASH('a', 'm') :
d->p += 2;
if (*d->p == 'i') {
++d->p;
- return (vector_str_push(&d->vec, "operator-=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator-="));
} else if (*d->p == 'u') {
++d->p;
- return (vector_str_push(&d->vec, "operator*=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator*="));
} else if (*d->p == 'd') {
++d->p;
- return (vector_str_push(&d->vec, "operator%=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator%="));
}
return (false);
@@ -823,40 +817,40 @@ read_op(struct demangle_data *d)
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator<<=", 11));
+ return (VEC_PUSH_STR(&d->vec, "operator<<="));
case SIMPLE_HASH('a', 'r') :
/* ars */
if (*(d->p + 2) != 's')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator>>=", 11));
+ return (VEC_PUSH_STR(&d->vec, "operator>>="));
case SIMPLE_HASH('a', 'o') :
/* aor */
if (*(d->p + 2) != 'r')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator|=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator|="));
case SIMPLE_HASH('a', 'e') :
/* aer */
if (*(d->p + 2) != 'r')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator^=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator^="));
case SIMPLE_HASH('c', 'm') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator,", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator,"));
case SIMPLE_HASH('r', 'm') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator->*", 11));
+ return (VEC_PUSH_STR(&d->vec, "operator->*"));
case SIMPLE_HASH('c', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "()", 2));
+ return (VEC_PUSH_STR(&d->vec, "()"));
case SIMPLE_HASH('v', 'c') :
d->p += 2;
- return (vector_str_push(&d->vec, "[]", 2));
+ return (VEC_PUSH_STR(&d->vec, "[]"));
case SIMPLE_HASH('c', 't') :
d->p += 4;
d->type = ENCODE_OP_CT;
@@ -883,11 +877,10 @@ read_op(struct demangle_data *d)
return (false);
case SIMPLE_HASH('n', 'w') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator new()", 14));
+ return (VEC_PUSH_STR(&d->vec, "operator new()"));
case SIMPLE_HASH('d', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator delete()",
- 17));
+ return (VEC_PUSH_STR(&d->vec, "operator delete()"));
case SIMPLE_HASH('o', 'p') :
/* __op<TO_TYPE>__<FROM_TYPE> */
d->p += 2;
@@ -962,13 +955,13 @@ read_op_user(struct demangle_data *d)
if (vector_str_push(&d->vec, from_str, from_len) == false)
goto clean;
- if (vector_str_push(&d->vec, "::operator ", 11) == false)
+ if (VEC_PUSH_STR(&d->vec, "::operator ") == false)
return (false);
if (vector_str_push(&d->vec, to_str, to_len) == false)
goto clean;
- rtn = vector_str_push(&d->vec, "()", 2);
+ rtn = VEC_PUSH_STR(&d->vec, "()");
clean:
free(to_str);
free(from_str);
@@ -1000,7 +993,7 @@ read_qual_name(struct demangle_data *d)
if (read_class(d) == false)
return (false);
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
return (false);
}
@@ -1029,12 +1022,10 @@ read_subst(struct demangle_data *d)
d->p = str;
- if (vector_str_push(&d->vec, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false)
return (-1);
- if (vector_str_push(&d->arg, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false)
return (-1);
if (*d->p == '\0')
@@ -1073,16 +1064,14 @@ read_subst_iter(struct demangle_data *d)
d->p = str;
for (i = 0; i < repeat ; ++i) {
- if (vector_str_push(&d->vec, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false)
return (-1);
- if (vector_str_push(&d->arg, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false)
return (-1);
if (i != repeat - 1 &&
- vector_str_push(&d->vec, ", ", 2) == false)
+ VEC_PUSH_STR(&d->vec, ", ") == false)
return (-1);
}
@@ -1108,7 +1097,7 @@ read_type(struct demangle_data *d)
case 'U' :
++d->p;
- if (vector_str_push(&d->vec, "unsigned ", 9) == false)
+ if (VEC_PUSH_STR(&d->vec, "unsigned ") == false)
return (false);
break;
@@ -1118,7 +1107,7 @@ read_type(struct demangle_data *d)
if (*d->p == 'P')
d->cnst = true;
else {
- if (vector_str_push(&d->vec, "const ", 6) ==
+ if (VEC_PUSH_STR(&d->vec, "const ") ==
false)
return (false);
}
@@ -1127,14 +1116,14 @@ read_type(struct demangle_data *d)
case 'V' :
++d->p;
- if (vector_str_push(&d->vec, "volatile ", 9) == false)
+ if (VEC_PUSH_STR(&d->vec, "volatile ") == false)
return (false);
break;
case 'S' :
++d->p;
- if (vector_str_push(&d->vec, "signed ", 7) == false)
+ if (VEC_PUSH_STR(&d->vec, "signed ") == false)
return (false);
break;
@@ -1185,39 +1174,39 @@ read_type(struct demangle_data *d)
case 'v' :
++d->p;
- return (vector_str_push(&d->vec, "void", 4));
+ return (VEC_PUSH_STR(&d->vec, "void"));
case 'c' :
++d->p;
- return (vector_str_push(&d->vec, "char", 4));
+ return (VEC_PUSH_STR(&d->vec, "char"));
case 's' :
++d->p;
- return (vector_str_push(&d->vec, "short", 5));
+ return (VEC_PUSH_STR(&d->vec, "short"));
case 'i' :
++d->p;
- return (vector_str_push(&d->vec, "int", 3));
+ return (VEC_PUSH_STR(&d->vec, "int"));
case 'l' :
++d->p;
- return (vector_str_push(&d->vec, "long", 4));
+ return (VEC_PUSH_STR(&d->vec, "long"));
case 'f' :
++d->p;
- return (vector_str_push(&d->vec, "float", 5));
+ return (VEC_PUSH_STR(&d->vec, "float"));
case 'd':
++d->p;
- return (vector_str_push(&d->vec, "double", 6));
+ return (VEC_PUSH_STR(&d->vec, "double"));
case 'r':
++d->p;
- return (vector_str_push(&d->vec, "long double", 11));
+ return (VEC_PUSH_STR(&d->vec, "long double"));
case 'e':
++d->p;
- return (vector_str_push(&d->vec, "...", 3));
+ return (VEC_PUSH_STR(&d->vec, "..."));
default:
return (false);
};
diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
index 5dff1ca..5c77b67 100644
--- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
+++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
@@ -37,7 +37,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3447 2016-05-03 13:32:23Z emaste $");
+ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3513 2016-12-29 07:04:22Z kaiwang27 $");
/**
* @file cpp_demangle_gnu2.c
@@ -66,6 +66,7 @@ struct demangle_data {
};
#define SIMPLE_HASH(x,y) (64 * x + y)
+#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s)))
#define CPP_DEMANGLE_GNU2_TRY 128
static void dest_cstring(struct cstring *);
@@ -126,7 +127,7 @@ cpp_demangle_gnu2(const char *org)
if (push_CTDT("::~", 3, &d.vec) == false)
goto clean;
- if (vector_str_push(&d.vec, "(void)", 6) == false)
+ if (VEC_PUSH_STR(&d.vec, "(void)") == false)
goto clean;
goto flat;
@@ -141,7 +142,7 @@ cpp_demangle_gnu2(const char *org)
++d.p;
else if (*d.p == '\0') {
if (d.class_name == true) {
- if (vector_str_push(&d.vec, "(void)", 6) == false)
+ if (VEC_PUSH_STR(&d.vec, "(void)") == false)
goto clean;
goto flat;
@@ -150,7 +151,7 @@ cpp_demangle_gnu2(const char *org)
}
/* start argument types */
- if (vector_str_push(&d.vec, "(", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, "(") == false)
goto clean;
for (;;) {
@@ -182,21 +183,21 @@ cpp_demangle_gnu2(const char *org)
goto clean;
if (d.ptr == true) {
- if (vector_str_push(&d.vec, "*", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, "*") == false)
goto clean;
d.ptr = false;
}
if (d.ref == true) {
- if (vector_str_push(&d.vec, "&", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, "&") == false)
goto clean;
d.ref = false;
}
if (d.cnst == true) {
- if (vector_str_push(&d.vec, " const", 6) == false)
+ if (VEC_PUSH_STR(&d.vec, " const") == false)
goto clean;
d.cnst = false;
@@ -223,7 +224,7 @@ cpp_demangle_gnu2(const char *org)
free(arg);
- if (vector_str_push(&d.vec, ", ", 2) == false)
+ if (VEC_PUSH_STR(&d.vec, ", ") == false)
goto clean;
if (++try > CPP_DEMANGLE_GNU2_TRY)
@@ -231,10 +232,10 @@ cpp_demangle_gnu2(const char *org)
}
/* end argument types */
- if (vector_str_push(&d.vec, ")", 1) == false)
+ if (VEC_PUSH_STR(&d.vec, ")") == false)
goto clean;
flat:
- if (d.cnst_fn == true && vector_str_push(&d.vec, " const", 6) == false)
+ if (d.cnst_fn == true && VEC_PUSH_STR(&d.vec, " const") == false)
goto clean;
rtn = vector_str_get_flat(&d.vec, NULL);
@@ -410,8 +411,7 @@ push_CTDT(const char *s, size_t l, struct vector_str *v)
assert(v->size > 1);
- return (vector_str_push(v, v->container[v->size - 2],
- strlen(v->container[v->size - 2])));
+ return (VEC_PUSH_STR(v, v->container[v->size - 2]));
}
static bool
@@ -518,7 +518,7 @@ read_func(struct demangle_data *d)
if (read_class(d) == false)
return (false);
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
return (false);
}
@@ -563,7 +563,7 @@ read_func_name(struct demangle_data *d)
/* not good condition, start function name with '__' */
d->type = ENCODE_FUNC;
- if (vector_str_push(&d->vec, "__", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "__") == false)
return (false);
return (read_func(d));
@@ -601,7 +601,7 @@ read_func_name(struct demangle_data *d)
if (read_qual_name(d) == false)
goto clean;
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
goto clean;
if (vector_str_push(&d->vec, op_name, len) == false)
@@ -623,7 +623,7 @@ read_func_name(struct demangle_data *d)
if (read_class(d) == false)
goto clean;
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
goto clean;
if (vector_str_push(&d->vec, op_name, len) == false)
@@ -665,7 +665,7 @@ read_func_name(struct demangle_data *d)
return (false);
}
- return (vector_str_push(&d->vec, " virtual table", 14));
+ return (VEC_PUSH_STR(&d->vec, " virtual table"));
} else
return (read_func(d));
clean:
@@ -702,7 +702,7 @@ read_func_ptr(struct demangle_data *d)
}
if (fptr.ptr == true) {
- if (vector_str_push(&fptr.vec, "*", 1) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, "*") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -712,7 +712,7 @@ read_func_ptr(struct demangle_data *d)
}
if (fptr.ref == true) {
- if (vector_str_push(&fptr.vec, "&", 1) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, "&") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -722,7 +722,7 @@ read_func_ptr(struct demangle_data *d)
}
if (fptr.cnst == true) {
- if (vector_str_push(&fptr.vec, " const", 6) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, " const") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -734,7 +734,7 @@ read_func_ptr(struct demangle_data *d)
if (*fptr.p == '_')
break;
- if (vector_str_push(&fptr.vec, ", ", 2) == false) {
+ if (VEC_PUSH_STR(&fptr.vec, ", ") == false) {
dest_demangle_data(&fptr);
return (false);
@@ -785,7 +785,7 @@ read_func_ptr(struct demangle_data *d)
free(rtn_type);
- if (vector_str_push(&d->vec, " (*)(", 5) == false) {
+ if (VEC_PUSH_STR(&d->vec, " (*)(") == false) {
free(arg_type);
return (false);
@@ -799,7 +799,7 @@ read_func_ptr(struct demangle_data *d)
free(arg_type);
- return (vector_str_push(&d->vec, ")", 1));
+ return (VEC_PUSH_STR(&d->vec, ")"));
}
static bool
@@ -836,7 +836,7 @@ read_memptr(struct demangle_data *d)
if (vector_str_push(&d->vec, mptr_str, len) == false)
goto clean;
- if (vector_str_push(&d->vec, "::*", 3) == false)
+ if (VEC_PUSH_STR(&d->vec, "::*") == false)
goto clean;
rtn = true;
@@ -859,108 +859,102 @@ read_op(struct demangle_data *d)
switch (SIMPLE_HASH(*(d->p), *(d->p+1))) {
case SIMPLE_HASH('m', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator*", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator*"));
case SIMPLE_HASH('d', 'v') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator/", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator/"));
case SIMPLE_HASH('m', 'd') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator%", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator%"));
case SIMPLE_HASH('p', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator+", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator+"));
case SIMPLE_HASH('m', 'i') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator-", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator-"));
case SIMPLE_HASH('l', 's') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator<<", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator<<"));
case SIMPLE_HASH('r', 's') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator>>", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator>>"));
case SIMPLE_HASH('e', 'q') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator==", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator=="));
case SIMPLE_HASH('n', 'e') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator!=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator!="));
case SIMPLE_HASH('l', 't') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator<", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator<"));
case SIMPLE_HASH('g', 't') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator>", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator>"));
case SIMPLE_HASH('l', 'e') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator<=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator<="));
case SIMPLE_HASH('g', 'e') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator>=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator>="));
case SIMPLE_HASH('a', 'd') :
d->p += 2;
if (*d->p == 'v') {
++d->p;
- return (vector_str_push(&d->vec, "operator/=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator/="));
} else
- return (vector_str_push(&d->vec, "operator&", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator&"));
case SIMPLE_HASH('o', 'r') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator|", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator|"));
case SIMPLE_HASH('e', 'r') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator^", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator^"));
case SIMPLE_HASH('a', 'a') :
d->p += 2;
if (*d->p == 'd') {
++d->p;
- return (vector_str_push(&d->vec, "operator&=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator&="));
} else
- return (vector_str_push(&d->vec, "operator&&",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator&&"));
case SIMPLE_HASH('o', 'o') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator||", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator||"));
case SIMPLE_HASH('n', 't') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator!", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator!"));
case SIMPLE_HASH('c', 'o') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator~", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator~"));
case SIMPLE_HASH('p', 'p') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator++", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator++"));
case SIMPLE_HASH('m', 'm') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator--", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator--"));
case SIMPLE_HASH('a', 's') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator=", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator="));
case SIMPLE_HASH('r', 'f') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator->", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator->"));
case SIMPLE_HASH('a', 'p') :
/* apl */
if (*(d->p + 2) != 'l')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator+=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator+="));
case SIMPLE_HASH('a', 'm') :
d->p += 2;
if (*d->p == 'i') {
++d->p;
- return (vector_str_push(&d->vec, "operator-=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator-="));
} else if (*d->p == 'u') {
++d->p;
- return (vector_str_push(&d->vec, "operator*=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator*="));
} else if (*d->p == 'd') {
++d->p;
- return (vector_str_push(&d->vec, "operator%=",
- 10));
+ return (VEC_PUSH_STR(&d->vec, "operator%="));
}
return (false);
@@ -970,47 +964,46 @@ read_op(struct demangle_data *d)
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator<<=", 11));
+ return (VEC_PUSH_STR(&d->vec, "operator<<="));
case SIMPLE_HASH('a', 'r') :
/* ars */
if (*(d->p + 2) != 's')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator>>=", 11));
+ return (VEC_PUSH_STR(&d->vec, "operator>>="));
case SIMPLE_HASH('a', 'o') :
/* aor */
if (*(d->p + 2) != 'r')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator|=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator|="));
case SIMPLE_HASH('a', 'e') :
/* aer */
if (*(d->p + 2) != 'r')
return (false);
d->p += 3;
- return (vector_str_push(&d->vec, "operator^=", 10));
+ return (VEC_PUSH_STR(&d->vec, "operator^="));
case SIMPLE_HASH('c', 'm') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator,", 9));
+ return (VEC_PUSH_STR(&d->vec, "operator,"));
case SIMPLE_HASH('r', 'm') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator->*", 11));
+ return (VEC_PUSH_STR(&d->vec, "operator->*"));
case SIMPLE_HASH('c', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "()", 2));
+ return (VEC_PUSH_STR(&d->vec, "()"));
case SIMPLE_HASH('v', 'c') :
d->p += 2;
- return (vector_str_push(&d->vec, "[]", 2));
+ return (VEC_PUSH_STR(&d->vec, "[]"));
case SIMPLE_HASH('n', 'w') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator new()", 14));
+ return (VEC_PUSH_STR(&d->vec, "operator new()"));
case SIMPLE_HASH('d', 'l') :
d->p += 2;
- return (vector_str_push(&d->vec, "operator delete()",
- 17));
+ return (VEC_PUSH_STR(&d->vec, "operator delete()"));
case SIMPLE_HASH('o', 'p') :
/* __op<TO_TYPE>__<FROM_TYPE> */
d->p += 2;
@@ -1025,7 +1018,7 @@ read_op(struct demangle_data *d)
if (read_type(d) == false)
return (false);
- return (vector_str_push(&d->vec, " type_info function", 19));
+ return (VEC_PUSH_STR(&d->vec, " type_info function"));
case SIMPLE_HASH('t', 'i') :
d->p += 2;
d->type = ENCODE_OP_TI;
@@ -1033,7 +1026,7 @@ read_op(struct demangle_data *d)
if (read_type(d) == false)
return (false);
- return (vector_str_push(&d->vec, " type_info node", 15));
+ return (VEC_PUSH_STR(&d->vec, " type_info node"));
default :
return (false);
};
@@ -1099,13 +1092,13 @@ read_op_user(struct demangle_data *d)
if (vector_str_push(&d->vec, from_str, from_len) == false)
goto clean;
- if (vector_str_push(&d->vec, "::operator ", 11) == false)
+ if (VEC_PUSH_STR(&d->vec, "::operator ") == false)
goto clean;
if (vector_str_push(&d->vec, to_str, to_len) == false)
goto clean;
- rtn = vector_str_push(&d->vec, "()", 2);
+ rtn = VEC_PUSH_STR(&d->vec, "()");
clean:
free(to_str);
free(from_str);
@@ -1137,7 +1130,7 @@ read_qual_name(struct demangle_data *d)
if (read_class(d) == false)
return (false);
- if (vector_str_push(&d->vec, "::", 2) == false)
+ if (VEC_PUSH_STR(&d->vec, "::") == false)
return (false);
}
@@ -1166,12 +1159,10 @@ read_subst(struct demangle_data *d)
d->p = str;
- if (vector_str_push(&d->vec, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false)
return (-1);
- if (vector_str_push(&d->arg, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false)
return (-1);
if (*d->p == '\0')
@@ -1210,16 +1201,14 @@ read_subst_iter(struct demangle_data *d)
d->p = str;
for (i = 0; i < repeat ; ++i) {
- if (vector_str_push(&d->vec, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false)
return (-1);
- if (vector_str_push(&d->arg, d->arg.container[idx - 1],
- strlen(d->arg.container[idx - 1])) == false)
+ if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false)
return (-1);
if (i != repeat - 1 &&
- vector_str_push(&d->vec, ", ", 2) == false)
+ VEC_PUSH_STR(&d->vec, ", ") == false)
return (-1);
}
@@ -1245,7 +1234,7 @@ read_type(struct demangle_data *d)
case 'U' :
++d->p;
- if (vector_str_push(&d->vec, "unsigned ", 9) == false)
+ if (VEC_PUSH_STR(&d->vec, "unsigned ") == false)
return (false);
break;
@@ -1255,7 +1244,7 @@ read_type(struct demangle_data *d)
if (*d->p == 'P')
d->cnst = true;
else {
- if (vector_str_push(&d->vec, "const ", 6) ==
+ if (VEC_PUSH_STR(&d->vec, "const ") ==
false)
return (false);
}
@@ -1264,14 +1253,14 @@ read_type(struct demangle_data *d)
case 'V' :
++d->p;
- if (vector_str_push(&d->vec, "volatile ", 9) == false)
+ if (VEC_PUSH_STR(&d->vec, "volatile ") == false)
return (false);
break;
case 'S' :
++d->p;
- if (vector_str_push(&d->vec, "signed ", 7) == false)
+ if (VEC_PUSH_STR(&d->vec, "signed ") == false)
return (false);
break;
@@ -1322,51 +1311,51 @@ read_type(struct demangle_data *d)
case 'v' :
++d->p;
- return (vector_str_push(&d->vec, "void", 4));
+ return (VEC_PUSH_STR(&d->vec, "void"));
case 'b':
++d->p;
- return(vector_str_push(&d->vec, "bool", 4));
+ return(VEC_PUSH_STR(&d->vec, "bool"));
case 'c' :
++d->p;
- return (vector_str_push(&d->vec, "char", 4));
+ return (VEC_PUSH_STR(&d->vec, "char"));
case 's' :
++d->p;
- return (vector_str_push(&d->vec, "short", 5));
+ return (VEC_PUSH_STR(&d->vec, "short"));
case 'i' :
++d->p;
- return (vector_str_push(&d->vec, "int", 3));
+ return (VEC_PUSH_STR(&d->vec, "int"));
case 'l' :
++d->p;
- return (vector_str_push(&d->vec, "long", 4));
+ return (VEC_PUSH_STR(&d->vec, "long"));
case 'f' :
++d->p;
- return (vector_str_push(&d->vec, "float", 5));
+ return (VEC_PUSH_STR(&d->vec, "float"));
case 'd':
++d->p;
- return (vector_str_push(&d->vec, "double", 6));
+ return (VEC_PUSH_STR(&d->vec, "double"));
case 'r':
++d->p;
- return (vector_str_push(&d->vec, "long double", 11));
+ return (VEC_PUSH_STR(&d->vec, "long double"));
case 'e':
++d->p;
- return (vector_str_push(&d->vec, "...", 3));
+ return (VEC_PUSH_STR(&d->vec, "..."));
case 'w':
++d->p;
- return (vector_str_push(&d->vec, "wchar_t", 7));
+ return (VEC_PUSH_STR(&d->vec, "wchar_t"));
case 'x':
++d->p;
- return (vector_str_push(&d->vec, "long long", 9));
+ return (VEC_PUSH_STR(&d->vec, "long long"));
default:
return (false);
};
diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
index c3d3f4b..bd57122 100644
--- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
+++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
@@ -36,7 +36,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3480 2016-07-24 23:38:41Z emaste $");
+ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3512 2016-12-29 07:04:19Z kaiwang27 $");
/**
* @file cpp_demangle.c
@@ -93,6 +93,8 @@ struct cpp_demangle_data {
#define FLOAT_EXTENED_BYTES 10
#define SIMPLE_HASH(x,y) (64 * x + y)
+#define DEM_PUSH_STR(d,s) cpp_demangle_push_str((d), (s), strlen((s)))
+#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s)))
static void cpp_demangle_data_dest(struct cpp_demangle_data *);
static int cpp_demangle_data_init(struct cpp_demangle_data *,
@@ -217,13 +219,13 @@ cpp_demangle_gnu3(const char *org)
if (ddata.output.size == 0)
goto clean;
- if (ddata.paren && !vector_str_push(&ddata.output, ")", 1))
+ if (ddata.paren && !VEC_PUSH_STR(&ddata.output, ")"))
goto clean;
- if (ddata.mem_vat && !vector_str_push(&ddata.output, " volatile", 9))
+ if (ddata.mem_vat && !VEC_PUSH_STR(&ddata.output, " volatile"))
goto clean;
- if (ddata.mem_cst && !vector_str_push(&ddata.output, " const", 6))
+ if (ddata.mem_cst && !VEC_PUSH_STR(&ddata.output, " const"))
goto clean;
- if (ddata.mem_rst && !vector_str_push(&ddata.output, " restrict", 9))
+ if (ddata.mem_rst && !VEC_PUSH_STR(&ddata.output, " restrict"))
goto clean;
rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL);
@@ -398,7 +400,7 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
if (type_str != NULL) {
if (!vector_str_init(&subst_v))
return (0);
- if (!vector_str_push(&subst_v, type_str, strlen(type_str)))
+ if (!VEC_PUSH_STR(&subst_v, type_str))
goto clean;
}
@@ -406,10 +408,10 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
while (idx > 0) {
switch (v->q_container[idx - 1]) {
case TYPE_PTR:
- if (!cpp_demangle_push_str(ddata, "*", 1))
+ if (!DEM_PUSH_STR(ddata, "*"))
goto clean;
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, "*", 1))
+ if (!VEC_PUSH_STR(&subst_v, "*"))
goto clean;
if (!cpp_demangle_push_subst_v(ddata,
&subst_v))
@@ -418,10 +420,10 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
break;
case TYPE_REF:
- if (!cpp_demangle_push_str(ddata, "&", 1))
+ if (!DEM_PUSH_STR(ddata, "&"))
goto clean;
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, "&", 1))
+ if (!VEC_PUSH_STR(&subst_v, "&"))
goto clean;
if (!cpp_demangle_push_subst_v(ddata,
&subst_v))
@@ -430,10 +432,10 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
break;
case TYPE_CMX:
- if (!cpp_demangle_push_str(ddata, " complex", 8))
+ if (!DEM_PUSH_STR(ddata, " complex"))
goto clean;
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, " complex", 8))
+ if (!VEC_PUSH_STR(&subst_v, " complex"))
goto clean;
if (!cpp_demangle_push_subst_v(ddata,
&subst_v))
@@ -442,7 +444,7 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
break;
case TYPE_IMG:
- if (!cpp_demangle_push_str(ddata, " imaginary", 10))
+ if (!DEM_PUSH_STR(ddata, " imaginary"))
goto clean;
if (type_str != NULL) {
if (!vector_str_push(&subst_v, " imaginary",
@@ -466,14 +468,13 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
snprintf(buf, e_len + 2, " %s",
v->ext_name.container[e_idx]);
- if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) {
+ if (!DEM_PUSH_STR(ddata, buf)) {
free(buf);
goto clean;
}
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, buf,
- e_len + 1)) {
+ if (!VEC_PUSH_STR(&subst_v, buf)) {
free(buf);
goto clean;
}
@@ -488,10 +489,10 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
break;
case TYPE_RST:
- if (!cpp_demangle_push_str(ddata, " restrict", 9))
+ if (!DEM_PUSH_STR(ddata, " restrict"))
goto clean;
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, " restrict", 9))
+ if (!VEC_PUSH_STR(&subst_v, " restrict"))
goto clean;
if (!cpp_demangle_push_subst_v(ddata,
&subst_v))
@@ -500,10 +501,10 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
break;
case TYPE_VAT:
- if (!cpp_demangle_push_str(ddata, " volatile", 9))
+ if (!DEM_PUSH_STR(ddata, " volatile"))
goto clean;
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, " volatile", 9))
+ if (!VEC_PUSH_STR(&subst_v, " volatile"))
goto clean;
if (!cpp_demangle_push_subst_v(ddata,
&subst_v))
@@ -512,10 +513,10 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
break;
case TYPE_CST:
- if (!cpp_demangle_push_str(ddata, " const", 6))
+ if (!DEM_PUSH_STR(ddata, " const"))
goto clean;
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, " const", 6))
+ if (!VEC_PUSH_STR(&subst_v, " const"))
goto clean;
if (!cpp_demangle_push_subst_v(ddata,
&subst_v))
@@ -534,13 +535,12 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
goto clean;
snprintf(buf, e_len + 12, " __vector(%s)",
v->ext_name.container[e_idx]);
- if (!cpp_demangle_push_str(ddata, buf, e_len + 11)) {
+ if (!DEM_PUSH_STR(ddata, buf)) {
free(buf);
goto clean;
}
if (type_str != NULL) {
- if (!vector_str_push(&subst_v, buf,
- e_len + 11)) {
+ if (!VEC_PUSH_STR(&subst_v, buf)) {
free(buf);
goto clean;
}
@@ -617,7 +617,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddata)
if (!cpp_demangle_read_type(ddata, 0))
return (0);
- if (!cpp_demangle_push_str(ddata, "[]", 2))
+ if (!DEM_PUSH_STR(ddata, "[]"))
return (0);
} else {
if (ELFTC_ISDIGIT(*ddata->cur) != 0) {
@@ -632,11 +632,11 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddata)
return (0);
if (!cpp_demangle_read_type(ddata, 0))
return (0);
- if (!cpp_demangle_push_str(ddata, "[", 1))
+ if (!DEM_PUSH_STR(ddata, "["))
return (0);
if (!cpp_demangle_push_str(ddata, num, num_len))
return (0);
- if (!cpp_demangle_push_str(ddata, "]", 1))
+ if (!DEM_PUSH_STR(ddata, "]"))
return (0);
} else {
p_idx = ddata->output.size;
@@ -664,7 +664,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddata)
free(exp);
return (0);
}
- if (!cpp_demangle_push_str(ddata, "[", 1)) {
+ if (!DEM_PUSH_STR(ddata, "[")) {
free(exp);
return (0);
}
@@ -672,7 +672,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddata)
free(exp);
return (0);
}
- if (!cpp_demangle_push_str(ddata, "]", 1)) {
+ if (!DEM_PUSH_STR(ddata, "]")) {
free(exp);
return (0);
}
@@ -708,10 +708,10 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
switch (*(++ddata->cur)) {
case '0':
ddata->cur += 2;
- return (cpp_demangle_push_str(ddata, "false", 5));
+ return (DEM_PUSH_STR(ddata, "false"));
case '1':
ddata->cur += 2;
- return (cpp_demangle_push_str(ddata, "true", 4));
+ return (DEM_PUSH_STR(ddata, "true"));
default:
return (0);
}
@@ -748,7 +748,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
case 'x':
case 'y':
if (*(++ddata->cur) == 'n') {
- if (!cpp_demangle_push_str(ddata, "-", 1))
+ if (!DEM_PUSH_STR(ddata, "-"))
return (0);
++ddata->cur;
}
@@ -1151,7 +1151,7 @@ cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c,
if (!cpp_demangle_read_type(ddata, 0))
return (0);
if (*ddata->cur != 'E') {
- if (!cpp_demangle_push_str(ddata, "(", 1))
+ if (!DEM_PUSH_STR(ddata, "("))
return (0);
if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM)) {
if ((class_type_size = ddata->class_type.size) == 0)
@@ -1165,7 +1165,7 @@ cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c,
if (!cpp_demangle_push_str(ddata, class_type,
class_type_len))
return (0);
- if (!cpp_demangle_push_str(ddata, "::*", 3))
+ if (!DEM_PUSH_STR(ddata, "::*"))
return (0);
++ddata->func_type;
} else {
@@ -1177,7 +1177,7 @@ cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c,
return (0);
}
- if (!cpp_demangle_push_str(ddata, ")(", 2))
+ if (!DEM_PUSH_STR(ddata, ")("))
return (0);
limit = 0;
@@ -1199,7 +1199,7 @@ cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c,
return (0);
}
- if (!cpp_demangle_push_str(ddata, ")", 1))
+ if (!DEM_PUSH_STR(ddata, ")"))
return (0);
}
@@ -1222,7 +1222,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
/* special name */
switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) {
case SIMPLE_HASH('G', 'A'):
- if (!cpp_demangle_push_str(ddata, "hidden alias for ", 17))
+ if (!DEM_PUSH_STR(ddata, "hidden alias for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1230,7 +1230,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
return (cpp_demangle_read_encoding(ddata));
case SIMPLE_HASH('G', 'R'):
- if (!cpp_demangle_push_str(ddata, "reference temporary #", 21))
+ if (!DEM_PUSH_STR(ddata, "reference temporary #"))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1240,11 +1240,11 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
rtn = 0;
if (!cpp_demangle_read_number_as_string(ddata, &num_str))
goto clean1;
- if (!cpp_demangle_push_str(ddata, num_str, strlen(num_str)))
+ if (!DEM_PUSH_STR(ddata, num_str))
goto clean2;
- if (!cpp_demangle_push_str(ddata, " for ", 5))
+ if (!DEM_PUSH_STR(ddata, " for "))
goto clean2;
- if (!cpp_demangle_push_str(ddata, name, strlen(name)))
+ if (!DEM_PUSH_STR(ddata, name))
goto clean2;
rtn = 1;
clean2:
@@ -1259,14 +1259,12 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
return (0);
switch (*ddata->cur) {
case 'n':
- if (!cpp_demangle_push_str(ddata,
- "non-transaction clone for ", 26))
+ if (!DEM_PUSH_STR(ddata, "non-transaction clone for "))
return (0);
break;
case 't':
default:
- if (!cpp_demangle_push_str(ddata,
- "transaction clone for ", 22))
+ if (!DEM_PUSH_STR(ddata, "transaction clone for "))
return (0);
break;
}
@@ -1275,15 +1273,15 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('G', 'V'):
/* sentry object for 1 time init */
- if (!cpp_demangle_push_str(ddata, "guard variable for ", 20))
+ if (!DEM_PUSH_STR(ddata, "guard variable for "))
return (0);
ddata->cur += 2;
break;
case SIMPLE_HASH('T', 'c'):
/* virtual function covariant override thunk */
- if (!cpp_demangle_push_str(ddata,
- "virtual function covariant override ", 36))
+ if (!DEM_PUSH_STR(ddata,
+ "virtual function covariant override "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1296,8 +1294,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'C'):
/* construction vtable */
- if (!cpp_demangle_push_str(ddata, "construction vtable for ",
- 24))
+ if (!DEM_PUSH_STR(ddata, "construction vtable for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1311,9 +1308,9 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
goto clean3;
if (!cpp_demangle_read_type(ddata, 0))
goto clean3;
- if (!cpp_demangle_push_str(ddata, "-in-", 4))
+ if (!DEM_PUSH_STR(ddata, "-in-"))
goto clean3;
- if (!cpp_demangle_push_str(ddata, type, strlen(type)))
+ if (!DEM_PUSH_STR(ddata, type))
goto clean3;
rtn = 1;
clean3:
@@ -1326,7 +1323,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'F'):
/* typeinfo fn */
- if (!cpp_demangle_push_str(ddata, "typeinfo fn for ", 16))
+ if (!DEM_PUSH_STR(ddata, "typeinfo fn for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1335,8 +1332,8 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'h'):
/* virtual function non-virtual override thunk */
- if (!cpp_demangle_push_str(ddata,
- "virtual function non-virtual override ", 38))
+ if (!DEM_PUSH_STR(ddata,
+ "virtual function non-virtual override "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1347,8 +1344,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'H'):
/* TLS init function */
- if (!cpp_demangle_push_str(ddata, "TLS init function for ",
- 22))
+ if (!DEM_PUSH_STR(ddata, "TLS init function for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1357,7 +1353,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'I'):
/* typeinfo structure */
- if (!cpp_demangle_push_str(ddata, "typeinfo for ", 13))
+ if (!DEM_PUSH_STR(ddata, "typeinfo for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1366,7 +1362,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'J'):
/* java class */
- if (!cpp_demangle_push_str(ddata, "java Class for ", 15))
+ if (!DEM_PUSH_STR(ddata, "java Class for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1375,7 +1371,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'S'):
/* RTTI name (NTBS) */
- if (!cpp_demangle_push_str(ddata, "typeinfo name for ", 18))
+ if (!DEM_PUSH_STR(ddata, "typeinfo name for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1384,7 +1380,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'T'):
/* VTT table */
- if (!cpp_demangle_push_str(ddata, "VTT for ", 8))
+ if (!DEM_PUSH_STR(ddata, "VTT for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1393,8 +1389,8 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'v'):
/* virtual function virtual override thunk */
- if (!cpp_demangle_push_str(ddata,
- "virtual function virtual override ", 34))
+ if (!DEM_PUSH_STR(ddata,
+ "virtual function virtual override "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1405,7 +1401,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'V'):
/* virtual table */
- if (!cpp_demangle_push_str(ddata, "vtable for ", 12))
+ if (!DEM_PUSH_STR(ddata, "vtable for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1414,8 +1410,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('T', 'W'):
/* TLS wrapper function */
- if (!cpp_demangle_push_str(ddata, "TLS wrapper function for ",
- 25))
+ if (!DEM_PUSH_STR(ddata, "TLS wrapper function for "))
return (0);
ddata->cur += 2;
if (*ddata->cur == '\0')
@@ -1450,14 +1445,14 @@ cpp_demangle_read_local_name(struct cpp_demangle_data *ddata)
if (*(++ddata->cur) == '\0')
return (0);
if (ddata->paren == true) {
- if (!cpp_demangle_push_str(ddata, ")", 1))
+ if (!DEM_PUSH_STR(ddata, ")"))
return (0);
ddata->paren = false;
}
if (*ddata->cur == 's')
++ddata->cur;
else {
- if (!cpp_demangle_push_str(ddata, "::", 2))
+ if (!DEM_PUSH_STR(ddata, "::"))
return (0);
if (!cpp_demangle_read_name(ddata))
return (0);
@@ -1639,9 +1634,9 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
break;
else if (*ddata->cur != 'I' &&
*ddata->cur != 'C' && *ddata->cur != 'D') {
- if (!cpp_demangle_push_str(ddata, "::", 2))
+ if (!DEM_PUSH_STR(ddata, "::"))
goto clean;
- if (!vector_str_push(&v, "::", 2))
+ if (!VEC_PUSH_STR(&v, "::"))
goto clean;
}
if (limit++ > CPP_DEMANGLE_TRY_LIMIT)
@@ -1719,7 +1714,7 @@ cpp_demangle_read_nv_offset(struct cpp_demangle_data *ddata)
if (ddata == NULL)
return (0);
- if (!cpp_demangle_push_str(ddata, "offset : ", 9))
+ if (!DEM_PUSH_STR(ddata, "offset : "))
return (0);
return (cpp_demangle_read_offset_number(ddata));
@@ -1765,14 +1760,14 @@ cpp_demangle_read_offset_number(struct cpp_demangle_data *ddata)
while (*ddata->cur != '_')
++ddata->cur;
- if (negative && !cpp_demangle_push_str(ddata, "-", 1))
+ if (negative && !DEM_PUSH_STR(ddata, "-"))
return (0);
assert(start != NULL);
if (!cpp_demangle_push_str(ddata, start, ddata->cur - start))
return (0);
- if (!cpp_demangle_push_str(ddata, " ", 1))
+ if (!DEM_PUSH_STR(ddata, " "))
return (0);
++ddata->cur;
@@ -1815,11 +1810,11 @@ cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *ddata)
goto clean3;
if (p_func_type == ddata->func_type) {
- if (!cpp_demangle_push_str(ddata, " ", 1))
+ if (!DEM_PUSH_STR(ddata, " "))
goto clean3;
if (!cpp_demangle_push_str(ddata, class_type, class_type_len))
goto clean3;
- if (!cpp_demangle_push_str(ddata, "::*", 3))
+ if (!DEM_PUSH_STR(ddata, "::*"))
goto clean3;
}
@@ -1848,7 +1843,7 @@ cpp_demangle_read_sname(struct cpp_demangle_data *ddata)
return (0);
if (len == 12 && (memcmp("_GLOBAL__N_1", ddata->cur, 12) == 0))
- err = cpp_demangle_push_str(ddata, "(anonymous namespace)", 21);
+ err = DEM_PUSH_STR(ddata, "(anonymous namespace)");
else
err = cpp_demangle_push_str(ddata, ddata->cur, len);
@@ -1877,7 +1872,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) {
case SIMPLE_HASH('S', 'a'):
/* std::allocator */
- if (cpp_demangle_push_str(ddata, "std::allocator", 14) == 0)
+ if (!DEM_PUSH_STR(ddata, "std::allocator"))
return (0);
ddata->cur += 2;
if (*ddata->cur == 'I')
@@ -1887,7 +1882,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('S', 'b'):
/* std::basic_string */
- if (!cpp_demangle_push_str(ddata, "std::basic_string", 17))
+ if (!DEM_PUSH_STR(ddata, "std::basic_string"))
return (0);
ddata->cur += 2;
if (*ddata->cur == 'I')
@@ -1897,7 +1892,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('S', 'd'):
/* std::basic_iostream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::basic_iostream", 19))
+ if (!DEM_PUSH_STR(ddata, "std::basic_iostream"))
return (0);
ddata->last_sname = "basic_iostream";
ddata->cur += 2;
@@ -1908,7 +1903,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('S', 'i'):
/* std::basic_istream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::basic_istream", 18))
+ if (!DEM_PUSH_STR(ddata, "std::basic_istream"))
return (0);
ddata->last_sname = "basic_istream";
ddata->cur += 2;
@@ -1919,7 +1914,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('S', 'o'):
/* std::basic_ostream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::basic_ostream", 18))
+ if (!DEM_PUSH_STR(ddata, "std::basic_ostream"))
return (0);
ddata->last_sname = "basic_ostream";
ddata->cur += 2;
@@ -1935,7 +1930,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
*
* a.k.a std::string
*/
- if (!cpp_demangle_push_str(ddata, "std::string", 11))
+ if (!DEM_PUSH_STR(ddata, "std::string"))
return (0);
ddata->last_sname = "string";
ddata->cur += 2;
@@ -1993,10 +1988,10 @@ cpp_demangle_read_subst_std(struct cpp_demangle_data *ddata)
subst_str = NULL;
rtn = 0;
- if (!cpp_demangle_push_str(ddata, "std::", 5))
+ if (!DEM_PUSH_STR(ddata, "std::"))
goto clean;
- if (!vector_str_push(&v, "std::", 5))
+ if (!VEC_PUSH_STR(&v, "std::"))
goto clean;
ddata->cur += 2;
@@ -2115,7 +2110,7 @@ cpp_demangle_read_tmpl_args(struct cpp_demangle_data *ddata)
if (!vector_read_cmd_push(&ddata->cmd, READ_TMPL))
return (0);
- if (!cpp_demangle_push_str(ddata, "<", 1))
+ if (!DEM_PUSH_STR(ddata, "<"))
return (0);
limit = 0;
@@ -2140,13 +2135,13 @@ cpp_demangle_read_tmpl_args(struct cpp_demangle_data *ddata)
size = v->size;
assert(size > 0);
if (!strncmp(v->container[size - 1], ">", 1)) {
- if (!cpp_demangle_push_str(ddata, " >", 2))
+ if (!DEM_PUSH_STR(ddata, " >"))
return (0);
- } else if (!cpp_demangle_push_str(ddata, ">", 1))
+ } else if (!DEM_PUSH_STR(ddata, ">"))
return (0);
break;
} else if (*ddata->cur != 'I' &&
- !cpp_demangle_push_str(ddata, ", ", 2))
+ !DEM_PUSH_STR(ddata, ", "))
return (0);
if (limit++ > CPP_DEMANGLE_TRY_LIMIT)
@@ -2213,7 +2208,7 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
output = &ddata->output_tmp;
} else if (delimit == 1) {
if (ddata->paren == false) {
- if (!cpp_demangle_push_str(ddata, "(", 1))
+ if (!DEM_PUSH_STR(ddata, "("))
return (0);
if (ddata->output.size < 2)
return (0);
@@ -2228,7 +2223,7 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
if (ddata->pfirst)
ddata->pfirst = false;
else if (*ddata->cur != 'I' &&
- !cpp_demangle_push_str(ddata, ", ", 2))
+ !DEM_PUSH_STR(ddata, ", "))
return (0);
}
@@ -2250,7 +2245,7 @@ again:
switch (*ddata->cur) {
case 'a':
/* signed char */
- if (!cpp_demangle_push_str(ddata, "signed char", 11))
+ if (!DEM_PUSH_STR(ddata, "signed char"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2264,7 +2259,7 @@ again:
case 'b':
/* bool */
- if (!cpp_demangle_push_str(ddata, "bool", 4))
+ if (!DEM_PUSH_STR(ddata, "bool"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2278,14 +2273,14 @@ again:
case 'c':
/* char */
- if (!cpp_demangle_push_str(ddata, "char", 4))
+ if (!DEM_PUSH_STR(ddata, "char"))
goto clean;
++ddata->cur;
goto rtn;
case 'd':
/* double */
- if (!cpp_demangle_push_str(ddata, "double", 6))
+ if (!DEM_PUSH_STR(ddata, "double"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2295,44 +2290,43 @@ again:
switch (*ddata->cur) {
case 'd':
/* IEEE 754r decimal floating point (64 bits) */
- if (!cpp_demangle_push_str(ddata, "decimal64", 9))
+ if (!DEM_PUSH_STR(ddata, "decimal64"))
goto clean;
++ddata->cur;
break;
case 'e':
/* IEEE 754r decimal floating point (128 bits) */
- if (!cpp_demangle_push_str(ddata, "decimal128", 10))
+ if (!DEM_PUSH_STR(ddata, "decimal128"))
goto clean;
++ddata->cur;
break;
case 'f':
/* IEEE 754r decimal floating point (32 bits) */
- if (!cpp_demangle_push_str(ddata, "decimal32", 9))
+ if (!DEM_PUSH_STR(ddata, "decimal32"))
goto clean;
++ddata->cur;
break;
case 'h':
/* IEEE 754r half-precision floating point (16 bits) */
- if (!cpp_demangle_push_str(ddata, "half", 4))
+ if (!DEM_PUSH_STR(ddata, "half"))
goto clean;
++ddata->cur;
break;
case 'i':
/* char32_t */
- if (!cpp_demangle_push_str(ddata, "char32_t", 8))
+ if (!DEM_PUSH_STR(ddata, "char32_t"))
goto clean;
++ddata->cur;
break;
case 'n':
/* std::nullptr_t (i.e., decltype(nullptr)) */
- if (!cpp_demangle_push_str(ddata, "decltype(nullptr)",
- 17))
+ if (!DEM_PUSH_STR(ddata, "decltype(nullptr)"))
goto clean;
++ddata->cur;
break;
case 's':
/* char16_t */
- if (!cpp_demangle_push_str(ddata, "char16_t", 8))
+ if (!DEM_PUSH_STR(ddata, "char16_t"))
goto clean;
++ddata->cur;
break;
@@ -2344,15 +2338,13 @@ again:
if (!cpp_demangle_read_expression_flat(ddata,
&exp_str))
goto clean;
- if (!vector_str_push(&v.ext_name, exp_str,
- strlen(exp_str)))
+ if (!VEC_PUSH_STR(&v.ext_name, exp_str))
goto clean;
} else {
if (!cpp_demangle_read_number_as_string(ddata,
&num_str))
goto clean;
- if (!vector_str_push(&v.ext_name, num_str,
- strlen(num_str)))
+ if (!VEC_PUSH_STR(&v.ext_name, num_str))
goto clean;
}
if (*ddata->cur != '_')
@@ -2368,14 +2360,14 @@ again:
case 'e':
/* long double */
- if (!cpp_demangle_push_str(ddata, "long double", 11))
+ if (!DEM_PUSH_STR(ddata, "long double"))
goto clean;
++ddata->cur;
goto rtn;
case 'f':
/* float */
- if (!cpp_demangle_push_str(ddata, "float", 5))
+ if (!DEM_PUSH_STR(ddata, "float"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2389,7 +2381,7 @@ again:
case 'g':
/* __float128 */
- if (!cpp_demangle_push_str(ddata, "__float128", 10))
+ if (!DEM_PUSH_STR(ddata, "__float128"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2403,21 +2395,21 @@ again:
case 'h':
/* unsigned char */
- if (!cpp_demangle_push_str(ddata, "unsigned char", 13))
+ if (!DEM_PUSH_STR(ddata, "unsigned char"))
goto clean;
++ddata->cur;
goto rtn;
case 'i':
/* int */
- if (!cpp_demangle_push_str(ddata, "int", 3))
+ if (!DEM_PUSH_STR(ddata, "int"))
goto clean;
++ddata->cur;
goto rtn;
case 'j':
/* unsigned int */
- if (!cpp_demangle_push_str(ddata, "unsigned int", 12))
+ if (!DEM_PUSH_STR(ddata, "unsigned int"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2431,14 +2423,14 @@ again:
case 'l':
/* long */
- if (!cpp_demangle_push_str(ddata, "long", 4))
+ if (!DEM_PUSH_STR(ddata, "long"))
goto clean;
++ddata->cur;
goto rtn;
case 'm':
/* unsigned long */
- if (!cpp_demangle_push_str(ddata, "unsigned long", 13))
+ if (!DEM_PUSH_STR(ddata, "unsigned long"))
goto clean;
++ddata->cur;
@@ -2453,14 +2445,14 @@ again:
case 'n':
/* __int128 */
- if (!cpp_demangle_push_str(ddata, "__int128", 8))
+ if (!DEM_PUSH_STR(ddata, "__int128"))
goto clean;
++ddata->cur;
goto rtn;
case 'o':
/* unsigned __int128 */
- if (!cpp_demangle_push_str(ddata, "unsigned __int128", 17))
+ if (!DEM_PUSH_STR(ddata, "unsigned __int128"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2488,7 +2480,7 @@ again:
case 's':
/* short, local string */
- if (!cpp_demangle_push_str(ddata, "short", 5))
+ if (!DEM_PUSH_STR(ddata, "short"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2502,7 +2494,7 @@ again:
case 't':
/* unsigned short */
- if (!cpp_demangle_push_str(ddata, "unsigned short", 14))
+ if (!DEM_PUSH_STR(ddata, "unsigned short"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2537,7 +2529,7 @@ again:
case 'v':
/* void */
- if (!cpp_demangle_push_str(ddata, "void", 4))
+ if (!DEM_PUSH_STR(ddata, "void"))
goto clean;
++ddata->cur;
goto rtn;
@@ -2551,28 +2543,28 @@ again:
case 'w':
/* wchar_t */
- if (!cpp_demangle_push_str(ddata, "wchar_t", 7))
+ if (!DEM_PUSH_STR(ddata, "wchar_t"))
goto clean;
++ddata->cur;
goto rtn;
case 'x':
/* long long */
- if (!cpp_demangle_push_str(ddata, "long long", 9))
+ if (!DEM_PUSH_STR(ddata, "long long"))
goto clean;
++ddata->cur;
goto rtn;
case 'y':
/* unsigned long long */
- if (!cpp_demangle_push_str(ddata, "unsigned long long", 18))
+ if (!DEM_PUSH_STR(ddata, "unsigned long long"))
goto clean;
++ddata->cur;
goto rtn;
case 'z':
/* ellipsis */
- if (!cpp_demangle_push_str(ddata, "ellipsis", 8))
+ if (!DEM_PUSH_STR(ddata, "..."))
goto clean;
++ddata->cur;
goto rtn;
@@ -2609,7 +2601,7 @@ rtn:
if (--ddata->push_head > 0)
return (1);
- if (!vector_str_push(&ddata->output_tmp, " ", 1))
+ if (!VEC_PUSH_STR(&ddata->output_tmp, " "))
return (0);
if (!vector_str_push_vector_head(&ddata->output,
@@ -2620,7 +2612,7 @@ rtn:
if (!vector_str_init(&ddata->output_tmp))
return (0);
- if (!cpp_demangle_push_str(ddata, "(", 1))
+ if (!DEM_PUSH_STR(ddata, "("))
return (0);
ddata->paren = true;
@@ -2685,358 +2677,357 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) {
case SIMPLE_HASH('a', 'a'):
/* operator && */
- if (!cpp_demangle_push_str(ddata, "operator&&", 10))
+ if (!DEM_PUSH_STR(ddata, "operator&&"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('a', 'd'):
/* operator & (unary) */
- if (!cpp_demangle_push_str(ddata, "operator&", 9))
+ if (!DEM_PUSH_STR(ddata, "operator&"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('a', 'n'):
/* operator & */
- if (!cpp_demangle_push_str(ddata, "operator&", 9))
+ if (!DEM_PUSH_STR(ddata, "operator&"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('a', 'N'):
/* operator &= */
- if (!cpp_demangle_push_str(ddata, "operator&=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator&="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('a', 'S'):
/* operator = */
- if (!cpp_demangle_push_str(ddata, "operator=", 9))
+ if (!DEM_PUSH_STR(ddata, "operator="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('c', 'l'):
/* operator () */
- if (!cpp_demangle_push_str(ddata, "operator()", 10))
+ if (!DEM_PUSH_STR(ddata, "operator()"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('c', 'm'):
/* operator , */
- if (!cpp_demangle_push_str(ddata, "operator,", 9))
+ if (!DEM_PUSH_STR(ddata, "operator,"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('c', 'o'):
/* operator ~ */
- if (!cpp_demangle_push_str(ddata, "operator~", 9))
+ if (!DEM_PUSH_STR(ddata, "operator~"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('c', 'v'):
/* operator (cast) */
- if (!cpp_demangle_push_str(ddata, "operator(cast)", 14))
+ if (!DEM_PUSH_STR(ddata, "operator(cast)"))
return (0);
ddata->cur += 2;
return (cpp_demangle_read_type(ddata, 1));
case SIMPLE_HASH('d', 'a'):
/* operator delete [] */
- if (!cpp_demangle_push_str(ddata, "operator delete []", 18))
+ if (!DEM_PUSH_STR(ddata, "operator delete []"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('d', 'e'):
/* operator * (unary) */
- if (!cpp_demangle_push_str(ddata, "operator*", 9))
+ if (!DEM_PUSH_STR(ddata, "operator*"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('d', 'l'):
/* operator delete */
- if (!cpp_demangle_push_str(ddata, "operator delete", 15))
+ if (!DEM_PUSH_STR(ddata, "operator delete"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('d', 'v'):
/* operator / */
- if (!cpp_demangle_push_str(ddata, "operator/", 9))
+ if (!DEM_PUSH_STR(ddata, "operator/"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('d', 'V'):
/* operator /= */
- if (!cpp_demangle_push_str(ddata, "operator/=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator/="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('e', 'o'):
/* operator ^ */
- if (!cpp_demangle_push_str(ddata, "operator^", 9))
+ if (!DEM_PUSH_STR(ddata, "operator^"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('e', 'O'):
/* operator ^= */
- if (!cpp_demangle_push_str(ddata, "operator^=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator^="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('e', 'q'):
/* operator == */
- if (!cpp_demangle_push_str(ddata, "operator==", 10))
+ if (!DEM_PUSH_STR(ddata, "operator=="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('g', 'e'):
/* operator >= */
- if (!cpp_demangle_push_str(ddata, "operator>=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator>="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('g', 't'):
/* operator > */
- if (!cpp_demangle_push_str(ddata, "operator>", 9))
+ if (!DEM_PUSH_STR(ddata, "operator>"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('i', 'x'):
/* operator [] */
- if (!cpp_demangle_push_str(ddata, "operator[]", 10))
+ if (!DEM_PUSH_STR(ddata, "operator[]"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('l', 'e'):
/* operator <= */
- if (!cpp_demangle_push_str(ddata, "operator<=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator<="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('l', 's'):
/* operator << */
- if (!cpp_demangle_push_str(ddata, "operator<<", 10))
+ if (!DEM_PUSH_STR(ddata, "operator<<"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('l', 'S'):
/* operator <<= */
- if (!cpp_demangle_push_str(ddata, "operator<<=", 11))
+ if (!DEM_PUSH_STR(ddata, "operator<<="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('l', 't'):
/* operator < */
- if (!cpp_demangle_push_str(ddata, "operator<", 9))
+ if (!DEM_PUSH_STR(ddata, "operator<"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('m', 'i'):
/* operator - */
- if (!cpp_demangle_push_str(ddata, "operator-", 9))
+ if (!DEM_PUSH_STR(ddata, "operator-"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('m', 'I'):
/* operator -= */
- if (!cpp_demangle_push_str(ddata, "operator-=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator-="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('m', 'l'):
/* operator * */
- if (!cpp_demangle_push_str(ddata, "operator*", 9))
+ if (!DEM_PUSH_STR(ddata, "operator*"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('m', 'L'):
/* operator *= */
- if (!cpp_demangle_push_str(ddata, "operator*=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator*="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('m', 'm'):
/* operator -- */
- if (!cpp_demangle_push_str(ddata, "operator--", 10))
+ if (!DEM_PUSH_STR(ddata, "operator--"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('n', 'a'):
/* operator new[] */
- if (!cpp_demangle_push_str(ddata, "operator new []", 15))
+ if (!DEM_PUSH_STR(ddata, "operator new []"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('n', 'e'):
/* operator != */
- if (!cpp_demangle_push_str(ddata, "operator!=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator!="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('n', 'g'):
/* operator - (unary) */
- if (!cpp_demangle_push_str(ddata, "operator-", 9))
+ if (!DEM_PUSH_STR(ddata, "operator-"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('n', 't'):
/* operator ! */
- if (!cpp_demangle_push_str(ddata, "operator!", 9))
+ if (!DEM_PUSH_STR(ddata, "operator!"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('n', 'w'):
/* operator new */
- if (!cpp_demangle_push_str(ddata, "operator new", 12))
+ if (!DEM_PUSH_STR(ddata, "operator new"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('o', 'o'):
/* operator || */
- if (!cpp_demangle_push_str(ddata, "operator||", 10))
+ if (!DEM_PUSH_STR(ddata, "operator||"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('o', 'r'):
/* operator | */
- if (!cpp_demangle_push_str(ddata, "operator|", 9))
+ if (!DEM_PUSH_STR(ddata, "operator|"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('o', 'R'):
/* operator |= */
- if (!cpp_demangle_push_str(ddata, "operator|=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator|="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('p', 'l'):
/* operator + */
- if (!cpp_demangle_push_str(ddata, "operator+", 9))
+ if (!DEM_PUSH_STR(ddata, "operator+"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('p', 'L'):
/* operator += */
- if (!cpp_demangle_push_str(ddata, "operator+=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator+="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('p', 'm'):
/* operator ->* */
- if (!cpp_demangle_push_str(ddata, "operator->*", 11))
+ if (!DEM_PUSH_STR(ddata, "operator->*"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('p', 'p'):
/* operator ++ */
- if (!cpp_demangle_push_str(ddata, "operator++", 10))
+ if (!DEM_PUSH_STR(ddata, "operator++"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('p', 's'):
/* operator + (unary) */
- if (!cpp_demangle_push_str(ddata, "operator+", 9))
+ if (!DEM_PUSH_STR(ddata, "operator+"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('p', 't'):
/* operator -> */
- if (!cpp_demangle_push_str(ddata, "operator->", 10))
+ if (!DEM_PUSH_STR(ddata, "operator->"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('q', 'u'):
/* operator ? */
- if (!cpp_demangle_push_str(ddata, "operator?", 9))
+ if (!DEM_PUSH_STR(ddata, "operator?"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('r', 'm'):
/* operator % */
- if (!cpp_demangle_push_str(ddata, "operator%", 9))
+ if (!DEM_PUSH_STR(ddata, "operator%"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('r', 'M'):
/* operator %= */
- if (!cpp_demangle_push_str(ddata, "operator%=", 10))
+ if (!DEM_PUSH_STR(ddata, "operator%="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('r', 's'):
/* operator >> */
- if (!cpp_demangle_push_str(ddata, "operator>>", 10))
+ if (!DEM_PUSH_STR(ddata, "operator>>"))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('r', 'S'):
/* operator >>= */
- if (!cpp_demangle_push_str(ddata, "operator>>=", 11))
+ if (!DEM_PUSH_STR(ddata, "operator>>="))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('r', 'z'):
/* operator sizeof */
- if (!cpp_demangle_push_str(ddata, "operator sizeof ", 16))
+ if (!DEM_PUSH_STR(ddata, "operator sizeof "))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('s', 'r'):
/* scope resolution operator */
- if (!cpp_demangle_push_str(ddata, "scope resolution operator ",
- 26))
+ if (!DEM_PUSH_STR(ddata, "scope resolution operator "))
return (0);
ddata->cur += 2;
return (1);
case SIMPLE_HASH('s', 'v'):
/* operator sizeof */
- if (!cpp_demangle_push_str(ddata, "operator sizeof ", 16))
+ if (!DEM_PUSH_STR(ddata, "operator sizeof "))
return (0);
ddata->cur += 2;
return (1);
@@ -3044,8 +3035,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
/* vendor extened operator */
if (*ddata->cur == 'v' && ELFTC_ISDIGIT(*(ddata->cur + 1))) {
- if (!cpp_demangle_push_str(ddata, "vendor extened operator ",
- 24))
+ if (!DEM_PUSH_STR(ddata, "vendor extened operator "))
return (0);
if (!cpp_demangle_push_str(ddata, ddata->cur + 1, 1))
return (0);
@@ -3064,7 +3054,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
return (0);
if ((len = strlen(ddata->last_sname)) == 0)
return (0);
- if (!cpp_demangle_push_str(ddata, "::", 2))
+ if (!DEM_PUSH_STR(ddata, "::"))
return (0);
if (!cpp_demangle_push_str(ddata, ddata->last_sname, len))
return (0);
@@ -3080,7 +3070,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
return (0);
if ((len = strlen(ddata->last_sname)) == 0)
return (0);
- if (!cpp_demangle_push_str(ddata, "::~", 3))
+ if (!DEM_PUSH_STR(ddata, "::~"))
return (0);
if (!cpp_demangle_push_str(ddata, ddata->last_sname, len))
return (0);
@@ -3135,13 +3125,13 @@ cpp_demangle_read_v_offset(struct cpp_demangle_data *ddata)
if (ddata == NULL)
return (0);
- if (!cpp_demangle_push_str(ddata, "offset : ", 9))
+ if (!DEM_PUSH_STR(ddata, "offset : "))
return (0);
if (!cpp_demangle_read_offset_number(ddata))
return (0);
- if (!cpp_demangle_push_str(ddata, "virtual offset : ", 17))
+ if (!DEM_PUSH_STR(ddata, "virtual offset : "))
return (0);
return (!cpp_demangle_read_offset_number(ddata));
diff --git a/contrib/elftoolchain/nm/nm.c b/contrib/elftoolchain/nm/nm.c
index ebb42ca..493f3a8 100644
--- a/contrib/elftoolchain/nm/nm.c
+++ b/contrib/elftoolchain/nm/nm.c
@@ -48,7 +48,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: nm.c 3472 2016-05-17 20:11:16Z emaste $");
+ELFTC_VCSID("$Id: nm.c 3504 2016-12-17 15:33:16Z kaiwang27 $");
/* symbol information list */
STAILQ_HEAD(sym_head, sym_entry);
@@ -1186,7 +1186,7 @@ read_elf(Elf *elf, const char *filename, Elf_Kind kind)
}
if (!elf_getshnum(elf, &shnum)) {
if ((e_err = elf_errno()) != 0)
- warnx("%s: %s", OBJNAME, elf_errmsg(e_err));
+ warnx("%s: %s", OBJNAME, "File format not recognized");
else
warnx("%s: cannot get section number", OBJNAME);
rtn = 1;
diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c
index 2bf668e..0b99f08 100644
--- a/contrib/elftoolchain/readelf/readelf.c
+++ b/contrib/elftoolchain/readelf/readelf.c
@@ -47,7 +47,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: readelf.c 3484 2016-08-03 13:36:49Z emaste $");
+ELFTC_VCSID("$Id: readelf.c 3519 2017-04-09 23:15:58Z kaiwang27 $");
/* Backwards compatability for older FreeBSD releases. */
#ifndef STB_GNU_UNIQUE
@@ -718,6 +718,7 @@ section_type(unsigned int mach, unsigned int stype)
case SHT_MIPS_EH_REGION: return "MIPS_EH_REGION";
case SHT_MIPS_XLATE_OLD: return "MIPS_XLATE_OLD";
case SHT_MIPS_PDR_EXCEPTION: return "MIPS_PDR_EXCEPTION";
+ case SHT_MIPS_ABIFLAGS: return "MIPS_ABIFLAGS";
default:
break;
}
@@ -4093,30 +4094,26 @@ static void
dump_mips_specific_info(struct readelf *re)
{
struct section *s;
- int i, options_found;
+ int i;
- options_found = 0;
s = NULL;
for (i = 0; (size_t) i < re->shnum; i++) {
s = &re->sl[i];
if (s->name != NULL && (!strcmp(s->name, ".MIPS.options") ||
(s->type == SHT_MIPS_OPTIONS))) {
dump_mips_options(re, s);
- options_found = 1;
}
}
/*
- * According to SGI mips64 spec, .reginfo should be ignored if
- * .MIPS.options section is present.
+ * Dump .reginfo if present (although it will be ignored by an OS if a
+ * .MIPS.options section is present, according to SGI mips64 spec).
*/
- if (!options_found) {
- for (i = 0; (size_t) i < re->shnum; i++) {
- s = &re->sl[i];
- if (s->name != NULL && (!strcmp(s->name, ".reginfo") ||
- (s->type == SHT_MIPS_REGINFO)))
- dump_mips_reginfo(re, s);
- }
+ for (i = 0; (size_t) i < re->shnum; i++) {
+ s = &re->sl[i];
+ if (s->name != NULL && (!strcmp(s->name, ".reginfo") ||
+ (s->type == SHT_MIPS_REGINFO)))
+ dump_mips_reginfo(re, s);
}
}
@@ -6212,9 +6209,7 @@ dump_dwarf_loclist(struct readelf *re)
Dwarf_Half tag, version, pointer_size, off_size;
Dwarf_Error de;
struct loc_at *la;
- int i, j, ret;
-
- printf("\nContents of section .debug_loc:\n");
+ int i, j, ret, has_content;
/* Search .debug_info section. */
while ((ret = dwarf_next_cu_header_b(re->dbg, NULL, &version, NULL,
@@ -6231,7 +6226,7 @@ dump_dwarf_loclist(struct readelf *re)
lowpc = 0;
if (tag == DW_TAG_compile_unit) {
if (dwarf_attrval_unsigned(die, DW_AT_low_pc,
- &lowpc, &de) != DW_DLV_OK)
+ &lowpc, &de) != DW_DLV_OK)
lowpc = 0;
}
@@ -6277,14 +6272,20 @@ dump_dwarf_loclist(struct readelf *re)
if (TAILQ_EMPTY(&lalist))
return;
- printf(" Offset Begin End Expression\n");
-
+ has_content = 0;
TAILQ_FOREACH(la, &lalist, la_next) {
- if (dwarf_loclist_n(la->la_at, &llbuf, &lcnt, &de) !=
+ if ((ret = dwarf_loclist_n(la->la_at, &llbuf, &lcnt, &de)) !=
DW_DLV_OK) {
- warnx("dwarf_loclist_n failed: %s", dwarf_errmsg(de));
+ if (ret != DW_DLV_NO_ENTRY)
+ warnx("dwarf_loclist_n failed: %s",
+ dwarf_errmsg(de));
continue;
}
+ if (!has_content) {
+ has_content = 1;
+ printf("\nContents of section .debug_loc:\n");
+ printf(" Offset Begin End Expression\n");
+ }
set_cu_context(re, la->la_cu_psize, la->la_cu_osize,
la->la_cu_ver);
for (i = 0; i < lcnt; i++) {
@@ -6319,6 +6320,9 @@ dump_dwarf_loclist(struct readelf *re)
}
dwarf_dealloc(re->dbg, llbuf, DW_DLA_LIST);
}
+
+ if (!has_content)
+ printf("\nSection '.debug_loc' has no debugging data.\n");
}
/*
@@ -6665,8 +6669,9 @@ dump_elf(struct readelf *re)
static void
dump_dwarf(struct readelf *re)
{
- int error;
+ struct loc_at *la, *_la;
Dwarf_Error de;
+ int error;
if (dwarf_elf_init(re->elf, DW_DLC_READ, NULL, NULL, &re->dbg, &de)) {
if ((error = dwarf_errno(de)) != DW_DLE_DEBUG_INFO_NULL)
@@ -6702,6 +6707,11 @@ dump_dwarf(struct readelf *re)
if (re->dop & DW_O)
dump_dwarf_loclist(re);
+ TAILQ_FOREACH_SAFE(la, &lalist, la_next, _la) {
+ TAILQ_REMOVE(&lalist, la, la_next);
+ free(la);
+ }
+
dwarf_finish(re->dbg, &de);
}
diff --git a/contrib/elftoolchain/strings/strings.c b/contrib/elftoolchain/strings/strings.c
index a936b6b..fbc8001 100644
--- a/contrib/elftoolchain/strings/strings.c
+++ b/contrib/elftoolchain/strings/strings.c
@@ -46,7 +46,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: strings.c 3446 2016-05-03 01:31:17Z emaste $");
+ELFTC_VCSID("$Id: strings.c 3498 2016-10-26 19:25:13Z emaste $");
enum radix_style {
RADIX_DECIMAL,
diff --git a/lib/libelftc/elftc_version.c b/lib/libelftc/elftc_version.c
index 3115e28..22a29ed 100644
--- a/lib/libelftc/elftc_version.c
+++ b/lib/libelftc/elftc_version.c
@@ -6,5 +6,5 @@
const char *
elftc_version(void)
{
- return "elftoolchain r3490M";
+ return "elftoolchain r3520M";
}
OpenPOWER on IntegriCloud