+ introduce asd_omf_linnum_line directives; they will be used for writing LINNUM

entries in the OMF object format

git-svn-id: trunk@39007 -
This commit is contained in:
nickysn 2018-05-16 17:05:02 +00:00
parent b80642c384
commit 61e6d2afec
5 changed files with 75 additions and 4 deletions

View File

@ -357,7 +357,9 @@ interface
available on the specified CPU; this represents directives such as
NASM's 'CPU 686' or MASM/TASM's '.686p'. Might not be supported by
all assemblers. }
asd_cpu
asd_cpu,
{ for the OMF object format }
asd_omf_linnum_line
);
TAsmSehDirective=(
@ -395,7 +397,9 @@ interface
{ ARM }
'thumb_func',
'code',
'cpu'
'cpu',
{ for the OMF object format }
'omf_line'
);
sehdirectivestr : array[TAsmSehDirective] of string[16]=(
'.seh_proc','.seh_endproc',

View File

@ -1630,6 +1630,11 @@ Implementation
break;
end;
end;
{$ifdef OMFOBJSUPPORT}
asd_omf_linnum_line:
{ ignore for now, but should be added}
;
{$endif OMFOBJSUPPORT}
{$ifdef ARM}
asd_thumb_func:
ObjData.ThumbFunc:=true;
@ -1783,6 +1788,11 @@ Implementation
asd_code:
{ ignore for now, but should be added}
;
{$ifdef OMFOBJSUPPORT}
asd_omf_linnum_line:
{ ignore for now, but should be added}
;
{$endif OMFOBJSUPPORT}
asd_cpu:
begin
ObjData.CPUType:=cpu_none;

View File

@ -191,6 +191,10 @@ interface
implementation
uses
globtype,
cutils,
aasmtai,
fmodule,
systems;
{****************************************************************************
@ -198,9 +202,57 @@ implementation
****************************************************************************}
procedure TDebugInfoCodeView.insertlineinfo(list: TAsmList);
var
currfileinfo,
lastfileinfo : tfileposinfo;
nolineinfolevel : Integer;
currfuncname : pshortstring;
hp : tai;
begin
{ todo: implement }
inherited insertlineinfo(list);
FillChar(lastfileinfo,sizeof(lastfileinfo),0);
hp:=Tai(list.first);
nolineinfolevel:=0;
while assigned(hp) do
begin
case hp.typ of
ait_function_name :
begin
currfuncname:=tai_function_name(hp).funcname;
list.concat(tai_comment.Create(strpnew('function: '+currfuncname^)));
end;
ait_force_line :
begin
lastfileinfo.line:=-1;
end;
ait_marker :
begin
case tai_marker(hp).kind of
mark_NoLineInfoStart:
inc(nolineinfolevel);
mark_NoLineInfoEnd:
dec(nolineinfolevel);
end;
end;
end;
{ OMF LINNUM records do not support multiple source files }
if (hp.typ=ait_instruction) and
(nolineinfolevel=0) and
(tailineinfo(hp).fileinfo.fileindex=main_module.unit_index) then
begin
currfileinfo:=tailineinfo(hp).fileinfo;
{ line changed ? }
if (lastfileinfo.line<>currfileinfo.line) and (currfileinfo.line<>0) then
begin
{ line directive }
list.insertbefore(tai_directive.Create(asd_omf_linnum_line,tostr(currfileinfo.line)),hp);
end;
lastfileinfo:=currfileinfo;
end;
hp:=tai(hp.next);
end;
end;
{****************************************************************************

View File

@ -67,6 +67,7 @@
{$define VOLATILE_ES}
{$define SUPPORT_GET_FRAME}
{$define cpucg64shiftsupport}
{$define OMFOBJSUPPORT}
{$endif i8086}
{$ifdef i386}

View File

@ -1225,6 +1225,10 @@ interface
end;
end;
end;
{$ifdef OMFOBJSUPPORT}
asd_omf_linnum_line :
writer.AsmWriteLn('; OMF LINNUM Line '+tai_directive(hp).name);
{$endif OMFOBJSUPPORT}
else
internalerror(200509191);
end;