* hpread.c (hpread_record_lines): New argument "offset". All
authorJeff Law <law@redhat.com>
Sat, 4 Mar 1995 00:55:45 +0000 (00:55 +0000)
committerJeff Law <law@redhat.com>
Sat, 4 Mar 1995 00:55:45 +0000 (00:55 +0000)
callers changed.  Use it to handle dynamic address relocation.
(hpread_build_psymtabs): Adjust texthigh as we read each function
debug symbol.  Fix computation of texthigh.
(hpread_read_subrange_type): Work around macro bugs in HP's
compilers.
(hpread_process_one_debug_symbol): Correctly map source lines.

gdb/ChangeLog
gdb/hpread.c

index 0ddfcd342a133999aa260e9a01d75d400f9fc45e..ed7161e956a6a286264a0e7139cbabb1f66b6757 100644 (file)
@@ -1,5 +1,13 @@
 Fri Mar  3 15:12:12 1995  Jeff Law  (law@snake.cs.utah.edu)
 
+       * hpread.c (hpread_record_lines): New argument "offset".  All
+       callers changed.  Use it to handle dynamic address relocation.
+       (hpread_build_psymtabs): Adjust texthigh as we read each function
+       debug symbol.  Fix computation of texthigh.
+       (hpread_read_subrange_type): Work around macro bugs in HP's
+       compilers.
+       (hpread_process_one_debug_symbol): Correctly map source lines.
+
        * somread.c (check_strange_names): Filter names emitted by the HP
        compiler when generating PIC code.
 
index 099a883db49e466ecf49fc4c47f0cecb328bf230..bc8f83408eefa8aef773ae8bd1390c7898942462 100644 (file)
@@ -174,7 +174,8 @@ static void hpread_process_one_debug_symbol
           struct objfile *, CORE_ADDR, int, char *, int));
 
 static sltpointer hpread_record_lines
-  PARAMS ((struct subfile *, sltpointer, sltpointer, struct objfile *));
+  PARAMS ((struct subfile *, sltpointer, sltpointer,
+          struct objfile *, CORE_ADDR));
 
 static struct type *hpread_read_function_type
   PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
@@ -448,7 +449,6 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
 
                if (pst && past_first_source_file)
                  {
-                   texthigh += ANOFFSET (section_offsets, SECT_OFF_TEXT);
                    hpread_end_psymtab (pst, psymtab_include_list,
                                        includes_used,
                                        (hp_symnum
@@ -498,10 +498,12 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
            case DNTT_TYPE_ENTRY:
              /* The beginning of a function.  DNTT_TYPE_ENTRY may also denote
                 a secondary entry point.  */
+             valu = dn_bufp->dfunc.hiaddr + ANOFFSET (section_offsets,
+                                                      SECT_OFF_TEXT);
+             if (valu > texthigh)
+               texthigh = valu;
              valu = dn_bufp->dfunc.lowaddr +
                ANOFFSET (section_offsets, SECT_OFF_TEXT);
-             if (dn_bufp->dfunc.hiaddr > texthigh)
-               texthigh = dn_bufp->dfunc.hiaddr;
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              ADD_PSYMBOL_TO_LIST (namestring, strlen (namestring),
                                   VAR_NAMESPACE, LOC_BLOCK,
@@ -515,7 +517,6 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                 and file blocks right now.  */
              if (dn_bufp->dend.endkind == DNTT_TYPE_MODULE)
                {
-                 texthigh += ANOFFSET (section_offsets, SECT_OFF_TEXT);
                  hpread_end_psymtab (pst, psymtab_include_list, includes_used,
                                      (hp_symnum
                                       * sizeof (struct dntt_type_block)),
@@ -1602,8 +1603,9 @@ hpread_read_subrange_type (hp_type, dn_bufp, objfile)
   TYPE_CODE (type) = TYPE_CODE_RANGE;
   TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8;
   TYPE_NFIELDS (type) = 2;
-  TYPE_FIELDS (type) = (struct field *) obstack_alloc
-    (&objfile->type_obstack, 2 * sizeof (struct field));
+  TYPE_FIELDS (type)
+    = (struct field *) obstack_alloc (&objfile->type_obstack,
+                                     2 * sizeof (struct field));
 
   if (dn_bufp->dsubr.dyn_low)
     TYPE_FIELD_BITPOS (type, 0) = 0;
@@ -1738,10 +1740,11 @@ hpread_type_lookup (hp_type, objfile)
 }
 
 static sltpointer
-hpread_record_lines (subfile, s_idx, e_idx, objfile)
+hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
      struct subfile *subfile;
      sltpointer s_idx, e_idx;
      struct objfile *objfile;
+     CORE_ADDR offset;
 {
   union sltentry *sl_bufp;
 
@@ -1751,7 +1754,8 @@ hpread_record_lines (subfile, s_idx, e_idx, objfile)
       /* Only record "normal" entries in the SLT.  */
       if (sl_bufp->snorm.sltdesc == SLT_NORMAL
          || sl_bufp->snorm.sltdesc == SLT_EXIT)
-       record_line (subfile, sl_bufp->snorm.line, sl_bufp->snorm.address);
+       record_line (subfile, sl_bufp->snorm.line,
+                    sl_bufp->snorm.address + offset);
       s_idx++;
     }
   return e_idx;
@@ -1808,14 +1812,19 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
          finish the symbol table of the previous source file
          (if any) and start accumulating a new symbol table.  */
 
-      valu = text_offset + offset;     /* Relocate for dynamic loading */
+      valu = text_offset;
       if (!last_source_file)
-       start_symtab (name, NULL, valu);
-
-      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
-                                               SL_INDEX (objfile),
-                                               dn_bufp->dsfile.address,
-                                               objfile);
+       {
+         start_symtab (name, NULL, valu);
+         SL_INDEX (objfile) = dn_bufp->dsfile.address;
+       }
+      else
+       {
+         SL_INDEX (objfile) = hpread_record_lines (current_subfile,
+                                                   SL_INDEX (objfile),
+                                                   dn_bufp->dsfile.address,
+                                                   objfile, offset);
+       }
       start_subfile (name, NULL);
       break;
       
@@ -1830,7 +1839,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dfunc.address,
-                                               objfile);
+                                               objfile, offset);
       
       WITHIN_FUNCTION (objfile) = 1;
       CURRENT_FUNCTION_VALUE (objfile) = valu;
@@ -1858,7 +1867,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dbegin.address,
-                                               objfile);
+                                               objfile, offset);
       SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
       record_line (current_subfile, SYMBOL_LINE (sym), valu);
       break;
@@ -1868,7 +1877,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dbegin.address,
-                                               objfile);
+                                               objfile, offset);
       valu = hpread_get_location (dn_bufp->dbegin.address, objfile);
       valu += offset;          /* Relocate for dynamic loading */
       desc = hpread_get_depth (dn_bufp->dbegin.address, objfile);
@@ -1880,7 +1889,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dend.address + 1,
-                                               objfile);
+                                               objfile, offset);
       switch (dn_bufp->dend.endkind)
        {
        case DNTT_TYPE_MODULE:
This page took 0.029978 seconds and 4 git commands to generate.