mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 16:09:17 +02:00
* moved the code that obtains the parameters to HandleErrorAddrFrame (after
trapping a runtime error) to a separate method. git-svn-id: trunk@29798 -
This commit is contained in:
parent
b9f88aa80c
commit
5ec640006c
@ -40,6 +40,9 @@ type
|
|||||||
{$ifndef NODEBUG}
|
{$ifndef NODEBUG}
|
||||||
PDebugController=^TDebugController;
|
PDebugController=^TDebugController;
|
||||||
TDebugController=object(TGDBController)
|
TDebugController=object(TGDBController)
|
||||||
|
private
|
||||||
|
function GetFPCBreakErrorParameters(var ExitCode: LongInt; var ExitAddr, ExitFrame: CORE_ADDR): Boolean;
|
||||||
|
public
|
||||||
InvalidSourceLine : boolean;
|
InvalidSourceLine : boolean;
|
||||||
|
|
||||||
{ if true the current debugger raw will stay in middle of
|
{ if true the current debugger raw will stay in middle of
|
||||||
@ -1299,6 +1302,29 @@ begin
|
|||||||
Val('$'+st,GetPointerAt,code);
|
Val('$'+st,GetPointerAt,code);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDebugController.GetFPCBreakErrorParameters(var ExitCode: LongInt; var ExitAddr, ExitFrame: CORE_ADDR): Boolean;
|
||||||
|
const
|
||||||
|
{ try to find the parameters }
|
||||||
|
FirstArgOffset = -sizeof(pointer);
|
||||||
|
SecondArgOffset = 2*-sizeof(pointer);
|
||||||
|
ThirdArgOffset = 3*-sizeof(pointer);
|
||||||
|
begin
|
||||||
|
// Procedure HandleErrorAddrFrame (Errno : longint;addr : CodePointer; frame : Pointer);
|
||||||
|
// [public,alias:'FPC_BREAK_ERROR']; {$ifdef cpui386} register; {$endif}
|
||||||
|
{TODO: handle archs with register calling conventions}
|
||||||
|
{$if defined(FrameNameKnown)}
|
||||||
|
ExitCode:=GetLongintAt(GetFramePointer+FirstArgOffset);
|
||||||
|
ExitAddr:=GetPointerAt(GetFramePointer+SecondArgOffset);
|
||||||
|
ExitFrame:=GetPointerAt(GetFramePointer+ThirdArgOffset);
|
||||||
|
GetFPCBreakErrorParameters := True;
|
||||||
|
{$else}
|
||||||
|
ExitCode := 0;
|
||||||
|
ExitAddr := 0;
|
||||||
|
ExitFrame := 0;
|
||||||
|
GetFPCBreakErrorParameters := False;
|
||||||
|
{$endif}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDebugController.DoSelectSourceLine(const fn:string;line:longint);
|
procedure TDebugController.DoSelectSourceLine(const fn:string;line:longint);
|
||||||
var
|
var
|
||||||
W: PSourceWindow;
|
W: PSourceWindow;
|
||||||
@ -1309,12 +1335,6 @@ var
|
|||||||
stop_addr : CORE_ADDR;
|
stop_addr : CORE_ADDR;
|
||||||
i,ExitCode : longint;
|
i,ExitCode : longint;
|
||||||
ExitAddr,ExitFrame : CORE_ADDR;
|
ExitAddr,ExitFrame : CORE_ADDR;
|
||||||
const
|
|
||||||
{ try to find the parameters }
|
|
||||||
FirstArgOffset = -sizeof(pointer);
|
|
||||||
SecondArgOffset = 2*-sizeof(pointer);
|
|
||||||
ThirdArgOffset = 3*-sizeof(pointer);
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
BreakIndex:=stop_breakpoint_number;
|
BreakIndex:=stop_breakpoint_number;
|
||||||
Desktop^.Lock;
|
Desktop^.Lock;
|
||||||
@ -1327,13 +1347,8 @@ begin
|
|||||||
|
|
||||||
if (BreakIndex=FPCBreakErrorNumber) then
|
if (BreakIndex=FPCBreakErrorNumber) then
|
||||||
begin
|
begin
|
||||||
{ Procedure HandleErrorAddrFrame
|
if GetFPCBreakErrorParameters(ExitCode, ExitAddr, ExitFrame) then
|
||||||
(Errno : longint;addr,frame : longint);
|
begin
|
||||||
[public,alias:'FPC_BREAK_ERROR']; }
|
|
||||||
{$ifdef FrameNameKnown}
|
|
||||||
ExitCode:=GetLongintAt(GetFramePointer+FirstArgOffset);
|
|
||||||
ExitAddr:=GetPointerAt(GetFramePointer+SecondArgOffset);
|
|
||||||
ExitFrame:=GetPointerAt(GetFramePointer+ThirdArgOffset);
|
|
||||||
if (ExitCode=0) and (ExitAddr=0) then
|
if (ExitCode=0) and (ExitAddr=0) then
|
||||||
begin
|
begin
|
||||||
Desktop^.Unlock;
|
Desktop^.Unlock;
|
||||||
@ -1361,7 +1376,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$endif FrameNameKnown}
|
end;
|
||||||
end;
|
end;
|
||||||
{ Update Disassembly position }
|
{ Update Disassembly position }
|
||||||
if Assigned(DisassemblyWindow) then
|
if Assigned(DisassemblyWindow) then
|
||||||
|
Loading…
Reference in New Issue
Block a user