mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 21:49:31 +02:00
* fixed open arrays with dwarf
* fixed line info writting for smart linked files git-svn-id: trunk@2446 -
This commit is contained in:
parent
301042c824
commit
2ff2918016
compiler
@ -521,7 +521,7 @@ interface
|
||||
tai_file = class(tai)
|
||||
str : pchar;
|
||||
idx : longint;
|
||||
constructor Create(_str : string;_idx : longint);
|
||||
constructor Create(_str : string);
|
||||
destructor Destroy; override;
|
||||
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
|
||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||
@ -530,10 +530,10 @@ interface
|
||||
|
||||
{ Generates a dwarf line location }
|
||||
tai_loc = class(tai)
|
||||
fileidx,
|
||||
fileentry : tai_file;
|
||||
line,
|
||||
column : longint;
|
||||
constructor Create(_fileidx,_line,_column : longint);
|
||||
constructor Create(_fileidx : tai_file;_line,_column : longint);
|
||||
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
|
||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||
end;
|
||||
@ -1934,12 +1934,11 @@ implementation
|
||||
tai_file
|
||||
****************************************************************************}
|
||||
|
||||
constructor tai_file.Create(_str : string;_idx : longint);
|
||||
constructor tai_file.Create(_str : string);
|
||||
begin
|
||||
inherited Create;
|
||||
typ:=ait_file;
|
||||
str:=strpnew(_str);
|
||||
idx:=_idx;
|
||||
end;
|
||||
|
||||
|
||||
@ -1990,11 +1989,11 @@ implementation
|
||||
tai_loc
|
||||
****************************************************************************}
|
||||
|
||||
constructor tai_loc.Create(_fileidx,_line,_column : longint);
|
||||
constructor tai_loc.Create(_fileidx : tai_file;_line,_column : longint);
|
||||
begin
|
||||
inherited Create;
|
||||
typ:=ait_loc;
|
||||
fileidx:=_fileidx;
|
||||
fileentry:=_fileidx;
|
||||
line:=_line;
|
||||
column:=_column;
|
||||
end;
|
||||
@ -2003,7 +2002,7 @@ implementation
|
||||
constructor tai_loc.ppuload(t:taitype;ppufile:tcompilerppufile);
|
||||
begin
|
||||
inherited ppuload(t,ppufile);
|
||||
fileidx:=ppufile.getlongint;
|
||||
{!!!! fileidx:=ppufile.getlongint; }
|
||||
line:=ppufile.getlongint;
|
||||
column:=ppufile.getlongint;
|
||||
end;
|
||||
@ -2012,7 +2011,7 @@ implementation
|
||||
procedure tai_loc.ppuwrite(ppufile:tcompilerppufile);
|
||||
begin
|
||||
inherited ppuwrite(ppufile);
|
||||
ppufile.putlongint(fileidx);
|
||||
{!!!!! ppufile.putlongint(fileidx); }
|
||||
ppufile.putlongint(line);
|
||||
ppufile.putlongint(column);
|
||||
end;
|
||||
|
@ -360,10 +360,13 @@ implementation
|
||||
do_line : boolean;
|
||||
|
||||
sepChar : char;
|
||||
nextdwarffileidx : longint;
|
||||
begin
|
||||
if not assigned(p) then
|
||||
exit;
|
||||
|
||||
nextdwarffileidx:=1;
|
||||
|
||||
last_align := 2;
|
||||
InlineLevel:=0;
|
||||
{ lineinfo is only needed for al_procedures (PFV) }
|
||||
@ -881,6 +884,8 @@ implementation
|
||||
|
||||
ait_file :
|
||||
begin
|
||||
tai_file(hp).idx:=nextdwarffileidx;
|
||||
inc(nextdwarffileidx);
|
||||
AsmWrite(#9'.file '+tostr(tai_file(hp).idx)+' "');
|
||||
|
||||
AsmWritePChar(tai_file(hp).str);
|
||||
@ -890,7 +895,7 @@ implementation
|
||||
|
||||
ait_loc :
|
||||
begin
|
||||
AsmWrite(#9'.loc '+tostr(tai_loc(hp).fileidx)+' '+tostr(tai_loc(hp).line)+' '+tostr(tai_loc(hp).column));
|
||||
AsmWrite(#9'.loc '+tostr(tai_loc(hp).fileentry.idx)+' '+tostr(tai_loc(hp).line)+' '+tostr(tai_loc(hp).column));
|
||||
AsmLn;
|
||||
end;
|
||||
|
||||
@ -920,6 +925,9 @@ implementation
|
||||
if CurrSecType<>sec_none then
|
||||
WriteSection(CurrSecType,'');
|
||||
AsmStartSize:=AsmSize;
|
||||
|
||||
{ reset dwarf file index }
|
||||
nextdwarffileidx:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -189,7 +189,6 @@ interface
|
||||
|
||||
TDebugInfoDwarf = class(TDebugInfo)
|
||||
private
|
||||
currfileidx : longint;
|
||||
currabbrevnumber : longint;
|
||||
|
||||
writing_def_dwarf : boolean;
|
||||
@ -817,16 +816,22 @@ implementation
|
||||
|
||||
|
||||
procedure append_dwarftag_arraydef(def:tarraydef);
|
||||
var
|
||||
size : aint;
|
||||
begin
|
||||
if is_open_array(def) then
|
||||
size:=def.elesize
|
||||
else
|
||||
size:=def.size;
|
||||
if assigned(def.typesym) then
|
||||
append_entry(DW_TAG_array_type,true,[
|
||||
DW_AT_name,DW_FORM_string,def.typesym.name+#0,
|
||||
DW_AT_byte_size,DW_FORM_udata,def.size,
|
||||
DW_AT_byte_size,DW_FORM_udata,size,
|
||||
DW_AT_stride_size,DW_FORM_udata,def.elesize*8
|
||||
])
|
||||
else
|
||||
append_entry(DW_TAG_array_type,true,[
|
||||
DW_AT_byte_size,DW_FORM_udata,def.size,
|
||||
DW_AT_byte_size,DW_FORM_udata,size,
|
||||
DW_AT_stride_size,DW_FORM_udata,def.elesize*8
|
||||
]);
|
||||
append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.elementtype.def));
|
||||
@ -1023,11 +1028,19 @@ implementation
|
||||
}
|
||||
end;
|
||||
st_ansistring:
|
||||
{ looks like a pchar }
|
||||
append_dwarftag(list,cchartype.def);
|
||||
begin
|
||||
{ looks like a pchar }
|
||||
append_entry(DW_TAG_pointer_type,false,[]);
|
||||
append_labelentry_ref(DW_AT_type,def_dwarf_lab(cchartype.def));
|
||||
finish_entry;
|
||||
end;
|
||||
st_widestring:
|
||||
{ looks like a pwidechar }
|
||||
append_dwarftag(list,cwidechartype.def);
|
||||
begin
|
||||
{ looks like a pwidechar }
|
||||
append_entry(DW_TAG_pointer_type,false,[]);
|
||||
append_labelentry_ref(DW_AT_type,def_dwarf_lab(cwidechartype.def));
|
||||
finish_entry;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1947,6 +1960,7 @@ implementation
|
||||
hlabel : tasmlabel;
|
||||
hp : tai;
|
||||
infile : tinputfile;
|
||||
current_file : tai_file;
|
||||
begin
|
||||
FillChar(lastfileinfo,sizeof(lastfileinfo),0);
|
||||
currfuncname:=nil;
|
||||
@ -1974,14 +1988,16 @@ implementation
|
||||
infile:=current_module.sourcefiles.get_file(currfileinfo.fileindex);
|
||||
if assigned(infile) then
|
||||
begin
|
||||
inc(currfileidx);
|
||||
if (infile.path^<>'') then
|
||||
list.insertbefore(tai_file.create(
|
||||
BsToSlash(FixPath(infile.path^,false)+FixFileName(infile.name^)),currfileidx
|
||||
),hp)
|
||||
begin
|
||||
current_file:=tai_file.create(BsToSlash(FixPath(infile.path^,false)+FixFileName(infile.name^)));
|
||||
list.insertbefore(current_file,hp)
|
||||
end
|
||||
else
|
||||
list.insertbefore(tai_file.create(
|
||||
FixFileName(infile.name^),currfileidx),hp);
|
||||
begin
|
||||
current_file:=tai_file.create(FixFileName(infile.name^));
|
||||
list.insertbefore(current_file,hp);
|
||||
end;
|
||||
{ force new line info }
|
||||
lastfileinfo.line:=-1;
|
||||
end;
|
||||
@ -1990,7 +2006,7 @@ implementation
|
||||
{ line changed ? }
|
||||
if (lastfileinfo.line<>currfileinfo.line) and (currfileinfo.line<>0) then
|
||||
list.insertbefore(tai_loc.create(
|
||||
currfileidx,currfileinfo.line,currfileinfo.column),hp);
|
||||
current_file,currfileinfo.line,currfileinfo.column),hp);
|
||||
lastfileinfo:=currfileinfo;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user