summaryrefslogtreecommitdiffstats
path: root/contrib/gcclibs
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2013-11-11 21:18:02 +0000
committerpfg <pfg@FreeBSD.org>2013-11-11 21:18:02 +0000
commit7ee9c7bb018a215c159762ac76b1ceb208a08387 (patch)
treea758cfe831740d6be74cf9acb9c1af4d34566be1 /contrib/gcclibs
parentb3db14de0bb6b35026d8f9b0b1a7b8c6bfe03c0c (diff)
downloadFreeBSD-src-7ee9c7bb018a215c159762ac76b1ceb208a08387.zip
FreeBSD-src-7ee9c7bb018a215c159762ac76b1ceb208a08387.tar.gz
cxxfilt: small changes from Apple's developer tools
From Apple's Developer Tools 4.0 [1]: demangle.patch 2007-05-05 Geoffrey Keating (d_name): Detect local-source-name. (d_prefix): Likewise. (d_unqualified_name): Implement local-source-name. libiberty-printf.patch MFC after: 1 month [1] http://opensource.apple.com/source/cxxfilt/cxxfilt-9/patches/
Diffstat (limited to 'contrib/gcclibs')
-rw-r--r--contrib/gcclibs/libiberty/cp-demangle.c30
-rw-r--r--contrib/gcclibs/libiberty/testsuite/demangle-expected44
2 files changed, 73 insertions, 1 deletions
diff --git a/contrib/gcclibs/libiberty/cp-demangle.c b/contrib/gcclibs/libiberty/cp-demangle.c
index 2fa5978..3f11967 100644
--- a/contrib/gcclibs/libiberty/cp-demangle.c
+++ b/contrib/gcclibs/libiberty/cp-demangle.c
@@ -1054,6 +1054,11 @@ d_name (struct d_info *di)
case 'Z':
return d_local_name (di);
+/* APPLE LOCAL begin mainline 2007-05-09 5173149 */ \
+ case 'L':
+ return d_unqualified_name (di);
+
+/* APPLE LOCAL end mainline 2007-05-09 5173149 */ \
case 'S':
{
int subst;
@@ -1174,7 +1179,10 @@ d_prefix (struct d_info *di)
if (IS_DIGIT (peek)
|| IS_LOWER (peek)
|| peek == 'C'
- || peek == 'D')
+/* APPLE LOCAL begin mainline 2007-05-09 5173149 */ \
+ || peek == 'D'
+ || peek == 'L')
+/* APPLE LOCAL end mainline 2007-05-09 5173149 */ \
dc = d_unqualified_name (di);
else if (peek == 'S')
dc = d_substitution (di, 1);
@@ -1208,6 +1216,11 @@ d_prefix (struct d_info *di)
/* <unqualified-name> ::= <operator-name>
::= <ctor-dtor-name>
::= <source-name>
+ APPLE LOCAL begin mainline 2007-05-09 5173149
+ ::= <local-source-name>
+
+ <local-source-name> ::= L <source-name> <discriminator>
+ APPLE LOCAL end mainline 2007-05-09 5173149
*/
static struct demangle_component *
@@ -1229,6 +1242,21 @@ d_unqualified_name (struct d_info *di)
}
else if (peek == 'C' || peek == 'D')
return d_ctor_dtor_name (di);
+/* APPLE LOCAL begin mainline 2007-05-09 5173149 */ \
+ else if (peek == 'L')
+ {
+ struct demangle_component * ret;
+
+ d_advance (di, 1);
+
+ ret = d_source_name (di);
+ if (ret == NULL)
+ return NULL;
+ if (! d_discriminator (di))
+ return NULL;
+ return ret;
+ }
+/* APPLE LOCAL end mainline 2007-05-09 5173149 */ \
else
return NULL;
}
diff --git a/contrib/gcclibs/libiberty/testsuite/demangle-expected b/contrib/gcclibs/libiberty/testsuite/demangle-expected
index 3f5622f..4666e3f 100644
--- a/contrib/gcclibs/libiberty/testsuite/demangle-expected
+++ b/contrib/gcclibs/libiberty/testsuite/demangle-expected
@@ -3816,3 +3816,47 @@ f
SASDASDFASDF_sdfsdf
SASDASDFASDF_sdfsdf
SASDASDFASDF_sdfsdf
+# APPLE LOCAL begin mainline 2007-05-09 5173149
+# These are all cases of invalid manglings where the demangler would read
+# past the end of the string.
+# d_name wasn't honouring a NULL from d_substitution
+--format=gnu-v3
+_ZSA
+_ZSA
+# d_expr_primary wasn't honouring NULL from cplus_demangle_mangled_name
+--format=gnu-v3
+_ZN1fIL_
+_ZN1fIL_
+# d_operator_name was taking two characters in a row
+--format=gnu-v3
+_Za
+_Za
+# d_prefix wasn't honouring NULL from d_substitution
+--format=gnu-v3
+_ZNSA
+_ZNSA
+# d_prefix wasn't honouring NULL from d_template_param
+--format=gnu-v3
+_ZNT
+_ZNT
+# Dereferencing NULL in d_pointer_to_member_type
+--format=gnu-v3
+_Z1aMark
+_Z1aMark
+# <local-source-name> test 1
+--format=gnu-v3
+_ZL3foo_2
+foo
+# <local-source-name> test 2
+--format=gnu-v3
+_ZZL3foo_2vE4var1
+foo()::var1
+# <local-source-name> test 3
+--format=gnu-v3
+_ZZL3foo_2vE4var1_0
+foo()::var1
+# <local-source-name> test 4
+--format=gnu-v3
+_ZZN7myspaceL3foo_1EvEN11localstruct1fEZNS_3fooEvE16otherlocalstruct
+myspace::foo()::localstruct::f(myspace::foo()::otherlocalstruct)
+# APPLE LOCAL end mainline 2007-05-09 5173149
OpenPOWER on IntegriCloud