2001-10-04 Frank Ch. Eigler <fche@redhat.com>
[binutils-gdb.git] / gdb / partial-stab.h
index ebedef72c53ca60a2a7e5decba2a87bd78b047b9..e18cabbba097f0e6221562eaa2f40794fa38461c 100644 (file)
@@ -201,7 +201,7 @@ switch (CUR_SYMBOL_TYPE)
 
   case N_SO:
     {
-      unsigned long valu;
+      CORE_ADDR valu;
       static int prev_so_symnum = -10;
       static int first_so_symnum;
       char *p;
@@ -399,7 +399,7 @@ switch (CUR_SYMBOL_TYPE)
     /* See if this is an end of function stab.  */
     if (pst && CUR_SYMBOL_TYPE == N_FUN && *namestring == '\000')
       {
-       unsigned long valu;
+       CORE_ADDR valu;
 
        /* It's value is the size (in bytes) of the function for
           function relative stabs, or the address of the function's
@@ -595,10 +595,22 @@ switch (CUR_SYMBOL_TYPE)
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
        /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
           value for the bottom of the text seg in those cases. */
-       if (pst && textlow_not_set)
+       if (CUR_SYMBOL_VALUE == ANOFFSET (objfile->section_offsets, 
+                                         SECT_OFF_TEXT (objfile)))
          {
-           pst->textlow =
+           CORE_ADDR minsym_valu = 
              find_stab_function_addr (namestring, pst->filename, objfile);
+           /* find_stab_function_addr will return 0 if the minimal
+              symbol wasn't found.  (Unfortunately, this might also
+              be a valid address.)  Anyway, if it *does* return 0,
+              it is likely that the value was set correctly to begin
+              with... */
+           if (minsym_valu != 0)
+             CUR_SYMBOL_VALUE = minsym_valu;
+         }
+       if (pst && textlow_not_set)
+         {
+           pst->textlow = CUR_SYMBOL_VALUE;
            textlow_not_set = 0;
          }
 #endif
@@ -652,8 +664,17 @@ switch (CUR_SYMBOL_TYPE)
           value for the bottom of the text seg in those cases. */
        if (CUR_SYMBOL_VALUE == ANOFFSET (objfile->section_offsets, 
                                          SECT_OFF_TEXT (objfile)))
-         CUR_SYMBOL_VALUE = 
-           find_stab_function_addr (namestring, pst->filename, objfile);
+         {
+           CORE_ADDR minsym_valu = 
+             find_stab_function_addr (namestring, pst->filename, objfile);
+           /* find_stab_function_addr will return 0 if the minimal
+              symbol wasn't found.  (Unfortunately, this might also
+              be a valid address.)  Anyway, if it *does* return 0,
+              it is likely that the value was set correctly to begin
+              with... */
+           if (minsym_valu != 0)
+             CUR_SYMBOL_VALUE = minsym_valu;
+         }
        if (pst && textlow_not_set)
          {
            pst->textlow = CUR_SYMBOL_VALUE;