(set_main_name): New function.
* symtab.h: Declare.
* TODO: Update
From 2000-03-05 Anthony Green <green@redhat.com>:
* dbxread.c (process_one_symbol): Handle the N_MAIN stab by
setting main_name.
* blockframe.c (inside_main_func): Use main_name instead of
"main".
* symtab.c (find_main_psymtab): Ditto.
* source.c (select_source_symtab): Ditto.
* nlmread.c (nlm_symfile_read): Ditto.
* rs6000-tdep.c (skip_prologue): Ditto.
+2001-07-07 Andrew Cagney <ac131313@redhat.com>
+
+ * symtab.c (main_name): New function.
+ (set_main_name): New function.
+ * symtab.h: Declare.
+ * TODO: Update
+
+ From 2000-03-05 Anthony Green <green@redhat.com>:
+ * dbxread.c (process_one_symbol): Handle the N_MAIN stab by
+ setting main_name.
+ * blockframe.c (inside_main_func): Use main_name instead of
+ "main".
+ * symtab.c (find_main_psymtab): Ditto.
+ * source.c (select_source_symtab): Ditto.
+ * nlmread.c (nlm_symfile_read): Ditto.
+ * rs6000-tdep.c (skip_prologue): Ditto.
+
2001-07-07 Andrew Cagney <ac131313@redhat.com>
* TODO: Convert most items into PRs.
[I think this has been merged, need to confirm - cagney]
---
-
-Java (Anthony Green, David Taylor)
-
-Anthony Green has a number of Java patches that did not make it into
-the 5.0 release. The first two are in cvs now, but the third needs
-some fixing up before it can go in.
-
-Patch: java tests
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00512.html
-
-Patch: java booleans
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00515.html
-
-Patch: handle N_MAIN stab
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00527.html
-
-- 2001-03-08
Add CRIS target.
{
struct symbol *mainsym;
- mainsym = lookup_symbol ("main", NULL, VAR_NAMESPACE, NULL, NULL);
+ mainsym = lookup_symbol (main_name (), NULL, VAR_NAMESPACE, NULL, NULL);
if (mainsym && SYMBOL_CLASS (mainsym) == LOC_BLOCK)
{
symfile_objfile->ei.main_func_lowpc =
}
break;
+ case N_MAIN: /* Name of main routine. */
+ /* FIXME: If one has a symbol file with N_MAIN and then replaces
+ it with a symbol file with "main" and without N_MAIN. I'm
+ not sure exactly what rule to follow but probably something
+ like: N_MAIN takes precedence over "main" no matter what
+ objfile it is in; If there is more than one N_MAIN, choose
+ the one in the symfile_objfile; If there is more than one
+ N_MAIN within a given objfile, complain() and choose
+ arbitrarily. (kingdon) */
+ if (name != NULL)
+ set_main_name (name);
+ break;
+
/* The following symbol types can be ignored. */
case N_OBJ: /* Solaris 2: Object file dir and name */
/* N_UNDF: Solaris 2: file separator mark */
/* N_UNDF: -- we will never encounter it, since we only process one
file's symbols at once. */
case N_ENDM: /* Solaris 2: End of module */
- case N_MAIN: /* Name of main routine. */
case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
break;
}
/* Switch thread and print notification. */
#endif
+
#endif /* #ifndef DEFS_H */
stabsect_build_psymtabs (objfile, mainline, ".stab",
".stabstr", ".text");
- mainsym = lookup_symbol ("main", NULL, VAR_NAMESPACE, NULL, NULL);
+ mainsym = lookup_symbol (main_name (), NULL, VAR_NAMESPACE, NULL, NULL);
if (mainsym
&& SYMBOL_CLASS (mainsym) == LOC_BLOCK)
function as well. */
tmp = find_pc_misc_function (pc);
- if (tmp >= 0 && STREQ (misc_function_vector[tmp].name, "main"))
+ if (tmp >= 0 && STREQ (misc_function_vector[tmp].name, main_name ()))
return pc + 8;
}
}
/* Make the default place to list be the function `main'
if one exists. */
- if (lookup_symbol ("main", 0, VAR_NAMESPACE, 0, NULL))
+ if (lookup_symbol (main_name (), 0, VAR_NAMESPACE, 0, NULL))
{
- sals = decode_line_spec ("main", 1);
+ sals = decode_line_spec (main_name (), 1);
sal = sals.sals[0];
xfree (sals.sals);
current_source_symtab = sal.symtab;
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);
}
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)
{
extern void free_search_symbols (struct symbol_search *);
extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search *);
+/* The name of the ``main'' function.
+ FIXME: cagney/2001-03-20: Can't make main_name() const since some
+ of the calling code currently assumes that the string isn't
+ const. */
+extern void set_main_name (const char *name);
+extern /*const*/ char *main_name (void);
+
#endif /* !defined(SYMTAB_H) */