Index: src/binutils/ChangeLog =================================================================== RCS file: /cvs/src/src/binutils/ChangeLog,v retrieving revision 1.1159 diff -u -p -r1.1159 ChangeLog --- src/binutils/ChangeLog 10 Apr 2007 08:01:13 -0000 1.1159 +++ src/binutils/ChangeLog 12 Apr 2007 21:25:23 -0000 @@ -1,3 +1,11 @@ +2007-04-12 Dave MacLachlan + + * cxxfilt.c Added support for objc++ demangling + (objcpp_symbol_characters): list of valid symbols for objc++ symbols + (main): added objcpp_demangling option + * demangle.h Added DMGL_OBJCPP, OBJCPP_DEMANGLING_STYLE_STRING, + OBJCPP_DEMANGLING + 2007-04-10 Vladimir Prus * NEWS: Mention disjoint histograms support in Index: src/binutils/cxxfilt.c =================================================================== RCS file: /cvs/src/src/binutils/cxxfilt.c,v retrieving revision 1.12 diff -u -p -r1.12 cxxfilt.c --- src/binutils/cxxfilt.c 17 Feb 2007 13:33:54 -0000 1.12 +++ src/binutils/cxxfilt.c 12 Apr 2007 21:25:23 -0000 @@ -4,6 +4,7 @@ Written by James Clark (jjc@jclark.uucp) Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling Modified by Satish Pai (pai@apollo.hp.com) for HP demangling + Modified by Dave MacLachlan (dmaclach@google.com) for ObjC++ demangling This file is part of GCC. @@ -166,6 +167,32 @@ hp_symbol_characters (void) return "_$.<>#,*&[]:(){}"; } +/* +Return the string of non-alnum characters that may occur +as a valid symbol name component in an Objective C++ object file. + +statics in Objective C methods get C++ mangled names, however the +mangling includes the name of the Objective C method in it. So +@implementation foo +-(void)bar:(id)a { + static int baz; +} +gets mangled to +__ZZ11-[foo bar:]E3baz + +So for objc++ symbols are composed of uppercase and lowercase letters, +decimal digits, dollar symbol, period (.), minus (-), plus (+), open square +bracket ([), close square bracket (]), color (:), space ( ), and +underscore (_). A symbol can begin with a letter, underscore, minus, +plus or dollar sign. If a symbol begins with a digit, it must contain a +non-digit character. +*/ +static const char * +objcpp_symbol_characters (void) +{ + return "_$.-+[]: "; +} + extern int main (int, char **); int @@ -246,6 +273,9 @@ main (int argc, char **argv) case hp_demangling: valid_symbols = hp_symbol_characters (); break; + case objcpp_demangling: + valid_symbols = objcpp_symbol_characters (); + break; default: /* Folks should explicitly indicate the appropriate alphabet for each demangling. Providing a default would allow the Index: src/include/demangle.h =================================================================== RCS file: /cvs/src/src/include/demangle.h,v retrieving revision 1.23 diff -u -p -r1.23 demangle.h --- src/include/demangle.h 30 Jan 2007 23:16:53 -0000 1.23 +++ src/include/demangle.h 12 Apr 2007 21:25:28 -0000 @@ -48,9 +48,10 @@ extern "C" { #define DMGL_EDG (1 << 13) #define DMGL_GNU_V3 (1 << 14) #define DMGL_GNAT (1 << 15) +#define DMGL_OBJCPP (1 << 16) /* Knows about some objcpp types */ /* If none of these are set, use 'current_demangling_style' as the default. */ -#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT) +#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_OBJCPP) /* Enumeration of possible demangling styles. @@ -72,7 +73,8 @@ extern enum demangling_styles edg_demangling = DMGL_EDG, gnu_v3_demangling = DMGL_GNU_V3, java_demangling = DMGL_JAVA, - gnat_demangling = DMGL_GNAT + gnat_demangling = DMGL_GNAT, + objcpp_demangling = DMGL_OBJCPP } current_demangling_style; /* Define string names for the various demangling styles. */ @@ -87,6 +89,7 @@ extern enum demangling_styles #define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3" #define JAVA_DEMANGLING_STYLE_STRING "java" #define GNAT_DEMANGLING_STYLE_STRING "gnat" +#define OBJCPP_DEMANGLING_STYLE_STRING "objc++" /* Some macros to test what demangling style is active. */ @@ -100,6 +103,7 @@ extern enum demangling_styles #define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3) #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA) #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT) +#define OBJCPP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_OBJCPP) /* Provide information about the available demangle styles. This code is pulled from gdb into libiberty because it is useful to binutils also. */ Index: src/libiberty/ChangeLog =================================================================== RCS file: /cvs/src/src/libiberty/ChangeLog,v retrieving revision 1.421 diff -u -p -r1.421 ChangeLog --- src/libiberty/ChangeLog 11 Apr 2007 20:01:26 -0000 1.421 +++ src/libiberty/ChangeLog 12 Apr 2007 21:25:28 -0000 @@ -1,3 +1,9 @@ +2007-04-12 Dave MacLachlan + + * cplus-dem.c Added support for objc++ demangling style + (cplus_demangle): added OBJCPP_DEMANGLING to types that use + cplus_demangle_v3 + 2007-04-11 Thomas Neumann tneumann@users.sourceforge.net * argv.c: Use ANSI C declarations. Index: src/libiberty/cplus-dem.c =================================================================== RCS file: /cvs/src/src/libiberty/cplus-dem.c,v retrieving revision 1.46 diff -u -p -r1.46 cplus-dem.c --- src/libiberty/cplus-dem.c 12 May 2006 20:00:37 -0000 1.46 +++ src/libiberty/cplus-dem.c 12 Apr 2007 21:25:28 -0000 @@ -1,9 +1,10 @@ /* Demangler for GNU C++ Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.uucp) Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling Modified by Satish Pai (pai@apollo.hp.com) for HP demangling + Modified by Dave MacLachlan (dmaclach@google.com) for ObjC++ demangling This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -308,6 +309,12 @@ const struct demangler_engine libiberty_ } , { + OBJCPP_DEMANGLING_STYLE_STRING, + objcpp_demangling, + "ObjC++ style demangling" + } + , + { NULL, unknown_demangling, NULL } }; @@ -857,7 +864,7 @@ cplus_demangle (const char *mangled, int work->options |= (int) current_demangling_style & DMGL_STYLE_MASK; /* The V3 ABI demangling is implemented elsewhere. */ - if (GNU_V3_DEMANGLING || AUTO_DEMANGLING) + if (GNU_V3_DEMANGLING || AUTO_DEMANGLING || OBJCPP_DEMANGLING) { ret = cplus_demangle_v3 (mangled, work->options); if (ret || GNU_V3_DEMANGLING)