mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-06 02:47:48 +01:00
+ support for Mach-O in lineinfo.pp (by Jan Ruzicka)
* always store the return address in the stack frame on ppc if debuginfo
or lineinfo is turned on (otherwise the parent of a leaf function is
missing in backtraces)
git-svn-id: trunk@724 -
This commit is contained in:
parent
bf311fd100
commit
bf51ab03af
@ -1096,7 +1096,8 @@ const
|
|||||||
|
|
||||||
{ save link register? }
|
{ save link register? }
|
||||||
if not (po_assembler in current_procinfo.procdef.procoptions) then
|
if not (po_assembler in current_procinfo.procdef.procoptions) then
|
||||||
if (pi_do_call in current_procinfo.flags) then
|
if (pi_do_call in current_procinfo.flags) or
|
||||||
|
([cs_lineinfo,cs_debuginfo] * aktmoduleswitches <> []) then
|
||||||
begin
|
begin
|
||||||
{ save return address... }
|
{ save return address... }
|
||||||
list.concat(taicpu.op_reg(A_MFLR,NR_R0));
|
list.concat(taicpu.op_reg(A_MFLR,NR_R0));
|
||||||
|
|||||||
@ -790,6 +790,86 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$endif beos}
|
{$endif beos}
|
||||||
|
|
||||||
|
{$ifdef darwin}
|
||||||
|
type
|
||||||
|
MachoFatHeader=
|
||||||
|
packed record
|
||||||
|
magic: longint;
|
||||||
|
nfatarch: longint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
MachoHeader=
|
||||||
|
packed record
|
||||||
|
magic: longword;
|
||||||
|
cpu_type_t: longint;
|
||||||
|
cpu_subtype_t: longint;
|
||||||
|
filetype: longint;
|
||||||
|
ncmds: longint;
|
||||||
|
sizeofcmds: longint;
|
||||||
|
flags: longint;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
cmdblock=
|
||||||
|
packed record
|
||||||
|
cmd: longint;
|
||||||
|
cmdsize: longint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
symbSeg=
|
||||||
|
packed record
|
||||||
|
symoff : longint;
|
||||||
|
nsyms : longint;
|
||||||
|
stroff : longint;
|
||||||
|
strsize: longint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function readCommand: boolean;
|
||||||
|
var
|
||||||
|
block:cmdblock;
|
||||||
|
readMore :boolean;
|
||||||
|
symbolsSeg: symbSeg;
|
||||||
|
|
||||||
|
begin
|
||||||
|
readCommand := false;
|
||||||
|
readMore := true;
|
||||||
|
blockread (f, block, sizeof(block));
|
||||||
|
if block.cmd = $2 then
|
||||||
|
begin
|
||||||
|
blockread (f, symbolsSeg, sizeof(symbolsSeg));
|
||||||
|
stabstrofs:=symbolsSeg.stroff;
|
||||||
|
stabofs:=symbolsSeg.symoff;
|
||||||
|
stabcnt:=symbolsSeg.nsyms;
|
||||||
|
|
||||||
|
readMore := false;
|
||||||
|
readCommand := true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if readMore then
|
||||||
|
begin
|
||||||
|
Seek(f, FilePos (f) + block.cmdsize - sizeof(block));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function LoadMachO32PPC:boolean;
|
||||||
|
var
|
||||||
|
mh:MachoHeader;
|
||||||
|
i: longint;
|
||||||
|
begin
|
||||||
|
StabsFunctionRelative:=false;
|
||||||
|
LoadMachO32PPC := false;
|
||||||
|
blockread (f, mh, sizeof(mh));
|
||||||
|
for i:= 1 to mh.ncmds do
|
||||||
|
begin
|
||||||
|
if readCommand then
|
||||||
|
begin
|
||||||
|
LoadMachO32PPC := true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$endif darwin}
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Executable Open/Close
|
Executable Open/Close
|
||||||
@ -859,6 +939,13 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
{$ifdef darwin}
|
||||||
|
if LoadMachO32PPC then
|
||||||
|
begin
|
||||||
|
OpenStabs:=true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
{$endif darwin}
|
||||||
{$ifdef netware}
|
{$ifdef netware}
|
||||||
if LoadNetwareNLM then
|
if LoadNetwareNLM then
|
||||||
begin
|
begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user