* [rfa/symbol readers] Clean up setting symbols' names
@ 2004-02-16 19:35 Daniel Jacobowitz
2004-02-16 20:54 ` Elena Zannoni
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-02-16 19:35 UTC (permalink / raw)
To: gdb-patches
This patch does a couple of related things.
1. It adds a macro, SYMBOL_SET_LINKAGE_NAME, which is used to set a
symbol's name when the name should not be demangled. Used for things like
typedefs whose name comes from debug info. I did not change anything
related to memory allocation when I did this - though in hpread I found a
few inconsistencies.
2. It makes 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.
In the process I also kill a couple of DEPRECATED_SYMBOL_NAME uses, and the
redundant function add_psymbol_with_dem_name_to_list.
No testsuite changes with DWARF2 or stabs+ on i386-linux. OK?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-02-16 Daniel Jacobowitz <drow@mvista.com>
* symtab.h (SYMBOL_SET_LINKAGE_NAME): Define.
* ada-lang.c (add_symbols_from_enclosing_procs): Use
SYMBOL_SET_LINKAGE_NAME.
* dwarfread.c (enum_type, synthesize_typedef): Likewise.
* jv-lang.c (add_class_symbol): Likewise.
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
(common_block_end): Likewise.
* xcoffread.c (process_xcoff_symbol): Likewise.
* symfile.c (add_psymbol_with_dem_name_to_list): Remove.
* symfile.h (add_psymbol_with_dem_name_to_list): Remove prototype.
* objfiles.c (terminate_minimal_symbol_table): Remove unnecessary
initializations.
* hpread.c (scan_procs): Use SYMBOL_SET_NAMES. Remove calls to
add_psymbol_with_dem_name_to_list.
(hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type): Use SYMBOL_SET_LINKAGE_NAME.
(hpread_process_one_debug_symbol): Likewise. Use SYMBOL_SET_NAMES
and rely on the demangler.
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.35
diff -u -p -r1.35 ada-lang.c
--- ada-lang.c 23 Jan 2004 23:03:28 -0000 1.35
+++ ada-lang.c 15 Feb 2004 23:56:24 -0000
@@ -3533,7 +3533,7 @@ add_symbols_from_enclosing_procs (const
/* Initialize the local variable symbol that stands for the
* static link (when it exists). */
static_link = &static_link_sym;
- DEPRECATED_SYMBOL_NAME (static_link) = "";
+ SYMBOL_SET_LINKAGE_NAME (static_link, "");
SYMBOL_LANGUAGE (static_link) = language_unknown;
SYMBOL_CLASS (static_link) = LOC_LOCAL;
SYMBOL_DOMAIN (static_link) = VAR_DOMAIN;
Index: dwarfread.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarfread.c,v
retrieving revision 1.37
diff -u -p -r1.37 dwarfread.c
--- dwarfread.c 14 Feb 2004 15:46:32 -0000 1.37
+++ dwarfread.c 15 Feb 2004 23:56:27 -0000
@@ -1710,8 +1710,9 @@ enum_type (struct dieinfo *dip, struct o
sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = create_name (list->field.name,
- &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym,
+ create_name (list->field.name,
+ &objfile->objfile_obstack));
SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_CLASS (sym) = LOC_CONST;
@@ -3013,8 +3014,8 @@ synthesize_typedef (struct dieinfo *dip,
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
OBJSTAT (objfile, n_syms++);
memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = create_name (dip->at_name,
- &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym, create_name (dip->at_name,
+ &objfile->objfile_obstack));
SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
SYMBOL_TYPE (sym) = type;
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.45
diff -u -p -r1.45 hpread.c
--- hpread.c 7 Feb 2004 23:13:47 -0000 1.45
+++ hpread.c 15 Feb 2004 23:56:30 -0000
@@ -746,26 +746,24 @@ scan_procs (int *curr_pd_p, quick_proced
if ((trans_lang ((enum hp_language) qPD[curr_pd].language) == language_cplus) &&
vt_bits[(long) qPD[curr_pd].sbAlias]) /* not a null string */
{
- /* Get mangled name for the procedure, and demangle it */
+ /* Get mangled name for the procedure. */
rtn_name = &vt_bits[(long) qPD[curr_pd].sbAlias];
- rtn_dem_name = cplus_demangle (rtn_name, DMGL_ANSI | DMGL_PARAMS);
}
else
{
rtn_name = &vt_bits[(long) qPD[curr_pd].sbProc];
- rtn_dem_name = NULL;
}
/* Hack to get around HP C/C++ compilers' insistence on providing
"_MAIN_" as an alternate name for "main" */
if ((strcmp (rtn_name, "_MAIN_") == 0) &&
(strcmp (&vt_bits[(long) qPD[curr_pd].sbProc], "main") == 0))
- rtn_dem_name = rtn_name = main_string;
+ rtn_name = main_string;
#ifdef DUMPING
if (dumping)
{
- printf ("..add %s (demangled %s), index %x to this psymtab\n", rtn_name, rtn_dem_name, curr_pd);
+ printf ("..add %s, index %x to this psymtab\n", rtn_name, curr_pd);
}
#endif
@@ -786,31 +784,23 @@ scan_procs (int *curr_pd_p, quick_proced
the correct list in the psymtab. - RT */
dn_bufp = hpread_get_lntt (qPD[curr_pd].isym, objfile);
if (dn_bufp->dfunc.global)
- add_psymbol_with_dem_name_to_list (rtn_name,
- strlen (rtn_name),
- rtn_dem_name,
- strlen (rtn_dem_name),
- VAR_DOMAIN,
- LOC_BLOCK, /* "I am a routine" */
- &objfile->global_psymbols,
- (qPD[curr_pd].adrStart + /* Starting address of rtn */
- ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
- 0, /* core addr?? */
- trans_lang ((enum hp_language) qPD[curr_pd].language),
- objfile);
+ add_psymbol_to_list (rtn_name, strlen (rtn_name), VAR_DOMAIN,
+ LOC_BLOCK, /* "I am a routine" */
+ &objfile->global_psymbols,
+ (qPD[curr_pd].adrStart + /* Starting address of rtn */
+ ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
+ 0, /* core addr?? */
+ trans_lang ((enum hp_language) qPD[curr_pd].language),
+ objfile);
else
- add_psymbol_with_dem_name_to_list (rtn_name,
- strlen (rtn_name),
- rtn_dem_name,
- strlen (rtn_dem_name),
- VAR_DOMAIN,
- LOC_BLOCK, /* "I am a routine" */
- &objfile->static_psymbols,
- (qPD[curr_pd].adrStart + /* Starting address of rtn */
- ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
- 0, /* core addr?? */
- trans_lang ((enum hp_language) qPD[curr_pd].language),
- objfile);
+ add_psymbol_to_list (rtn_name, strlen (rtn_name), VAR_DOMAIN,
+ LOC_BLOCK, /* "I am a routine" */
+ &objfile->static_psymbols,
+ (qPD[curr_pd].adrStart + /* Starting address of rtn */
+ ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
+ 0, /* core addr?? */
+ trans_lang ((enum hp_language) qPD[curr_pd].language),
+ objfile);
symbol_count++;
*curr_pd_p = ++curr_pd; /* bump up count & reflect in caller */
@@ -3124,14 +3114,17 @@ hpread_read_enum_type (dnttpointer hp_ty
mem = dn_bufp->denum.firstmem;
while (mem.word && mem.word != DNTTNIL)
{
+ char *sym_name;
+
memp = hpread_get_lntt (mem.dnttp.index, objfile);
name = VT (objfile) + memp->dmember.name;
sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
- &objfile->objfile_obstack);
+ sym_name = obsavestring (name, strlen (name),
+ &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym, sym_name);
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = memp->dmember.value;
@@ -3229,6 +3222,8 @@ hpread_read_function_type (dnttpointer h
param = dn_bufp->dfunc_template.firstparam;
while (param.word && param.word != DNTTNIL)
{
+ char *sym_name;
+
paramp = hpread_get_lntt (param.dnttp.index, objfile);
nsyms++;
param = paramp->dfparam.nextparam;
@@ -3238,8 +3233,10 @@ hpread_read_function_type (dnttpointer h
sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
(void) memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
- &objfile->objfile_obstack);
+
+ sym_name = obsavestring (name, strlen (name),
+ &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym, sym_name);
/* Figure out where it lives. */
if (paramp->dfparam.regparam)
@@ -3418,7 +3415,7 @@ hpread_read_doc_function_type (dnttpoint
sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
(void) memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = name;
+ SYMBOL_SET_LINKAGE_NAME (sym, name);
/* Figure out where it lives. */
if (paramp->dfparam.regparam)
@@ -5096,12 +5093,14 @@ 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. */
sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->objfile_obstack);
+ set_name = obsavestring (name, strlen (name), &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym, set_name);
SYMBOL_LANGUAGE (sym) = language_auto;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_LINE (sym) = 0;
@@ -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)
@@ -5889,7 +5867,7 @@ hpread_process_one_debug_symbol (union d
newsym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
memset (newsym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (newsym) = name;
+ SYMBOL_SET_LINKAGE_NAME (newsym, name);
SYMBOL_LANGUAGE (newsym) = language_auto;
SYMBOL_DOMAIN (newsym) = VAR_DOMAIN;
SYMBOL_LINE (newsym) = 0;
Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.29
diff -u -p -r1.29 jv-lang.c
--- jv-lang.c 7 Feb 2004 23:13:47 -0000 1.29
+++ jv-lang.c 15 Feb 2004 23:56:30 -0000
@@ -142,7 +142,7 @@ add_class_symbol (struct type *type, COR
obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
SYMBOL_LANGUAGE (sym) = language_java;
- DEPRECATED_SYMBOL_NAME (sym) = TYPE_TAG_NAME (type);
+ SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type));
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
/* SYMBOL_VALUE (sym) = valu; */
SYMBOL_TYPE (sym) = type;
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.49
diff -u -p -r1.49 objfiles.c
--- objfiles.c 14 Feb 2004 15:46:33 -0000 1.49
+++ objfiles.c 15 Feb 2004 23:56:31 -0000
@@ -283,11 +283,6 @@ terminate_minimal_symbol_table (struct o
= &objfile->msymbols[objfile->minimal_symbol_count];
memset (m, 0, sizeof (*m));
- DEPRECATED_SYMBOL_NAME (m) = NULL;
- SYMBOL_VALUE_ADDRESS (m) = 0;
- MSYMBOL_INFO (m) = NULL;
- MSYMBOL_SIZE (m) = 0;
- MSYMBOL_TYPE (m) = mst_unknown;
SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown);
}
}
Index: stabsread.c
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.c,v
retrieving revision 1.74
diff -u -p -r1.74 stabsread.c
--- stabsread.c 7 Feb 2004 23:13:47 -0000 1.74
+++ stabsread.c 15 Feb 2004 23:56:34 -0000
@@ -367,6 +367,8 @@ patch_block_stabs (struct pending *symbo
sym = find_symbol_in_list (symbols, name, pp - name);
if (!sym)
{
+ char *sym_name;
+
/* FIXME-maybe: it would be nice if we noticed whether
the variable was defined *anywhere*, not just whether
it is defined in this compilation unit. But neither
@@ -385,8 +387,9 @@ patch_block_stabs (struct pending *symbo
memset (sym, 0, sizeof (struct symbol));
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
- DEPRECATED_SYMBOL_NAME (sym) =
- obsavestring (name, pp - name, &objfile->objfile_obstack);
+ sym_name = obsavestring (name, pp - name,
+ &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym, sym_name);
pp += 2;
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
{
@@ -641,12 +644,15 @@ define_symbol (CORE_ADDR valu, char *str
if (is_cplus_marker (string[0]))
{
+ char *sym_name;
+
/* Special GNU C++ names. */
switch (string[1])
{
case 't':
- DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"),
- &objfile->objfile_obstack);
+ sym_name = obsavestring ("this", strlen ("this"),
+ &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym, sym_name);
break;
case 'v': /* $vtbl_ptr_type */
@@ -654,8 +660,9 @@ define_symbol (CORE_ADDR valu, char *str
goto normal;
case 'e':
- DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"),
- &objfile->objfile_obstack);
+ sym_name = obsavestring ("eh_throw", strlen ("eh_throw"),
+ &objfile->objfile_obstack);
+ SYMBOL_SET_LINKAGE_NAME (sym, sym_name);
break;
case '_':
@@ -1130,13 +1137,15 @@ define_symbol (CORE_ADDR valu, char *str
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = valu;
#ifdef STATIC_TRANSFORM_NAME
- if (IS_STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym)))
+ if (IS_STATIC_TRANSFORM_NAME (SYMBOL_LINKAGE_NAME (sym)))
{
struct minimal_symbol *msym;
- msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile);
+ msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, objfile);
if (msym != NULL)
{
- DEPRECATED_SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym));
+ char *sym_name
+ = STATIC_TRANSFORM_NAME (SYMBOL_LINKAGE_NAME (sym));
+ SYMBOL_SET_LINKAGE_NAME (sym, sym_name);
SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
}
}
@@ -1276,13 +1285,16 @@ define_symbol (CORE_ADDR valu, char *str
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = valu;
#ifdef STATIC_TRANSFORM_NAME
- if (IS_STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym)))
+ }
+ if (IS_STATIC_TRANSFORM_NAME (SYMBOL_LINKAGE_NAME (sym)))
{
struct minimal_symbol *msym;
- msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile);
+ msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, objfile);
if (msym != NULL)
{
- DEPRECATED_SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym));
+ char *sym_name
+ = STATIC_TRANSFORM_NAME (SYMBOL_LINKAGE_NAME (sym));
+ SYMBOL_SET_LINKAGE_NAME (sym, sym_name);
SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
}
}
@@ -3493,7 +3505,7 @@ read_enum_type (char **pp, struct type *
sym = (struct symbol *)
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = name;
+ SYMBOL_SET_LINKAGE_NAME (sym, name);
SYMBOL_LANGUAGE (sym) = current_subfile->language;
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -4068,7 +4080,7 @@ common_block_end (struct objfile *objfil
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
/* Note: common_block_name already saved on objfile_obstack */
- DEPRECATED_SYMBOL_NAME (sym) = common_block_name;
+ SYMBOL_SET_LINKAGE_NAME (sym, common_block_name);
SYMBOL_CLASS (sym) = LOC_BLOCK;
/* Now we copy all the symbols which have been defined since the BCOMM. */
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.123
diff -u -p -r1.123 symfile.c
--- symfile.c 15 Feb 2004 15:16:29 -0000 1.123
+++ symfile.c 15 Feb 2004 23:56:36 -0000
@@ -2611,75 +2611,6 @@ add_psymbol_to_list (char *name, int nam
return psym;
}
-/* Add a symbol with a long value to a psymtab. This differs from
- * add_psymbol_to_list above in taking both a mangled and a demangled
- * name. */
-
-void
-add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
- int dem_namelength, domain_enum domain,
- enum address_class class,
- struct psymbol_allocation_list *list, long val, /* Value as a long */
- CORE_ADDR coreaddr, /* Value as a CORE_ADDR */
- enum language language,
- struct objfile *objfile)
-{
- struct partial_symbol *psym;
- char *buf = alloca (namelength + 1);
- /* psymbol is static so that there will be no uninitialized gaps in the
- structure which might contain random data, causing cache misses in
- bcache. */
- static struct partial_symbol psymbol;
-
- /* Create local copy of the partial symbol */
-
- memcpy (buf, name, namelength);
- buf[namelength] = '\0';
- DEPRECATED_SYMBOL_NAME (&psymbol) = deprecated_bcache (buf, namelength + 1,
- objfile->psymbol_cache);
-
- buf = alloca (dem_namelength + 1);
- memcpy (buf, dem_name, dem_namelength);
- buf[dem_namelength] = '\0';
-
- switch (language)
- {
- case language_c:
- case language_cplus:
- SYMBOL_CPLUS_DEMANGLED_NAME (&psymbol) =
- deprecated_bcache (buf, dem_namelength + 1, objfile->psymbol_cache);
- break;
- /* FIXME What should be done for the default case? Ignoring for now. */
- }
-
- /* val and coreaddr are mutually exclusive, one of them *will* be zero */
- if (val != 0)
- {
- SYMBOL_VALUE (&psymbol) = val;
- }
- else
- {
- SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
- }
- SYMBOL_SECTION (&psymbol) = 0;
- SYMBOL_LANGUAGE (&psymbol) = language;
- PSYMBOL_DOMAIN (&psymbol) = domain;
- PSYMBOL_CLASS (&psymbol) = class;
- SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
-
- /* Stash the partial symbol away in the cache */
- psym = deprecated_bcache (&psymbol, sizeof (struct partial_symbol),
- objfile->psymbol_cache);
-
- /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
- if (list->next >= list->list + list->size)
- {
- extend_psymbol_list (list, objfile);
- }
- *list->next++ = psym;
- OBJSTAT (objfile, n_psyms++);
-}
-
/* Initialize storage for partial symbols. */
void
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.27
diff -u -p -r1.27 symfile.h
--- symfile.h 14 Feb 2004 15:46:33 -0000 1.27
+++ symfile.h 15 Feb 2004 23:56:36 -0000
@@ -159,15 +159,6 @@ struct partial_symbol *add_psymbol_to_li
long, CORE_ADDR,
enum language, struct objfile *);
-extern void add_psymbol_with_dem_name_to_list (char *, int, char *, int,
- domain_enum,
- enum address_class,
- struct psymbol_allocation_list
- *, long, CORE_ADDR,
- enum language,
- struct objfile *);
-
-
extern void init_psymbol_list (struct objfile *, int);
extern void sort_pst_symbols (struct partial_symtab *);
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.87
diff -u -p -r1.87 symtab.h
--- symtab.h 7 Feb 2004 23:13:47 -0000 1.87
+++ symtab.h 15 Feb 2004 23:56:37 -0000
@@ -195,6 +195,11 @@ extern void symbol_set_names (struct gen
const char *linkage_name, int len,
struct objfile *objfile);
+#define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \
+ do { \
+ (symbol)->ginfo.name = (linkage_name); \
+ } while (0)
+
/* Now come lots of name accessor macros. Short version as to when to
use which: Use SYMBOL_NATURAL_NAME to refer to the name of the
symbol in the original source code. Use SYMBOL_LINKAGE_NAME if you
Index: xcoffread.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffread.c,v
retrieving revision 1.40
diff -u -p -r1.40 xcoffread.c
--- xcoffread.c 14 Feb 2004 15:46:33 -0000 1.40
+++ xcoffread.c 15 Feb 2004 23:56:38 -0000
@@ -1477,7 +1477,8 @@ process_xcoff_symbol (struct coff_symbol
will be patched with the type from its stab entry later on in
patch_block_stabs (), unless the file was compiled without -g. */
- DEPRECATED_SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
+ SYMBOL_SET_LINKAGE_NAME (sym,
+ SYMNAME_ALLOC (name, symname_alloced));
SYMBOL_TYPE (sym) = func_symbol_type;
SYMBOL_CLASS (sym) = LOC_BLOCK;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfa/symbol readers] Clean up setting symbols' names
2004-02-16 19:35 [rfa/symbol readers] Clean up setting symbols' names Daniel Jacobowitz
@ 2004-02-16 20:54 ` Elena Zannoni
2004-02-16 20:59 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Elena Zannoni @ 2004-02-16 20:54 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
Daniel Jacobowitz writes:
> This patch does a couple of related things.
>
> 1. It adds a macro, SYMBOL_SET_LINKAGE_NAME, which is used to set a
> symbol's name when the name should not be demangled. Used for things like
> typedefs whose name comes from debug info. I did not change anything
> related to memory allocation when I did this - though in hpread I found a
> few inconsistencies.
>
> 2. It makes 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.
>
> In the process I also kill a couple of DEPRECATED_SYMBOL_NAME uses, and the
> redundant function add_psymbol_with_dem_name_to_list.
>
> No testsuite changes with DWARF2 or stabs+ on i386-linux. OK?
>
NO. There are way too many unrelated changes in this patch.
The changes to hpread to use SYMBOL_SET_NAMES should be
independent. However you are also changing the logic of the code in a
few places, not just mechanically replacing things. You are changing
printf's, deleting functions, etc etc. You say there are no regression
on i386-linux, did you test on hpux?
The objfiles and symfile changes are also logically separate.
The SYMBOL_SET_LINKAGE_NAME macro can also be a separate thing.
I shouldn't spend time reminding you of this.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfa/symbol readers] Clean up setting symbols' names
2004-02-16 20:54 ` Elena Zannoni
@ 2004-02-16 20:59 ` Daniel Jacobowitz
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-02-16 20:59 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
On Mon, Feb 16, 2004 at 03:50:25PM -0500, Elena Zannoni wrote:
> Daniel Jacobowitz writes:
> > This patch does a couple of related things.
> >
> > 1. It adds a macro, SYMBOL_SET_LINKAGE_NAME, which is used to set a
> > symbol's name when the name should not be demangled. Used for things like
> > typedefs whose name comes from debug info. I did not change anything
> > related to memory allocation when I did this - though in hpread I found a
> > few inconsistencies.
> >
> > 2. It makes 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.
> >
> > In the process I also kill a couple of DEPRECATED_SYMBOL_NAME uses, and the
> > redundant function add_psymbol_with_dem_name_to_list.
> >
> > No testsuite changes with DWARF2 or stabs+ on i386-linux. OK?
> >
>
> NO. There are way too many unrelated changes in this patch.
>
> The changes to hpread to use SYMBOL_SET_NAMES should be
> independent. However you are also changing the logic of the code in a
> few places, not just mechanically replacing things. You are changing
> printf's, deleting functions, etc etc. You say there are no regression
> on i386-linux, did you test on hpux?
No. Fancy that, that's why I asked for someone to do so. I don't have
any way to test on HP/UX; the last time I tried to set up a test
environment on the testdrive systems it took me a week and a half to
get a baseline. The last time I tried to use it they'd upgraded
libraries and none of my binaries worked.
> The objfiles and symfile changes are also logically separate.
> The SYMBOL_SET_LINKAGE_NAME macro can also be a separate thing.
>
> I shouldn't spend time reminding you of this.
I fail to see how the symfile change is independent of anything, since
the function is still used before my patch. I'll break the patch in
thirds with splitdiff and test the thirds.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-02-16 20:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-16 19:35 [rfa/symbol readers] Clean up setting symbols' names Daniel Jacobowitz
2004-02-16 20:54 ` Elena Zannoni
2004-02-16 20:59 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox