aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-07-07 17:19:50 +0000
committerAndrew Cagney <cagney@redhat.com>2001-07-07 17:19:50 +0000
commit51cc5b073771099289e43e0d4a15f71fb0515f0b (patch)
tree8d4feb1344264b42785f9edf0e4c330a9380f427 /gdb
parentc72e73889f2075d648af94c52687d306befd8fbf (diff)
downloadgdb-51cc5b073771099289e43e0d4a15f71fb0515f0b.zip
gdb-51cc5b073771099289e43e0d4a15f71fb0515f0b.tar.gz
gdb-51cc5b073771099289e43e0d4a15f71fb0515f0b.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/TODO17
-rw-r--r--gdb/blockframe.c2
-rw-r--r--gdb/dbxread.c14
-rw-r--r--gdb/defs.h1
-rw-r--r--gdb/nlmread.c2
-rw-r--r--gdb/rs6000-tdep.c2
-rw-r--r--gdb/source.c4
-rw-r--r--gdb/symtab.c29
-rw-r--r--gdb/symtab.h7
10 files changed, 71 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1dbeb8d..e7af45b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,22 @@
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.
2001-07-07 Mark Kettenis <kettenis@gnu.org>
diff --git a/gdb/TODO b/gdb/TODO
index afa64ce..15cc521 100644
--- a/gdb/TODO
+++ b/gdb/TODO
@@ -65,23 +65,6 @@ http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00496.html
[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.
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 34e1484..c88649e 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -120,7 +120,7 @@ inside_main_func (CORE_ADDR pc)
{
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 =
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index d3a1489..5d7ed74 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2390,13 +2390,25 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
}
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;
}
diff --git a/gdb/defs.h b/gdb/defs.h
index aa69216..9467fc7 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -1484,4 +1484,5 @@ enum gdb_rc gdb_list_thread_ids (/* output object */);
/* Switch thread and print notification. */
#endif
+
#endif /* #ifndef DEFS_H */
diff --git a/gdb/nlmread.c b/gdb/nlmread.c
index 0baf177..e4c4970 100644
--- a/gdb/nlmread.c
+++ b/gdb/nlmread.c
@@ -193,7 +193,7 @@ nlm_symfile_read (struct objfile *objfile, int mainline)
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)
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 864345d..2ae3929 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -753,7 +753,7 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata)
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;
}
}
diff --git a/gdb/source.c b/gdb/source.c
index 2895dd3..417d588 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -153,9 +153,9 @@ select_source_symtab (register struct symtab *s)
/* 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;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a16393e..dcaae52 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1158,7 +1158,7 @@ find_main_psymtab (void)
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);
}
@@ -3624,6 +3624,33 @@ decode_line_spec (char *string, int funfirstline)
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)
{
diff --git a/gdb/symtab.h b/gdb/symtab.h
index d85add3..7ae9346 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1427,4 +1427,11 @@ extern void search_symbols (char *, namespace_enum, int, char **,
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) */