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 PR: 218395 MFC after: 2 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation
This commit is contained in:
commit
bee2765cc1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317075
@ -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);
|
||||
|
||||
|
2
contrib/elftoolchain/ar/os.FreeBSD.mk
Normal file
2
contrib/elftoolchain/ar/os.FreeBSD.mk
Normal file
@ -0,0 +1,2 @@
|
||||
DPADD+= ${LIBBZ2}
|
||||
LDADD+= -lbz2
|
@ -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, \
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
4
contrib/elftoolchain/elfcopy/os.FreeBSD.mk
Normal file
4
contrib/elftoolchain/elfcopy/os.FreeBSD.mk
Normal file
@ -0,0 +1,4 @@
|
||||
.if !defined(LIBELF_AR)
|
||||
DPADD+= ${LIBBZ2}
|
||||
LDADD+= -lbz2
|
||||
.endif
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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),
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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]"
|
||||
|
@ -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]"
|
||||
|
@ -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
|
||||
|
@ -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[] = {
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -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);
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
@ -4099,30 +4100,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6218,9 +6215,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,
|
||||
@ -6237,7 +6232,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;
|
||||
}
|
||||
|
||||
@ -6283,14 +6278,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++) {
|
||||
@ -6325,6 +6326,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");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -6672,8 +6676,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)
|
||||
@ -6709,6 +6714,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);
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user