mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-22 15:19:42 +01:00
* first things to include lineinfo in the executable
This commit is contained in:
parent
be98f80d7f
commit
54baf96873
@ -336,6 +336,10 @@ unit ag386att;
|
|||||||
procedure ti386attasmlist.WriteTree(p:paasmoutput);
|
procedure ti386attasmlist.WriteTree(p:paasmoutput);
|
||||||
const
|
const
|
||||||
allocstr : array[boolean] of string[10]=(' released',' allocated');
|
allocstr : array[boolean] of string[10]=(' released',' allocated');
|
||||||
|
nolinetai =[ait_label,
|
||||||
|
ait_regalloc,ait_tempalloc,
|
||||||
|
ait_stabn,ait_stabs,ait_section,
|
||||||
|
ait_cut,ait_marker,ait_align,ait_stab_function_name];
|
||||||
type
|
type
|
||||||
t80bitarray = array[0..9] of byte;
|
t80bitarray = array[0..9] of byte;
|
||||||
t64bitarray = array[0..7] of byte;
|
t64bitarray = array[0..7] of byte;
|
||||||
@ -358,66 +362,72 @@ unit ag386att;
|
|||||||
begin
|
begin
|
||||||
if not assigned(p) then
|
if not assigned(p) then
|
||||||
exit;
|
exit;
|
||||||
do_line:=(cs_debuginfo in aktmoduleswitches) or (cs_asm_source in aktglobalswitches);
|
{ lineinfo is only needed for codesegment (PFV) }
|
||||||
|
do_line:=(cs_asm_source in aktglobalswitches) or
|
||||||
|
((cs_lineinfo in aktmoduleswitches) and (p=codesegment));
|
||||||
hp:=pai(p^.first);
|
hp:=pai(p^.first);
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
aktfilepos:=hp^.fileinfo;
|
aktfilepos:=hp^.fileinfo;
|
||||||
if do_line then
|
|
||||||
|
if not(hp^.typ in nolinetai) then
|
||||||
begin
|
begin
|
||||||
{ I think it is better to write stabs before source line PM }
|
|
||||||
{$ifdef GDB}
|
{$ifdef GDB}
|
||||||
{ write stabs }
|
{ write stabs }
|
||||||
if cs_debuginfo in aktmoduleswitches then
|
if cs_debuginfo in aktmoduleswitches then
|
||||||
begin
|
WriteFileLineInfo(hp^.fileinfo);
|
||||||
if not (hp^.typ in [
|
|
||||||
ait_label,
|
|
||||||
ait_regalloc,ait_tempalloc,
|
|
||||||
ait_stabn,ait_stabs,ait_section,
|
|
||||||
ait_cut,ait_marker,ait_align,ait_stab_function_name]) then
|
|
||||||
begin
|
|
||||||
WriteFileLineInfo(hp^.fileinfo);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$endif GDB}
|
{$endif GDB}
|
||||||
{ load infile }
|
|
||||||
if lastfileinfo.fileindex<>hp^.fileinfo.fileindex then
|
if do_line then
|
||||||
begin
|
begin
|
||||||
infile:=current_module^.sourcefiles^.get_file(hp^.fileinfo.fileindex);
|
{ load infile }
|
||||||
{ open only if needed !! }
|
if lastfileinfo.fileindex<>hp^.fileinfo.fileindex then
|
||||||
if (cs_asm_source in aktglobalswitches) then
|
|
||||||
infile^.open;
|
|
||||||
{ avoid unnecessary reopens of the same file !! }
|
|
||||||
lastfileinfo.fileindex:=hp^.fileinfo.fileindex;
|
|
||||||
{ be sure to change line !! }
|
|
||||||
lastfileinfo.line:=-1;
|
|
||||||
end;
|
|
||||||
{ write source }
|
|
||||||
if (cs_asm_source in aktglobalswitches) and
|
|
||||||
not (hp^.typ in [
|
|
||||||
ait_label,
|
|
||||||
ait_stabn,ait_stabs,ait_section,
|
|
||||||
ait_cut,ait_align,ait_stab_function_name]) then
|
|
||||||
begin
|
|
||||||
if (infile<>lastinfile) and assigned(lastinfile) then
|
|
||||||
begin
|
begin
|
||||||
AsmWriteLn(target_asm.comment+'['+infile^.name^+']');
|
infile:=current_module^.sourcefiles^.get_file(hp^.fileinfo.fileindex);
|
||||||
lastinfile^.close;
|
{ open only if needed !! }
|
||||||
|
if (cs_asm_source in aktglobalswitches) then
|
||||||
|
infile^.open;
|
||||||
|
{ avoid unnecessary reopens of the same file !! }
|
||||||
|
lastfileinfo.fileindex:=hp^.fileinfo.fileindex;
|
||||||
|
{ be sure to change line !! }
|
||||||
|
lastfileinfo.line:=-1;
|
||||||
end;
|
end;
|
||||||
if (hp^.fileinfo.line<>lastfileinfo.line) and
|
{ write source }
|
||||||
(hp^.fileinfo.line<infile^.maxlinebuf) then
|
if (cs_asm_source in aktglobalswitches) then
|
||||||
begin
|
begin
|
||||||
if (hp^.fileinfo.line<>0) and
|
if (infile<>lastinfile) and assigned(lastinfile) then
|
||||||
(infile^.linebuf^[hp^.fileinfo.line]>=0) then
|
begin
|
||||||
AsmWriteLn(target_asm.comment+'['+tostr(hp^.fileinfo.line)+'] '+
|
AsmWriteLn(target_asm.comment+'['+infile^.name^+']');
|
||||||
fixline(infile^.GetLineStr(hp^.fileinfo.line)));
|
lastinfile^.close;
|
||||||
{ set it to a negative value !
|
end;
|
||||||
to make that is has been read already !! PM }
|
if (hp^.fileinfo.line<>lastfileinfo.line) and
|
||||||
infile^.linebuf^[hp^.fileinfo.line]:=-infile^.linebuf^[hp^.fileinfo.line]-1;
|
(hp^.fileinfo.line<infile^.maxlinebuf) then
|
||||||
end;
|
begin
|
||||||
lastfileinfo:=hp^.fileinfo;
|
if (hp^.fileinfo.line<>0) and
|
||||||
lastinfile:=infile;
|
(infile^.linebuf^[hp^.fileinfo.line]>=0) then
|
||||||
end;
|
AsmWriteLn(target_asm.comment+'['+tostr(hp^.fileinfo.line)+'] '+
|
||||||
|
fixline(infile^.GetLineStr(hp^.fileinfo.line)));
|
||||||
|
{ set it to a negative value !
|
||||||
|
to make that is has been read already !! PM }
|
||||||
|
infile^.linebuf^[hp^.fileinfo.line]:=-infile^.linebuf^[hp^.fileinfo.line]-1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ifdef LINEINFO}
|
||||||
|
{ lineinfo }
|
||||||
|
if (cs_lineinfo in aktmoduleswitches) then
|
||||||
|
begin
|
||||||
|
if (infile<>lastinfile) then
|
||||||
|
begin
|
||||||
|
lineinfolist^.concat(new(pai_const(init_8bit
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$endif LINEINFO}
|
||||||
|
lastfileinfo:=hp^.fileinfo;
|
||||||
|
lastinfile:=infile;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
case hp^.typ of
|
case hp^.typ of
|
||||||
@ -834,7 +844,10 @@ unit ag386att;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 1999-08-10 12:26:20 pierre
|
Revision 1.10 1999-08-13 15:44:57 peter
|
||||||
|
* first things to include lineinfo in the executable
|
||||||
|
|
||||||
|
Revision 1.9 1999/08/10 12:26:20 pierre
|
||||||
* avoid double .edata section if using DLLTOOL
|
* avoid double .edata section if using DLLTOOL
|
||||||
|
|
||||||
Revision 1.8 1999/08/04 00:22:34 florian
|
Revision 1.8 1999/08/04 00:22:34 florian
|
||||||
|
|||||||
@ -79,6 +79,7 @@ interface
|
|||||||
cs_typed_const_not_changeable,
|
cs_typed_const_not_changeable,
|
||||||
{ generation }
|
{ generation }
|
||||||
cs_profile,cs_debuginfo,cs_browser,cs_local_browser,cs_compilesystem,
|
cs_profile,cs_debuginfo,cs_browser,cs_local_browser,cs_compilesystem,
|
||||||
|
cs_lineinfo,
|
||||||
{ linking }
|
{ linking }
|
||||||
cs_smartlink
|
cs_smartlink
|
||||||
);
|
);
|
||||||
@ -177,7 +178,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.16 1999-08-11 17:26:33 peter
|
Revision 1.17 1999-08-13 15:44:58 peter
|
||||||
|
* first things to include lineinfo in the executable
|
||||||
|
|
||||||
|
Revision 1.16 1999/08/11 17:26:33 peter
|
||||||
* tlinker object is now inherited for win32 and dos
|
* tlinker object is now inherited for win32 and dos
|
||||||
* postprocessexecutable is now a method of tlinker
|
* postprocessexecutable is now a method of tlinker
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user