/* Support routines for building symbol tables in GDB's internal format.
- Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009,
- 2010 Free Software Foundation, Inc.
+ Copyright (C) 1986-2004, 2007-2012 Free Software Foundation, Inc.
This file is part of GDB.
free_pendings = list;
}
}
-
-/* Add a symbol to one of the lists of symbols. While we're at it, if
- we're in the C++ case and don't have full namespace debugging info,
- check to see if it references an anonymous namespace; if so, add an
- appropriate using directive. */
+
+/* Add a symbol to one of the lists of symbols. */
void
add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
find_symbol_in_list (struct pending *list, char *name, int length)
{
int j;
- char *pp;
+ const char *pp;
while (list != NULL)
{
if (symbol)
{
complaint (&symfile_complaints,
- _("block end address less than block start address in %s (patched it)"),
+ _("block end address less than block "
+ "start address in %s (patched it)"),
SYMBOL_PRINT_NAME (symbol));
}
else
{
complaint (&symfile_complaints,
- _("block end address %s less than block start address %s (patched it)"),
+ _("block end address %s less than block "
+ "start address %s (patched it)"),
paddress (gdbarch, BLOCK_END (block)),
paddress (gdbarch, BLOCK_START (block)));
}
else
{
complaint (&symfile_complaints,
- _("inner block (%s-%s) not inside outer block (%s-%s)"),
+ _("inner block (%s-%s) not "
+ "inside outer block (%s-%s)"),
paddress (gdbarch, BLOCK_START (pblock->block)),
paddress (gdbarch, BLOCK_END (pblock->block)),
paddress (gdbarch, BLOCK_START (block)),
patch_subfile_names (struct subfile *subfile, char *name)
{
if (subfile != NULL && subfile->dirname == NULL && subfile->name != NULL
- && subfile->name[strlen (subfile->name) - 1] == '/')
+ && IS_DIR_SEPARATOR (subfile->name[strlen (subfile->name) - 1]))
{
subfile->dirname = subfile->name;
subfile->name = xstrdup (name);
if (link == NULL)
{
- internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
+ internal_error (__FILE__, __LINE__,
+ _("failed internal consistency check"));
}
name = link->name;
subfile_stack = link->next;
subfile->next;
subfile = subfile->next)
{
- if (strcmp (lbasename (subfile->name), mainbase) == 0)
+ if (filename_cmp (lbasename (subfile->name), mainbase) == 0)
{
++nr_matches;
mainsub_alias = subfile;
{
symtab->dirname = NULL;
}
- symtab->free_code = free_linetable;
- symtab->free_func = NULL;
/* Use whatever language we have been using for this
subfile, not the one that was deduced in allocate_symtab
symtab->language = subfile->language;
/* Save the debug format string (if any) in the symtab. */
- if (subfile->debugformat != NULL)
- {
- symtab->debugformat = obsavestring (subfile->debugformat,
- strlen (subfile->debugformat),
- &objfile->objfile_obstack);
- }
+ symtab->debugformat = subfile->debugformat;
/* Similarly for the producer. */
- if (subfile->producer != NULL)
- symtab->producer = obsavestring (subfile->producer,
- strlen (subfile->producer),
- &objfile->objfile_obstack);
+ symtab->producer = subfile->producer;
/* All symtabs for the main file and the subfiles share a
blockvector, so we need to clear primary for everything
{
xfree ((void *) subfile->line_vector);
}
- if (subfile->debugformat != NULL)
- {
- xfree ((void *) subfile->debugformat);
- }
- if (subfile->producer != NULL)
- xfree (subfile->producer);
nextsub = subfile->next;
xfree ((void *) subfile);
/* Compute a small integer hash code for the given name. */
int
-hashname (char *name)
+hashname (const char *name)
{
return (hash(name,strlen(name)) % HASHSIZE);
}
\f
void
-record_debugformat (char *format)
+record_debugformat (const char *format)
{
- current_subfile->debugformat = xstrdup (format);
+ current_subfile->debugformat = format;
}
void
record_producer (const char *producer)
{
- /* The producer is not always provided in the debugging info.
- Do nothing if PRODUCER is NULL. */
- if (producer == NULL)
- return;
-
- current_subfile->producer = xstrdup (producer);
+ current_subfile->producer = producer;
}
/* Merge the first symbol list SRCLIST into the second symbol list