]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-archer-pie-addons.patch
- BR: gettext-devel
[packages/gdb.git] / gdb-archer-pie-addons.patch
CommitLineData
51a5ef0f
PS
1Index: gdb-7.1.90.20100711/gdb/dwarf2read.c
2===================================================================
3--- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-13 00:26:25.000000000 +0200
4+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:34:00.000000000 +0200
5@@ -5737,7 +5737,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)
51a5ef0f 19@@ -5746,6 +5751,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
PS
26 {
27@@ -5807,12 +5813,15 @@ read_common_block (struct die_info *die,
ab050a48
BZ
28 else
29 dwarf2_complex_location_expr_complaint ();
30
31- SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
32+ if (!base_p)
33+ dwarf2_invalid_attrib_class_complaint
34+ ("DW_AT_data_member_location", "common block member");
35+ SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset + baseaddr;
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);
51a5ef0f 45@@ -5826,7 +5835,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 }
51a5ef0f
PS
54Index: gdb-7.1.90.20100711/gdb/gdbtypes.h
55===================================================================
56--- gdb-7.1.90.20100711.orig/gdb/gdbtypes.h 2010-07-12 23:07:34.000000000 +0200
57+++ gdb-7.1.90.20100711/gdb/gdbtypes.h 2010-07-13 00:34:00.000000000 +0200
58@@ -395,6 +395,7 @@ enum type_instance_flag_value
59 enum field_loc_kind
60 {
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 };
66@@ -577,6 +578,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. */
69
70+ /* This address is unrelocated by the objfile's ANOFFSET. */
71 CORE_ADDR physaddr;
72 char *physname;
73 }
74@@ -1073,6 +1075,7 @@ extern void allocate_gnat_aux_type (stru
ab050a48
BZ
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)
ab050a48 80 #define SET_FIELD_BITPOS(thisfld, bitpos) \
51a5ef0f
PS
81 (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
82@@ -1080,6 +1083,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))
51a5ef0f 90@@ -1092,6 +1096,7 @@ extern void allocate_gnat_aux_type (stru
ab050a48
BZ
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))
ab050a48 96 #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
51a5ef0f
PS
97 #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
98Index: gdb-7.1.90.20100711/gdb/jv-lang.c
99===================================================================
100--- gdb-7.1.90.20100711.orig/gdb/jv-lang.c 2010-05-17 19:18:39.000000000 +0200
101+++ gdb-7.1.90.20100711/gdb/jv-lang.c 2010-07-13 00:34:00.000000000 +0200
102@@ -409,7 +409,8 @@ java_link_class_type (struct gdbarch *gd
ab050a48
BZ
103
104 fields = NULL;
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);
51a5ef0f 112@@ -457,7 +458,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
120 TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
121 if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
51a5ef0f
PS
122Index: gdb-7.1.90.20100711/gdb/value.c
123===================================================================
124--- gdb-7.1.90.20100711.orig/gdb/value.c 2010-07-12 23:07:33.000000000 +0200
125+++ gdb-7.1.90.20100711/gdb/value.c 2010-07-13 00:35:21.000000000 +0200
126@@ -1943,7 +1943,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 {
51a5ef0f 136@@ -1977,7 +1978,8 @@ value_static_field (struct type *type, i
ab050a48
BZ
137 }
138 if (retval && VALUE_LVAL (retval) == lval_memory)
139 SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
140- value_address (retval));
141+ value_address (retval)
51a5ef0f
PS
142+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
143 break;
ab050a48 144 }
51a5ef0f 145 default:
This page took 0.056938 seconds and 4 git commands to generate.