DESCRIPTION
- Given pointer to two partial symbol table entries, compare
- them by name and return -N, 0, or +N (ala strcmp). Typically
- used by sorting routines like qsort().
+ Given pointers to pointers to two partial symbol table entries,
+ compare them by name and return -N, 0, or +N (ala strcmp).
+ Typically used by sorting routines like qsort().
NOTES
const PTR s1p;
const PTR s2p;
{
- register char *st1 = SYMBOL_NAME ((struct partial_symbol *) s1p);
- register char *st2 = SYMBOL_NAME ((struct partial_symbol *) s2p);
+ register char *st1 = SYMBOL_NAME (*(struct partial_symbol **) s1p);
+ register char *st2 = SYMBOL_NAME (*(struct partial_symbol **) s2p);
if ((st1[0] - st2[0]) || !st1[0])
{
/* Sort the global list; don't sort the static list */
qsort (pst -> objfile -> global_psymbols.list + pst -> globals_offset,
- pst -> n_global_syms, sizeof (struct partial_symbol),
+ pst -> n_global_syms, sizeof (struct partial_symbol *),
compare_psymbols);
}
objfile->static_psymbols.size = 0;
/* Free the obstacks for non-reusable objfiles */
+ obstack_free (&objfile -> psymbol_cache.cache, 0);
obstack_free (&objfile -> psymbol_obstack, 0);
obstack_free (&objfile -> symbol_obstack, 0);
obstack_free (&objfile -> type_obstack, 0);
objfile -> md = NULL;
/* obstack_specify_allocation also initializes the obstack so
it is empty. */
+ obstack_specify_allocation (&objfile -> psymbol_cache.cache, 0, 0,
+ xmalloc, free);
obstack_specify_allocation (&objfile -> psymbol_obstack, 0, 0,
xmalloc, free);
obstack_specify_allocation (&objfile -> symbol_obstack, 0, 0,
struct section_offsets *section_offsets;
char *filename;
CORE_ADDR textlow;
- struct partial_symbol *global_syms;
- struct partial_symbol *static_syms;
+ struct partial_symbol **global_syms;
+ struct partial_symbol **static_syms;
{
struct partial_symtab *psymtab;
struct objfile *objfile;
{
register struct partial_symbol *psym;
- register char *demangled_name;
-
+ char *buf = alloca (namelength + 1);
+ struct partial_symbol psymbol;
+
+ /* Create local copy of the partial symbol */
+ memcpy (buf, name, namelength);
+ buf[namelength] = '\0';
+ SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache);
+ SYMBOL_VALUE (&psymbol) = val;
+ SYMBOL_SECTION (&psymbol) = 0;
+ SYMBOL_LANGUAGE (&psymbol) = language;
+ PSYMBOL_NAMESPACE (&psymbol) = namespace;
+ PSYMBOL_CLASS (&psymbol) = class;
+ SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
+
+ /* Stash the partial symbol away in the cache */
+ psym = 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);
+ extend_psymbol_list (list, objfile);
}
- psym = list->next++;
-
- SYMBOL_NAME (psym) =
- (char *) obstack_alloc (&objfile->psymbol_obstack, namelength + 1);
- memcpy (SYMBOL_NAME (psym), name, namelength);
- SYMBOL_NAME (psym)[namelength] = '\0';
- SYMBOL_VALUE (psym) = val;
- SYMBOL_SECTION (psym) = 0;
- SYMBOL_LANGUAGE (psym) = language;
- PSYMBOL_NAMESPACE (psym) = namespace;
- PSYMBOL_CLASS (psym) = class;
- SYMBOL_INIT_LANGUAGE_SPECIFIC (psym, language);
+ *list->next++ = psym;
OBJSTAT (objfile, n_psyms++);
}
struct objfile *objfile;
{
register struct partial_symbol *psym;
- register char *demangled_name;
-
+ char *buf = alloca (namelength + 1);
+ struct partial_symbol psymbol;
+
+ /* Create local copy of the partial symbol */
+ memcpy (buf, name, namelength);
+ buf[namelength] = '\0';
+ SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache);
+ SYMBOL_VALUE_ADDRESS (&psymbol) = val;
+ SYMBOL_SECTION (&psymbol) = 0;
+ SYMBOL_LANGUAGE (&psymbol) = language;
+ PSYMBOL_NAMESPACE (&psymbol) = namespace;
+ PSYMBOL_CLASS (&psymbol) = class;
+ SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
+
+ /* Stash the partial symbol away in the cache */
+ psym = 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);
+ extend_psymbol_list (list, objfile);
}
- psym = list->next++;
-
- SYMBOL_NAME (psym) =
- (char *) obstack_alloc (&objfile->psymbol_obstack, namelength + 1);
- memcpy (SYMBOL_NAME (psym), name, namelength);
- SYMBOL_NAME (psym)[namelength] = '\0';
- SYMBOL_VALUE_ADDRESS (psym) = val;
- SYMBOL_SECTION (psym) = 0;
- SYMBOL_LANGUAGE (psym) = language;
- PSYMBOL_NAMESPACE (psym) = namespace;
- PSYMBOL_CLASS (psym) = class;
- SYMBOL_INIT_LANGUAGE_SPECIFIC (psym, language);
+ *list->next++ = psym;
OBJSTAT (objfile, n_psyms++);
}
objfile -> global_psymbols.size = total_symbols / 10;
objfile -> static_psymbols.size = total_symbols / 10;
objfile -> global_psymbols.next =
- objfile -> global_psymbols.list = (struct partial_symbol *)
+ objfile -> global_psymbols.list = (struct partial_symbol **)
xmmalloc (objfile -> md, objfile -> global_psymbols.size
- * sizeof (struct partial_symbol));
+ * sizeof (struct partial_symbol *));
objfile -> static_psymbols.next =
- objfile -> static_psymbols.list = (struct partial_symbol *)
+ objfile -> static_psymbols.list = (struct partial_symbol **)
xmmalloc (objfile -> md, objfile -> static_psymbols.size
- * sizeof (struct partial_symbol));
+ * sizeof (struct partial_symbol *));
}
\f
void