mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 23:00:27 +02:00
Debugger: Inspect dialog, fix missing data in some rows of a structure (remove line breaks)
This commit is contained in:
parent
b03e3b50fd
commit
8494ca68fb
@ -10,6 +10,7 @@ uses
|
|||||||
function HexDigicCount(ANum: QWord; AByteSize: Integer = 0; AForceAddr: Boolean = False): integer;
|
function HexDigicCount(ANum: QWord; AByteSize: Integer = 0; AForceAddr: Boolean = False): integer;
|
||||||
function QuoteText(AText: Utf8String): UTf8String;
|
function QuoteText(AText: Utf8String): UTf8String;
|
||||||
function QuoteWideText(AText: WideString): WideString;
|
function QuoteWideText(AText: WideString): WideString;
|
||||||
|
function ClearMultiline(const AValue: ansistring): ansistring;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -211,5 +212,38 @@ begin
|
|||||||
until False;
|
until False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ClearMultiline(const AValue: ansistring): ansistring;
|
||||||
|
var
|
||||||
|
j: SizeInt;
|
||||||
|
ow: SizeInt;
|
||||||
|
NewLine: Boolean;
|
||||||
|
begin
|
||||||
|
ow:=0;
|
||||||
|
SetLength(Result{%H-},Length(AValue));
|
||||||
|
NewLine:=true;
|
||||||
|
for j := 1 to Length(AValue) do begin
|
||||||
|
if (AValue[j]=#13) or (AValue[j]=#10) then begin
|
||||||
|
NewLine:=true;
|
||||||
|
inc(ow);
|
||||||
|
Result[ow]:=#32; // insert one space instead of new line
|
||||||
|
end
|
||||||
|
else if Avalue[j] in [#9,#32] then begin
|
||||||
|
if not NewLine then begin // strip leading spaces after new line
|
||||||
|
inc(ow);
|
||||||
|
Result[ow]:=#32;
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
inc(ow);
|
||||||
|
Result[ow]:=AValue[j];
|
||||||
|
NewLine:=false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
If ow>255 then begin
|
||||||
|
//Limit watch to 255 chars in length
|
||||||
|
Result:=Copy(Result,1,252)+'...';
|
||||||
|
end else begin
|
||||||
|
SetLength(Result,ow);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ uses
|
|||||||
DbgIntfDebuggerBase, DbgIntfBaseTypes, LazClasses, SpinEx, LazDebuggerIntf,
|
DbgIntfDebuggerBase, DbgIntfBaseTypes, LazClasses, SpinEx, LazDebuggerIntf,
|
||||||
LazDebuggerIntfBaseTypes,
|
LazDebuggerIntfBaseTypes,
|
||||||
// IDE
|
// IDE
|
||||||
BaseDebugManager, InputHistory, Debugger,
|
BaseDebugManager, InputHistory, Debugger, IdeDebuggerWatchResPrinter,
|
||||||
IdeDebuggerWatchResPrinter, IdeDebuggerWatchResult, IdeDebuggerWatchResUtils,
|
IdeDebuggerWatchResult, IdeDebuggerWatchResUtils, IdeDebuggerBase,
|
||||||
IdeDebuggerBase, ArrayNavigationFrame, IdeDebuggerOpts,
|
ArrayNavigationFrame, IdeDebuggerOpts, IdeDebuggerBackendValueConv,
|
||||||
IdeDebuggerBackendValueConv, WatchInspectToolbar, DebuggerDlg,
|
WatchInspectToolbar, DebuggerDlg, EnvironmentOpts, RecentListProcs,
|
||||||
EnvironmentOpts, RecentListProcs, IdeDebuggerStringConstants;
|
IdeDebuggerStringConstants, IdeDebuggerUtils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ begin
|
|||||||
WatchInspectNav1.ColTypeEnabled := True;
|
WatchInspectNav1.ColTypeEnabled := True;
|
||||||
WatchInspectNav1.ColVisibilityEnabled := False;
|
WatchInspectNav1.ColVisibilityEnabled := False;
|
||||||
|
|
||||||
v := FWatchPrinter.PrintWatchValue(Res, wdfDefault);
|
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfDefault));
|
||||||
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
||||||
|
|
||||||
GridDataSetup;
|
GridDataSetup;
|
||||||
@ -224,11 +224,11 @@ begin
|
|||||||
WatchInspectNav1.ColTypeEnabled := True;
|
WatchInspectNav1.ColTypeEnabled := True;
|
||||||
WatchInspectNav1.ColVisibilityEnabled := False;
|
WatchInspectNav1.ColVisibilityEnabled := False;
|
||||||
|
|
||||||
v := FWatchPrinter.PrintWatchValue(Res, wdfDefault);
|
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfDefault));
|
||||||
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
||||||
|
|
||||||
GridDataSetup;
|
GridDataSetup;
|
||||||
v := FWatchPrinter.PrintWatchValue(Res, wdfPointer);
|
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfPointer));
|
||||||
FGridData.Cells[1,1]:=WatchInspectNav1.Expression;
|
FGridData.Cells[1,1]:=WatchInspectNav1.Expression;
|
||||||
FGridData.Cells[2,1]:=Res.TypeName;
|
FGridData.Cells[2,1]:=Res.TypeName;
|
||||||
FGridData.Cells[3,1]:=v;
|
FGridData.Cells[3,1]:=v;
|
||||||
@ -238,7 +238,7 @@ begin
|
|||||||
FGridData.RowCount := 3;
|
FGridData.RowCount := 3;
|
||||||
FGridData.Cells[1,2]:=Format(lisInspectPointerTo, ['']);
|
FGridData.Cells[1,2]:=Format(lisInspectPointerTo, ['']);
|
||||||
FGridData.Cells[2,2]:=Res.TypeName;
|
FGridData.Cells[2,2]:=Res.TypeName;
|
||||||
FGridData.Cells[3,2]:=FWatchPrinter.PrintWatchValue(Res, wdfDefault);
|
FGridData.Cells[3,2]:=ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfDefault));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ begin
|
|||||||
WatchInspectNav1.ColTypeEnabled := True;
|
WatchInspectNav1.ColTypeEnabled := True;
|
||||||
WatchInspectNav1.ColVisibilityEnabled := False;
|
WatchInspectNav1.ColVisibilityEnabled := False;
|
||||||
|
|
||||||
v := FWatchPrinter.PrintWatchValue(Res, wdfDefault);
|
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfDefault));
|
||||||
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
||||||
|
|
||||||
GridDataSetup;
|
GridDataSetup;
|
||||||
@ -343,7 +343,7 @@ begin
|
|||||||
Entry := Res.SelectedEntry;
|
Entry := Res.SelectedEntry;
|
||||||
FGridData.Cells[1,i+1-SubStart] := IntToStr(LowBnd + ResIdxOffs + i);
|
FGridData.Cells[1,i+1-SubStart] := IntToStr(LowBnd + ResIdxOffs + i);
|
||||||
FGridData.Cells[2,i+1-SubStart] := Entry.TypeName;
|
FGridData.Cells[2,i+1-SubStart] := Entry.TypeName;
|
||||||
FGridData.Cells[3,i+1-SubStart] := FWatchPrinter.PrintWatchValue(Entry, wdfDefault);
|
FGridData.Cells[3,i+1-SubStart] := ClearMultiline(FWatchPrinter.PrintWatchValue(Entry, wdfDefault));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -457,7 +457,7 @@ begin
|
|||||||
else FGridData.Cells[2,f] := '';
|
else FGridData.Cells[2,f] := '';
|
||||||
|
|
||||||
if Fld <> nil
|
if Fld <> nil
|
||||||
then FGridData.Cells[3,f] := FWatchPrinter.PrintWatchValue(Fld, wdfDefault)
|
then FGridData.Cells[3,f] := ClearMultiline(FWatchPrinter.PrintWatchValue(Fld, wdfDefault))
|
||||||
else FGridData.Cells[3,f] := '<error>';
|
else FGridData.Cells[3,f] := '<error>';
|
||||||
|
|
||||||
FGridData.Cells[4,f] := FieldLocationNames[FldInfo.FieldVisibility];
|
FGridData.Cells[4,f] := FieldLocationNames[FldInfo.FieldVisibility];
|
||||||
@ -1220,7 +1220,7 @@ begin
|
|||||||
// skDecomposable: ;
|
// skDecomposable: ;
|
||||||
else begin
|
else begin
|
||||||
Clear;
|
Clear;
|
||||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, ClearMultiline(FHumanReadable)]);
|
||||||
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||||
PageControl.ActivePage := ErrorPage;
|
PageControl.ActivePage := ErrorPage;
|
||||||
end;
|
end;
|
||||||
@ -1280,7 +1280,7 @@ begin
|
|||||||
// rdkConvertRes: InspectResDataStruct;
|
// rdkConvertRes: InspectResDataStruct;
|
||||||
else begin
|
else begin
|
||||||
Clear;
|
Clear;
|
||||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, ClearMultiline(FHumanReadable)]);
|
||||||
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||||
PageControl.ActivePage := ErrorPage;
|
PageControl.ActivePage := ErrorPage;
|
||||||
end;
|
end;
|
||||||
@ -1291,7 +1291,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Clear;
|
Clear;
|
||||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, ClearMultiline(FHumanReadable)]);
|
||||||
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||||
PageControl.ActivePage := ErrorPage;
|
PageControl.ActivePage := ErrorPage;
|
||||||
end;
|
end;
|
||||||
|
@ -1188,39 +1188,6 @@ end;
|
|||||||
|
|
||||||
procedure TWatchesDlg.UpdateItem(const VNode: PVirtualNode;
|
procedure TWatchesDlg.UpdateItem(const VNode: PVirtualNode;
|
||||||
const AWatch: TIdeWatch);
|
const AWatch: TIdeWatch);
|
||||||
function ClearMultiline(const AValue: ansistring): ansistring;
|
|
||||||
var
|
|
||||||
j: SizeInt;
|
|
||||||
ow: SizeInt;
|
|
||||||
NewLine: Boolean;
|
|
||||||
begin
|
|
||||||
ow:=0;
|
|
||||||
SetLength(Result{%H-},Length(AValue));
|
|
||||||
NewLine:=true;
|
|
||||||
for j := 1 to Length(AValue) do begin
|
|
||||||
if (AValue[j]=#13) or (AValue[j]=#10) then begin
|
|
||||||
NewLine:=true;
|
|
||||||
inc(ow);
|
|
||||||
Result[ow]:=#32; // insert one space instead of new line
|
|
||||||
end
|
|
||||||
else if Avalue[j] in [#9,#32] then begin
|
|
||||||
if not NewLine then begin // strip leading spaces after new line
|
|
||||||
inc(ow);
|
|
||||||
Result[ow]:=#32;
|
|
||||||
end;
|
|
||||||
end else begin
|
|
||||||
inc(ow);
|
|
||||||
Result[ow]:=AValue[j];
|
|
||||||
NewLine:=false;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
If ow>255 then begin
|
|
||||||
//Limit watch to 255 chars in length
|
|
||||||
Result:=Copy(Result,1,252)+'...';
|
|
||||||
end else begin
|
|
||||||
SetLength(Result,ow);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
function DoDelayedDelete: Boolean;
|
function DoDelayedDelete: Boolean;
|
||||||
begin
|
begin
|
||||||
// In case the debugger did ProcessMessages, and a "delete" action was triggered
|
// In case the debugger did ProcessMessages, and a "delete" action was triggered
|
||||||
|
Loading…
Reference in New Issue
Block a user