mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 11:49:07 +02:00
gdbmi debugger: small refactor, move release-lock to debuggerintf
git-svn-id: trunk@58148 -
This commit is contained in:
parent
75417ff3a2
commit
28ff72d0c2
@ -1764,6 +1764,7 @@ type
|
|||||||
FOnBreakPointHit: TDebuggerBreakPointHitEvent;
|
FOnBreakPointHit: TDebuggerBreakPointHitEvent;
|
||||||
FWorkingDir: String;
|
FWorkingDir: String;
|
||||||
FDestroyNotificationList: array [TDebuggerNotifyReason] of TMethodList;
|
FDestroyNotificationList: array [TDebuggerNotifyReason] of TMethodList;
|
||||||
|
FReleaseLock: Integer;
|
||||||
procedure DebuggerEnvironmentChanged(Sender: TObject);
|
procedure DebuggerEnvironmentChanged(Sender: TObject);
|
||||||
procedure EnvironmentChanged(Sender: TObject);
|
procedure EnvironmentChanged(Sender: TObject);
|
||||||
//function GetUnitInfoProvider: TDebuggerUnitInfoProvider;
|
//function GetUnitInfoProvider: TDebuggerUnitInfoProvider;
|
||||||
@ -1809,6 +1810,9 @@ type
|
|||||||
procedure SetState(const AValue: TDBGState);
|
procedure SetState(const AValue: TDBGState);
|
||||||
procedure SetErrorState(const AMsg: String; const AInfo: String = '');
|
procedure SetErrorState(const AMsg: String; const AInfo: String = '');
|
||||||
procedure DoRelease; virtual;
|
procedure DoRelease; virtual;
|
||||||
|
// prevent destruction while nested in any call
|
||||||
|
procedure LockRelease; virtual;
|
||||||
|
procedure UnlockRelease; virtual;
|
||||||
public
|
public
|
||||||
class function Caption: String; virtual; // The name of the debugger as shown in the debuggeroptions
|
class function Caption: String; virtual; // The name of the debugger as shown in the debuggeroptions
|
||||||
class function ExePaths: String; virtual; // The default locations of the exe
|
class function ExePaths: String; virtual; // The default locations of the exe
|
||||||
@ -1883,7 +1887,7 @@ type
|
|||||||
property State: TDBGState read FState; // The current state of the debugger
|
property State: TDBGState read FState; // The current state of the debugger
|
||||||
property SupportedCommands: TDBGCommands read GetSupportedCommands; // All available commands of the debugger
|
property SupportedCommands: TDBGCommands read GetSupportedCommands; // All available commands of the debugger
|
||||||
property TargetWidth: Byte read GetTargetWidth; // Currently only 32 or 64
|
property TargetWidth: Byte read GetTargetWidth; // Currently only 32 or 64
|
||||||
property Waiting: Boolean read GetWaiting; // Set when the debugger is wating for a command to complete
|
//property Waiting: Boolean read GetWaiting; // Set when the debugger is wating for a command to complete
|
||||||
property Watches: TWatchesSupplier read FWatches; // list of all watches etc
|
property Watches: TWatchesSupplier read FWatches; // list of all watches etc
|
||||||
property Threads: TThreadsSupplier read FThreads;
|
property Threads: TThreadsSupplier read FThreads;
|
||||||
property WorkingDir: String read FWorkingDir write FWorkingDir; // The working dir of the exe being debugged
|
property WorkingDir: String read FWorkingDir write FWorkingDir; // The working dir of the exe being debugged
|
||||||
@ -6095,9 +6099,25 @@ end;
|
|||||||
|
|
||||||
procedure TDebuggerIntf.DoRelease;
|
procedure TDebuggerIntf.DoRelease;
|
||||||
begin
|
begin
|
||||||
|
SetState(dsDestroying);
|
||||||
|
if FReleaseLock > 0
|
||||||
|
then exit;
|
||||||
|
|
||||||
Self.Free;
|
Self.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerIntf.LockRelease;
|
||||||
|
begin
|
||||||
|
inc(FReleaseLock);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerIntf.UnlockRelease;
|
||||||
|
begin
|
||||||
|
dec(FReleaseLock);
|
||||||
|
if (FReleaseLock = 0) and (State = dsDestroying)
|
||||||
|
then Release;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDebuggerIntf.StepInto;
|
procedure TDebuggerIntf.StepInto;
|
||||||
begin
|
begin
|
||||||
if ReqCmd(dcStepInto, []) then exit;
|
if ReqCmd(dcStepInto, []) then exit;
|
||||||
|
@ -763,7 +763,6 @@ type
|
|||||||
FRunQueueOnUnlock: Boolean;
|
FRunQueueOnUnlock: Boolean;
|
||||||
FDebuggerFlags: TGDBMIDebuggerFlags;
|
FDebuggerFlags: TGDBMIDebuggerFlags;
|
||||||
FSourceNames: TStringList; // Objects[] -> TMap[Integer|Integer] -> TDbgPtr
|
FSourceNames: TStringList; // Objects[] -> TMap[Integer|Integer] -> TDbgPtr
|
||||||
FReleaseLock: Integer;
|
|
||||||
FInProcessStopped: Boolean; // paused, but maybe state run
|
FInProcessStopped: Boolean; // paused, but maybe state run
|
||||||
FCommandNoneMiState: Array [TGDBMIExecCommandType] of Boolean;
|
FCommandNoneMiState: Array [TGDBMIExecCommandType] of Boolean;
|
||||||
FCommandAsyncState: Array [TGDBMIExecCommandType] of Boolean;
|
FCommandAsyncState: Array [TGDBMIExecCommandType] of Boolean;
|
||||||
@ -814,10 +813,6 @@ type
|
|||||||
deprecated;
|
deprecated;
|
||||||
function GDBSourceAdress(const ASource: String; ALine, {%H-}AColumn: Integer; out AAddr: TDbgPtr): Boolean;
|
function GDBSourceAdress(const ASource: String; ALine, {%H-}AColumn: Integer; out AAddr: TDbgPtr): Boolean;
|
||||||
|
|
||||||
// prevent destruction while nested in any call
|
|
||||||
procedure LockRelease;
|
|
||||||
procedure UnlockRelease;
|
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
procedure ClearSourceInfo;
|
procedure ClearSourceInfo;
|
||||||
function FindBreakpoint(const ABreakpoint: Integer): TDBGBreakPoint;
|
function FindBreakpoint(const ABreakpoint: Integer): TDBGBreakPoint;
|
||||||
@ -885,7 +880,6 @@ type
|
|||||||
property TargetFlags: TGDBMITargetFlags read FTargetInfo.TargetFlags write FTargetInfo.TargetFlags;
|
property TargetFlags: TGDBMITargetFlags read FTargetInfo.TargetFlags write FTargetInfo.TargetFlags;
|
||||||
property PauseWaitState: TGDBMIPauseWaitState read FPauseWaitState;
|
property PauseWaitState: TGDBMIPauseWaitState read FPauseWaitState;
|
||||||
property DebuggerFlags: TGDBMIDebuggerFlags read FDebuggerFlags;
|
property DebuggerFlags: TGDBMIDebuggerFlags read FDebuggerFlags;
|
||||||
procedure DoRelease; override; // Destroy self (or schedule)
|
|
||||||
procedure DoUnknownException(Sender: TObject; AnException: Exception);
|
procedure DoUnknownException(Sender: TObject; AnException: Exception);
|
||||||
|
|
||||||
procedure DoNotifyAsync(Line: String);
|
procedure DoNotifyAsync(Line: String);
|
||||||
@ -7383,8 +7377,6 @@ end;
|
|||||||
|
|
||||||
constructor TGDBMIDebugger.Create(const AExternalDebugger: String);
|
constructor TGDBMIDebugger.Create(const AExternalDebugger: String);
|
||||||
begin
|
begin
|
||||||
FReleaseLock := 0;
|
|
||||||
|
|
||||||
FMainAddrBreak := TGDBMIInternalBreakPoint.Create('main');
|
FMainAddrBreak := TGDBMIInternalBreakPoint.Create('main');
|
||||||
FBreakErrorBreak := TGDBMIInternalBreakPoint.Create('FPC_BREAK_ERROR');
|
FBreakErrorBreak := TGDBMIInternalBreakPoint.Create('FPC_BREAK_ERROR');
|
||||||
FRunErrorBreak := TGDBMIInternalBreakPoint.Create('FPC_RUNERROR');
|
FRunErrorBreak := TGDBMIInternalBreakPoint.Create('FPC_RUNERROR');
|
||||||
@ -7683,15 +7675,6 @@ begin
|
|||||||
Registers.CurrentRegistersList.Clear;
|
Registers.CurrentRegistersList.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMIDebugger.DoRelease;
|
|
||||||
begin
|
|
||||||
SetState(dsDestroying);
|
|
||||||
if FReleaseLock > 0
|
|
||||||
then exit;
|
|
||||||
|
|
||||||
inherited DoRelease;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TGDBMIDebugger.DoUnknownException(Sender: TObject; AnException: Exception);
|
procedure TGDBMIDebugger.DoUnknownException(Sender: TObject; AnException: Exception);
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
@ -8535,18 +8518,6 @@ begin
|
|||||||
LinesList.Free;
|
LinesList.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMIDebugger.LockRelease;
|
|
||||||
begin
|
|
||||||
inc(FReleaseLock);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TGDBMIDebugger.UnlockRelease;
|
|
||||||
begin
|
|
||||||
dec(FReleaseLock);
|
|
||||||
if (FReleaseLock = 0) and (State = dsDestroying)
|
|
||||||
then Release;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TGDBMIDebugger.GDBStepInto: Boolean;
|
function TGDBMIDebugger.GDBStepInto: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
Loading…
Reference in New Issue
Block a user