mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-21 19:05:16 +02:00
+ added more dwarf sections
git-svn-id: trunk@2318 -
This commit is contained in:
parent
5e694a801e
commit
aa176601fb
@ -48,9 +48,12 @@ interface
|
|||||||
|
|
||||||
TAsmSectionType=(sec_none,
|
TAsmSectionType=(sec_none,
|
||||||
sec_code,sec_data,sec_rodata,sec_bss,sec_threadvar,
|
sec_code,sec_data,sec_rodata,sec_bss,sec_threadvar,
|
||||||
sec_common, { used for executable creation }
|
{ used for executable creation }
|
||||||
sec_custom, { custom section, no prefix }
|
sec_common,
|
||||||
sec_stub, { used for darwin import stubs }
|
{ custom section, no prefix }
|
||||||
|
sec_custom,
|
||||||
|
{ used for darwin import stubs }
|
||||||
|
sec_stub,
|
||||||
{ stabs }
|
{ stabs }
|
||||||
sec_stab,sec_stabstr,
|
sec_stab,sec_stabstr,
|
||||||
{ win32 }
|
{ win32 }
|
||||||
@ -59,6 +62,9 @@ interface
|
|||||||
sec_eh_frame,
|
sec_eh_frame,
|
||||||
{ dwarf }
|
{ dwarf }
|
||||||
sec_debug_frame,
|
sec_debug_frame,
|
||||||
|
sec_debug_info,
|
||||||
|
sec_debug_line,
|
||||||
|
sec_debug_abrev,
|
||||||
{ ELF resources }
|
{ ELF resources }
|
||||||
sec_fpc,
|
sec_fpc,
|
||||||
{ Table of contents section }
|
{ Table of contents section }
|
||||||
@ -589,7 +595,7 @@ implementation
|
|||||||
'stab','stabstr',
|
'stab','stabstr',
|
||||||
'idata2','idata4','idata5','idata6','idata7','edata',
|
'idata2','idata4','idata5','idata6','idata7','edata',
|
||||||
'eh_frame',
|
'eh_frame',
|
||||||
'debug_frame',
|
'debug_frame','debug_info','debug_line','debug_abrev',
|
||||||
'fpc',
|
'fpc',
|
||||||
'toc'
|
'toc'
|
||||||
);
|
);
|
||||||
|
@ -212,7 +212,7 @@ implementation
|
|||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
'.debug_frame',
|
'.debug_frame','.debug_info','.debug_line','.debug_abrev',
|
||||||
'fpc.resptrs',
|
'fpc.resptrs',
|
||||||
'.toc'
|
'.toc'
|
||||||
);
|
);
|
||||||
@ -224,7 +224,7 @@ implementation
|
|||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
'.debug_frame',
|
'.debug_frame','.debug_info','.debug_line','.debug_abrev',
|
||||||
'fpc.resptrs',
|
'fpc.resptrs',
|
||||||
'.toc'
|
'.toc'
|
||||||
);
|
);
|
||||||
|
@ -26,10 +26,12 @@ unit dbgdwarf;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
aasmtai,
|
||||||
DbgBase;
|
DbgBase;
|
||||||
|
|
||||||
type
|
type
|
||||||
TDebugInfoDwarf=class(TDebugInfo)
|
TDebugInfoDwarf=class(TDebugInfo)
|
||||||
|
procedure insertlineinfo(list:taasmoutput);override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -44,6 +46,81 @@ implementation
|
|||||||
idtxt : 'DWARF';
|
idtxt : 'DWARF';
|
||||||
);
|
);
|
||||||
|
|
||||||
|
procedure tdebuginfodwarf.insertlineinfo(list:taasmoutput);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
{
|
||||||
|
var
|
||||||
|
currfileinfo,
|
||||||
|
lastfileinfo : tfileposinfo;
|
||||||
|
currfuncname : pstring;
|
||||||
|
currsectype : tasmsectiontype;
|
||||||
|
hlabel : tasmlabel;
|
||||||
|
hp : tai;
|
||||||
|
infile : tinputfile;
|
||||||
|
begin
|
||||||
|
FillChar(lastfileinfo,sizeof(lastfileinfo),0);
|
||||||
|
currfuncname:=nil;
|
||||||
|
currsectype:=sec_code;
|
||||||
|
hp:=Tai(list.first);
|
||||||
|
while assigned(hp) do
|
||||||
|
begin
|
||||||
|
case hp.typ of
|
||||||
|
ait_section :
|
||||||
|
currsectype:=tai_section(hp).sectype;
|
||||||
|
ait_function_name :
|
||||||
|
currfuncname:=tai_function_name(hp).funcname;
|
||||||
|
ait_force_line :
|
||||||
|
lastfileinfo.line:=-1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (currsectype=sec_code) and
|
||||||
|
(hp.typ=ait_instruction) then
|
||||||
|
begin
|
||||||
|
currfileinfo:=tailineinfo(hp).fileinfo;
|
||||||
|
{ file changed ? (must be before line info) }
|
||||||
|
if (currfileinfo.fileindex<>0) and
|
||||||
|
(lastfileinfo.fileindex<>currfileinfo.fileindex) then
|
||||||
|
begin
|
||||||
|
infile:=current_module.sourcefiles.get_file(currfileinfo.fileindex);
|
||||||
|
if assigned(infile) then
|
||||||
|
begin
|
||||||
|
objectlibrary.getlabel(hlabel,alt_dbgfile);
|
||||||
|
{ emit stabs }
|
||||||
|
if (infile.path^<>'') then
|
||||||
|
list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(infile.path^,false))+'",'+tostr(n_includefile)+
|
||||||
|
',0,0,'+hlabel.name),hp);
|
||||||
|
list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+FixFileName(infile.name^)+'",'+tostr(n_includefile)+
|
||||||
|
',0,0,'+hlabel.name),hp);
|
||||||
|
list.insertbefore(tai_label.create(hlabel),hp);
|
||||||
|
{ force new line info }
|
||||||
|
lastfileinfo.line:=-1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ line changed ? }
|
||||||
|
if (lastfileinfo.line<>currfileinfo.line) and (currfileinfo.line<>0) then
|
||||||
|
begin
|
||||||
|
if assigned(currfuncname) and
|
||||||
|
(tf_use_function_relative_addresses in target_info.flags) then
|
||||||
|
begin
|
||||||
|
objectlibrary.getlabel(hlabel,alt_dbgline);
|
||||||
|
list.insertbefore(Tai_stab.Create_str(stab_stabn,tostr(n_textline)+',0,'+tostr(currfileinfo.line)+','+
|
||||||
|
hlabel.name+' - '+{$IFDEF POWERPC64}'.'+{$ENDIF POWERPC64}currfuncname^),hp);
|
||||||
|
list.insertbefore(tai_label.create(hlabel),hp);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
list.insertbefore(Tai_stab.Create_str(stab_stabd,tostr(n_textline)+',0,'+tostr(currfileinfo.line)),hp);
|
||||||
|
end;
|
||||||
|
lastfileinfo:=currfileinfo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
hp:=tai(hp.next);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterDebugInfo(dbg_dwarf_info,TDebugInfoDwarf);
|
RegisterDebugInfo(dbg_dwarf_info,TDebugInfoDwarf);
|
||||||
end.
|
end.
|
||||||
|
@ -117,6 +117,26 @@ implementation
|
|||||||
DW_CFA_start_frame = $f0;
|
DW_CFA_start_frame = $f0;
|
||||||
DW_CFA_end_frame = $f1;
|
DW_CFA_end_frame = $f1;
|
||||||
|
|
||||||
|
DW_LNS_copy = $01;
|
||||||
|
DW_LNS_advance_pc = $02;
|
||||||
|
DW_LNS_advance_line = $03;
|
||||||
|
DW_LNS_set_file = $04;
|
||||||
|
DW_LNS_set_column = $05;
|
||||||
|
DW_LNS_negate_stmt = $06;
|
||||||
|
DW_LNS_set_basic_block = $07;
|
||||||
|
DW_LNS_const_add_pc = $08;
|
||||||
|
|
||||||
|
DW_LNS_fixed_advance_pc = $09;
|
||||||
|
DW_LNS_set_prologue_end = $0a;
|
||||||
|
DW_LNS_set_epilogue_begin = $0b;
|
||||||
|
DW_LNS_set_isa = $0c;
|
||||||
|
|
||||||
|
DW_LNE_end_sequence = $01;
|
||||||
|
DW_LNE_set_address = $02;
|
||||||
|
DW_LNE_define_file = $03;
|
||||||
|
DW_LNE_lo_user = $80;
|
||||||
|
DW_LNE_hi_user = $ff;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Helpers
|
Helpers
|
||||||
|
@ -362,9 +362,9 @@ interface
|
|||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
'.debug_frame',
|
'.debug_frame','.debug_info','.debug_line','.debug_abrev',
|
||||||
'.fpc',
|
'.fpc',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
AsmLn;
|
AsmLn;
|
||||||
|
@ -560,7 +560,7 @@ const go32v2stub : array[0..2047] of byte=(
|
|||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
'.debug_frame',
|
'.debug_frame','.debug_info','.debug_line','.debug_abrev',
|
||||||
'.fpc',
|
'.fpc',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
@ -355,7 +355,7 @@ implementation
|
|||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
'.debug_frame',
|
'.debug_frame','.debug_info','.debug_line','.debug_abrev',
|
||||||
'fpc',
|
'fpc',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
@ -61,15 +61,21 @@ implementation
|
|||||||
secnames : array[TAsmSectionType] of string[4] = ('',
|
secnames : array[TAsmSectionType] of string[4] = ('',
|
||||||
'CODE','DATA','DATA','BSS','',
|
'CODE','DATA','DATA','BSS','',
|
||||||
'','','','','','','',
|
'','','','','','','',
|
||||||
'','','','','','','',
|
'','','','',
|
||||||
''
|
'',
|
||||||
|
'','','','',
|
||||||
|
'',
|
||||||
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
secnamesml64 : array[TAsmSectionType] of string[7] = ('',
|
secnamesml64 : array[TAsmSectionType] of string[7] = ('',
|
||||||
'_TEXT','_DATE','_DATA','_BSS','',
|
'_TEXT','_DATE','_DATA','_BSS','',
|
||||||
'','','','','',
|
'','','','','',
|
||||||
'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
|
'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
|
||||||
'','','',''
|
'',
|
||||||
|
'','','','',
|
||||||
|
'',
|
||||||
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
function single2str(d : single) : string;
|
function single2str(d : single) : string;
|
||||||
|
Loading…
Reference in New Issue
Block a user