IDE, Debugger: Implemented symbol for pending breakpoint (used for code in libraries(dll/so), before it is loaded)

git-svn-id: trunk@57193 -
This commit is contained in:
martin 2018-01-30 19:44:26 +00:00
parent b6006da0d4
commit c7fe5d1822
11 changed files with 78 additions and 29 deletions

1
.gitattributes vendored
View File

@ -8166,6 +8166,7 @@ images/sourceeditor/InactiveBreakPoint.png -text
images/sourceeditor/InvalidBreakPoint.png -text images/sourceeditor/InvalidBreakPoint.png -text
images/sourceeditor/InvalidDisabledBreakPoint.png -text svneol=unset#image/png images/sourceeditor/InvalidDisabledBreakPoint.png -text svneol=unset#image/png
images/sourceeditor/MultiBreakPoint.png -text images/sourceeditor/MultiBreakPoint.png -text
images/sourceeditor/PendingBreakPoint.png -text
images/sourceeditor/Record.png -text images/sourceeditor/Record.png -text
images/sourceeditor/UnknownBreakPoint.png -text images/sourceeditor/UnknownBreakPoint.png -text
images/sourceeditor/UnknownDisabledBreakPoint.png -text svneol=unset#image/png images/sourceeditor/UnknownDisabledBreakPoint.png -text svneol=unset#image/png

View File

@ -158,7 +158,7 @@ type
); );
(* TValidState: State for breakpoints *) (* TValidState: State for breakpoints *)
TValidState = (vsUnknown, vsValid, vsInvalid); TValidState = (vsUnknown, vsValid, vsInvalid, vsPending);
const const
DebuggerDataStateStr : array[TDebuggerDataState] of string = ( DebuggerDataStateStr : array[TDebuggerDataState] of string = (
@ -352,6 +352,7 @@ type
property Kind: TDBGBreakPointKind read GetKind write SetKind; property Kind: TDBGBreakPointKind read GetKind write SetKind;
property Valid: TValidState read GetValid; property Valid: TValidState read GetValid;
public public
procedure SetPendingToValid(const AValue: TValidState);
procedure SetLocation(const ASource: String; const ALine: Integer); virtual; procedure SetLocation(const ASource: String; const ALine: Integer); virtual;
procedure SetWatch(const AData: String; const AScope: TDBGWatchPointScope; procedure SetWatch(const AData: String; const AScope: TDBGWatchPointScope;
const AKind: TDBGWatchPointKind); virtual; const AKind: TDBGWatchPointKind); virtual;
@ -3520,6 +3521,12 @@ begin
AddReference; AddReference;
end; end;
procedure TBaseBreakPoint.SetPendingToValid(const AValue: TValidState);
begin
assert(Valid = vsPending, 'Can only change state if pending');
SetValid(AValue);
end;
procedure TBaseBreakPoint.DoBreakHitCountChange; procedure TBaseBreakPoint.DoBreakHitCountChange;
begin begin
Changed; Changed;

View File

@ -1086,12 +1086,13 @@ type
FAddr: TDBGPtr; FAddr: TDBGPtr;
FBreakID: Integer; FBreakID: Integer;
FHitCnt: Integer; FHitCnt: Integer;
FValid: Boolean; FValid: TValidState;
FWatchData: String; FWatchData: String;
FWatchKind: TDBGWatchPointKind; FWatchKind: TDBGWatchPointKind;
FWatchScope: TDBGWatchPointScope; FWatchScope: TDBGWatchPointScope;
protected protected
function ExecBreakInsert(out ABreakId, AHitCnt: Integer; out AnAddr: TDBGPtr): Boolean; function ExecBreakInsert(out ABreakId, AHitCnt: Integer; out AnAddr: TDBGPtr;
out APending: Boolean): Boolean;
function DoExecute: Boolean; override; function DoExecute: Boolean; override;
public public
constructor Create(AOwner: TGDBMIDebugger; ASource: string; ALine: Integer; constructor Create(AOwner: TGDBMIDebugger; ASource: string; ALine: Integer;
@ -1115,7 +1116,7 @@ type
property Addr: TDBGPtr read FAddr; property Addr: TDBGPtr read FAddr;
property BreakID: Integer read FBreakID; property BreakID: Integer read FBreakID;
property HitCnt: Integer read FHitCnt; property HitCnt: Integer read FHitCnt;
property Valid: Boolean read FValid; property Valid: TValidState read FValid;
end; end;
{ TGDBMIDebuggerCommandBreakRemove } { TGDBMIDebuggerCommandBreakRemove }
@ -5709,6 +5710,8 @@ function TGDBMIDebuggerCommandExecute.ProcessStopped(const AParams: String;
if ABreakId >= 0 then if ABreakId >= 0 then
BreakPoint := TGDBMIBreakPoint(FTheDebugger.FindBreakpoint(ABreakID)); BreakPoint := TGDBMIBreakPoint(FTheDebugger.FindBreakpoint(ABreakID));
if (BreakPoint <> nil) and (BreakPoint.Valid = vsPending) then
BreakPoint.SetPendingToValid(vsValid);
if (BreakPoint <> nil) and (BreakPoint.Kind <> bpkData) and if (BreakPoint <> nil) and (BreakPoint.Kind <> bpkData) and
(AReason in [gbrWatchScope, gbrWatchTrigger]) (AReason in [gbrWatchScope, gbrWatchTrigger])
then BreakPoint := nil; then BreakPoint := nil;
@ -7661,6 +7664,8 @@ var
i, x: Integer; i, x: Integer;
ct: TThreads; ct: TThreads;
t: TThreadEntry; t: TThreadEntry;
List: TGDBMINameValueList;
BreakPoint: TGDBMIBreakPoint;
begin begin
EventText := GetPart(['='], [','], Line, False, False); EventText := GetPart(['='], [','], Line, False, False);
x := StringCase(EventText, [ x := StringCase(EventText, [
@ -7711,6 +7716,19 @@ begin
7: RemoveThreadGroup(Line); 7: RemoveThreadGroup(Line);
8: DoDbgEvent(ecThread, etThreadStart, ParseThread(Line, EventText)); 8: DoDbgEvent(ecThread, etThreadStart, ParseThread(Line, EventText));
9: DoDbgEvent(ecThread, etThreadExit, ParseThread(Line, EventText)); 9: DoDbgEvent(ecThread, etThreadExit, ParseThread(Line, EventText));
10: begin //breakpoint-modified
List := TGDBMINameValueList.Create(Line);
List.SetPath('bkpt');
i := StrToIntDef(List.Values['number'], -1);
BreakPoint := nil;
if i >= 0 then
BreakPoint := TGDBMIBreakPoint(FindBreakpoint(i));
if (BreakPoint <> nil) and (BreakPoint.Valid = vsPending) and
(List.IndexOf('pending') < 0) and
(pos('pend', lowercase(List.Values['addr'])) <= 0)
then
BreakPoint.SetPendingToValid(vsValid);
end;
else else
DebugLn(DBG_WARNINGS, '[WARNING] Debugger: Unexpected async-record: ', Line); DebugLn(DBG_WARNINGS, '[WARNING] Debugger: Unexpected async-record: ', Line);
end; end;
@ -8932,8 +8950,8 @@ end;
{ TGDBMIDebuggerCommandBreakInsert } { TGDBMIDebuggerCommandBreakInsert }
function TGDBMIDebuggerCommandBreakInsert.ExecBreakInsert(out ABreakId, AHitCnt: Integer; out function TGDBMIDebuggerCommandBreakInsert.ExecBreakInsert(out ABreakId,
AnAddr: TDBGPtr): Boolean; AHitCnt: Integer; out AnAddr: TDBGPtr; out APending: Boolean): Boolean;
var var
R: TGDBMIExecResult; R: TGDBMIExecResult;
ResultList: TGDBMINameValueList; ResultList: TGDBMINameValueList;
@ -8944,6 +8962,7 @@ begin
ABreakId := 0; ABreakId := 0;
AHitCnt := 0; AHitCnt := 0;
AnAddr := 0; AnAddr := 0;
APending := False;
case FKind of case FKind of
bpkSource: bpkSource:
begin begin
@ -9000,9 +9019,9 @@ begin
(DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwUserBreakPoint]) (DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwUserBreakPoint])
then then
Include(FTheDebugger.FDebuggerFlags, dfSetBreakFailed); Include(FTheDebugger.FDebuggerFlags, dfSetBreakFailed);
if ((ResultList.IndexOf('pending') >= 0) or APending := (ResultList.IndexOf('pending') >= 0) or
(pos('pend', lowercase(ResultList.Values['addr'])) > 0)) and (pos('pend', lowercase(ResultList.Values['addr'])) > 0);
(DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwUserBreakPoint]) if APending and (DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwUserBreakPoint])
then then
Include(FTheDebugger.FDebuggerFlags, dfSetBreakPending); Include(FTheDebugger.FDebuggerFlags, dfSetBreakPending);
end; end;
@ -9042,19 +9061,24 @@ begin
end; end;
function TGDBMIDebuggerCommandBreakInsert.DoExecute: Boolean; function TGDBMIDebuggerCommandBreakInsert.DoExecute: Boolean;
var
Pending: Boolean;
begin begin
Result := True; Result := True;
FContext.ThreadContext := ccNotRequired; FContext.ThreadContext := ccNotRequired;
FContext.StackContext := ccNotRequired; FContext.StackContext := ccNotRequired;
FValid := False; FValid := vsInvalid;
DefaultTimeOut := DebuggerProperties.TimeoutForEval; DefaultTimeOut := DebuggerProperties.TimeoutForEval;
try try
if FReplaceId <> 0 if FReplaceId <> 0
then ExecBreakDelete(FReplaceId); then ExecBreakDelete(FReplaceId);
FValid := ExecBreakInsert(FBreakID, FHitCnt, FAddr); if ExecBreakInsert(FBreakID, FHitCnt, FAddr, Pending) then
if not FValid then Exit; FValid := vsValid;
if FValid = vsInvalid then Exit;
if Pending then
FValid := vsPending;
if (FExpression <> '') and not (dcsCanceled in SeenStates) if (FExpression <> '') and not (dcsCanceled in SeenStates)
then ExecBreakCondition(FBreakID, FExpression); then ExecBreakCondition(FBreakID, FExpression);
@ -9066,7 +9090,7 @@ begin
then begin then begin
ExecBreakDelete(FBreakID); ExecBreakDelete(FBreakID);
FBreakID := 0; FBreakID := 0;
FValid := False; FValid := vsInvalid;
FAddr := 0; FAddr := 0;
FHitCnt := 0; FHitCnt := 0;
end; end;
@ -9417,8 +9441,9 @@ begin
// Check Insert Result // Check Insert Result
BeginUpdate; BeginUpdate;
if TGDBMIDebuggerCommandBreakInsert(Sender).Valid case TGDBMIDebuggerCommandBreakInsert(Sender).Valid of
then SetValid(vsValid) vsValid: SetValid(vsValid);
vsPending: SetValid(vsPending);
else begin else begin
if (TGDBMIDebuggerCommandBreakInsert(Sender).Kind = bpkData) and if (TGDBMIDebuggerCommandBreakInsert(Sender).Kind = bpkData) and
(TGDBMIDebugger(Debugger).State = dsInit) (TGDBMIDebugger(Debugger).State = dsInit)
@ -9429,6 +9454,7 @@ begin
end end
else SetValid(vsInvalid); else SetValid(vsInvalid);
end; end;
end;
FBreakID := TGDBMIDebuggerCommandBreakInsert(Sender).BreakID; FBreakID := TGDBMIDebuggerCommandBreakInsert(Sender).BreakID;
SetHitCount(TGDBMIDebuggerCommandBreakInsert(Sender).HitCnt); SetHitCount(TGDBMIDebuggerCommandBreakInsert(Sender).HitCnt);

View File

@ -201,9 +201,9 @@ function GetBreakPointStateDescription(ABreakpoint: TBaseBreakpoint): string;
const const
// enabled valid // enabled valid
DEBUG_STATE: array[Boolean, TValidState] of ShortString = ( DEBUG_STATE: array[Boolean, TValidState] of ShortString = (
{vsUnknown, vsValid, vsInvalid} {vsUnknown, vsValid, vsInvalid, vsPending}
{Disabled} (lisOff, lisDisabled, lisInvalidOff), {Disabled} (lisOff, lisDisabled, lisInvalidOff, lisInvalidOff),
{Endabled} (lisOn, lisEnabled, lisInvalidOn)); {Endabled} (lisOn, lisEnabled, lisInvalidOn, lisPendingOn));
begin begin
Result:=DEBUG_STATE[ABreakpoint.Enabled,ABreakpoint.Valid]; Result:=DEBUG_STATE[ABreakpoint.Enabled,ABreakpoint.Valid];
end; end;

View File

@ -125,7 +125,7 @@ implementation
var var
DBG_LOCATION_INFO: PLazLoggerLogGroup; DBG_LOCATION_INFO: PLazLoggerLogGroup;
BrkImgIdxInitialized: Boolean; BrkImgIdxInitialized: Boolean;
ImgBreakPoints: Array [0..8] of Integer; ImgBreakPoints: Array [0..10] of Integer;
procedure CreateDebugDialog(Sender: TObject; aFormName: string; var AForm: TCustomForm; procedure CreateDebugDialog(Sender: TObject; aFormName: string; var AForm: TCustomForm;
DoDisableAutoSizing: boolean); DoDisableAutoSizing: boolean);
@ -408,14 +408,17 @@ begin
ImgBreakPoints[0] := IDEImages.LoadImage('ActiveBreakPoint'); // red dot ImgBreakPoints[0] := IDEImages.LoadImage('ActiveBreakPoint'); // red dot
ImgBreakPoints[1] := IDEImages.LoadImage('InvalidBreakPoint'); // red dot "X" ImgBreakPoints[1] := IDEImages.LoadImage('InvalidBreakPoint'); // red dot "X"
ImgBreakPoints[2] := IDEImages.LoadImage('UnknownBreakPoint'); // red dot "?" ImgBreakPoints[2] := IDEImages.LoadImage('UnknownBreakPoint'); // red dot "?"
ImgBreakPoints[3] := IDEImages.LoadImage('PendingBreakPoint'); // red dot "||"
ImgBreakPoints[3] := IDEImages.LoadImage('InactiveBreakPoint');// green dot
ImgBreakPoints[4] := IDEImages.LoadImage('InvalidDisabledBreakPoint');// green dot "X"
ImgBreakPoints[5] := IDEImages.LoadImage('UnknownDisabledBreakPoint');// green dot "?"
ImgBreakPoints[6] := IDEImages.LoadImage('debugger_current_line'); ImgBreakPoints[4] := IDEImages.LoadImage('InactiveBreakPoint');// green dot
ImgBreakPoints[7] := IDEImages.LoadImage('debugger_current_line_breakpoint'); ImgBreakPoints[5] := IDEImages.LoadImage('InvalidDisabledBreakPoint');// green dot "X"
ImgBreakPoints[8] := IDEImages.LoadImage('debugger_current_line_disabled_breakpoint'); ImgBreakPoints[6] := IDEImages.LoadImage('UnknownDisabledBreakPoint');// green dot "?"
ImgBreakPoints[7] := IDEImages.LoadImage('InactiveBreakPoint');// green dot
ImgBreakPoints[8] := IDEImages.LoadImage('debugger_current_line');
ImgBreakPoints[9] := IDEImages.LoadImage('debugger_current_line_breakpoint');
ImgBreakPoints[10] := IDEImages.LoadImage('debugger_current_line_disabled_breakpoint');
BrkImgIdxInitialized := True; BrkImgIdxInitialized := True;
end; end;
@ -423,21 +426,22 @@ begin
if AIsCurLine if AIsCurLine
then begin then begin
if ABreakPoint = nil if ABreakPoint = nil
then Result := ImgBreakPoints[6]
else if ABreakPoint.Enabled
then Result := ImgBreakPoints[7] then Result := ImgBreakPoints[7]
else Result := ImgBreakPoints[8]; else if ABreakPoint.Enabled
then Result := ImgBreakPoints[9]
else Result := ImgBreakPoints[10];
end end
else else
if (ABreakPoint <> nil) if (ABreakPoint <> nil)
then begin then begin
if ABreakPoint.Enabled if ABreakPoint.Enabled
then i := 0 then i := 0
else i := 3; else i := 4;
case ABreakPoint.Valid of case ABreakPoint.Valid of
vsValid: i := i + 0; vsValid: i := i + 0;
vsInvalid: i := i + 1; vsInvalid: i := i + 1;
vsUnknown: i := i + 2; vsUnknown: i := i + 2;
vsPending: i := i + 3; // TODO
end; end;
Result := ImgBreakPoints[i]; Result := ImgBreakPoints[i];
end; end;

View File

@ -514,6 +514,11 @@ begin
Img := SourceEditorMarks.InvalidBreakPointImg Img := SourceEditorMarks.InvalidBreakPointImg
else else
Img := SourceEditorMarks.InvalidDisabledBreakPointImg; Img := SourceEditorMarks.InvalidDisabledBreakPointImg;
vsPending:
if Enabled then
Img := SourceEditorMarks.PendingBreakPointImg
else
Img := SourceEditorMarks.InactiveBreakPointImg;
else else
if Enabled then if Enabled then
Img := SourceEditorMarks.UnknownBreakPointImg Img := SourceEditorMarks.UnknownBreakPointImg

View File

@ -5425,6 +5425,7 @@ resourcestring
lisDisabled = 'Disabled'; lisDisabled = 'Disabled';
lisInvalidOff = 'Invalid (Off)'; lisInvalidOff = 'Invalid (Off)';
lisInvalidOn = 'Invalid (On)'; lisInvalidOn = 'Invalid (On)';
lisPendingOn = 'Pending (On)';
lisOff = '? (Off)'; lisOff = '? (Off)';
lisOn = '? (On)'; lisOn = '? (On)';
lisTakeSnapshot = 'Take a Snapshot'; lisTakeSnapshot = 'Take a Snapshot';

View File

@ -196,6 +196,7 @@ type
FCurrentLineImg: Integer; FCurrentLineImg: Integer;
FCurrentLineDisabledBreakPointImg: Integer; FCurrentLineDisabledBreakPointImg: Integer;
FExtToolsMarks: TETMarks; FExtToolsMarks: TETMarks;
fPendingBreakPointImg: Integer;
FSourceLineImg: Integer; FSourceLineImg: Integer;
FImgList: TImageList; FImgList: TImageList;
fInactiveBreakPointImg: Integer; fInactiveBreakPointImg: Integer;
@ -242,6 +243,7 @@ type
property InactiveBreakPointImg: Integer read fInactiveBreakPointImg; property InactiveBreakPointImg: Integer read fInactiveBreakPointImg;
property InvalidBreakPointImg: Integer read fInvalidBreakPointImg; property InvalidBreakPointImg: Integer read fInvalidBreakPointImg;
property InvalidDisabledBreakPointImg: Integer read fInvalidDisabledBreakPointImg; property InvalidDisabledBreakPointImg: Integer read fInvalidDisabledBreakPointImg;
property PendingBreakPointImg: Integer read fPendingBreakPointImg;
property MultiBreakPointImg: Integer read fMultiBreakPointImg; property MultiBreakPointImg: Integer read fMultiBreakPointImg;
property UnknownBreakPointImg: Integer read fUnknownBreakPointImg; property UnknownBreakPointImg: Integer read fUnknownBreakPointImg;
property UnknownDisabledBreakPointImg: Integer read fUnknownDisabledBreakPointImg; property UnknownDisabledBreakPointImg: Integer read fUnknownDisabledBreakPointImg;
@ -566,6 +568,8 @@ begin
fInvalidBreakPointImg:=AddImage('InvalidBreakPoint'); fInvalidBreakPointImg:=AddImage('InvalidBreakPoint');
// load invalid disabled breakpoint image // load invalid disabled breakpoint image
fInvalidDisabledBreakPointImg := AddImage('InvalidDisabledBreakPoint'); fInvalidDisabledBreakPointImg := AddImage('InvalidDisabledBreakPoint');
// load pending active breakpoint image
fPendingBreakPointImg := AddImage('PendingBreakPoint');
// load unknown breakpoint image // load unknown breakpoint image
fUnknownBreakPointImg:=AddImage('UnknownBreakPoint'); fUnknownBreakPointImg:=AddImage('UnknownBreakPoint');
// load unknown disabled breakpoint image // load unknown disabled breakpoint image

Binary file not shown.

View File

@ -44,3 +44,4 @@ sourceeditor/state11x11_warning.png
sourceeditor/tsynsyncroedit.png sourceeditor/tsynsyncroedit.png
sourceeditor/UnknownBreakPoint.png sourceeditor/UnknownBreakPoint.png
sourceeditor/UnknownDisabledBreakPoint.png sourceeditor/UnknownDisabledBreakPoint.png
sourceeditor/PendingBreakPoint.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B