2004-05-13 Bryce McKinlay <mckinlay@redhat.com>
authorBryce McKinlay <mckinlay@redhat.com>
Thu, 13 May 2004 17:30:41 +0000 (17:30 +0000)
committerBryce McKinlay <mckinlay@redhat.com>
Thu, 13 May 2004 17:30:41 +0000 (17:30 +0000)
* dwarf2loc.c (find_location_expression): Use ANOFFSET to adjust
base_address for shared libraries.

gdb/ChangeLog
gdb/dwarf2loc.c

index d3dbedb7102db7f8b22d0f8218e7d283c41b7e34..d035f9504b5b0fb24f92cd278997cf1dc4df5e74 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-13  Bryce McKinlay  <mckinlay@redhat.com>
+
+       * dwarf2loc.c (find_location_expression): Use ANOFFSET to adjust
+       base_address for shared libraries.
+
 2004-05-13  Bryce McKinlay  <mckinlay@redhat.com>
 
        * MAINTAINERS (write after approval): Add myself.       
index ef333f7e77012d4c08ef1a1ce0f16031dacacdf0..cdbeb10acf43eef6557822c49be23169406e1a54 100644 (file)
@@ -53,11 +53,14 @@ static char *
 find_location_expression (struct dwarf2_loclist_baton *baton,
                          size_t *locexpr_length, CORE_ADDR pc)
 {
-  CORE_ADDR base_address = baton->base_address;
   CORE_ADDR low, high;
   char *loc_ptr, *buf_end;
   unsigned int addr_size = TARGET_ADDR_BIT / TARGET_CHAR_BIT, length;
   CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
+  /* Adjust base_address for relocatable objects.  */
+  CORE_ADDR base_offset = ANOFFSET (baton->objfile->section_offsets,
+                                   SECT_OFF_TEXT (baton->objfile));
+  CORE_ADDR base_address = baton->base_address + base_offset;
 
   loc_ptr = baton->data;
   buf_end = baton->data + baton->size;