* buildsym.c (record_line): Remove call to gdbarch_addr_bits_remove.
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 17 Jun 2009 18:41:50 +0000 (18:41 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Wed, 17 Jun 2009 18:41:50 +0000 (18:41 +0000)
* coffread.c (coff_symtab_read): Call gdbarch_addr_bits_remove before
calling record_line.
(enter_linenos): Likewise.
* dbxread.c (process_one_symbol): Likewise.
* dwarf2read.c (dwarf_decode_lines): Likewise.
* mdebugread.c (psymtab_to_symtab_1): Likewise.
* xcoffread.c (enter_line_range): Likewise.

gdb/ChangeLog
gdb/buildsym.c
gdb/coffread.c
gdb/dbxread.c
gdb/dwarf2read.c
gdb/mdebugread.c
gdb/xcoffread.c

index d8ac830..fdb4541 100644 (file)
@@ -1,5 +1,17 @@
 2009-06-17  Ulrich Weigand  <uweigand@de.ibm.com>
 
+       * buildsym.c (record_line): Remove call to gdbarch_addr_bits_remove.
+
+       * coffread.c (coff_symtab_read): Call gdbarch_addr_bits_remove before
+       calling record_line.
+       (enter_linenos): Likewise.
+       * dbxread.c (process_one_symbol): Likewise.
+       * dwarf2read.c (dwarf_decode_lines): Likewise.
+       * mdebugread.c (psymtab_to_symtab_1): Likewise.
+       * xcoffread.c (enter_line_range): Likewise.
+
+2009-06-17  Ulrich Weigand  <uweigand@de.ibm.com>
+
        * ax-gdb.c (gen_bitfield_ref): Add EXP argument, use expression
        architecture instead of current_gdbarch.
        (gen_struct_ref): Add EXP argument, pass to get_bitfield_ref.
index e0d8f0d..e7c48fe 100644 (file)
@@ -731,8 +731,6 @@ record_line (struct subfile *subfile, int line, CORE_ADDR pc)
                      * sizeof (struct linetable_entry))));
     }
 
-  pc = gdbarch_addr_bits_remove (current_gdbarch, pc);
-
   /* Normally, we treat lines as unsorted.  But the end of sequence
      marker is special.  We sort line markers at the same PC by line
      number, so end of sequence markers (which have line == 0) appear
index 201cfa2..ee8b380 100644 (file)
@@ -1024,7 +1024,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
                 for which we do not have any other statement-line-number. */
              if (fcn_last_line == 1)
                record_line (current_subfile, fcn_first_line,
-                            fcn_first_line_addr);
+                            gdbarch_addr_bits_remove (gdbarch,
+                                                      fcn_first_line_addr));
              else
                enter_linenos (fcn_line_ptr, fcn_first_line, fcn_last_line,
                               objfile);
@@ -1350,6 +1351,7 @@ static void
 enter_linenos (long file_offset, int first_line,
               int last_line, struct objfile *objfile)
 {
+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
   char *rawptr;
   struct internal_lineno lptr;
 
@@ -1382,9 +1384,12 @@ enter_linenos (long file_offset, int first_line,
       /* The next function, or the sentinel, will have L_LNNO32 zero;
         we exit. */
       if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
-       record_line (current_subfile, first_line + L_LNNO32 (&lptr),
-                    lptr.l_addr.l_paddr
-                    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)));
+       {
+         CORE_ADDR addr = lptr.l_addr.l_paddr;
+         addr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+         record_line (current_subfile, first_line + L_LNNO32 (&lptr),
+                      gdbarch_addr_bits_remove (gdbarch, addr));
+       }
       else
        break;
     }
index 33a2104..1d1aa2d 100644 (file)
@@ -2790,7 +2790,11 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
             which may have an N_FUN stabs at the end of the function,
             but no N_SLINE stabs.  */
          if (sline_found_in_function)
-           record_line (current_subfile, 0, last_function_start + valu);
+           {
+             CORE_ADDR addr = last_function_start + valu;
+             record_line (current_subfile, 0,
+                          gdbarch_addr_bits_remove (gdbarch, addr));
+           }
 
          within_function = 0;
          new = pop_context ();
@@ -3006,14 +3010,15 @@ no enclosing block"));
 
       if (within_function && sline_found_in_function == 0)
        {
-         if (processing_gcc_compilation == 2)
-           record_line (current_subfile, desc, last_function_start);
-         else
-           record_line (current_subfile, desc, valu);
+         CORE_ADDR addr = processing_gcc_compilation == 2 ?
+                          last_function_start : valu;
+         record_line (current_subfile, desc,
+                      gdbarch_addr_bits_remove (gdbarch, addr));
          sline_found_in_function = 1;
        }
       else
-       record_line (current_subfile, desc, valu);
+       record_line (current_subfile, desc,
+                    gdbarch_addr_bits_remove (gdbarch, valu));
       break;
 
     case N_BCOMM:
index 89dcb45..26baba5 100644 (file)
@@ -7226,6 +7226,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
   unsigned char op_code, extended_op, adj_opcode;
   CORE_ADDR baseaddr;
   struct objfile *objfile = cu->objfile;
+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
   const int decode_for_pst_p = (pst != NULL);
   struct subfile *last_subfile = NULL, *first_subfile = current_subfile;
 
@@ -7245,6 +7246,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
       int is_stmt = lh->default_is_stmt;
       int basic_block = 0;
       int end_sequence = 0;
+      CORE_ADDR addr;
 
       if (!decode_for_pst_p && lh->num_file_names >= file)
        {
@@ -7285,16 +7287,18 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
                {
                  lh->file_names[file - 1].included_p = 1;
                  if (!decode_for_pst_p)
-                    {
-                      if (last_subfile != current_subfile)
-                        {
-                          if (last_subfile)
-                            record_line (last_subfile, 0, address);
-                          last_subfile = current_subfile;
-                        }
+                   {
+                     if (last_subfile != current_subfile)
+                       {
+                         addr = gdbarch_addr_bits_remove (gdbarch, address);
+                         if (last_subfile)
+                           record_line (last_subfile, 0, addr);
+                         last_subfile = current_subfile;
+                       }
                      /* Append row to matrix using current values.  */
-                     record_line (current_subfile, line, 
-                                  check_cu_functions (address, cu));
+                     addr = check_cu_functions (address, cu);
+                     addr = gdbarch_addr_bits_remove (gdbarch, addr);
+                     record_line (current_subfile, line, addr);
                    }
                }
              basic_block = 1;
@@ -7363,16 +7367,18 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
                {
                  lh->file_names[file - 1].included_p = 1;
                  if (!decode_for_pst_p)
-                    {
-                      if (last_subfile != current_subfile)
-                        {
-                          if (last_subfile)
-                            record_line (last_subfile, 0, address);
-                          last_subfile = current_subfile;
-                        }
-                      record_line (current_subfile, line, 
-                                   check_cu_functions (address, cu));
-                    }
+                   {
+                     if (last_subfile != current_subfile)
+                       {
+                         addr = gdbarch_addr_bits_remove (gdbarch, address);
+                         if (last_subfile)
+                           record_line (last_subfile, 0, addr);
+                         last_subfile = current_subfile;
+                       }
+                     addr = check_cu_functions (address, cu);
+                     addr = gdbarch_addr_bits_remove (gdbarch, addr);
+                     record_line (current_subfile, line, addr);
+                   }
                }
              basic_block = 0;
              break;
@@ -7452,7 +7458,10 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
         {
           lh->file_names[file - 1].included_p = 1;
           if (!decode_for_pst_p)
-            record_line (current_subfile, 0, address);
+           {
+             addr = gdbarch_addr_bits_remove (gdbarch, address);
+             record_line (current_subfile, 0, addr);
+           }
         }
     }
 
index 78b92a0..65d6d0b 100644 (file)
@@ -3966,6 +3966,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
 
   if (processing_gcc_compilation != 0)
     {
+      struct gdbarch *gdbarch = get_objfile_arch (pst->objfile);
 
       /* This symbol table contains stabs-in-ecoff entries.  */
 
@@ -4060,7 +4061,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
                {
                  /* Handle encoded stab line number. */
                  valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile));
-                 record_line (current_subfile, sh.index, valu);
+                 record_line (current_subfile, sh.index,
+                              gdbarch_addr_bits_remove (gdbarch, valu));
                }
            }
          else if (sh.st == stProc || sh.st == stStaticProc
index d26838c..cdb8a20 100644 (file)
@@ -765,6 +765,8 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff
                  CORE_ADDR startaddr,  /* offsets to line table */
                  CORE_ADDR endaddr, unsigned *firstLine)
 {
+  struct objfile *objfile = this_symtab_psymtab->objfile;
+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
   unsigned int curoffset;
   CORE_ADDR addr;
   void *ext_lnno;
@@ -777,7 +779,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff
     return;
   curoffset = beginoffset;
   limit_offset =
-    ((struct coff_symfile_info *) this_symtab_psymtab->objfile->deprecated_sym_private)
+    ((struct coff_symfile_info *) objfile->deprecated_sym_private)
     ->max_lineno_offset;
 
   if (endoffset != 0)
@@ -793,7 +795,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff
   else
     limit_offset -= 1;
 
-  abfd = this_symtab_psymtab->objfile->obfd;
+  abfd = objfile->obfd;
   linesz = coff_data (abfd)->local_linesz;
   ext_lnno = alloca (linesz);
 
@@ -807,8 +809,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff
       addr = (int_lnno.l_lnno
              ? int_lnno.l_addr.l_paddr
              : read_symbol_nvalue (int_lnno.l_addr.l_symndx));
-      addr += ANOFFSET (this_symtab_psymtab->objfile->section_offsets,
-                       SECT_OFF_TEXT (this_symtab_psymtab->objfile));
+      addr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 
       if (addr < startaddr || (endaddr && addr >= endaddr))
        return;
@@ -816,11 +817,12 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff
       if (int_lnno.l_lnno == 0)
        {
          *firstLine = read_symbol_lineno (int_lnno.l_addr.l_symndx);
-         record_line (subfile, 0, addr);
+         record_line (subfile, 0, gdbarch_addr_bits_remove (gdbarch, addr));
          --(*firstLine);
        }
       else
-       record_line (subfile, *firstLine + int_lnno.l_lnno, addr);
+       record_line (subfile, *firstLine + int_lnno.l_lnno,
+                    gdbarch_addr_bits_remove (gdbarch, addr));
       curoffset += linesz;
     }
 }