|
@@ -41,6 +41,7 @@ interface
|
|
|
|
|
|
|
|
uses
|
|
uses
|
|
|
cclasses,globtype,
|
|
cclasses,globtype,
|
|
|
|
|
+ cgbase,
|
|
|
aasmbase,aasmtai,aasmdata,
|
|
aasmbase,aasmtai,aasmdata,
|
|
|
symbase,symconst,symtype,symdef,symsym,
|
|
symbase,symconst,symtype,symdef,symsym,
|
|
|
finput,
|
|
finput,
|
|
@@ -196,6 +197,11 @@ interface
|
|
|
DW_AT_HP_all_variables_modifiable := $2019,
|
|
DW_AT_HP_all_variables_modifiable := $2019,
|
|
|
DW_AT_HP_linkage_name := $201a,DW_AT_HP_prof_flags := $201b,
|
|
DW_AT_HP_linkage_name := $201a,DW_AT_HP_prof_flags := $201b,
|
|
|
|
|
|
|
|
|
|
+ { WATCOM extensions. }
|
|
|
|
|
+ DW_AT_WATCOM_memory_model := $2082,
|
|
|
|
|
+ DW_AT_WATCOM_references_start := $2083,
|
|
|
|
|
+ DW_AT_WATCOM_parm_entry := $2084,
|
|
|
|
|
+
|
|
|
{ GNU extensions. }
|
|
{ GNU extensions. }
|
|
|
DW_AT_sf_names := $2101,DW_AT_src_info := $2102,
|
|
DW_AT_sf_names := $2101,DW_AT_src_info := $2102,
|
|
|
DW_AT_mac_info := $2103,DW_AT_src_coords := $2104,
|
|
DW_AT_mac_info := $2103,DW_AT_src_coords := $2104,
|
|
@@ -250,6 +256,17 @@ interface
|
|
|
DW_ADDR_far32 := 5
|
|
DW_ADDR_far32 := 5
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+ { values of DW_AT_WATCOM_memory_model }
|
|
|
|
|
+ Tdwarf_watcom_memory_model = (
|
|
|
|
|
+ DW_WATCOM_MEMORY_MODEL_none := 0,
|
|
|
|
|
+ DW_WATCOM_MEMORY_MODEL_flat := 1,
|
|
|
|
|
+ DW_WATCOM_MEMORY_MODEL_small := 2,
|
|
|
|
|
+ DW_WATCOM_MEMORY_MODEL_medium := 3,
|
|
|
|
|
+ DW_WATCOM_MEMORY_MODEL_compact := 4,
|
|
|
|
|
+ DW_WATCOM_MEMORY_MODEL_large := 5,
|
|
|
|
|
+ DW_WATCOM_MEMORY_MODEL_huge := 6
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
TDwarfFile = record
|
|
TDwarfFile = record
|
|
|
Index: integer;
|
|
Index: integer;
|
|
|
Name: PChar;
|
|
Name: PChar;
|
|
@@ -345,6 +362,8 @@ interface
|
|
|
|
|
|
|
|
function get_def_dwarf_labs(def:tdef): PDwarfHashSetItem;
|
|
function get_def_dwarf_labs(def:tdef): PDwarfHashSetItem;
|
|
|
|
|
|
|
|
|
|
+ function is_fbreg(reg:tregister):boolean;
|
|
|
|
|
+
|
|
|
{ Convenience version of the method below, so the compiler creates the
|
|
{ Convenience version of the method below, so the compiler creates the
|
|
|
tvarrec for us (must only pass one element in the last parameter). }
|
|
tvarrec for us (must only pass one element in the last parameter). }
|
|
|
procedure append_attribute(attr: tdwarf_attribute; form: tdwarf_form; const values: array of const);
|
|
procedure append_attribute(attr: tdwarf_attribute; form: tdwarf_form; const values: array of const);
|
|
@@ -357,6 +376,12 @@ interface
|
|
|
procedure append_labelentry_dataptr_abs(attr : tdwarf_attribute;sym : tasmsymbol);
|
|
procedure append_labelentry_dataptr_abs(attr : tdwarf_attribute;sym : tasmsymbol);
|
|
|
procedure append_labelentry_dataptr_rel(attr : tdwarf_attribute;sym,endsym : tasmsymbol);
|
|
procedure append_labelentry_dataptr_rel(attr : tdwarf_attribute;sym,endsym : tasmsymbol);
|
|
|
procedure append_labelentry_dataptr_common(attr : tdwarf_attribute);
|
|
procedure append_labelentry_dataptr_common(attr : tdwarf_attribute);
|
|
|
|
|
+ procedure append_pointerclass(list:TAsmList;def:tpointerdef);
|
|
|
|
|
+ procedure append_proc_frame_base(list:TAsmList;def:tprocdef);
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ procedure append_seg_name(const name:string);
|
|
|
|
|
+ procedure append_seg_reg(const segment_register:tregister);
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
|
|
|
procedure beforeappenddef(list:TAsmList;def:tdef);override;
|
|
procedure beforeappenddef(list:TAsmList;def:tdef);override;
|
|
|
procedure afterappenddef(list:TAsmList;def:tdef);override;
|
|
procedure afterappenddef(list:TAsmList;def:tdef);override;
|
|
@@ -458,9 +483,9 @@ implementation
|
|
|
uses
|
|
uses
|
|
|
sysutils,cutils,cfileutl,constexp,
|
|
sysutils,cutils,cfileutl,constexp,
|
|
|
version,globals,verbose,systems,
|
|
version,globals,verbose,systems,
|
|
|
- cpubase,cpuinfo,cgbase,paramgr,
|
|
|
|
|
|
|
+ cpubase,cpuinfo,paramgr,
|
|
|
fmodule,
|
|
fmodule,
|
|
|
- defutil,symtable,ppu
|
|
|
|
|
|
|
+ defutil,symtable,symcpu,ppu
|
|
|
{$ifdef OMFOBJSUPPORT}
|
|
{$ifdef OMFOBJSUPPORT}
|
|
|
,dbgcodeview
|
|
,dbgcodeview
|
|
|
{$endif OMFOBJSUPPORT}
|
|
{$endif OMFOBJSUPPORT}
|
|
@@ -679,6 +704,9 @@ implementation
|
|
|
DW_LNE_end_sequence = $01;
|
|
DW_LNE_end_sequence = $01;
|
|
|
DW_LNE_set_address = $02;
|
|
DW_LNE_set_address = $02;
|
|
|
DW_LNE_define_file = $03;
|
|
DW_LNE_define_file = $03;
|
|
|
|
|
+ { DW_LNE_set_segment is a non-standard Open Watcom extension. It might
|
|
|
|
|
+ create conflicts with future versions of the DWARF standard. }
|
|
|
|
|
+ DW_LNE_set_segment = $04;
|
|
|
DW_LNE_lo_user = $80;
|
|
DW_LNE_lo_user = $80;
|
|
|
DW_LNE_hi_user = $ff;
|
|
DW_LNE_hi_user = $ff;
|
|
|
|
|
|
|
@@ -1014,6 +1042,16 @@ implementation
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+ function TDebugInfoDwarf.is_fbreg(reg: tregister): boolean;
|
|
|
|
|
+ begin
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ result:=reg=NR_BP;
|
|
|
|
|
+{$else i8086}
|
|
|
|
|
+ { always return false, because we don't emit DW_AT_frame_base attributes yet }
|
|
|
|
|
+ result:=false;
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
function TDebugInfoDwarf.def_dwarf_lab(def: tdef): tasmsymbol;
|
|
function TDebugInfoDwarf.def_dwarf_lab(def: tdef): tasmsymbol;
|
|
|
begin
|
|
begin
|
|
|
result:=get_def_dwarf_labs(def)^.lab;
|
|
result:=get_def_dwarf_labs(def)^.lab;
|
|
@@ -1072,6 +1110,8 @@ implementation
|
|
|
appendsym_property(TAsmList(arg),tpropertysym(p));
|
|
appendsym_property(TAsmList(arg),tpropertysym(p));
|
|
|
constsym:
|
|
constsym:
|
|
|
appendsym_const_member(TAsmList(arg),tconstsym(p),true);
|
|
appendsym_const_member(TAsmList(arg),tconstsym(p),true);
|
|
|
|
|
+ else
|
|
|
|
|
+ ;
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
@@ -1283,7 +1323,12 @@ implementation
|
|
|
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_type_sym(aitconst_ptr_unaligned,sym))
|
|
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ { DW_FORM_ref_addr is treated as 32-bit by Open Watcom on i8086 }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_type_sym(aitconst_32bit_unaligned,sym));
|
|
|
|
|
+{$else i8086}
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_ptr_unaligned,sym));
|
|
|
|
|
+{$endif i8086}
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol);
|
|
procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol);
|
|
@@ -1308,6 +1353,95 @@ implementation
|
|
|
AddConstToAbbrev(ord(DW_FORM_data4));
|
|
AddConstToAbbrev(ord(DW_FORM_data4));
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+ procedure TDebugInfoDwarf.append_pointerclass(list: TAsmList;
|
|
|
|
|
+ def: tpointerdef);
|
|
|
|
|
+ begin
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ case tcpupointerdef(def).x86pointertyp of
|
|
|
|
|
+ x86pt_near,
|
|
|
|
|
+ { todo: is there a way to specify these somehow? }
|
|
|
|
|
+ x86pt_near_cs,x86pt_near_ds,x86pt_near_ss,
|
|
|
|
|
+ x86pt_near_es,x86pt_near_fs,x86pt_near_gs:
|
|
|
|
|
+ append_attribute(DW_AT_address_class,DW_FORM_data1,[DW_ADDR_near16]);
|
|
|
|
|
+ x86pt_far:
|
|
|
|
|
+ append_attribute(DW_AT_address_class,DW_FORM_data1,[DW_ADDR_far16]);
|
|
|
|
|
+ x86pt_huge:
|
|
|
|
|
+ append_attribute(DW_AT_address_class,DW_FORM_data1,[DW_ADDR_huge16]);
|
|
|
|
|
+ end;
|
|
|
|
|
+{$else i8086}
|
|
|
|
|
+ { Theoretically, we could do this, but it might upset some debuggers, }
|
|
|
|
|
+ { even though it's part of the DWARF standard. }
|
|
|
|
|
+ { append_attribute(DW_AT_address_class,DW_FORM_data1,[DW_ADDR_none]); }
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
|
|
+ procedure TDebugInfoDwarf.append_proc_frame_base(list: TAsmList;
|
|
|
|
|
+ def: tprocdef);
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ var
|
|
|
|
|
+ dreg: longint;
|
|
|
|
|
+ blocksize: longint;
|
|
|
|
|
+ templist: TAsmList;
|
|
|
|
|
+ begin
|
|
|
|
|
+ dreg:=dwarf_reg(NR_BP);
|
|
|
|
|
+ templist:=TAsmList.create;
|
|
|
|
|
+ if dreg<=31 then
|
|
|
|
|
+ begin
|
|
|
|
|
+ templist.concat(tai_const.create_8bit(ord(DW_OP_reg0)+dreg));
|
|
|
|
|
+ blocksize:=1;
|
|
|
|
|
+ end
|
|
|
|
|
+ else
|
|
|
|
|
+ begin
|
|
|
|
|
+ templist.concat(tai_const.create_8bit(ord(DW_OP_regx)));
|
|
|
|
|
+ templist.concat(tai_const.create_uleb128bit(dreg));
|
|
|
|
|
+ blocksize:=1+Lengthuleb128(dreg);
|
|
|
|
|
+ end;
|
|
|
|
|
+ append_block1(DW_AT_frame_base,blocksize);
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concatlist(templist);
|
|
|
|
|
+ templist.free;
|
|
|
|
|
+ end;
|
|
|
|
|
+{$else i8086}
|
|
|
|
|
+ begin
|
|
|
|
|
+ { problem: base reg isn't known here
|
|
|
|
|
+ DW_AT_frame_base,DW_FORM_block1,1
|
|
|
|
|
+ }
|
|
|
|
|
+ end;
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ procedure TDebugInfoDwarf.append_seg_name(const name:string);
|
|
|
|
|
+ begin
|
|
|
|
|
+ append_block1(DW_AT_segment,3);
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_const2u)));
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_seg_name(name));
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
|
|
+ procedure TDebugInfoDwarf.append_seg_reg(const segment_register: tregister);
|
|
|
|
|
+ var
|
|
|
|
|
+ dreg: longint;
|
|
|
|
|
+ blocksize: longint;
|
|
|
|
|
+ templist: TAsmList;
|
|
|
|
|
+ begin
|
|
|
|
|
+ dreg:=dwarf_reg(segment_register);
|
|
|
|
|
+ templist:=TAsmList.create;
|
|
|
|
|
+ if dreg<=31 then
|
|
|
|
|
+ begin
|
|
|
|
|
+ templist.concat(tai_const.create_8bit(ord(DW_OP_reg0)+dreg));
|
|
|
|
|
+ blocksize:=1;
|
|
|
|
|
+ end
|
|
|
|
|
+ else
|
|
|
|
|
+ begin
|
|
|
|
|
+ templist.concat(tai_const.create_8bit(ord(DW_OP_regx)));
|
|
|
|
|
+ templist.concat(tai_const.create_uleb128bit(dreg));
|
|
|
|
|
+ blocksize:=1+Lengthuleb128(dreg);
|
|
|
|
|
+ end;
|
|
|
|
|
+ append_block1(DW_AT_segment,blocksize);
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concatlist(templist);
|
|
|
|
|
+ templist.free;
|
|
|
|
|
+ end;
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
procedure TDebugInfoDwarf.append_labelentry_dataptr_abs(attr : tdwarf_attribute;sym : tasmsymbol);
|
|
procedure TDebugInfoDwarf.append_labelentry_dataptr_abs(attr : tdwarf_attribute;sym : tasmsymbol);
|
|
|
begin
|
|
begin
|
|
@@ -1355,8 +1489,12 @@ implementation
|
|
|
sign : tdwarf_type;
|
|
sign : tdwarf_type;
|
|
|
signform : tdwarf_form;
|
|
signform : tdwarf_form;
|
|
|
fullbytesize : byte;
|
|
fullbytesize : byte;
|
|
|
|
|
+ ordtype : tordtype;
|
|
|
begin
|
|
begin
|
|
|
- case def.ordtype of
|
|
|
|
|
|
|
+ ordtype:=def.ordtype;
|
|
|
|
|
+ if ordtype=customint then
|
|
|
|
|
+ ordtype:=range_to_basetype(def.low,def.high);
|
|
|
|
|
+ case ordtype of
|
|
|
s8bit,
|
|
s8bit,
|
|
|
s16bit,
|
|
s16bit,
|
|
|
s32bit,
|
|
s32bit,
|
|
@@ -1390,7 +1528,7 @@ implementation
|
|
|
basedef:=s16inttype
|
|
basedef:=s16inttype
|
|
|
else
|
|
else
|
|
|
basedef:=u16inttype;
|
|
basedef:=u16inttype;
|
|
|
- 4:
|
|
|
|
|
|
|
+ 3,4:
|
|
|
if (sign=DW_ATE_signed) then
|
|
if (sign=DW_ATE_signed) then
|
|
|
basedef:=s32inttype
|
|
basedef:=s32inttype
|
|
|
else
|
|
else
|
|
@@ -1462,7 +1600,7 @@ implementation
|
|
|
]);
|
|
]);
|
|
|
finish_entry;
|
|
finish_entry;
|
|
|
end;
|
|
end;
|
|
|
- pasbool8 :
|
|
|
|
|
|
|
+ pasbool1 :
|
|
|
begin
|
|
begin
|
|
|
append_entry(DW_TAG_base_type,false,[
|
|
append_entry(DW_TAG_base_type,false,[
|
|
|
DW_AT_name,DW_FORM_string,'Boolean'#0,
|
|
DW_AT_name,DW_FORM_string,'Boolean'#0,
|
|
@@ -1471,6 +1609,15 @@ implementation
|
|
|
]);
|
|
]);
|
|
|
finish_entry;
|
|
finish_entry;
|
|
|
end;
|
|
end;
|
|
|
|
|
+ pasbool8 :
|
|
|
|
|
+ begin
|
|
|
|
|
+ append_entry(DW_TAG_base_type,false,[
|
|
|
|
|
+ DW_AT_name,DW_FORM_string,'Boolean8'#0,
|
|
|
|
|
+ DW_AT_encoding,DW_FORM_data1,DW_ATE_boolean,
|
|
|
|
|
+ DW_AT_byte_size,DW_FORM_data1,1
|
|
|
|
|
+ ]);
|
|
|
|
|
+ finish_entry;
|
|
|
|
|
+ end;
|
|
|
bool8bit :
|
|
bool8bit :
|
|
|
begin
|
|
begin
|
|
|
append_entry(DW_TAG_base_type,false,[
|
|
append_entry(DW_TAG_base_type,false,[
|
|
@@ -1792,6 +1939,7 @@ implementation
|
|
|
procedure TDebugInfoDwarf.appenddef_pointer(list:TAsmList;def:tpointerdef);
|
|
procedure TDebugInfoDwarf.appenddef_pointer(list:TAsmList;def:tpointerdef);
|
|
|
begin
|
|
begin
|
|
|
append_entry(DW_TAG_pointer_type,false,[]);
|
|
append_entry(DW_TAG_pointer_type,false,[]);
|
|
|
|
|
+ append_pointerclass(list,def);
|
|
|
if not(is_voidpointer(def)) then
|
|
if not(is_voidpointer(def)) then
|
|
|
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.pointeddef));
|
|
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.pointeddef));
|
|
|
finish_entry;
|
|
finish_entry;
|
|
@@ -2117,7 +2265,7 @@ implementation
|
|
|
|
|
|
|
|
var
|
|
var
|
|
|
procendlabel : tasmlabel;
|
|
procendlabel : tasmlabel;
|
|
|
- procentry : string;
|
|
|
|
|
|
|
+ procentry,s : string;
|
|
|
cc : Tdwarf_calling_convention;
|
|
cc : Tdwarf_calling_convention;
|
|
|
st : tsymtable;
|
|
st : tsymtable;
|
|
|
vmtoffset : pint;
|
|
vmtoffset : pint;
|
|
@@ -2165,20 +2313,25 @@ implementation
|
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_comment.Create(strpnew('Procdef '+def.fullprocname(true))));
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_comment.Create(strpnew('Procdef '+def.fullprocname(true))));
|
|
|
if not is_objc_class_or_protocol(def.struct) then
|
|
if not is_objc_class_or_protocol(def.struct) then
|
|
|
append_entry(DW_TAG_subprogram,true,
|
|
append_entry(DW_TAG_subprogram,true,
|
|
|
- [DW_AT_name,DW_FORM_string,symname(def.procsym, false)+#0
|
|
|
|
|
- { data continues below }
|
|
|
|
|
- { problem: base reg isn't known here
|
|
|
|
|
- DW_AT_frame_base,DW_FORM_block1,1
|
|
|
|
|
- }
|
|
|
|
|
- ])
|
|
|
|
|
|
|
+ [DW_AT_name,DW_FORM_string,symname(def.procsym, false)+#0])
|
|
|
else
|
|
else
|
|
|
append_entry(DW_TAG_subprogram,true,
|
|
append_entry(DW_TAG_subprogram,true,
|
|
|
- [DW_AT_name,DW_FORM_string,def.mangledname+#0
|
|
|
|
|
- { data continues below }
|
|
|
|
|
- { problem: base reg isn't known here
|
|
|
|
|
- DW_AT_frame_base,DW_FORM_block1,1
|
|
|
|
|
- }
|
|
|
|
|
- ]);
|
|
|
|
|
|
|
+ [DW_AT_name,DW_FORM_string,def.mangledname+#0]);
|
|
|
|
|
+
|
|
|
|
|
+ if (ds_dwarf_cpp in current_settings.debugswitches) and (def.owner.symtabletype in [objectsymtable,recordsymtable]) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ { If C++ emulation is enabled, add DW_AT_linkage_name attribute for methods.
|
|
|
|
|
+ LLDB uses it to display fully qualified method names.
|
|
|
|
|
+ Add a simple C++ mangled name without params to achieve at least "Class::Method()"
|
|
|
|
|
+ instead of just "Method" in LLDB. }
|
|
|
|
|
+ s:=tabstractrecorddef(def.owner.defowner).objrealname^;
|
|
|
|
|
+ procentry:=Format('_ZN%d%s', [Length(s), s]);
|
|
|
|
|
+ s:=symname(def.procsym, false);
|
|
|
|
|
+ procentry:=Format('%s%d%sEv'#0, [procentry, Length(s), s]);
|
|
|
|
|
+ append_attribute(DW_AT_linkage_name,DW_FORM_string, [procentry]);
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
|
|
+ append_proc_frame_base(list,def);
|
|
|
|
|
|
|
|
{ Append optional flags. }
|
|
{ Append optional flags. }
|
|
|
|
|
|
|
@@ -2188,6 +2341,13 @@ implementation
|
|
|
cc:=dwarf_calling_convention(def);
|
|
cc:=dwarf_calling_convention(def);
|
|
|
if (cc<>DW_CC_normal) then
|
|
if (cc<>DW_CC_normal) then
|
|
|
append_attribute(DW_AT_calling_convention,DW_FORM_data1,[ord(cc)]);
|
|
append_attribute(DW_AT_calling_convention,DW_FORM_data1,[ord(cc)]);
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ { Call model (near or far). Open Watcom compatible. }
|
|
|
|
|
+ if tcpuprocdef(def).is_far then
|
|
|
|
|
+ append_attribute(DW_AT_address_class,DW_FORM_data1,[DW_ADDR_far16])
|
|
|
|
|
+ else
|
|
|
|
|
+ append_attribute(DW_AT_address_class,DW_FORM_data1,[DW_ADDR_none]);
|
|
|
|
|
+{$endif i8086}
|
|
|
{ Externally visible. }
|
|
{ Externally visible. }
|
|
|
if (po_global in def.procoptions) and
|
|
if (po_global in def.procoptions) and
|
|
|
(def.parast.symtablelevel<=normal_function_level) then
|
|
(def.parast.symtablelevel<=normal_function_level) then
|
|
@@ -2234,6 +2394,9 @@ implementation
|
|
|
else
|
|
else
|
|
|
procentry := def.mangledname;
|
|
procentry := def.mangledname;
|
|
|
|
|
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ append_seg_name(procentry);
|
|
|
|
|
+{$endif i8086}
|
|
|
append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION));
|
|
append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION));
|
|
|
append_labelentry(DW_AT_high_pc,procendlabel);
|
|
append_labelentry(DW_AT_high_pc,procendlabel);
|
|
|
|
|
|
|
@@ -2241,8 +2404,18 @@ implementation
|
|
|
begin
|
|
begin
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].Concat(
|
|
current_asmdata.asmlists[al_dwarf_aranges].Concat(
|
|
|
tai_const.create_type_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION)));
|
|
tai_const.create_type_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION)));
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ { bits 16..31 of the offset }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_16bit_unaligned(0));
|
|
|
|
|
+ { segment }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_seg_name(procentry));
|
|
|
|
|
+{$endif i8086}
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].Concat(
|
|
current_asmdata.asmlists[al_dwarf_aranges].Concat(
|
|
|
tai_const.Create_rel_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION),procendlabel));
|
|
tai_const.Create_rel_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry,AT_FUNCTION),procendlabel));
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ { bits 16..31 of length }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_16bit_unaligned(0));
|
|
|
|
|
+{$endif i8086}
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
@@ -2340,7 +2513,7 @@ implementation
|
|
|
sl_absolutetype,
|
|
sl_absolutetype,
|
|
|
sl_typeconv:
|
|
sl_typeconv:
|
|
|
begin
|
|
begin
|
|
|
- currdef:=tfieldvarsym(symlist^.sym).vardef;
|
|
|
|
|
|
|
+ currdef:=symlist^.def;
|
|
|
{ ignore, these don't change the address }
|
|
{ ignore, these don't change the address }
|
|
|
end;
|
|
end;
|
|
|
sl_vec:
|
|
sl_vec:
|
|
@@ -2387,7 +2560,12 @@ implementation
|
|
|
blocksize,size_of_int : longint;
|
|
blocksize,size_of_int : longint;
|
|
|
tag : tdwarf_tag;
|
|
tag : tdwarf_tag;
|
|
|
has_high_reg : boolean;
|
|
has_high_reg : boolean;
|
|
|
- dreg,dreghigh : byte;
|
|
|
|
|
|
|
+ dreg,dreghigh : shortint;
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ has_segment_sym_name : boolean=false;
|
|
|
|
|
+ segment_sym_name : TSymStr='';
|
|
|
|
|
+ segment_reg: TRegister=NR_NO;
|
|
|
|
|
+{$endif i8086}
|
|
|
begin
|
|
begin
|
|
|
blocksize:=0;
|
|
blocksize:=0;
|
|
|
dreghigh:=0;
|
|
dreghigh:=0;
|
|
@@ -2413,15 +2591,19 @@ implementation
|
|
|
LOC_FPUREGISTER,
|
|
LOC_FPUREGISTER,
|
|
|
LOC_CFPUREGISTER :
|
|
LOC_CFPUREGISTER :
|
|
|
begin
|
|
begin
|
|
|
- dreg:=dwarf_reg(sym.localloc.register);
|
|
|
|
|
|
|
+ { dwarf_reg_no_error might return -1
|
|
|
|
|
+ in case the register variable has been optimized out }
|
|
|
|
|
+ dreg:=dwarf_reg_no_error(sym.localloc.register);
|
|
|
has_high_reg:=(sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER]) and (sym.localloc.registerhi<>NR_NO);
|
|
has_high_reg:=(sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER]) and (sym.localloc.registerhi<>NR_NO);
|
|
|
if has_high_reg then
|
|
if has_high_reg then
|
|
|
- dreghigh:=dwarf_reg(sym.localloc.registerhi);
|
|
|
|
|
|
|
+ dreghigh:=dwarf_reg_no_error(sym.localloc.registerhi);
|
|
|
|
|
+ if dreghigh=-1 then
|
|
|
|
|
+ has_high_reg:=false;
|
|
|
if (sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER]) and
|
|
if (sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER]) and
|
|
|
(sym.typ=paravarsym) and
|
|
(sym.typ=paravarsym) and
|
|
|
paramanager.push_addr_param(sym.varspez,sym.vardef,tprocdef(sym.owner.defowner).proccalloption) and
|
|
paramanager.push_addr_param(sym.varspez,sym.vardef,tprocdef(sym.owner.defowner).proccalloption) and
|
|
|
not(vo_has_local_copy in sym.varoptions) and
|
|
not(vo_has_local_copy in sym.varoptions) and
|
|
|
- not is_open_string(sym.vardef) then
|
|
|
|
|
|
|
+ not is_open_string(sym.vardef) and (dreg>=0) then
|
|
|
begin
|
|
begin
|
|
|
templist.concat(tai_const.create_8bit(ord(DW_OP_bregx)));
|
|
templist.concat(tai_const.create_8bit(ord(DW_OP_bregx)));
|
|
|
templist.concat(tai_const.create_uleb128bit(dreg));
|
|
templist.concat(tai_const.create_uleb128bit(dreg));
|
|
@@ -2447,7 +2629,7 @@ implementation
|
|
|
templist.concat(tai_const.create_uleb128bit(size_of_int));
|
|
templist.concat(tai_const.create_uleb128bit(size_of_int));
|
|
|
blocksize:=blocksize+1+Lengthuleb128(size_of_int);
|
|
blocksize:=blocksize+1+Lengthuleb128(size_of_int);
|
|
|
end
|
|
end
|
|
|
- else
|
|
|
|
|
|
|
+ else if (dreg>=0) then
|
|
|
begin
|
|
begin
|
|
|
templist.concat(tai_const.create_8bit(ord(DW_OP_regx)));
|
|
templist.concat(tai_const.create_8bit(ord(DW_OP_regx)));
|
|
|
templist.concat(tai_const.create_uleb128bit(dreg));
|
|
templist.concat(tai_const.create_uleb128bit(dreg));
|
|
@@ -2475,6 +2657,10 @@ implementation
|
|
|
templist.concat(tai_const.create_8bit(ord(DW_OP_addr)));
|
|
templist.concat(tai_const.create_8bit(ord(DW_OP_addr)));
|
|
|
templist.concat(tai_const.Create_type_name(aitconst_ptr_unaligned,sym.mangledname,offset));
|
|
templist.concat(tai_const.Create_type_name(aitconst_ptr_unaligned,sym.mangledname,offset));
|
|
|
blocksize:=1+sizeof(puint);
|
|
blocksize:=1+sizeof(puint);
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ segment_sym_name:=sym.mangledname;
|
|
|
|
|
+ has_segment_sym_name:=true;
|
|
|
|
|
+{$endif i8086}
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
paravarsym,
|
|
paravarsym,
|
|
@@ -2486,10 +2672,32 @@ implementation
|
|
|
}
|
|
}
|
|
|
if sym.localloc.loc<> LOC_INVALID then
|
|
if sym.localloc.loc<> LOC_INVALID then
|
|
|
begin
|
|
begin
|
|
|
- dreg:=dwarf_reg(sym.localloc.reference.base);
|
|
|
|
|
- templist.concat(tai_const.create_8bit(ord(DW_OP_breg0)+dreg));
|
|
|
|
|
- templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
|
|
|
|
- blocksize:=1+Lengthsleb128(sym.localloc.reference.offset);
|
|
|
|
|
|
|
+ if is_fbreg(sym.localloc.reference.base) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ templist.concat(tai_const.create_8bit(ord(DW_OP_fbreg)));
|
|
|
|
|
+ templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
|
|
|
|
+ blocksize:=1+Lengthsleb128(sym.localloc.reference.offset+offset);
|
|
|
|
|
+ end
|
|
|
|
|
+ else
|
|
|
|
|
+ begin
|
|
|
|
|
+ dreg:=dwarf_reg(sym.localloc.reference.base);
|
|
|
|
|
+ if dreg<=31 then
|
|
|
|
|
+ begin
|
|
|
|
|
+ templist.concat(tai_const.create_8bit(ord(DW_OP_breg0)+dreg));
|
|
|
|
|
+ templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
|
|
|
|
+ blocksize:=1+Lengthsleb128(sym.localloc.reference.offset+offset);
|
|
|
|
|
+ end
|
|
|
|
|
+ else
|
|
|
|
|
+ begin
|
|
|
|
|
+ templist.concat(tai_const.create_8bit(ord(DW_OP_bregx)));
|
|
|
|
|
+ templist.concat(tai_const.create_uleb128bit(dreg));
|
|
|
|
|
+ templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
|
|
|
|
+ blocksize:=1+Lengthuleb128(dreg)+LengthSleb128(sym.localloc.reference.offset+offset);
|
|
|
|
|
+ end;
|
|
|
|
|
+ end;
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ segment_reg:=sym.localloc.reference.segment;
|
|
|
|
|
+{$endif i8086}
|
|
|
{$ifndef gdb_supports_DW_AT_variable_parameter}
|
|
{$ifndef gdb_supports_DW_AT_variable_parameter}
|
|
|
{ Parameters which are passed by reference. (var and the like)
|
|
{ Parameters which are passed by reference. (var and the like)
|
|
|
Hide the reference-pointer and dereference the pointer
|
|
Hide the reference-pointer and dereference the pointer
|
|
@@ -2591,6 +2799,12 @@ implementation
|
|
|
if (vo_is_self in sym.varoptions) then
|
|
if (vo_is_self in sym.varoptions) then
|
|
|
append_attribute(DW_AT_artificial,DW_FORM_flag,[true]);
|
|
append_attribute(DW_AT_artificial,DW_FORM_flag,[true]);
|
|
|
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def));
|
|
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def));
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ if has_segment_sym_name then
|
|
|
|
|
+ append_seg_name(segment_sym_name)
|
|
|
|
|
+ else if segment_reg<>NR_NO then
|
|
|
|
|
+ append_seg_reg(segment_reg);
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
|
|
|
templist.free;
|
|
templist.free;
|
|
|
|
|
|
|
@@ -2952,8 +3166,6 @@ implementation
|
|
|
templist.free;
|
|
templist.free;
|
|
|
exit;
|
|
exit;
|
|
|
end;
|
|
end;
|
|
|
- else
|
|
|
|
|
- internalerror(2013120111);
|
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
append_entry(DW_TAG_variable,false,[
|
|
append_entry(DW_TAG_variable,false,[
|
|
@@ -3173,7 +3385,7 @@ implementation
|
|
|
bind: tasmsymbind;
|
|
bind: tasmsymbind;
|
|
|
lang: tdwarf_source_language;
|
|
lang: tdwarf_source_language;
|
|
|
begin
|
|
begin
|
|
|
- current_module.flags:=current_module.flags or uf_has_dwarf_debuginfo;
|
|
|
|
|
|
|
+ include(current_module.moduleflags,mf_has_dwarf_debuginfo);
|
|
|
storefilepos:=current_filepos;
|
|
storefilepos:=current_filepos;
|
|
|
current_filepos:=current_module.mainfilepos;
|
|
current_filepos:=current_module.mainfilepos;
|
|
|
|
|
|
|
@@ -3230,10 +3442,20 @@ implementation
|
|
|
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_infosection0',AB_LOCAL,AT_METADATA,voidpointertype),
|
|
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_infosection0',AB_LOCAL,AT_METADATA,voidpointertype),
|
|
|
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
|
current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_METADATA,voidpointertype)));
|
|
|
|
|
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ { address_size }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(4));
|
|
|
|
|
+ { segment_size }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(2));
|
|
|
|
|
+ { no alignment/padding bytes on i8086 for Open Watcom compatibility }
|
|
|
|
|
+{$else i8086}
|
|
|
|
|
+ { address_size }
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(sizeof(pint)));
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(sizeof(pint)));
|
|
|
|
|
+ { segment_size }
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(0));
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(0));
|
|
|
{ alignment }
|
|
{ alignment }
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_32bit_unaligned(0));
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_32bit_unaligned(0));
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
|
|
|
{ start ranges section }
|
|
{ start ranges section }
|
|
|
new_section(current_asmdata.asmlists[al_dwarf_ranges],sec_debug_ranges,'',0);
|
|
new_section(current_asmdata.asmlists[al_dwarf_ranges],sec_debug_ranges,'',0);
|
|
@@ -3274,6 +3496,22 @@ implementation
|
|
|
DW_AT_language,DW_FORM_data1,lang,
|
|
DW_AT_language,DW_FORM_data1,lang,
|
|
|
DW_AT_identifier_case,DW_FORM_data1,DW_ID_case_insensitive]);
|
|
DW_AT_identifier_case,DW_FORM_data1,DW_ID_case_insensitive]);
|
|
|
|
|
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ case current_settings.x86memorymodel of
|
|
|
|
|
+ mm_tiny,
|
|
|
|
|
+ mm_small:
|
|
|
|
|
+ append_attribute(DW_AT_WATCOM_memory_model,DW_FORM_data1,[DW_WATCOM_MEMORY_MODEL_small]);
|
|
|
|
|
+ mm_medium:
|
|
|
|
|
+ append_attribute(DW_AT_WATCOM_memory_model,DW_FORM_data1,[DW_WATCOM_MEMORY_MODEL_medium]);
|
|
|
|
|
+ mm_compact:
|
|
|
|
|
+ append_attribute(DW_AT_WATCOM_memory_model,DW_FORM_data1,[DW_WATCOM_MEMORY_MODEL_compact]);
|
|
|
|
|
+ mm_large:
|
|
|
|
|
+ append_attribute(DW_AT_WATCOM_memory_model,DW_FORM_data1,[DW_WATCOM_MEMORY_MODEL_large]);
|
|
|
|
|
+ mm_huge:
|
|
|
|
|
+ append_attribute(DW_AT_WATCOM_memory_model,DW_FORM_data1,[DW_WATCOM_MEMORY_MODEL_huge]);
|
|
|
|
|
+ end;
|
|
|
|
|
+{$endif i8086}
|
|
|
|
|
+
|
|
|
{ reference to line info section }
|
|
{ reference to line info section }
|
|
|
if not(tf_dwarf_relative_addresses in target_info.flags) then
|
|
if not(tf_dwarf_relative_addresses in target_info.flags) then
|
|
|
append_labelentry_dataptr_abs(DW_AT_stmt_list,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_METADATA,voidpointertype))
|
|
append_labelentry_dataptr_abs(DW_AT_stmt_list,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_METADATA,voidpointertype))
|
|
@@ -3340,8 +3578,19 @@ implementation
|
|
|
if not(target_info.system in systems_darwin) then
|
|
if not(target_info.system in systems_darwin) then
|
|
|
begin
|
|
begin
|
|
|
{ end of aranges table }
|
|
{ end of aranges table }
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ { 32-bit offset }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_32bit_unaligned(0));
|
|
|
|
|
+ { 16-bit segment }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_16bit_unaligned(0));
|
|
|
|
|
+ { 32-bit length }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_32bit_unaligned(0));
|
|
|
|
|
+{$else i8086}
|
|
|
|
|
+ { offset }
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
|
|
|
|
|
+ { length }
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
|
|
|
|
|
+{$endif i8086}
|
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_symbol.createname(target_asm.labelprefix+'earanges0',AT_METADATA,0,voidpointertype));
|
|
current_asmdata.asmlists[al_dwarf_aranges].concat(tai_symbol.createname(target_asm.labelprefix+'earanges0',AT_METADATA,0,voidpointertype));
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
@@ -3378,7 +3627,7 @@ implementation
|
|
|
hp:=tmodule(loaded_units.first);
|
|
hp:=tmodule(loaded_units.first);
|
|
|
while assigned(hp) do
|
|
while assigned(hp) do
|
|
|
begin
|
|
begin
|
|
|
- If ((hp.flags and uf_has_dwarf_debuginfo)=uf_has_dwarf_debuginfo) and not assigned(hp.package) then
|
|
|
|
|
|
|
+ If (mf_has_dwarf_debuginfo in hp.moduleflags) and not assigned(hp.package) then
|
|
|
begin
|
|
begin
|
|
|
list.concat(Tai_const.Createname(make_mangledname('DEBUGSTART',hp.localsymtable,''),0));
|
|
list.concat(Tai_const.Createname(make_mangledname('DEBUGSTART',hp.localsymtable,''),0));
|
|
|
list.concat(Tai_const.Createname(make_mangledname('DEBUGEND',hp.localsymtable,''),0));
|
|
list.concat(Tai_const.Createname(make_mangledname('DEBUGEND',hp.localsymtable,''),0));
|
|
@@ -3425,17 +3674,21 @@ implementation
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
- procedure tdebuginfodwarf.append_visibility(vis: tvisibility);
|
|
|
|
|
|
|
+ procedure TDebugInfoDwarf.append_visibility(vis: tvisibility);
|
|
|
begin
|
|
begin
|
|
|
case vis of
|
|
case vis of
|
|
|
|
|
+ vis_hidden,
|
|
|
vis_private,
|
|
vis_private,
|
|
|
vis_strictprivate:
|
|
vis_strictprivate:
|
|
|
append_attribute(DW_AT_accessibility,DW_FORM_data1,[ord(DW_ACCESS_private)]);
|
|
append_attribute(DW_AT_accessibility,DW_FORM_data1,[ord(DW_ACCESS_private)]);
|
|
|
vis_protected,
|
|
vis_protected,
|
|
|
vis_strictprotected:
|
|
vis_strictprotected:
|
|
|
append_attribute(DW_AT_accessibility,DW_FORM_data1,[ord(DW_ACCESS_protected)]);
|
|
append_attribute(DW_AT_accessibility,DW_FORM_data1,[ord(DW_ACCESS_protected)]);
|
|
|
|
|
+ vis_published,
|
|
|
vis_public:
|
|
vis_public:
|
|
|
{ default };
|
|
{ default };
|
|
|
|
|
+ vis_none:
|
|
|
|
|
+ internalerror(2019050720);
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
@@ -3501,8 +3754,12 @@ implementation
|
|
|
inc(nolineinfolevel);
|
|
inc(nolineinfolevel);
|
|
|
mark_NoLineInfoEnd:
|
|
mark_NoLineInfoEnd:
|
|
|
dec(nolineinfolevel);
|
|
dec(nolineinfolevel);
|
|
|
|
|
+ else
|
|
|
|
|
+ ;
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
+ else
|
|
|
|
|
+ ;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
if (currsectype=sec_code) and
|
|
if (currsectype=sec_code) and
|
|
@@ -3551,16 +3808,25 @@ implementation
|
|
|
asmline.concat(tai_comment.Create(strpnew('['+tostr(currfileinfo.line)+':'+tostr(currfileinfo.column)+']')));
|
|
asmline.concat(tai_comment.Create(strpnew('['+tostr(currfileinfo.line)+':'+tostr(currfileinfo.column)+']')));
|
|
|
|
|
|
|
|
if (prevlabel = nil) or
|
|
if (prevlabel = nil) or
|
|
|
- { darwin's assembler cannot create an uleb128 of the difference }
|
|
|
|
|
- { between to symbols }
|
|
|
|
|
- { same goes for Solaris native assembler }
|
|
|
|
|
- (target_info.system in systems_darwin) or
|
|
|
|
|
|
|
+ { darwin's assembler cannot create an uleb128 of the difference
|
|
|
|
|
+ between to symbols
|
|
|
|
|
+ same goes for Solaris native assembler
|
|
|
|
|
+ ... and riscv }
|
|
|
|
|
+
|
|
|
|
|
+ (target_info.system in systems_darwin+[system_riscv32_linux,system_riscv64_linux]) or
|
|
|
(target_asm.id=as_solaris_as) then
|
|
(target_asm.id=as_solaris_as) then
|
|
|
begin
|
|
begin
|
|
|
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_type_sym(aitconst_ptr_unaligned,currlabel));
|
|
asmline.concat(tai_const.create_type_sym(aitconst_ptr_unaligned,currlabel));
|
|
|
|
|
+{$ifdef i8086}
|
|
|
|
|
+ { on i8086 we also emit an Open Watcom-specific 'set segment' op }
|
|
|
|
|
+ asmline.concat(tai_const.create_8bit(DW_LNS_extended_op));
|
|
|
|
|
+ asmline.concat(tai_const.create_uleb128bit(3));
|
|
|
|
|
+ asmline.concat(tai_const.create_8bit(DW_LNE_set_segment));
|
|
|
|
|
+ asmline.concat(tai_const.Create_seg_name(currlabel.Name));
|
|
|
|
|
+{$endif i8086}
|
|
|
end
|
|
end
|
|
|
else
|
|
else
|
|
|
begin
|
|
begin
|
|
@@ -4003,17 +4269,17 @@ implementation
|
|
|
{ now the information about the length of the string }
|
|
{ now the information about the length of the string }
|
|
|
if deref then
|
|
if deref then
|
|
|
begin
|
|
begin
|
|
|
- if (chardef.size=1) then
|
|
|
|
|
|
|
+ if not (is_widestring(def) and (tf_winlikewidestring in target_info.flags)) then
|
|
|
upperopcodes:=13
|
|
upperopcodes:=13
|
|
|
else
|
|
else
|
|
|
- upperopcodes:=15;
|
|
|
|
|
|
|
+ upperopcodes:=16;
|
|
|
{ lower bound is always 1, upper bound (length) needs to be calculated }
|
|
{ lower bound is always 1, upper bound (length) needs to be calculated }
|
|
|
append_entry(DW_TAG_subrange_type,false,[
|
|
append_entry(DW_TAG_subrange_type,false,[
|
|
|
DW_AT_lower_bound,DW_FORM_udata,1,
|
|
DW_AT_lower_bound,DW_FORM_udata,1,
|
|
|
DW_AT_upper_bound,DW_FORM_block1,upperopcodes
|
|
DW_AT_upper_bound,DW_FORM_block1,upperopcodes
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
- { high(string) is stored sizeof(ptrint) bytes before the string data }
|
|
|
|
|
|
|
+ { high(string) is stored sizeof(sizeint) bytes before the string data }
|
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address)));
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address)));
|
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref)));
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref)));
|
|
|
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)));
|
|
@@ -4025,12 +4291,22 @@ implementation
|
|
|
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_unaligned(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)));
|
|
|
|
|
|
|
+ if upperopcodes=16 then
|
|
|
|
|
+ { for Windows WideString the size is always a DWORD }
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit4)))
|
|
|
|
|
+ else
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizesinttype.size));
|
|
|
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)));
|
|
|
- current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref)));
|
|
|
|
|
|
|
+ if upperopcodes=16 then
|
|
|
|
|
+ begin
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref_size)));
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4));
|
|
|
|
|
+ end
|
|
|
|
|
+ else
|
|
|
|
|
+ current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref)));
|
|
|
|
|
|
|
|
{ for widestrings, the length is specified in bytes, so divide by two }
|
|
{ for widestrings, the length is specified in bytes, so divide by two }
|
|
|
- if (upperopcodes=15) then
|
|
|
|
|
|
|
+ if (upperopcodes=16) then
|
|
|
begin
|
|
begin
|
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit1)));
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit1)));
|
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_shr)));
|
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_shr)));
|
|
@@ -4054,6 +4330,13 @@ implementation
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
|
+ if (ds_dwarf_cpp in current_settings.debugswitches) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ // At least LLDB 6.0.0 does not like this implementation of string types.
|
|
|
|
|
+ // Call the inherited DWARF 2 implementation, which works fine.
|
|
|
|
|
+ inherited;
|
|
|
|
|
+ exit;
|
|
|
|
|
+ end;
|
|
|
case def.stringtype of
|
|
case def.stringtype of
|
|
|
st_shortstring:
|
|
st_shortstring:
|
|
|
begin
|
|
begin
|
|
@@ -4077,15 +4360,7 @@ implementation
|
|
|
end;
|
|
end;
|
|
|
st_widestring:
|
|
st_widestring:
|
|
|
begin
|
|
begin
|
|
|
- if not(tf_winlikewidestring in target_info.flags) then
|
|
|
|
|
- addstringdef('WideString',cwidechartype,true,-1)
|
|
|
|
|
- else
|
|
|
|
|
- begin
|
|
|
|
|
- { looks like a pwidechar (no idea about length location) }
|
|
|
|
|
- append_entry(DW_TAG_pointer_type,false,[]);
|
|
|
|
|
- append_labelentry_ref(DW_AT_type,def_dwarf_lab(cwidechartype));
|
|
|
|
|
- finish_entry;
|
|
|
|
|
- end;
|
|
|
|
|
|
|
+ addstringdef('WideString',cwidechartype,true,-1)
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|