This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfa] Use SYMBOL_SET_NAMES in hpread


Make hpread use SYMBOL_SET_NAMES.  It contained some fallback code to
use the debug info if demangling failed; I've disabled it, because from
the description it sounds like the right thing to do would be to fix
the demangler instead.  I can't tell whether the code is currently used
or not, so I would appreciate HP/UX testing for this patch.

Michael, could you do that, please?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2004-02-16  Daniel Jacobowitz  <drow@mvista.com>

	* hpread.c (hpread_process_one_debug_symbol): Use SYMBOL_SET_NAMES
	and rely on the demangler.

--- hpread.c	7 Feb 2004 23:13:47 -0000	1.45
+++ hpread.c	15 Feb 2004 23:56:30 -0000
@@ -5096,6 +5093,7 @@ hpread_process_one_debug_symbol (union d
   struct symbol *sym;
   struct context_stack *new;
   char *class_scope_name;
+  char *set_name;
 
   /* Allocate one GDB debug symbol and fill in some default values. */
@@ -5278,37 +5277,25 @@ hpread_process_one_debug_symbol (union d
       if ((dn_bufp->dfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
 	  dn_bufp->dfunc.alias &&	/* has an alias */
 	  *(char *) (VT (objfile) + dn_bufp->dfunc.alias))	/* not a null string */
-	DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.alias;
+	set_name = VT (objfile) + dn_bufp->dfunc.alias;
       else
-	DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
+	set_name = VT (objfile) + dn_bufp->dfunc.name;
 
       /* Special hack to get around HP compilers' insistence on
        * reporting "main" as "_MAIN_" for C/C++ */
-      if ((strcmp (DEPRECATED_SYMBOL_NAME (sym), "_MAIN_") == 0) &&
+      if ((strcmp (set_name, "_MAIN_") == 0) &&
 	  (strcmp (VT (objfile) + dn_bufp->dfunc.name, "main") == 0))
-	DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
+	set_name = VT (objfile) + dn_bufp->dfunc.name;
 
-      /* The SYMBOL_CPLUS_DEMANGLED_NAME field is expected to
-       * be the demangled name.
-       */
+      SYMBOL_SET_NAMES (sym, set_name, strlen (set_name), objfile);
+#if 0
+      /* NOTE drow/2004-02-08: The following code is terribly bogus.  The
+	 demangler should be fixed instead.  */
       if (dn_bufp->dfunc.language == HP_LANGUAGE_CPLUSPLUS)
 	{
-	  /* SYMBOL_INIT_DEMANGLED_NAME is a macro which winds up
-	   * calling the demangler in libiberty (cplus_demangle()) to
-	   * do the job. This generally does the job, even though
-	   * it's intended for the GNU compiler and not the aCC compiler
-	   * Note that SYMBOL_INIT_DEMANGLED_NAME calls the
-	   * demangler with arguments DMGL_PARAMS | DMGL_ANSI.
-	   * Generally, we don't want params when we display
-	   * a demangled name, but when I took out the DMGL_PARAMS,
-	   * some things broke, so I'm leaving it in here, and
-	   * working around the issue in stack.c. - RT
-	   */
-	  SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack);
-	  if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->dfunc.alias) &&
-	      (!SYMBOL_CPLUS_DEMANGLED_NAME (sym)))
+	  if (set_name == VT (objfile) + dn_bufp->dfunc.alias
+	      && !SYMBOL_CPLUS_DEMANGLED_NAME (sym))
 	    {
-
 	      /* Well, the symbol name is mangled, but the
 	       * demangler in libiberty failed so the demangled
 	       * field is still NULL. Try to
@@ -5334,6 +5321,7 @@ hpread_process_one_debug_symbol (union d
 		}
 	    }
 	}
+#endif
 
       /* Add the function symbol to the list of symbols in this blockvector */
       if (dn_bufp->dfunc.global)
@@ -5396,36 +5384,25 @@ hpread_process_one_debug_symbol (union d
       if ((dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
 	  dn_bufp->ddocfunc.alias &&	/* has an alias */
 	  *(char *) (VT (objfile) + dn_bufp->ddocfunc.alias))	/* not a null string */
-	DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.alias;
+	set_name = VT (objfile) + dn_bufp->ddocfunc.alias;
       else
-	DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
+	set_name = VT (objfile) + dn_bufp->ddocfunc.name;
 
       /* Special hack to get around HP compilers' insistence on
        * reporting "main" as "_MAIN_" for C/C++ */
       if ((strcmp (DEPRECATED_SYMBOL_NAME (sym), "_MAIN_") == 0) &&
 	  (strcmp (VT (objfile) + dn_bufp->ddocfunc.name, "main") == 0))
-	DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
+	set_name = VT (objfile) + dn_bufp->ddocfunc.name;
 
+      SYMBOL_SET_NAMES (sym, set_name, strlen (set_name), objfile);
+#if 0
+      /* NOTE drow/2004-02-08: The following code is terribly bogus.  The
+	 demangler should be fixed instead.  */
       if (dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS)
 	{
-
-	  /* SYMBOL_INIT_DEMANGLED_NAME is a macro which winds up
-	   * calling the demangler in libiberty (cplus_demangle()) to
-	   * do the job. This generally does the job, even though
-	   * it's intended for the GNU compiler and not the aCC compiler
-	   * Note that SYMBOL_INIT_DEMANGLED_NAME calls the
-	   * demangler with arguments DMGL_PARAMS | DMGL_ANSI.
-	   * Generally, we don't want params when we display
-	   * a demangled name, but when I took out the DMGL_PARAMS,
-	   * some things broke, so I'm leaving it in here, and
-	   * working around the issue in stack.c. - RT 
-	   */
-	  SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack);
-
-	  if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->ddocfunc.alias) &&
-	      (!SYMBOL_CPLUS_DEMANGLED_NAME (sym)))
+	  if (set_name == VT (objfile) + dn_bufp->ddocfunc.alias
+	      && !SYMBOL_CPLUS_DEMANGLED_NAME (sym))
 	    {
-
 	      /* Well, the symbol name is mangled, but the
 	       * demangler in libiberty failed so the demangled
 	       * field is still NULL. Try to
@@ -5451,6 +5428,7 @@ hpread_process_one_debug_symbol (union d
 		}
 	    }
 	}
+#endif
 
       /* Add the function symbol to the list of symbols in this blockvector */
       if (dn_bufp->ddocfunc.global)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]