Import ELF Tool Chain snapshot at r3520
From http://svn.code.sf.net/p/elftoolchain/code/
This commit is contained in:
parent
8c25ed7c1d
commit
c90b1e58a0
@ -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
ar/os.FreeBSD.mk
Normal file
2
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
elfcopy/os.FreeBSD.mk
Normal file
4
elfcopy/os.FreeBSD.mk
Normal file
@ -0,0 +1,4 @@
|
||||
.if !defined(LIBELF_AR)
|
||||
DPADD+= ${LIBBZ2}
|
||||
LDADD+= -lbz2
|
||||
.endif
|
18
elfcopy/pe.c
18
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
|
||||
@ -70,7 +70,7 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
|
||||
errx(EXIT_FAILURE, "gelf_getehdr() failed: %s",
|
||||
elf_errmsg(-1));
|
||||
|
||||
if (elf_getshstrndx(ecp->ein, &indx) == 0)
|
||||
if (elf_getshstrndx(e, &indx) == 0)
|
||||
errx(EXIT_FAILURE, "elf_getshstrndx() failed: %s",
|
||||
elf_errmsg(-1));
|
||||
|
||||
@ -124,7 +124,7 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
|
||||
(void) elf_errno();
|
||||
continue;
|
||||
}
|
||||
if ((name = elf_strptr(ecp->ein, indx, sh.sh_name)) ==
|
||||
if ((name = elf_strptr(e, indx, sh.sh_name)) ==
|
||||
NULL) {
|
||||
warnx("elf_strptr() failed: %s", elf_errmsg(-1));
|
||||
(void) elf_errno();
|
||||
@ -210,12 +210,14 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
|
||||
}
|
||||
pb->pb_align = 1;
|
||||
pb->pb_off = 0;
|
||||
pb->pb_size = roundup(sh.sh_size, poh.oh_filealign);
|
||||
if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) {
|
||||
warn("calloc failed");
|
||||
continue;
|
||||
if (sh.sh_type != SHT_NOBITS) {
|
||||
pb->pb_size = roundup(sh.sh_size, poh.oh_filealign);
|
||||
if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) {
|
||||
warn("calloc failed");
|
||||
continue;
|
||||
}
|
||||
memcpy(pb->pb_buf, d->d_buf, sh.sh_size);
|
||||
}
|
||||
memcpy(pb->pb_buf, d->d_buf, sh.sh_size);
|
||||
}
|
||||
elferr = elf_errno();
|
||||
if (elferr != 0)
|
||||
|
@ -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 $");
|
||||
|
||||
/* Symbol table buffer structure. */
|
||||
struct symbuf {
|
||||
@ -670,6 +670,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
|
||||
@ -234,6 +253,21 @@
|
||||
#define DW_AT_GNU_all_call_sites 0x2117
|
||||
#define DW_AT_GNU_all_source_call_sites 0x2118
|
||||
|
||||
/* Apple extensions. */
|
||||
#define DW_AT_APPLE_optimized 0x3fe1
|
||||
#define DW_AT_APPLE_flags 0x3fe2
|
||||
#define DW_AT_APPLE_isa 0x3fe3
|
||||
#define DW_AT_APPLE_block 0x3fe4
|
||||
#define DW_AT_APPLE_major_runtime_vers 0x3fe5
|
||||
#define DW_AT_APPLE_runtime_class 0x3fe6
|
||||
#define DW_AT_APPLE_omit_frame_ptr 0x3fe7
|
||||
#define DW_AT_APPLE_property_name 0x3fe8
|
||||
#define DW_AT_APPLE_property_getter 0x3fe9
|
||||
#define DW_AT_APPLE_property_setter 0x3fea
|
||||
#define DW_AT_APPLE_property_attribute 0x3feb
|
||||
#define DW_AT_APPLE_objc_complete_type 0x3fec
|
||||
#define DW_AT_APPLE_property 0x3fed
|
||||
|
||||
#define DW_FORM_addr 0x01
|
||||
#define DW_FORM_block2 0x03
|
||||
#define DW_FORM_block4 0x04
|
||||
@ -490,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)
|
||||
@ -145,6 +145,7 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dwarf_Half attr, Dwarf_Unsigned *valp, Dwa
|
||||
Dwarf_Die die1;
|
||||
Dwarf_Unsigned val;
|
||||
Dwarf_Debug dbg;
|
||||
int first;
|
||||
|
||||
dbg = die != NULL ? die->die_dbg : NULL;
|
||||
|
||||
@ -155,14 +156,16 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dwarf_Half attr, Dwarf_Unsigned *valp, Dwa
|
||||
|
||||
*valp = 0;
|
||||
|
||||
if ((at = _dwarf_attr_find(die, attr)) == NULL && attr != DW_AT_type) {
|
||||
DWARF_SET_ERROR(dbg, err, DW_DLE_NO_ENTRY);
|
||||
return (DW_DLV_NO_ENTRY);
|
||||
}
|
||||
|
||||
die1 = NULL;
|
||||
if (at == NULL &&
|
||||
(at = _dwarf_attr_find(die, DW_AT_abstract_origin)) != NULL) {
|
||||
for (;;) {
|
||||
if ((at = _dwarf_attr_find(die, attr)) != NULL ||
|
||||
attr != DW_AT_type)
|
||||
break;
|
||||
if ((at = _dwarf_attr_find(die, DW_AT_abstract_origin)) ==
|
||||
NULL &&
|
||||
(at = _dwarf_attr_find(die, DW_AT_specification)) == NULL)
|
||||
break;
|
||||
|
||||
switch (at->at_form) {
|
||||
case DW_FORM_ref1:
|
||||
case DW_FORM_ref2:
|
||||
@ -170,13 +173,15 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dwarf_Half attr, Dwarf_Unsigned *valp, Dwa
|
||||
case DW_FORM_ref8:
|
||||
case DW_FORM_ref_udata:
|
||||
val = at->u[0].u64;
|
||||
if ((die1 = _dwarf_die_find(die, val)) == NULL ||
|
||||
(at = _dwarf_attr_find(die1, attr)) == NULL) {
|
||||
if (die1 != NULL)
|
||||
dwarf_dealloc(dbg, die1, DW_DLA_DIE);
|
||||
first = (die1 == NULL);
|
||||
die1 = _dwarf_die_find(die, val);
|
||||
if (!first)
|
||||
dwarf_dealloc(dbg, die, DW_DLA_DIE);
|
||||
if (die1 == NULL) {
|
||||
DWARF_SET_ERROR(dbg, err, DW_DLE_NO_ENTRY);
|
||||
return (DW_DLV_NO_ENTRY);
|
||||
}
|
||||
die = die1;
|
||||
break;
|
||||
default:
|
||||
DWARF_SET_ERROR(dbg, err, DW_DLE_ATTR_FORM_BAD);
|
||||
@ -184,6 +189,11 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dwarf_Half attr, Dwarf_Unsigned *valp, Dwa
|
||||
}
|
||||
}
|
||||
|
||||
if (at == NULL) {
|
||||
DWARF_SET_ERROR(dbg, err, DW_DLE_NO_ENTRY);
|
||||
return (DW_DLV_NO_ENTRY);
|
||||
}
|
||||
|
||||
switch (at->at_form) {
|
||||
case DW_FORM_addr:
|
||||
case DW_FORM_data1:
|
||||
|
@ -22,9 +22,9 @@
|
||||
.\" 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 January 18, 2014
|
||||
.Dd December 26, 2016
|
||||
.Os
|
||||
.Dt DWARF_ATTRVAL_SIGNED 3
|
||||
.Sh NAME
|
||||
@ -168,17 +168,22 @@ or
|
||||
.Pp
|
||||
If the attribute named by argument
|
||||
.Ar attr
|
||||
is not present in the debugging information entry referenced by
|
||||
argument
|
||||
is
|
||||
.Dv DW_AT_type
|
||||
and is not present in the debugging information entry referenced by argument
|
||||
.Ar die ,
|
||||
and if a
|
||||
.Dv DW_AT_abstract_origin
|
||||
or
|
||||
.Dv DW_AT_specification
|
||||
attribute is present in the debugging information entry,
|
||||
function
|
||||
.Fn dwarf_attrval_unsigned
|
||||
will search for the named attribute in the debugging information entry
|
||||
referenced by the
|
||||
.Dv DW_AT_abstract_origin
|
||||
or
|
||||
.Dv DW_AT_specification
|
||||
attribute.
|
||||
.Sh RETURN VALUES
|
||||
On success, these functions returns
|
||||
|
@ -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:
|
||||
@ -298,6 +332,32 @@ dwarf_get_AT_name(unsigned attr, const char **s)
|
||||
*s = "DW_AT_GNU_all_call_sites"; break;
|
||||
case DW_AT_GNU_all_source_call_sites:
|
||||
*s = "DW_AT_GNU_all_source_call_sites"; break;
|
||||
case DW_AT_APPLE_optimized:
|
||||
*s = "DW_AT_APPLE_optimized"; break;
|
||||
case DW_AT_APPLE_flags:
|
||||
*s = "DW_AT_APPLE_flags"; break;
|
||||
case DW_AT_APPLE_isa:
|
||||
*s = "DW_AT_APPLE_isa"; break;
|
||||
case DW_AT_APPLE_block:
|
||||
*s = "DW_AT_APPLE_block"; break;
|
||||
case DW_AT_APPLE_major_runtime_vers:
|
||||
*s = "DW_AT_APPLE_major_runtime_vers"; break;
|
||||
case DW_AT_APPLE_runtime_class:
|
||||
*s = "DW_AT_APPLE_runtime_class"; break;
|
||||
case DW_AT_APPLE_omit_frame_ptr:
|
||||
*s = "DW_AT_APPLE_omit_frame_ptr"; break;
|
||||
case DW_AT_APPLE_property_name:
|
||||
*s = "DW_AT_APPLE_property_name"; break;
|
||||
case DW_AT_APPLE_property_getter:
|
||||
*s = "DW_AT_APPLE_property_getter"; break;
|
||||
case DW_AT_APPLE_property_setter:
|
||||
*s = "DW_AT_APPLE_property_setter"; break;
|
||||
case DW_AT_APPLE_property_attribute:
|
||||
*s = "DW_AT_APPLE_property_attribute"; break;
|
||||
case DW_AT_APPLE_objc_complete_type:
|
||||
*s = "DW_AT_APPLE_objc_complete_type"; break;
|
||||
case DW_AT_APPLE_property:
|
||||
*s = "DW_AT_APPLE_property"; break;
|
||||
default:
|
||||
return (DW_DLV_NO_ENTRY);
|
||||
}
|
||||
@ -730,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
|
||||
@ -82,6 +83,8 @@ Known descriptor names and their properties include:
|
||||
.It Li elf32-shbig-linux Ta ELF Ta MSB Ta 32
|
||||
.It Li elf32-shl-linux Ta ELF Ta LSB Ta 32
|
||||
.It Li elf32-sparc Ta ELF Ta MSB Ta 32
|
||||
.It Li elf32-tradbigmips Ta ELF Ta MSB Ta 32
|
||||
.It Li elf32-tradlittlemips Ta ELF Ta LSB Ta 32
|
||||
.It Li elf64-alpha Ta ELF Ta LSB Ta 64
|
||||
.It Li elf64-alpha-freebsd Ta ELF Ta LSB Ta 64
|
||||
.It Li elf64-big Ta ELF Ta MSB Ta 64
|
||||
@ -92,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
|
||||
@ -101,6 +105,8 @@ Known descriptor names and their properties include:
|
||||
.It Li elf64-sh64-linux Ta ELF Ta LSB Ta 64
|
||||
.It Li elf64-sparc Ta ELF Ta MSB Ta 64
|
||||
.It Li elf64-sparc-freebsd Ta ELF Ta MSB Ta 64
|
||||
.It Li elf64-tradbigmips Ta ELF Ta MSB Ta 64
|
||||
.It Li elf64-tradlittlemips Ta ELF Ta LSB Ta 64
|
||||
.It Li elf64-x86-64 Ta ELF Ta LSB Ta 64
|
||||
.It Li elf64-x86-64-freebsd Ta ELF Ta LSB Ta 64
|
||||
.It Li ihex Ta IHEX Ta - Ta -
|
||||
|
@ -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[] = {
|
||||
|
||||
@ -126,6 +126,15 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
|
||||
.bt_machine = EM_PPC,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf32-powerpc-freebsd",
|
||||
.bt_type = ETF_ELF,
|
||||
.bt_byteorder = ELFDATA2MSB,
|
||||
.bt_elfclass = ELFCLASS32,
|
||||
.bt_machine = EM_PPC,
|
||||
.bt_osabi = ELFOSABI_FREEBSD,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf32-powerpcle",
|
||||
.bt_type = ETF_ELF,
|
||||
@ -194,6 +203,22 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
|
||||
.bt_machine = EM_SPARC,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf32-tradbigmips",
|
||||
.bt_type = ETF_ELF,
|
||||
.bt_byteorder = ELFDATA2MSB,
|
||||
.bt_elfclass = ELFCLASS32,
|
||||
.bt_machine = EM_MIPS,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf32-tradlittlemips",
|
||||
.bt_type = ETF_ELF,
|
||||
.bt_byteorder = ELFDATA2LSB,
|
||||
.bt_elfclass = ELFCLASS32,
|
||||
.bt_machine = EM_MIPS,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf64-alpha",
|
||||
.bt_type = ETF_ELF,
|
||||
@ -273,6 +298,15 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
|
||||
.bt_machine = EM_PPC64,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf64-powerpc-freebsd",
|
||||
.bt_type = ETF_ELF,
|
||||
.bt_byteorder = ELFDATA2MSB,
|
||||
.bt_elfclass = ELFCLASS64,
|
||||
.bt_machine = EM_PPC64,
|
||||
.bt_osabi = ELFOSABI_FREEBSD,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf64-powerpcle",
|
||||
.bt_type = ETF_ELF,
|
||||
@ -350,6 +384,22 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
|
||||
.bt_osabi = ELFOSABI_FREEBSD
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf64-tradbigmips",
|
||||
.bt_type = ETF_ELF,
|
||||
.bt_byteorder = ELFDATA2MSB,
|
||||
.bt_elfclass = ELFCLASS64,
|
||||
.bt_machine = EM_MIPS,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf64-tradlittlemips",
|
||||
.bt_type = ETF_ELF,
|
||||
.bt_byteorder = ELFDATA2LSB,
|
||||
.bt_elfclass = ELFCLASS64,
|
||||
.bt_machine = EM_MIPS,
|
||||
},
|
||||
|
||||
{
|
||||
.bt_name = "elf64-x86-64",
|
||||
.bt_type = ETF_ELF,
|
||||
|
@ -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
4
nm/nm.c
4
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;
|
||||
|
@ -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 $");
|
||||
|
||||
/*
|
||||
* readelf(1) options.
|
||||
@ -644,6 +644,9 @@ phdr_type(unsigned int mach, unsigned int ptype)
|
||||
case PT_GNU_EH_FRAME: return "GNU_EH_FRAME";
|
||||
case PT_GNU_STACK: return "GNU_STACK";
|
||||
case PT_GNU_RELRO: return "GNU_RELRO";
|
||||
case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE";
|
||||
case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED";
|
||||
case PT_OPENBSD_BOOTDATA: return "OPENBSD_BOOTDATA";
|
||||
default:
|
||||
if (ptype >= PT_LOOS && ptype <= PT_HIOS)
|
||||
snprintf(s_ptype, sizeof(s_ptype), "LOOS+%#x",
|
||||
@ -709,6 +712,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;
|
||||
}
|
||||
@ -934,6 +938,7 @@ dt_type(unsigned int mach, unsigned int dtype)
|
||||
case DT_SUNW_RTLDINF: return "SUNW_RTLDINF";
|
||||
case DT_SUNW_FILTER: return "SUNW_FILTER";
|
||||
case DT_SUNW_CAP: return "SUNW_CAP";
|
||||
case DT_SUNW_ASLR: return "SUNW_ASLR";
|
||||
case DT_CHECKSUM: return "CHECKSUM";
|
||||
case DT_PLTPADSZ: return "PLTPADSZ";
|
||||
case DT_MOVEENT: return "MOVEENT";
|
||||
@ -2103,7 +2108,7 @@ dwarf_reg(unsigned int mach, unsigned int reg)
|
||||
static void
|
||||
dump_ehdr(struct readelf *re)
|
||||
{
|
||||
size_t shnum, shstrndx;
|
||||
size_t phnum, shnum, shstrndx;
|
||||
int i;
|
||||
|
||||
printf("ELF Header:\n");
|
||||
@ -2165,7 +2170,13 @@ dump_ehdr(struct readelf *re)
|
||||
re->ehdr.e_phentsize);
|
||||
|
||||
/* e_phnum. */
|
||||
printf("%-37s%u\n", " Number of program headers:", re->ehdr.e_phnum);
|
||||
printf("%-37s%u", " Number of program headers:", re->ehdr.e_phnum);
|
||||
if (re->ehdr.e_phnum == PN_XNUM) {
|
||||
/* Extended program header numbering is in use. */
|
||||
if (elf_getphnum(re->elf, &phnum))
|
||||
printf(" (%zu)", phnum);
|
||||
}
|
||||
putchar('\n');
|
||||
|
||||
/* e_shentsize. */
|
||||
printf("%-37s%u (bytes)\n", " Size of section headers:",
|
||||
@ -4077,30 +4088,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6196,9 +6203,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,
|
||||
@ -6215,7 +6220,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;
|
||||
}
|
||||
|
||||
@ -6261,14 +6266,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++) {
|
||||
@ -6303,6 +6314,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");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -6535,13 +6549,14 @@ load_sections(struct readelf *re)
|
||||
}
|
||||
if ((name = elf_strptr(re->elf, shstrndx, sh.sh_name)) == NULL) {
|
||||
(void) elf_errno();
|
||||
name = "ERROR";
|
||||
name = "<no-name>";
|
||||
}
|
||||
if ((ndx = elf_ndxscn(scn)) == SHN_UNDEF) {
|
||||
if ((elferr = elf_errno()) != 0)
|
||||
if ((elferr = elf_errno()) != 0) {
|
||||
warnx("elf_ndxscn failed: %s",
|
||||
elf_errmsg(elferr));
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ndx >= re->shnum) {
|
||||
warnx("section index of '%s' out of range", name);
|
||||
@ -6649,8 +6664,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)
|
||||
@ -6686,6 +6702,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,13 +46,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: strings.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
|
||||
enum return_code {
|
||||
RETURN_OK,
|
||||
RETURN_NOINPUT,
|
||||
RETURN_SOFTWARE
|
||||
};
|
||||
ELFTC_VCSID("$Id: strings.c 3498 2016-10-26 19:25:13Z emaste $");
|
||||
|
||||
enum radix_style {
|
||||
RADIX_DECIMAL,
|
||||
@ -107,7 +101,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int ch, rc;
|
||||
|
||||
rc = RETURN_OK;
|
||||
rc = 0;
|
||||
min_len = 0;
|
||||
encoding_size = 1;
|
||||
if (elf_version(EV_CURRENT) == EV_NONE)
|
||||
@ -197,7 +191,8 @@ main(int argc, char **argv)
|
||||
if (!*argv)
|
||||
rc = handle_file("{standard input}");
|
||||
else while (*argv) {
|
||||
rc = handle_file(*argv);
|
||||
if (handle_file(*argv) != 0)
|
||||
rc = 1;
|
||||
argv++;
|
||||
}
|
||||
return (rc);
|
||||
@ -209,11 +204,11 @@ handle_file(const char *name)
|
||||
int fd, rt;
|
||||
|
||||
if (name == NULL)
|
||||
return (RETURN_NOINPUT);
|
||||
return (1);
|
||||
if (strcmp("{standard input}", name) != 0) {
|
||||
if (freopen(name, "rb", stdin) == NULL) {
|
||||
warnx("'%s': %s", name, strerror(errno));
|
||||
return (RETURN_NOINPUT);
|
||||
return (1);
|
||||
}
|
||||
} else {
|
||||
return (find_strings(name, (off_t)0, (off_t)0));
|
||||
@ -221,7 +216,7 @@ handle_file(const char *name)
|
||||
|
||||
fd = fileno(stdin);
|
||||
if (fd < 0)
|
||||
return (RETURN_NOINPUT);
|
||||
return (1);
|
||||
rt = handle_elf(name, fd);
|
||||
return (rt);
|
||||
}
|
||||
@ -239,7 +234,7 @@ handle_binary(const char *name, int fd)
|
||||
(void) lseek(fd, (off_t)0, SEEK_SET);
|
||||
if (!fstat(fd, &buf))
|
||||
return (find_strings(name, (off_t)0, buf.st_size));
|
||||
return (RETURN_SOFTWARE);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -257,7 +252,7 @@ handle_elf(const char *name, int fd)
|
||||
Elf_Scn *scn;
|
||||
int rc;
|
||||
|
||||
rc = RETURN_OK;
|
||||
rc = 0;
|
||||
/* If entire file is chosen, treat it as a binary file */
|
||||
if (entire_file)
|
||||
return (handle_binary(name, fd));
|
||||
@ -272,7 +267,7 @@ handle_elf(const char *name, int fd)
|
||||
if (gelf_getehdr(elf, &elfhdr) == NULL) {
|
||||
(void) elf_end(elf);
|
||||
warnx("%s: ELF file could not be processed", name);
|
||||
return (RETURN_SOFTWARE);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (elfhdr.e_shnum == 0 && elfhdr.e_type == ET_CORE) {
|
||||
@ -352,7 +347,7 @@ find_strings(const char *name, off_t offset, off_t size)
|
||||
if ((obuf = (char*)calloc(1, min_len + 1)) == NULL) {
|
||||
(void) fprintf(stderr, "Unable to allocate memory: %s\n",
|
||||
strerror(errno));
|
||||
return (RETURN_SOFTWARE);
|
||||
return (1);
|
||||
}
|
||||
|
||||
(void) fseeko(stdin, offset, SEEK_SET);
|
||||
@ -426,7 +421,7 @@ find_strings(const char *name, off_t offset, off_t size)
|
||||
}
|
||||
_exit1:
|
||||
free(obuf);
|
||||
return (RETURN_OK);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define USAGE_MESSAGE "\
|
||||
|
2
test/ar/plugin/os.FreeBSD.mk
Normal file
2
test/ar/plugin/os.FreeBSD.mk
Normal file
@ -0,0 +1,2 @@
|
||||
DPADD+= ${LIBBZ2}
|
||||
LDADD+= -lbz2
|
@ -3,9 +3,15 @@
|
||||
all
|
||||
"Starting Test Suite"
|
||||
^misc
|
||||
^regression
|
||||
"Complete Test Suite"
|
||||
|
||||
misc
|
||||
"Starting noarg Test"
|
||||
"Starting misc Test"
|
||||
/ts/misc/tc
|
||||
"Complete noarg Test"
|
||||
"Complete misc Test"
|
||||
|
||||
regression
|
||||
"Starting regression Test"
|
||||
/ts/regression/tc
|
||||
"Complete regression Test"
|
||||
|
@ -3,5 +3,6 @@
|
||||
TOP= ../../..
|
||||
|
||||
SUBDIR+= misc
|
||||
SUBDIR+= regression
|
||||
|
||||
.include "${TOP}/mk/elftoolchain.subdir.mk"
|
||||
.include "${TOP}/mk/elftoolchain.subdir.mk"
|
||||
|
5
test/cxxfilt/ts/regression/Makefile
Normal file
5
test/cxxfilt/ts/regression/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
# $Id$
|
||||
|
||||
TOP= ../../../..
|
||||
|
||||
.include "../common/ts.mk"
|
34
test/cxxfilt/ts/regression/tclist
Normal file
34
test/cxxfilt/ts/regression/tclist
Normal file
@ -0,0 +1,34 @@
|
||||
# ticket 481, TLS wrappers
|
||||
"_ZTWL20PrettyStackTraceHead", "TLS wrapper function for PrettyStackTraceHead"
|
||||
|
||||
# ticket 488, trailing E
|
||||
"_ZN1fILi4EEE", "f<4>"
|
||||
|
||||
# ticket 489, handle Dv (__vector)
|
||||
"_Z22__gen_ocl_write_imagef11ocl_image2dDv2_iDv4_f", "__gen_ocl_write_imagef(ocl_image2d, int __vector(2), float __vector(4))"
|
||||
"_Z23__gen_ocl_write_imageui16ocl_image2darrayDv3_iDv4_j", "__gen_ocl_write_imageui(ocl_image2darray, int __vector(3), unsigned int __vector(4))"
|
||||
"_Z1fDv2_i", "f(int __vector(2))"
|
||||
|
||||
# ticket 491, omit "void"
|
||||
"_Z1fv", "f()"
|
||||
"_Z1fPv", "f(void*)"
|
||||
"_Z1fiv", "f(int, void)"
|
||||
"_Z1fvi", "f(void, int)"
|
||||
|
||||
# ticket 508, demangler failure
|
||||
"_ZN8TaskPool11AddTaskImplEONSt3__18functionIFvvEEE", "TaskPool::AddTaskImpl(std::__1::function<void ()>&&)"
|
||||
|
||||
# ticket 530, assertion failure
|
||||
"_ZNSp16invalidOargumentC1ERKSs", "invalidOargument::invalidOargument(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)"
|
||||
|
||||
# ticket 531, assertion failure
|
||||
"____new_strtold_internal", "____new_strtold_internal"
|
||||
|
||||
# ticket 537, demangler fails on a symbol from GNU gold
|
||||
"_ZN4gold15relocate_relocsILi64ELb1ENS_22Default_classify_relocILi4ELi64ELb1EEEEEvPKNS_13Relocate_infoIXT_EXT0_EEEPKhmPNS_14Output_sectionEN6elfcpp9Elf_typesIXT_EE7Elf_OffEPhNSD_8Elf_AddrEmSF_m", "void gold::relocate_relocs<64, true, gold::Default_classify_reloc<4, 64, true> >(gold::Relocate_info<64, true> const*, unsigned char const*, unsigned long, gold::Output_section*, elfcpp::Elf_types<64>::Elf_Off, unsigned char*, elfcpp::Elf_types<64>::Elf_Addr, unsigned long, unsigned char*, unsigned long)"
|
||||
|
||||
# ticket 538, demangler uses incorrect back-ref
|
||||
"_ZN1f1gEP1hNS0_1iE", "f::g(h*, h::i)"
|
||||
|
||||
# ticket 539, demangler does not demangle lambdas
|
||||
"_ZZN9libunwind17LocalAddressSpace18findUnwindSectionsEjRNS_18UnwindInfoSectionsEENUlP12dl_phdr_infojPvE_8__invokeES4_jS5_", "libunwind::LocalAddressSpace::findUnwindSections(unsigned int, libunwind::UnwindInfoSections&)::{lambda(dl_phdr_info*, unsigned int, void*)#1}::__invoke(dl_phdr_info*, unsigned int, void*)"
|
Loading…
Reference in New Issue
Block a user