--- ./gdb/breakpoint.c_orig	2017-05-22 05:52:03 -0500
+++ ./gdb/breakpoint.c	2017-05-22 06:11:15 -0500
@@ -6191,7 +6191,7 @@
       struct cleanup *stb_chain = make_cleanup_ui_file_delete (stb);
 
       print_address_symbolic (loc->gdbarch, loc->address, stb,
-			      demangle, "");
+			      gdb1_demangle, "");
       ui_out_field_stream (uiout, "at", stb);
 
       do_cleanups (stb_chain);
--- ./gdb/c-valprint.c_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/c-valprint.c	2017-05-22 06:11:27 -0500
@@ -155,7 +155,7 @@
 
   if (options->symbol_print)
     want_space = print_address_demangle (options, gdbarch, address, stream,
-					 demangle);
+					 gdb1_demangle);
   else if (options->addressprint)
     {
       fputs_filtered (paddress (gdbarch, address), stream);
--- ./gdb/f-valprint.c_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/f-valprint.c	2017-05-22 06:11:38 -0500
@@ -276,7 +276,7 @@
 
 	  if (options->symbol_print)
 	    want_space = print_address_demangle (options, gdbarch, addr,
-						 stream, demangle);
+						 stream, gdb1_demangle);
 	  else if (options->addressprint && options->format != 's')
 	    {
 	      fputs_filtered (paddress (gdbarch, addr), stream);
--- ./gdb/gdb-demangle.h_orig	2017-01-21 07:46:46 -0600
+++ ./gdb/gdb-demangle.h	2017-05-22 06:11:58 -0500
@@ -21,7 +21,7 @@
 
 /* Nonzero means that encoded C++/ObjC names should be printed out in their
    C++/ObjC form rather than raw.  */
-extern int demangle;
+extern int gdb1_demangle;
 
 /* Nonzero means that encoded C++/ObjC names should be printed out in their
    C++/ObjC form even in assembler language displays.  If this is set, but
--- ./gdb/gnu-v3-abi.c_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/gnu-v3-abi.c	2017-05-22 06:12:10 -0500
@@ -652,7 +652,7 @@
       struct value_print_options opts;
 
       get_user_print_options (&opts);
-      print_address_demangle (&opts, gdbarch, ptr_value, stream, demangle);
+      print_address_demangle (&opts, gdbarch, ptr_value, stream, gdb1_demangle);
     }
 
   if (adjustment)
--- ./gdb/jv-valprint.c_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/jv-valprint.c	2017-05-22 06:12:22 -0500
@@ -484,7 +484,7 @@
       if (TYPE_CODE (target_type) == TYPE_CODE_FUNC)
 	{
 	  /* Try to print what function it points to.  */
-	  print_address_demangle (options, gdbarch, addr, stream, demangle);
+	  print_address_demangle (options, gdbarch, addr, stream, gdb1_demangle);
 	  return;
 	}
 
--- ./gdb/p-valprint.c_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/p-valprint.c	2017-05-22 06:12:32 -0500
@@ -158,7 +158,7 @@
 	  /* Extract the address, assume that it is unsigned.  */
 	  addr = extract_unsigned_integer (valaddr + embedded_offset,
 					   TYPE_LENGTH (type), byte_order);
-	  print_address_demangle (options, gdbarch, addr, stream, demangle);
+	  print_address_demangle (options, gdbarch, addr, stream, gdb1_demangle);
 	  break;
 	}
       check_typedef (TYPE_TARGET_TYPE (type));
@@ -170,7 +170,7 @@
       if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
 	{
 	  /* Try to print what function it points to.  */
-	  print_address_demangle (options, gdbarch, addr, stream, demangle);
+	  print_address_demangle (options, gdbarch, addr, stream, gdb1_demangle);
 	  return;
 	}
 
@@ -314,7 +314,7 @@
 				       TYPE_LENGTH (TYPE_FIELD_TYPE (type,
 								     VTBL_FNADDR_OFFSET)),
 				       byte_order),
-	     stream, demangle);
+	     stream, gdb1_demangle);
 	}
       else
 	{
--- ./gdb/tui/tui-stack.c_orig	2017-01-21 07:46:47 -0600
+++ ./gdb/tui/tui-stack.c	2017-05-22 06:13:59 -0500
@@ -219,7 +219,7 @@
   char *p;
 
   print_address_symbolic (get_frame_arch (fi), get_frame_pc (fi),
-			  stream, demangle, "");
+			  stream, gdb1_demangle, "");
   p = tui_file_get_strbuf (stream);
 
   /* Use simple heuristics to isolate the function name.  The symbol
--- ./gdb/symtab.h_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/symtab.h	2017-05-22 06:12:47 -0500
@@ -257,8 +257,8 @@
    e.g., struct symbol or struct minimal_symbol.  */
 
 #define SYMBOL_PRINT_NAME(symbol)					\
-  (demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol))
-extern int demangle;
+  (gdb1_demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol))
+extern int gdb1_demangle;
 
 /* Macro that returns the name to be used when sorting and searching symbols.
    In  C++ and Java, we search for the demangled form of a name,
@@ -413,7 +413,7 @@
   (symbol_natural_name (&(symbol)->mginfo))
 #define MSYMBOL_LINKAGE_NAME(symbol)	(symbol)->mginfo.name
 #define MSYMBOL_PRINT_NAME(symbol)					\
-  (demangle ? MSYMBOL_NATURAL_NAME (symbol) : MSYMBOL_LINKAGE_NAME (symbol))
+  (gdb1_demangle ? MSYMBOL_NATURAL_NAME (symbol) : MSYMBOL_LINKAGE_NAME (symbol))
 #define MSYMBOL_DEMANGLED_NAME(symbol) \
   (symbol_demangled_name (&(symbol)->mginfo))
 #define MSYMBOL_SET_LANGUAGE(symbol,language,obstack)	\
--- ./gdb/valprint.c_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/valprint.c	2017-05-22 06:13:02 -0500
@@ -412,7 +412,7 @@
     }
 
   if (options->symbol_print)
-    print_address_demangle (options, gdbarch, address, stream, demangle);
+    print_address_demangle (options, gdbarch, address, stream, gdb1_demangle);
   else if (options->addressprint)
     fputs_filtered (paddress (gdbarch, address), stream);
 }
@@ -723,7 +723,7 @@
       type_print (type, "", stream, -1);
       fprintf_filtered (stream, "} ");
       /* Try to print what function it points to, and its address.  */
-      print_address_demangle (options, gdbarch, address, stream, demangle);
+      print_address_demangle (options, gdbarch, address, stream, gdb1_demangle);
     }
 }
 
@@ -1933,7 +1933,7 @@
       fputs_filtered (paddress (gdbarch, address), stream);
       fputs_filtered (": ", stream);
     }
-  print_address_demangle (options, gdbarch, func_addr, stream, demangle);
+  print_address_demangle (options, gdbarch, func_addr, stream, gdb1_demangle);
 }
 
 
--- ./gdb/utils.c_orig	2017-01-21 07:48:42 -0600
+++ ./gdb/utils.c	2017-05-22 06:13:16 -0500
@@ -2525,7 +2525,7 @@
   if (name != NULL)
     {
       /* If user wants to see raw output, no problem.  */
-      if (!demangle)
+      if (!gdb1_demangle)
 	{
 	  fputs_filtered (name, stream);
 	}
--- ./gdb/demangle.c_orig	2017-01-21 07:46:46 -0600
+++ ./gdb/demangle.c	2017-05-22 06:13:26 -0500
@@ -46,7 +46,7 @@
 static void demangle_command (char *, int);
 
 /* See documentation in gdb-demangle.h.  */
-int demangle = 1;
+int gdb1_demangle = 1;
 
 static void
 show_demangle (struct ui_file *file, int from_tty,
@@ -253,7 +253,7 @@
 	current_demangling_style_string = demangling_style_names[i];
     }
 
-  add_setshow_boolean_cmd ("demangle", class_support, &demangle, _("\
+  add_setshow_boolean_cmd ("demangle", class_support, &gdb1_demangle, _("\
 Set demangling of encoded C++/ObjC names when displaying symbols."), _("\
 Show demangling of encoded C++/ObjC names when displaying symbols."), NULL,
 			   NULL,
--- ./bfd/bfd.c_orig	2017-01-21 07:48:42 -0600
+++ ./bfd/bfd.c	2017-05-22 06:14:27 -0500
@@ -378,11 +378,14 @@
 #include "libecoff.h"
 #undef obj_symbols
 #include "elf-bfd.h"
+#include <aix-demangle.h>
 
 #ifndef EXIT_FAILURE
 #define EXIT_FAILURE 1
 #endif
 
+is_xlcpp_class = 0;
+
 
 /* provide storage for subsystem, stack and heap data which may have been
    passed in on the command line.  Ld puts this data into a bfd_link_info
@@ -1889,10 +1892,12 @@
 char *
 bfd_demangle (bfd *abfd, const char *name, int options)
 {
+  char *rest;
   char *res, *alloc;
   const char *pre, *suf;
   size_t pre_len;
   bfd_boolean skip_lead;
+  Name *nm;
 
   skip_lead = (abfd != NULL
 	       && *name != '\0'
@@ -1922,7 +1927,14 @@
       name = alloc;
     }
 
-  res = cplus_demangle (name, options);
+    if (!is_xlcpp_class) {
+      res = cplus_demangle (name, options);
+    }
+    else if( is_xlcpp_class) {
+      nm = demangle(name, &rest, RegularNames | ClassNames|SpecialNames|ParameterText|QualifierText); 
+      res = text(nm);
+    }
+
 
   if (alloc != NULL)
     free (alloc);
--- ./gdb/xcoffread.c_orig	2017-05-22 05:02:36 -0500
+++ ./gdb/xcoffread.c	2017-05-22 06:13:47 -0500
@@ -2335,10 +2335,12 @@
 
 			if (!misc_func_recorded)
 			  {
+				  is_xlcpp_class = 1;
 			    record_minimal_symbol
 			      (last_csect_name, last_csect_val,
 			       mst_text, last_csect_sec, objfile);
 			    misc_func_recorded = 1;
+				is_xlcpp_class = 0;
 			  }
 
 			if (pst != NULL)
@@ -2399,11 +2401,13 @@
 		  case XMC_TD:
 		    /* Data variables are recorded in the minimal symbol
 		       table, except for section symbols.  */
+			is_xlcpp_class = 1;
 		    if (*namestring != '.')
 		      record_minimal_symbol
 			(namestring, symbol.n_value,
 			 sclass == C_HIDEXT ? mst_file_data : mst_data,
 			 symbol.n_scnum, objfile);
+			is_xlcpp_class = 0;
 		    break;
 
 		  case XMC_TC0:
@@ -2437,12 +2441,15 @@
 		    if (first_fun_line_offset == 0 && symbol.n_numaux > 1)
 		      first_fun_line_offset =
 			main_aux[0].x_sym.x_fcnary.x_fcn.x_lnnoptr;
-
-		    record_minimal_symbol
-		      (namestring, symbol.n_value,
-		       sclass == C_HIDEXT ? mst_file_text : mst_text,
-		       symbol.n_scnum, objfile);
-		    misc_func_recorded = 1;
+			{
+			is_xlcpp_class = 1;
+ 			record_minimal_symbol
+ 			  (namestring, symbol.n_value,
+ 			   sclass == C_HIDEXT ? mst_file_text : mst_text,
+ 			   symbol.n_scnum, objfile);
+ 			misc_func_recorded = 1;
+                        is_xlcpp_class = 0;
+ 		      }
 		    break;
 
 		  case XMC_GL:
@@ -2453,10 +2460,12 @@
 		       mst_solib_trampoline symbol.  When we lookup mst
 		       symbols, we will choose mst_text over
 		       mst_solib_trampoline.  */
+			is_xlcpp_class = 1;
 		    record_minimal_symbol
 		      (namestring, symbol.n_value,
 		       mst_solib_trampoline, symbol.n_scnum, objfile);
 		    misc_func_recorded = 1;
+			is_xlcpp_class = 0;
 		    break;
 
 		  case XMC_DS:
@@ -2474,11 +2483,13 @@
 		       still need to record them.  This will
 		       typically be XMC_RW; I suspect XMC_RO and
 		       XMC_BS might be possible too.  */
+			is_xlcpp_class = 1;
 		    if (*namestring != '.')
 		      record_minimal_symbol
 			(namestring, symbol.n_value,
 			 sclass == C_HIDEXT ? mst_file_data : mst_data,
 			 symbol.n_scnum, objfile);
+			 is_xlcpp_class = 0;
 		    break;
 		  }
 		break;
@@ -2490,11 +2501,13 @@
 		  case XMC_BS:
 		    /* Common variables are recorded in the minimal symbol
 		       table, except for section symbols.  */
+			is_xlcpp_class = 1;
 		    if (*namestring != '.')
 		      record_minimal_symbol
 			(namestring, symbol.n_value,
 			 sclass == C_HIDEXT ? mst_file_bss : mst_bss,
 			 symbol.n_scnum, objfile);
+			is_xlcpp_class = 0;
 		    break;
 		  }
 		break;
@@ -2520,9 +2533,11 @@
 		   it as a function.  This will take care of functions like
 		   strcmp() compiled by xlc.  */
 
+		is_xlcpp_class = 1;
 		record_minimal_symbol (last_csect_name, last_csect_val,
 				       mst_text, last_csect_sec, objfile);
 		misc_func_recorded = 1;
+		is_xlcpp_class = 0;
 	      }
 
 	    if (pst)
@@ -2727,11 +2742,13 @@
 		  namestring = gdbarch_static_transform_name
 				 (gdbarch, namestring);
 
+		is_xlcpp_class = 1;
 		add_psymbol_to_list (namestring, p - namestring, 1,
 				     VAR_DOMAIN, LOC_STATIC,
 				     &objfile->static_psymbols,
 				     symbol.n_value,
 				     psymtab_language, objfile);
+		is_xlcpp_class = 0;
 		continue;
 
 	      case 'G':
@@ -2739,11 +2756,13 @@
 					    SECT_OFF_DATA (objfile));
 		/* The addresses in these entries are reported to be
 		   wrong.  See the code that reads 'G's for symtabs.  */
+		is_xlcpp_class = 1;
 		add_psymbol_to_list (namestring, p - namestring, 1,
 				     VAR_DOMAIN, LOC_STATIC,
 				     &objfile->global_psymbols,
 				     symbol.n_value,
 				     psymtab_language, objfile);
+		is_xlcpp_class = 0;
 		continue;
 
 	      case 'T':
@@ -2757,17 +2776,21 @@
 		    || (p == namestring + 1
 			&& namestring[0] != ' '))
 		  {
+			is_xlcpp_class = 1;
 		    add_psymbol_to_list (namestring, p - namestring, 1,
 					 STRUCT_DOMAIN, LOC_TYPEDEF,
 					 &objfile->static_psymbols,
 					 0, psymtab_language, objfile);
+			is_xlcpp_class = 0;
 		    if (p[2] == 't')
 		      {
+				is_xlcpp_class = 1;
 			/* Also a typedef with the same name.  */
 			add_psymbol_to_list (namestring, p - namestring, 1,
 					     VAR_DOMAIN, LOC_TYPEDEF,
 					     &objfile->static_psymbols,
 					     0, psymtab_language, objfile);
+			is_xlcpp_class = 0;
 			p += 1;
 		      }
 		  }
@@ -2838,10 +2861,12 @@
 			  ;
 			/* Note that the value doesn't matter for
 			   enum constants in psymtabs, just in symtabs.  */
+			is_xlcpp_class = 1;
 			add_psymbol_to_list (p, q - p, 1,
 					     VAR_DOMAIN, LOC_CONST,
 					     &objfile->static_psymbols,
 					     0, psymtab_language, objfile);
+			is_xlcpp_class = 0;
 			/* Point past the name.  */
 			p = q;
 			/* Skip over the value.  */
@@ -2856,10 +2881,12 @@
 
 	      case 'c':
 		/* Constant, e.g. from "const" in Pascal.  */
+		is_xlcpp_class = 1;
 		add_psymbol_to_list (namestring, p - namestring, 1,
 				     VAR_DOMAIN, LOC_CONST,
 				     &objfile->static_psymbols,
 				     0, psymtab_language, objfile);
+		is_xlcpp_class = 0;
 		continue;
 
 	      case 'f':
@@ -2875,11 +2902,13 @@
 		  }
 		symbol.n_value += ANOFFSET (objfile->section_offsets,
 					    SECT_OFF_TEXT (objfile));
+		is_xlcpp_class = 1;
 		add_psymbol_to_list (namestring, p - namestring, 1,
 				     VAR_DOMAIN, LOC_BLOCK,
 				     &objfile->static_psymbols,
 				     symbol.n_value,
 				     psymtab_language, objfile);
+		is_xlcpp_class = 0;
 		continue;
 
 		/* Global functions were ignored here, but now they
@@ -2906,11 +2935,13 @@
 
 		symbol.n_value += ANOFFSET (objfile->section_offsets,
 					    SECT_OFF_TEXT (objfile));
+		is_xlcpp_class = 1;
 		add_psymbol_to_list (namestring, p - namestring, 1,
 				     VAR_DOMAIN, LOC_BLOCK,
 				     &objfile->global_psymbols,
 				     symbol.n_value,
 				     psymtab_language, objfile);
+		is_xlcpp_class = 0;
 		continue;
 
 		/* Two things show up here (hopefully); static symbols of
--- ./bfd/bfd-in2.h_orig	2017-01-21 07:48:42 -0600
+++ ./bfd/bfd-in2.h	2017-05-22 06:14:33 -0500
@@ -203,6 +203,8 @@
 
 typedef unsigned int flagword;	/* 32 bits of flags */
 typedef unsigned char bfd_byte;
+
+extern int is_xlcpp_class;
 
 /* File formats.  */
 
