mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-04 08:58:28 +02:00
* i386 uses dwarf cfi info on linux/win32, so even when omitting the stack frame, trace backs in gdb are correct
git-svn-id: trunk@2316 -
This commit is contained in:
parent
46ff92bb60
commit
f5d790f9b6
@ -80,6 +80,7 @@ interface
|
|||||||
public
|
public
|
||||||
constructor create;
|
constructor create;
|
||||||
procedure generate_code(list:taasmoutput);
|
procedure generate_code(list:taasmoutput);
|
||||||
|
procedure generate_initial_instructions(list:taasmoutput);virtual;
|
||||||
{ operations }
|
{ operations }
|
||||||
procedure start_frame(list:taasmoutput);
|
procedure start_frame(list:taasmoutput);
|
||||||
procedure end_frame(list:taasmoutput);
|
procedure end_frame(list:taasmoutput);
|
||||||
@ -247,9 +248,32 @@ implementation
|
|||||||
FFrameEndLabel:=nil;
|
FFrameEndLabel:=nil;
|
||||||
FLastLocLabel:=nil;
|
FLastLocLabel:=nil;
|
||||||
code_alignment_factor:=1;
|
code_alignment_factor:=1;
|
||||||
data_alignment_factor:=-1;
|
data_alignment_factor:=-4;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef i386}
|
||||||
|
{ if more cpu dependend stuff is implemented, this needs more refactoring }
|
||||||
|
procedure tdwarfcfi.generate_initial_instructions(list:taasmoutput);
|
||||||
|
begin
|
||||||
|
list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
|
||||||
|
list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
|
||||||
|
list.concat(tai_const.create_uleb128bit(sizeof(aint)));
|
||||||
|
list.concat(tai_const.create_8bit(DW_CFA_offset_extended));
|
||||||
|
list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
|
||||||
|
list.concat(tai_const.create_uleb128bit((-sizeof(aint)) div data_alignment_factor));
|
||||||
|
end;
|
||||||
|
{$else i386}
|
||||||
|
{ if more cpu dependend stuff is implemented, this needs more refactoring }
|
||||||
|
procedure tdwarfcfi.generate_initial_instructions(list:taasmoutput);
|
||||||
|
begin
|
||||||
|
list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
|
||||||
|
list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
|
||||||
|
list.concat(tai_const.create_uleb128bit(sizeof(aint)));
|
||||||
|
list.concat(tai_const.create_8bit(DW_CFA_offset_extended));
|
||||||
|
list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
|
||||||
|
list.concat(tai_const.create_uleb128bit((-sizeof(aint)) div data_alignment_factor));
|
||||||
|
end;
|
||||||
|
{$endif i386}
|
||||||
|
|
||||||
procedure tdwarfcfi.generate_code(list:taasmoutput);
|
procedure tdwarfcfi.generate_code(list:taasmoutput);
|
||||||
var
|
var
|
||||||
@ -286,13 +310,8 @@ implementation
|
|||||||
def_cfa(stackpointer,sizeof(aint))
|
def_cfa(stackpointer,sizeof(aint))
|
||||||
cfa_offset_extended(returnaddres,-sizeof(aint))
|
cfa_offset_extended(returnaddres,-sizeof(aint))
|
||||||
}
|
}
|
||||||
{$warning TODO This needs to be target dependent}
|
generate_initial_instructions(list);
|
||||||
list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
|
|
||||||
list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
|
|
||||||
list.concat(tai_const.create_uleb128bit(sizeof(aint)));
|
|
||||||
list.concat(tai_const.create_8bit(DW_CFA_offset_extended));
|
|
||||||
list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
|
|
||||||
list.concat(tai_const.create_uleb128bit((-sizeof(aint)) div data_alignment_factor));
|
|
||||||
list.concat(cai_align.create_zeros(4));
|
list.concat(cai_align.create_zeros(4));
|
||||||
list.concat(tai_label.create(lenendlabel));
|
list.concat(tai_label.create(lenendlabel));
|
||||||
lenstartlabel:=nil;
|
lenstartlabel:=nil;
|
||||||
|
@ -50,7 +50,8 @@ unit i_linux;
|
|||||||
{$ifdef segment_threadvars}
|
{$ifdef segment_threadvars}
|
||||||
tf_section_threadvars,
|
tf_section_threadvars,
|
||||||
{$endif segment_threadvars}
|
{$endif segment_threadvars}
|
||||||
tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
|
tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,
|
||||||
|
tf_needs_dwarf_cfi];
|
||||||
cpu : cpu_i386;
|
cpu : cpu_i386;
|
||||||
unit_env : 'LINUXUNITS';
|
unit_env : 'LINUXUNITS';
|
||||||
extradefines : 'UNIX;HASUNIX';
|
extradefines : 'UNIX;HASUNIX';
|
||||||
|
@ -33,7 +33,7 @@ unit i_win;
|
|||||||
name : 'Win32 for i386';
|
name : 'Win32 for i386';
|
||||||
shortname : 'Win32';
|
shortname : 'Win32';
|
||||||
flags : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses
|
flags : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses
|
||||||
{,tf_smartlink_sections}{,tf_section_threadvars}];
|
{,tf_smartlink_sections}{,tf_section_threadvars},tf_needs_dwarf_cfi];
|
||||||
cpu : cpu_i386;
|
cpu : cpu_i386;
|
||||||
unit_env : 'WIN32UNITS';
|
unit_env : 'WIN32UNITS';
|
||||||
extradefines : 'MSWINDOWS;WINDOWS';
|
extradefines : 'MSWINDOWS;WINDOWS';
|
||||||
|
@ -258,7 +258,7 @@ interface
|
|||||||
asmbin : 'as';
|
asmbin : 'as';
|
||||||
asmcmd : '-o $OBJ $ASM';
|
asmcmd : '-o $OBJ $ASM';
|
||||||
supported_target : system_any;
|
supported_target : system_any;
|
||||||
flags : [af_allowdirect,af_needar,af_smartlink_sections];
|
flags : [af_allowdirect,af_needar,af_smartlink_sections,af_supports_dwarf];
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : '# ';
|
comment : '# ';
|
||||||
);
|
);
|
||||||
|
@ -1841,7 +1841,7 @@ unit cgx86;
|
|||||||
if not nostackframe then
|
if not nostackframe then
|
||||||
begin
|
begin
|
||||||
list.concat(tai_regalloc.alloc(current_procinfo.framepointer,nil));
|
list.concat(tai_regalloc.alloc(current_procinfo.framepointer,nil));
|
||||||
if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
|
if current_procinfo.framepointer=NR_STACK_POINTER_REG then
|
||||||
CGmessage(cg_d_stackframe_omited)
|
CGmessage(cg_d_stackframe_omited)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -1858,6 +1858,8 @@ unit cgx86;
|
|||||||
if localsize<>0 then
|
if localsize<>0 then
|
||||||
begin
|
begin
|
||||||
cg.g_stackpointer_alloc(list,localsize);
|
cg.g_stackpointer_alloc(list,localsize);
|
||||||
|
if current_procinfo.framepointer=NR_STACK_POINTER_REG then
|
||||||
|
dwarfcfi.cfa_def_cfa_offset(list,localsize+sizeof(aint));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user