Use only unaligned constants in dwarf debug info as specified by standard

git-svn-id: trunk@22516 -
This commit is contained in:
pierre 2012-10-02 14:00:03 +00:00
parent 42bd8d6bc1
commit a34c1ff22d

View File

@ -888,19 +888,19 @@ implementation
if (target_info.system in systems_windows+systems_wince) then if (target_info.system in systems_windows+systems_wince) then
offsetabstype:=aitconst_secrel32_symbol offsetabstype:=aitconst_secrel32_symbol
else else
offsetabstype:=aitconst_32bit; offsetabstype:=aitconst_32bit_unaligned;
if (target_info.system in systems_darwin) then if (target_info.system in systems_darwin) then
offsetreltype:=aitconst_darwin_dwarf_delta32 offsetreltype:=aitconst_darwin_dwarf_delta32
else else
offsetreltype:=aitconst_32bit; offsetreltype:=aitconst_32bit_unaligned;
end end
else else
begin begin
if (target_info.system in systems_darwin) then if (target_info.system in systems_darwin) then
offsetreltype:=aitconst_darwin_dwarf_delta64 offsetreltype:=aitconst_darwin_dwarf_delta64
else else
offsetreltype:=aitconst_64bit; offsetreltype:=aitconst_64bit_unaligned;
offsetabstype:=aitconst_64bit; offsetabstype:=aitconst_64bit_unaligned;
end; end;
end; end;
@ -1113,11 +1113,11 @@ implementation
DW_FORM_data2: DW_FORM_data2:
case value.VType of case value.VType of
vtInteger: vtInteger:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(value.VInteger)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(value.VInteger));
vtInt64: vtInt64:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(value.VInt64^)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(value.VInt64^));
vtQWord: vtQWord:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(value.VQWord^)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(value.VQWord^));
else else
internalerror(200602144); internalerror(200602144);
end; end;
@ -1125,11 +1125,11 @@ implementation
DW_FORM_data4: DW_FORM_data4:
case value.VType of case value.VType of
vtInteger: vtInteger:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(value.VInteger)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(value.VInteger));
vtInt64: vtInt64:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(value.VInt64^)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(value.VInt64^));
vtQWord: vtQWord:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(value.VQWord^)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(value.VQWord^));
else else
internalerror(200602145); internalerror(200602145);
end; end;
@ -1137,11 +1137,11 @@ implementation
DW_FORM_data8: DW_FORM_data8:
case value.VType of case value.VType of
vtInteger: vtInteger:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(value.VInteger)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit_unaligned(value.VInteger));
vtInt64: vtInt64:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(value.VInt64^)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit_unaligned(value.VInt64^));
vtQWord: vtQWord:
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(value.VQWord^)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit_unaligned(value.VQWord^));
else else
internalerror(200602146); internalerror(200602146);
end; end;
@ -1234,13 +1234,13 @@ implementation
begin begin
AddConstToAbbrev(ord(attr)); AddConstToAbbrev(ord(attr));
AddConstToAbbrev(ord(DW_FORM_addr)); AddConstToAbbrev(ord(DW_FORM_addr));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sym(sym)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(offsetabstype,sym));
end; end;
procedure TDebugInfoDwarf.append_labelentry_addr_ref(attr : tdwarf_attribute;sym : tasmsymbol); procedure TDebugInfoDwarf.append_labelentry_addr_ref(attr : tdwarf_attribute;sym : tasmsymbol);
begin begin
AddConstToAbbrev(ord(DW_FORM_ref_addr)); AddConstToAbbrev(ord(DW_FORM_ref_addr));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sym(sym)) current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(offsetabstype,sym))
end; end;
procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol); procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol);
@ -2715,20 +2715,20 @@ implementation
begin begin
{$ifdef cpu64bitaddr} {$ifdef cpu64bitaddr}
AddConstToAbbrev(ord(DW_FORM_data8)); AddConstToAbbrev(ord(DW_FORM_data8));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(0)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit_unaligned(0));
{$else cpu64bitaddr} {$else cpu64bitaddr}
AddConstToAbbrev(ord(DW_FORM_data4)); AddConstToAbbrev(ord(DW_FORM_data4));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(0)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(0));
{$endif cpu64bitaddr} {$endif cpu64bitaddr}
end; end;
constpointer: constpointer:
begin begin
{$ifdef cpu64bitaddr} {$ifdef cpu64bitaddr}
AddConstToAbbrev(ord(DW_FORM_data8)); AddConstToAbbrev(ord(DW_FORM_data8));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(int64(sym.value.valueordptr))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit_unaligned(int64(sym.value.valueordptr)));
{$else cpu64bitaddr} {$else cpu64bitaddr}
AddConstToAbbrev(ord(DW_FORM_data4)); AddConstToAbbrev(ord(DW_FORM_data4));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(longint(sym.value.valueordptr))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(longint(sym.value.valueordptr)));
{$endif cpu64bitaddr} {$endif cpu64bitaddr}
end; end;
constreal: constreal:
@ -2749,7 +2749,7 @@ implementation
s64currency: s64currency:
begin begin
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(8)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(8));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(trunc(pbestreal(sym.value.valueptr)^))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit_unaligned(trunc(pbestreal(sym.value.valueptr)^)));
end; end;
s80real, s80real,
sc80real: sc80real:
@ -2959,13 +2959,13 @@ implementation
{ size } { size }
current_asmdata.getlabel(lbl,alt_dbgfile); current_asmdata.getlabel(lbl,alt_dbgfile);
if use_64bit_headers then if use_64bit_headers then
linelist.concat(tai_const.create_32bit(longint($FFFFFFFF))); linelist.concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF)));
linelist.concat(tai_const.create_rel_sym(offsetreltype, linelist.concat(tai_const.create_rel_sym(offsetreltype,
lbl,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'edebug_line0'))); lbl,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'edebug_line0')));
linelist.concat(tai_label.create(lbl)); linelist.concat(tai_label.create(lbl));
{ version } { version }
linelist.concat(tai_const.create_16bit(dwarf_version)); linelist.concat(tai_const.create_16bit_unaligned(dwarf_version));
{ header length } { header length }
current_asmdata.getlabel(lbl,alt_dbgfile); current_asmdata.getlabel(lbl,alt_dbgfile);
@ -3108,13 +3108,13 @@ implementation
current_asmdata.getlabel(lenstartlabel,alt_dbgfile); current_asmdata.getlabel(lenstartlabel,alt_dbgfile);
{ size } { size }
if use_64bit_headers then if use_64bit_headers then
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(longint($FFFFFFFF))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype, current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype,
lenstartlabel,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'edebug_info0'))); lenstartlabel,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'edebug_info0')));
current_asmdata.asmlists[al_dwarf_info].concat(tai_label.create(lenstartlabel)); current_asmdata.asmlists[al_dwarf_info].concat(tai_label.create(lenstartlabel));
{ version } { version }
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(dwarf_version)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(dwarf_version));
{ abbrev table (=relative from section start)} { abbrev table (=relative from section start)}
if not(tf_dwarf_relative_addresses in target_info.flags) then if not(tf_dwarf_relative_addresses in target_info.flags) then
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(offsetabstype, current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(offsetabstype,
@ -3381,7 +3381,7 @@ implementation
asmline.concat(tai_const.create_8bit(DW_LNS_extended_op)); asmline.concat(tai_const.create_8bit(DW_LNS_extended_op));
asmline.concat(tai_const.create_uleb128bit(1+sizeof(pint))); asmline.concat(tai_const.create_uleb128bit(1+sizeof(pint)));
asmline.concat(tai_const.create_8bit(DW_LNE_set_address)); asmline.concat(tai_const.create_8bit(DW_LNE_set_address));
asmline.concat(tai_const.create_sym(currlabel)); asmline.concat(tai_const.create_type_sym(offsetabstype,currlabel));
end end
else else
begin begin
@ -3433,7 +3433,7 @@ implementation
asmline.concat(tai_const.create_8bit(DW_LNS_extended_op)); asmline.concat(tai_const.create_8bit(DW_LNS_extended_op));
asmline.concat(tai_const.create_uleb128bit(1+sizeof(pint))); asmline.concat(tai_const.create_uleb128bit(1+sizeof(pint)));
asmline.concat(tai_const.create_8bit(DW_LNE_set_address)); asmline.concat(tai_const.create_8bit(DW_LNE_set_address));
asmline.concat(tai_const.create_sym(currlabel)); asmline.concat(tai_const.create_type_sym(offsetabstype,currlabel));
end; end;
{ end sequence } { end sequence }
@ -3467,7 +3467,7 @@ implementation
asmline.concat(tai_const.create_8bit(DW_LNS_extended_op)); asmline.concat(tai_const.create_8bit(DW_LNS_extended_op));
asmline.concat(tai_const.create_uleb128bit(1+sizeof(pint))); asmline.concat(tai_const.create_uleb128bit(1+sizeof(pint)));
asmline.concat(tai_const.create_8bit(DW_LNE_set_address)); asmline.concat(tai_const.create_8bit(DW_LNE_set_address));
asmline.concat(tai_const.create_sym(nil)); asmline.concat(tai_const.create_type_sym(offsetabstype,nil));
asmline.concat(tai_const.create_8bit(DW_LNS_extended_op)); asmline.concat(tai_const.create_8bit(DW_LNS_extended_op));
asmline.concat(tai_const.Create_8bit(1)); asmline.concat(tai_const.Create_8bit(1));
asmline.concat(tai_const.Create_8bit(DW_LNE_end_sequence)); asmline.concat(tai_const.Create_8bit(DW_LNE_end_sequence));
@ -3713,9 +3713,9 @@ implementation
{ Since Dwarf 3 the length of a DW_FORM_ref_addr entry is not dependent on the pointer size of the { Since Dwarf 3 the length of a DW_FORM_ref_addr entry is not dependent on the pointer size of the
target platform, but on the used Dwarf-format (32 bit or 64 bit) for the current compilation section. } target platform, but on the used Dwarf-format (32 bit or 64 bit) for the current compilation section. }
if use_64bit_headers then if use_64bit_headers then
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_type_sym(aitconst_64bit,sym)) current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_type_sym(aitconst_64bit_unaligned,sym))
else else
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_type_sym(aitconst_32bit,sym)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_type_sym(aitconst_32bit_unaligned,sym));
end; end;
procedure tdebuginfodwarf3.appenddef_array(list: tasmlist; def: tarraydef); procedure tdebuginfodwarf3.appenddef_array(list: tasmlist; def: tarraydef);
@ -3751,12 +3751,12 @@ implementation
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_dup))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_dup)));
{ pointer = nil? } { pointer = nil? }
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_bra))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_bra)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(5)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(5));
{ yes -> length = 0 } { yes -> length = 0 }
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_const1s))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_const1s)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(byte(-1))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(byte(-1)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(3)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(3));
{ no -> load length } { no -> load length }
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizeof(ptrint))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizeof(ptrint)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_minus))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_minus)));
@ -3824,11 +3824,11 @@ implementation
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_dup))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_dup)));
{ pointer = nil? } { pointer = nil? }
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_bra))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_bra)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(4)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(4));
{ yes -> length = 0 } { yes -> length = 0 }
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(3)); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit_unaligned(3));
{ no -> load length } { no -> load length }
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizeof(ptrint))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizeof(ptrint)));
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_minus))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_minus)));