summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranonymous <local@localhost>2010-09-30 16:21:19 +0000
committeranonymous <local@localhost>2010-09-30 16:21:19 +0000
commit18482f17915bd417aa7a99a2050adbc355a4429c (patch)
treedeb143bcb16ca956fa3daf61a73a281a99beb0a6
parent71846ed960bffa879af2abf95956da6bb657eb6c (diff)
downloadlibcxxrt-18482f17915bd417aa7a99a2050adbc355a4429c.tar.gz
libcxxrt-18482f17915bd417aa7a99a2050adbc355a4429c.tar.bz2
libcxxrt-18482f17915bd417aa7a99a2050adbc355a4429c.tar.xz
Fix __cxa_demangle again.
-rw-r--r--src/Makefile2
-rw-r--r--src/_libelftc.h13
-rw-r--r--src/libelftc_dem_gnu3.c18
-rw-r--r--src/libelftc_vstr.c1
4 files changed, 12 insertions, 22 deletions
diff --git a/src/Makefile b/src/Makefile
index 499a05c..f2ab4fc 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,5 @@
OBJECTS = typeinfo.o exception.o dynamic_cast.o terminate.o guard.o \
- stdexcept.o memory.o aux.o
+ stdexcept.o memory.o aux.o libelftc_dem_gnu3.o libelftc_vstr.o
# Needed for building the shared library
CXXFLAGS = -fPIC
diff --git a/src/_libelftc.h b/src/_libelftc.h
index 541c164..283e50f 100644
--- a/src/_libelftc.h
+++ b/src/_libelftc.h
@@ -30,19 +30,6 @@
#include <stdbool.h>
-#include "_elftc.h"
-
-struct _Bfd_Target {
- const char *bt_name; /* target name. */
- unsigned int bt_type; /* target type. */
- unsigned int bt_byteorder; /* elf target byteorder. */
- unsigned int bt_elfclass; /* elf target class (32/64bit). */
- unsigned int bt_machine; /* elf target arch. */
- unsigned int bt_osabi; /* elf target abi. */
-};
-
-extern struct _Bfd_Target _libelftc_targets[];
-
/** @brief Dynamic vector data for string. */
struct vector_str {
/** Current size */
diff --git a/src/libelftc_dem_gnu3.c b/src/libelftc_dem_gnu3.c
index e1a91d2..8dff888 100644
--- a/src/libelftc_dem_gnu3.c
+++ b/src/libelftc_dem_gnu3.c
@@ -27,7 +27,6 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
-#include <libelftc.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
@@ -36,8 +35,6 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id$");
-
/**
* @file cpp_demangle.c
* @brief Decode IA-64 C++ ABI style implementation.
@@ -172,9 +169,18 @@ cpp_demangle_gnu3(const char *org)
unsigned int limit;
char *rtn;
- if (org == NULL || (org_len = strlen(org)) < 2)
+ if (org == NULL)
return (NULL);
+ // Try demangling as a type for short encodings
+ if (((org_len = strlen(org)) < 2) || (org[0] != '_' || org[1] != 'Z' )) {
+ if (!cpp_demangle_data_init(&ddata, org))
+ return (NULL);
+ if (!cpp_demangle_read_type(&ddata, 0))
+ goto clean;
+ rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL);
+ goto clean;
+ }
if (org_len > 11 && !strncmp(org, "_GLOBAL__I_", 11)) {
if ((rtn = malloc(org_len + 19)) == NULL)
return (NULL);
@@ -183,8 +189,6 @@ cpp_demangle_gnu3(const char *org)
return (rtn);
}
- if (org[0] != '_' || org[1] != 'Z')
- return (NULL);
if (!cpp_demangle_data_init(&ddata, org + 2))
return (NULL);
@@ -1941,7 +1945,7 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
return (0);
output = &ddata->output;
- if (!strncmp(ddata->output.container[ddata->output.size - 1], ">", 1)) {
+ if (ddata->output.size > 0 && !strncmp(ddata->output.container[ddata->output.size - 1], ">", 1)) {
cpp_demangle_gnu3_push_head++;
output = &ddata->output_tmp;
} else if (delimit == 1) {
diff --git a/src/libelftc_vstr.c b/src/libelftc_vstr.c
index 8f089c1..57e4aff 100644
--- a/src/libelftc_vstr.c
+++ b/src/libelftc_vstr.c
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <assert.h>
-#include <libelftc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>