* symtab.c (main_name): New function.
authorAndrew Cagney <cagney@redhat.com>
Sat, 7 Jul 2001 17:19:50 +0000 (17:19 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 7 Jul 2001 17:19:50 +0000 (17:19 +0000)
(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.

gdb/ChangeLog
gdb/TODO
gdb/blockframe.c
gdb/dbxread.c
gdb/defs.h
gdb/nlmread.c
gdb/rs6000-tdep.c
gdb/source.c
gdb/symtab.c
gdb/symtab.h

index 1dbeb8d596f7d8cf017574a9c35c9c58720c8278..e7af45bcc29413e268e3105dc985ff946043d179 100644 (file)
@@ -1,3 +1,20 @@
+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.
index afa64ce1114b0d11f8ba61b0c516a644b88017bc..15cc5215c8506a9f0fad8128ba978e8188a0bf2c 100644 (file)
--- 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.
index 34e1484f749417a4711de6d80f96d3721ddf7ec1..c88649e19d36aa02f478d7f2376d9e7113c6fbbf 100644 (file)
@@ -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 =
index d3a1489bc8159314ab6910921d124d11db063f73..5d7ed74e8af4cddbb135ffbe1a09e10c8f035ebc 100644 (file)
@@ -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;
     }
index aa69216ca3a33814dbc2f9ff51347108becacbe1..9467fc74a8bbb0e4ea123a75b3bd5c1fb675b78a 100644 (file)
@@ -1484,4 +1484,5 @@ enum gdb_rc gdb_list_thread_ids (/* output object */);
 
 /* Switch thread and print notification. */
 #endif
+
 #endif /* #ifndef DEFS_H */
index 0baf177ffb0c4fff2f4fc818b41872f29e6922db..e4c4970c8a6429a27ad4c2e448227b083d5d6e4a 100644 (file)
@@ -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)
index 864345dd17728e872a0113333501b6c8abf868a2..2ae392923f15b67d9eaefeefdba22c75ad00de07 100644 (file)
@@ -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;
        }
     }
index 2895dd388f683e76ff2e23cb349b3ee7bf052844..417d5886a5c24cf1b14ef846b3d1e6fb14a029a7 100644 (file)
@@ -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;
index a16393e81a72101c52eb424abf91e1a7248be894..dcaae5287c850ec50647642693c3bc9d40ab2efd 100644 (file)
@@ -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)
 {
index d85add3b3e86ed0b3fb5ecc41bde45472a51723f..7ae93468257d48c8abf3b89ac4fe6e343e266af0 100644 (file)
@@ -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) */
This page took 0.032406 seconds and 4 git commands to generate.