mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 12:07:58 +02:00
+ support for writing JVM line number information
* moved emitting line information from agjasmin to dbgjasm (+ it now also works if -al is not used) git-svn-id: branches/jvmbackend@18355 -
This commit is contained in:
parent
d456ec2ffe
commit
e20919f065
@ -295,7 +295,7 @@ interface
|
||||
asd_reference,asd_no_dead_strip,asd_weak_reference,asd_lazy_reference,
|
||||
asd_weak_definition,
|
||||
{ for Jasmin }
|
||||
asd_jclass,asd_jinterface,asd_jsuper,asd_jfield,asd_jlimit
|
||||
asd_jclass,asd_jinterface,asd_jsuper,asd_jfield,asd_jlimit,asd_jline
|
||||
);
|
||||
|
||||
const
|
||||
@ -307,7 +307,7 @@ interface
|
||||
'extern','nasm_import', 'tc', 'reference',
|
||||
'no_dead_strip','weak_reference','lazy_reference','weak_definition',
|
||||
{ for Jasmin }
|
||||
'class','interface','super','field','limit'
|
||||
'class','interface','super','field','limit','line'
|
||||
);
|
||||
|
||||
type
|
||||
|
@ -164,9 +164,7 @@ implementation
|
||||
last_align := 2;
|
||||
InlineLevel:=0;
|
||||
{ lineinfo is only needed for al_procedures (PFV) }
|
||||
do_line:=(cs_asm_source in current_settings.globalswitches) or
|
||||
((cs_lineinfo in current_settings.moduleswitches)
|
||||
and (p=current_asmdata.asmlists[al_procedures]));
|
||||
do_line:=(cs_asm_source in current_settings.globalswitches);
|
||||
hp:=tai(p.first);
|
||||
while assigned(hp) do
|
||||
begin
|
||||
@ -193,6 +191,7 @@ implementation
|
||||
{ be sure to change line !! }
|
||||
lastfileinfo.line:=-1;
|
||||
end;
|
||||
|
||||
{ write source }
|
||||
if (cs_asm_source in current_settings.globalswitches) and
|
||||
assigned(infile) then
|
||||
|
@ -130,7 +130,57 @@ implementation
|
||||
end;
|
||||
|
||||
procedure TDebugInfoJasmin.insertlineinfo(list: TAsmList);
|
||||
var
|
||||
currfileinfo,
|
||||
lastfileinfo : tfileposinfo;
|
||||
nolineinfolevel : Integer;
|
||||
currfuncname : pshortstring;
|
||||
hp : tai;
|
||||
begin
|
||||
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;
|
||||
|
||||
{ Java does 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_jline,tostr(currfileinfo.line)),hp);
|
||||
end;
|
||||
lastfileinfo:=currfileinfo;
|
||||
end;
|
||||
|
||||
hp:=tai(hp.next);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user