@@ -78,7 +78,9 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data,
78
78
case DW_FORM_line_strp:
79
79
case DW_FORM_sec_offset:
80
80
// FIXME: For AIX
81
- m_value.uval = data.GetMaxU64 (offset_ptr, 4 );
81
+ assert (m_unit); // Unit must be valid
82
+ ref_addr_size = m_unit->GetFormParams ().getDwarfOffsetByteSize ();
83
+ m_value.uval = data.GetMaxU64 (offset_ptr, ref_addr_size);
82
84
break ;
83
85
case DW_FORM_addrx1:
84
86
case DW_FORM_strx1:
@@ -120,11 +122,7 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data,
120
122
break ;
121
123
case DW_FORM_ref_addr:
122
124
assert (m_unit);
123
- if (m_unit->GetVersion () <= 2 )
124
- ref_addr_size = m_unit->GetAddressByteSize ();
125
- else
126
- ref_addr_size = 4 ;
127
- // FIXME: For AIX
125
+ ref_addr_size = m_unit->GetFormParams ().getRefAddrByteSize ();
128
126
m_value.uval = data.GetMaxU64 (offset_ptr, ref_addr_size);
129
127
break ;
130
128
case DW_FORM_indirect:
@@ -167,7 +165,7 @@ static FormSize g_form_sizes[] = {
167
165
{1 , 1 }, // 0x0b DW_FORM_data1
168
166
{1 , 1 }, // 0x0c DW_FORM_flag
169
167
{0 , 0 }, // 0x0d DW_FORM_sdata
170
- {1 , 4 }, // 0x0e DW_FORM_strp
168
+ {0 , 0 }, // 0x0e DW_FORM_strp
171
169
{0 , 0 }, // 0x0f DW_FORM_udata
172
170
{0 , 0 }, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes
173
171
// for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
@@ -177,15 +175,15 @@ static FormSize g_form_sizes[] = {
177
175
{1 , 8 }, // 0x14 DW_FORM_ref8
178
176
{0 , 0 }, // 0x15 DW_FORM_ref_udata
179
177
{0 , 0 }, // 0x16 DW_FORM_indirect
180
- {1 , 4 }, // 0x17 DW_FORM_sec_offset
178
+ {0 , 0 }, // 0x17 DW_FORM_sec_offset
181
179
{0 , 0 }, // 0x18 DW_FORM_exprloc
182
180
{1 , 0 }, // 0x19 DW_FORM_flag_present
183
181
{0 , 0 }, // 0x1a DW_FORM_strx (ULEB128)
184
182
{0 , 0 }, // 0x1b DW_FORM_addrx (ULEB128)
185
183
{1 , 4 }, // 0x1c DW_FORM_ref_sup4
186
184
{0 , 0 }, // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64)
187
185
{1 , 16 }, // 0x1e DW_FORM_data16
188
- {1 , 4 }, // 0x1f DW_FORM_line_strp
186
+ {0 , 0 }, // 0x1f DW_FORM_line_strp
189
187
{1 , 8 }, // 0x20 DW_FORM_ref_sig8
190
188
};
191
189
@@ -248,13 +246,9 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
248
246
return true ;
249
247
250
248
case DW_FORM_ref_addr:
251
- ref_addr_size = 4 ;
252
249
assert (unit); // Unit must be valid for DW_FORM_ref_addr objects or we will
253
250
// get this wrong
254
- if (unit->GetVersion () <= 2 )
255
- ref_addr_size = unit->GetAddressByteSize ();
256
- else
257
- ref_addr_size = 4 ;
251
+ ref_addr_size = unit->GetFormParams ().getRefAddrByteSize ();
258
252
*offset_ptr += ref_addr_size;
259
253
return true ;
260
254
@@ -290,7 +284,8 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
290
284
case DW_FORM_sec_offset:
291
285
case DW_FORM_strp:
292
286
case DW_FORM_line_strp:
293
- *offset_ptr += 4 ;
287
+ ref_addr_size = unit->GetFormParams ().getDwarfOffsetByteSize ();
288
+ *offset_ptr += ref_addr_size;
294
289
return true ;
295
290
296
291
// 4 byte values
@@ -507,8 +502,6 @@ dw_addr_t DWARFFormValue::Address() const {
507
502
&offset, index_size);
508
503
}
509
504
510
- bool UGLY_FLAG_FOR_AIX __attribute__ ((weak)) = false;
511
-
512
505
std::pair<DWARFUnit *, uint64_t >
513
506
DWARFFormValue::ReferencedUnitAndOffset () const {
514
507
uint64_t value = m_value.uval ;
@@ -521,8 +514,6 @@ DWARFFormValue::ReferencedUnitAndOffset() const {
521
514
assert (m_unit); // Unit must be valid for DW_FORM_ref forms that are compile
522
515
// unit relative or we will get this wrong
523
516
value += m_unit->GetOffset ();
524
- if (UGLY_FLAG_FOR_AIX)
525
- value -= 8 ;
526
517
if (!m_unit->ContainsDIEOffset (value)) {
527
518
m_unit->GetSymbolFileDWARF ().GetObjectFile ()->GetModule ()->ReportError (
528
519
" DW_FORM_ref* DIE reference {0:x16} is outside of its CU" , value);
@@ -549,7 +540,6 @@ DWARFFormValue::ReferencedUnitAndOffset() const {
549
540
return {nullptr , 0 };
550
541
return {tu, tu->GetTypeOffset ()};
551
542
}
552
-
553
543
default :
554
544
return {nullptr , 0 };
555
545
}
0 commit comments