]>
Commit | Line | Data |
---|---|---|
a7de96f0 | 1 | Index: gdb-7.4.50.20120602/gdb/dwarf2read.c |
51a5ef0f | 2 | =================================================================== |
a7de96f0 PS |
3 | --- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 19:14:38.000000000 +0200 |
4 | +++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 19:51:29.977252338 +0200 | |
5 | @@ -9746,7 +9746,12 @@ read_common_block (struct die_info *die, | |
ab050a48 BZ |
6 | { |
7 | struct attribute *attr; | |
8 | struct symbol *sym; | |
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. */ | |
14 | + CORE_ADDR base = 0; | |
15 | + int base_p = 0; | |
16 | ||
17 | attr = dwarf2_attr (die, DW_AT_location, cu); | |
18 | if (attr) | |
a7de96f0 | 19 | @@ -9755,6 +9760,7 @@ read_common_block (struct die_info *die, |
ab050a48 | 20 | if (attr_form_is_block (attr)) |
51a5ef0f PS |
21 | { |
22 | base = decode_locdesc (DW_BLOCK (attr), cu); | |
ab050a48 | 23 | + base_p = 1; |
51a5ef0f | 24 | } |
ab050a48 | 25 | else if (attr_form_is_section_offset (attr)) |
51a5ef0f | 26 | { |
a7de96f0 | 27 | @@ -9807,12 +9813,15 @@ read_common_block (struct die_info *die, |
6ed6bacf AM |
28 | if (sym != NULL |
29 | && handle_data_member_location (child_die, cu, &offset)) | |
30 | { | |
31 | - SYMBOL_VALUE_ADDRESS (sym) = base + offset; | |
ab050a48 BZ |
32 | + if (!base_p) |
33 | + dwarf2_invalid_attrib_class_complaint | |
34 | + ("DW_AT_data_member_location", "common block member"); | |
6ed6bacf | 35 | + SYMBOL_VALUE_ADDRESS (sym) = base + offset + baseaddr; |
ab050a48 BZ |
36 | add_symbol_to_list (sym, &global_symbols); |
37 | } | |
38 | ||
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); | |
42 | else | |
43 | SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym)); | |
44 | FIELD_TYPE (*field) = SYMBOL_TYPE (sym); | |
a7de96f0 | 45 | @@ -9826,7 +9835,7 @@ read_common_block (struct die_info *die, |
ab050a48 BZ |
46 | |
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; | |
51 | ||
52 | set_die_type (die, type, cu); | |
53 | } | |
a7de96f0 | 54 | Index: gdb-7.4.50.20120602/gdb/gdbtypes.h |
51a5ef0f | 55 | =================================================================== |
a7de96f0 PS |
56 | --- gdb-7.4.50.20120602.orig/gdb/gdbtypes.h 2012-06-02 19:11:54.000000000 +0200 |
57 | +++ gdb-7.4.50.20120602/gdb/gdbtypes.h 2012-06-02 19:52:44.990230200 +0200 | |
58 | @@ -401,6 +401,7 @@ enum field_loc_kind | |
51a5ef0f PS |
59 | { |
60 | FIELD_LOC_KIND_BITPOS, /* bitpos */ | |
a7de96f0 | 61 | FIELD_LOC_KIND_ENUMVAL, /* enumval */ |
51a5ef0f PS |
62 | + /* This address is unrelocated by the objfile's ANOFFSET. */ |
63 | FIELD_LOC_KIND_PHYSADDR, /* physaddr */ | |
f412e1b4 PS |
64 | FIELD_LOC_KIND_PHYSNAME, /* physname */ |
65 | FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */ | |
a7de96f0 | 66 | @@ -595,6 +596,7 @@ struct main_type |
51a5ef0f | 67 | is the location (in the target) of the static field. |
6ed6bacf | 68 | Otherwise, physname is the mangled label of the static field. */ |
51a5ef0f PS |
69 | |
70 | + /* This address is unrelocated by the objfile's ANOFFSET. */ | |
71 | CORE_ADDR physaddr; | |
f412e1b4 PS |
72 | const char *physname; |
73 | ||
a7de96f0 PS |
74 | @@ -1200,6 +1202,7 @@ extern void allocate_gnat_aux_type (stru |
75 | #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval) | |
76 | #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0) | |
ab050a48 BZ |
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) | |
f412e1b4 | 80 | #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) |
ab050a48 | 81 | #define SET_FIELD_BITPOS(thisfld, bitpos) \ |
a7de96f0 | 82 | @@ -1211,6 +1214,7 @@ extern void allocate_gnat_aux_type (stru |
ab050a48 BZ |
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)) | |
a7de96f0 | 90 | @@ -1227,6 +1231,7 @@ extern void allocate_gnat_aux_type (stru |
ab050a48 | 91 | #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) |
a7de96f0 | 92 | #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) |
ab050a48 BZ |
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)) | |
f412e1b4 | 96 | #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) |
ab050a48 | 97 | #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) |
a7de96f0 | 98 | Index: gdb-7.4.50.20120602/gdb/jv-lang.c |
51a5ef0f | 99 | =================================================================== |
a7de96f0 PS |
100 | --- gdb-7.4.50.20120602.orig/gdb/jv-lang.c 2012-05-10 21:59:12.000000000 +0200 |
101 | +++ gdb-7.4.50.20120602/gdb/jv-lang.c 2012-06-02 19:51:53.286245280 +0200 | |
102 | @@ -431,7 +431,8 @@ java_link_class_type (struct gdbarch *gd | |
ab050a48 BZ |
103 | |
104 | fields = NULL; | |
6ed6bacf | 105 | nfields--; /* First set up dummy "class" field. */ |
ab050a48 BZ |
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); | |
a7de96f0 | 112 | @@ -479,7 +480,8 @@ java_link_class_type (struct gdbarch *gd |
ab050a48 BZ |
113 | SET_TYPE_FIELD_PROTECTED (type, i); |
114 | } | |
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))))); | |
119 | else | |
a7de96f0 | 120 | SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset); |
ab050a48 | 121 | if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ |
a7de96f0 | 122 | Index: gdb-7.4.50.20120602/gdb/value.c |
51a5ef0f | 123 | =================================================================== |
a7de96f0 PS |
124 | --- gdb-7.4.50.20120602.orig/gdb/value.c 2012-06-02 19:11:55.000000000 +0200 |
125 | +++ gdb-7.4.50.20120602/gdb/value.c 2012-06-02 19:51:30.031252317 +0200 | |
126 | @@ -2592,7 +2592,8 @@ value_static_field (struct type *type, i | |
ab050a48 | 127 | { |
51a5ef0f PS |
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))))); | |
133 | break; | |
134 | case FIELD_LOC_KIND_PHYSNAME: | |
ab050a48 | 135 | { |