1 Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
2 ===================================================================
3 --- gdb-7.4.50.20111218.orig/gdb/dwarf2read.c 2011-12-19 01:31:24.000000000 +0100
4 +++ gdb-7.4.50.20111218/gdb/dwarf2read.c 2011-12-19 01:33:25.263238972 +0100
5 @@ -8347,7 +8347,12 @@ read_common_block (struct die_info *die,
7 struct attribute *attr;
9 - CORE_ADDR base = (CORE_ADDR) 0;
10 + struct objfile *objfile = cu->objfile;
11 + CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
12 + SECT_OFF_TEXT (objfile));
13 + /* This is used only for DW_AT_data_member_location entries. */
17 attr = dwarf2_attr (die, DW_AT_location, cu);
19 @@ -8356,6 +8361,7 @@ read_common_block (struct die_info *die,
20 if (attr_form_is_block (attr))
22 base = decode_locdesc (DW_BLOCK (attr), cu);
25 else if (attr_form_is_section_offset (attr))
27 @@ -8408,12 +8414,15 @@ read_common_block (struct die_info *die,
29 && handle_data_member_location (child_die, cu, &offset))
31 - SYMBOL_VALUE_ADDRESS (sym) = base + offset;
33 + dwarf2_invalid_attrib_class_complaint
34 + ("DW_AT_data_member_location", "common block member");
35 + SYMBOL_VALUE_ADDRESS (sym) = base + offset + baseaddr;
36 add_symbol_to_list (sym, &global_symbols);
39 if (SYMBOL_CLASS (sym) == LOC_STATIC)
40 - SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym));
41 + SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym) - baseaddr);
43 SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
44 FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
45 @@ -8427,7 +8436,7 @@ read_common_block (struct die_info *die,
47 sym = new_symbol (die, type, cu);
48 /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
49 - SYMBOL_VALUE_ADDRESS (sym) = base;
50 + SYMBOL_VALUE_ADDRESS (sym) = base + baseaddr;
52 set_die_type (die, type, cu);
54 Index: gdb-7.4.50.20111218/gdb/gdbtypes.h
55 ===================================================================
56 --- gdb-7.4.50.20111218.orig/gdb/gdbtypes.h 2011-12-18 23:35:23.000000000 +0100
57 +++ gdb-7.4.50.20111218/gdb/gdbtypes.h 2011-12-19 01:34:21.448025620 +0100
58 @@ -396,6 +396,7 @@ enum type_instance_flag_value
61 FIELD_LOC_KIND_BITPOS, /* bitpos */
62 + /* This address is unrelocated by the objfile's ANOFFSET. */
63 FIELD_LOC_KIND_PHYSADDR, /* physaddr */
64 FIELD_LOC_KIND_PHYSNAME, /* physname */
65 FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */
66 @@ -581,6 +582,7 @@ struct main_type
67 is the location (in the target) of the static field.
68 Otherwise, physname is the mangled label of the static field. */
70 + /* This address is unrelocated by the objfile's ANOFFSET. */
74 @@ -1194,6 +1196,7 @@ extern void allocate_gnat_aux_type (stru
75 #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
76 #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
77 #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
78 +/* This address is unrelocated by the objfile's ANOFFSET. */
79 #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
80 #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
81 #define SET_FIELD_BITPOS(thisfld, bitpos) \
82 @@ -1202,6 +1205,7 @@ extern void allocate_gnat_aux_type (stru
83 #define SET_FIELD_PHYSNAME(thisfld, name) \
84 (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
85 FIELD_STATIC_PHYSNAME (thisfld) = (name))
86 +/* This address is unrelocated by the objfile's ANOFFSET. */
87 #define SET_FIELD_PHYSADDR(thisfld, addr) \
88 (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
89 FIELD_STATIC_PHYSADDR (thisfld) = (addr))
90 @@ -1217,6 +1221,7 @@ extern void allocate_gnat_aux_type (stru
91 #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
92 #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
93 #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
94 +/* This address is unrelocated by the objfile's ANOFFSET. */
95 #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
96 #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
97 #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
98 Index: gdb-7.4.50.20111218/gdb/jv-lang.c
99 ===================================================================
100 --- gdb-7.4.50.20111218.orig/gdb/jv-lang.c 2011-12-06 19:54:39.000000000 +0100
101 +++ gdb-7.4.50.20111218/gdb/jv-lang.c 2011-12-19 01:33:25.280238908 +0100
102 @@ -430,7 +430,8 @@ java_link_class_type (struct gdbarch *gd
105 nfields--; /* First set up dummy "class" field. */
106 - SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
107 + SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas)
108 + - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
109 TYPE_FIELD_NAME (type, nfields) = "class";
110 TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
111 SET_TYPE_FIELD_PRIVATE (type, nfields);
112 @@ -478,7 +479,8 @@ java_link_class_type (struct gdbarch *gd
113 SET_TYPE_FIELD_PROTECTED (type, i);
115 if (accflags & 0x0008) /* ACC_STATIC */
116 - SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
117 + SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset
118 + - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
120 TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
121 if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
122 Index: gdb-7.4.50.20111218/gdb/value.c
123 ===================================================================
124 --- gdb-7.4.50.20111218.orig/gdb/value.c 2011-12-18 23:35:23.000000000 +0100
125 +++ gdb-7.4.50.20111218/gdb/value.c 2011-12-19 01:33:25.283238896 +0100
126 @@ -2481,7 +2481,8 @@ value_static_field (struct type *type, i
128 case FIELD_LOC_KIND_PHYSADDR:
129 retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
130 - TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
131 + TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
132 + + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
134 case FIELD_LOC_KIND_PHYSNAME: