Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2013 21:18:02 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258017 - in head/contrib: binutils/binutils gcclibs/libiberty gcclibs/libiberty/testsuite
Message-ID:  <201311112118.rABLI2OV021212@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Mon Nov 11 21:18:02 2013
New Revision: 258017
URL: http://svnweb.freebsd.org/changeset/base/258017

Log:
  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/

Modified:
  head/contrib/binutils/binutils/cxxfilt.c
  head/contrib/gcclibs/libiberty/cp-demangle.c
  head/contrib/gcclibs/libiberty/testsuite/demangle-expected

Modified: head/contrib/binutils/binutils/cxxfilt.c
==============================================================================
--- head/contrib/binutils/binutils/cxxfilt.c	Mon Nov 11 21:16:55 2013	(r258016)
+++ head/contrib/binutils/binutils/cxxfilt.c	Mon Nov 11 21:18:02 2013	(r258017)
@@ -63,12 +63,12 @@ demangle_it (char *mangled_name)
   result = cplus_demangle (mangled_name + skip_first, flags);
 
   if (result == NULL)
-    printf (mangled_name);
+    printf ("%s",mangled_name);
   else
     {
       if (mangled_name[0] == '.')
 	putchar ('.');
-      printf (result);
+      printf ("%s",result);
       free (result);
     }
 }

Modified: head/contrib/gcclibs/libiberty/cp-demangle.c
==============================================================================
--- head/contrib/gcclibs/libiberty/cp-demangle.c	Mon Nov 11 21:16:55 2013	(r258016)
+++ head/contrib/gcclibs/libiberty/cp-demangle.c	Mon Nov 11 21:18:02 2013	(r258017)
@@ -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;
 }

Modified: head/contrib/gcclibs/libiberty/testsuite/demangle-expected
==============================================================================
--- head/contrib/gcclibs/libiberty/testsuite/demangle-expected	Mon Nov 11 21:16:55 2013	(r258016)
+++ head/contrib/gcclibs/libiberty/testsuite/demangle-expected	Mon Nov 11 21:18:02 2013	(r258017)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311112118.rABLI2OV021212>