const char *, int,
namespace_enum);
-static struct symtab *lookup_symtab_1 (char *);
-
static struct symbol *lookup_symbol_aux (const char *name, const
struct block *block, const
namespace_enum namespace, int
psymtabs. *If* there is no '/' in the name, a match after a '/'
in the symtab filename will also work. */
-static struct symtab *
-lookup_symtab_1 (char *name)
+struct symtab *
+lookup_symtab (const char *name)
{
register struct symtab *s;
register struct partial_symtab *ps;
if (lbasename (name) == name)
ALL_SYMTABS (objfile, s)
{
- if (FILENAME_CMP (basename (s->filename), name) == 0)
+ if (FILENAME_CMP (lbasename (s->filename), name) == 0)
return s;
}
goto got_symtab;
}
-/* Lookup the symbol table of a source file named NAME. Try a couple
- of variations if the first lookup doesn't work. */
-
-struct symtab *
-lookup_symtab (char *name)
-{
- register struct symtab *s;
-#if 0
- register char *copy;
-#endif
-
- s = lookup_symtab_1 (name);
- if (s)
- return s;
-
-#if 0
- /* This screws c-exp.y:yylex if there is both a type "tree" and a symtab
- "tree.c". */
-
- /* If name not found as specified, see if adding ".c" helps. */
- /* Why is this? Is it just a user convenience? (If so, it's pretty
- questionable in the presence of C++, FORTRAN, etc.). It's not in
- the GDB manual. */
-
- copy = (char *) alloca (strlen (name) + 3);
- strcpy (copy, name);
- strcat (copy, ".c");
- s = lookup_symtab_1 (copy);
- if (s)
- return s;
-#endif /* 0 */
-
- /* We didn't find anything; die. */
- return 0;
-}
-
/* Lookup the partial symbol table of a source file named NAME.
*If* there is no '/' in the name, a match after a '/'
in the psymtab filename will also work. */
struct partial_symtab *
-lookup_partial_symtab (char *name)
+lookup_partial_symtab (const char *name)
{
register struct partial_symtab *pst;
register struct objfile *objfile;
if (lbasename (name) == name)
ALL_PSYMTABS (objfile, pst)
{
- if (FILENAME_CMP (basename (pst->filename), name) == 0)
+ if (FILENAME_CMP (lbasename (pst->filename), name) == 0)
return (pst);
}
ALL_PSYMTABS (objfile, pst)
{
- if (lookup_partial_symbol (pst, "main", 1, VAR_NAMESPACE))
+ if (lookup_partial_symbol (pst, main_name (), 1, VAR_NAMESPACE))
{
return (pst);
}
{
for (i = 0; i < nfiles; i++)
{
- if (strcmp (files[i], basename (file)) == 0)
+ if (strcmp (files[i], lbasename (file)) == 0)
return 1;
}
}
{
/* Maybe they typed the file with leading directories, while the
symbol tables record only its basename. */
- char *tail = basename (srcfile);
+ const char *tail = lbasename (srcfile);
if (tail > srcfile)
s = lookup_symtab (tail);
int list_used = 0;
size_t text_len = strlen (text);
char **list = (char **) xmalloc (list_alloced * sizeof (char *));
- char *base_name;
+ const char *base_name;
list[0] = NULL;
debug info records leading directories, but not the other
way around. This is what subroutines of breakpoint
command do when they parse file names. */
- base_name = basename (s->filename);
+ base_name = lbasename (s->filename);
if (base_name != s->filename
&& !filename_seen (base_name, 1, &first)
#if HAVE_DOS_BASED_FILE_SYSTEM
}
else
{
- base_name = basename (ps->filename);
+ base_name = lbasename (ps->filename);
if (base_name != ps->filename
&& !filename_seen (base_name, 1, &first)
#if HAVE_DOS_BASED_FILE_SYSTEM
return sals;
}
+/* Track MAIN */
+static char *name_of_main;
+
+void
+set_main_name (const char *name)
+{
+ if (name_of_main != NULL)
+ {
+ xfree (name_of_main);
+ name_of_main = NULL;
+ }
+ if (name != NULL)
+ {
+ name_of_main = xstrdup (name);
+ }
+}
+
+char *
+main_name (void)
+{
+ if (name_of_main != NULL)
+ return name_of_main;
+ else
+ return "main";
+}
+
+
void
_initialize_symtab (void)
{