mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 20:00:47 +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 QuoteText(AText: Utf8String): UTf8String;
|
||||
function QuoteWideText(AText: WideString): WideString;
|
||||
function ClearMultiline(const AValue: ansistring): ansistring;
|
||||
|
||||
implementation
|
||||
|
||||
@ -211,5 +212,38 @@ begin
|
||||
until False;
|
||||
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.
|
||||
|
||||
|
@ -38,11 +38,11 @@ uses
|
||||
DbgIntfDebuggerBase, DbgIntfBaseTypes, LazClasses, SpinEx, LazDebuggerIntf,
|
||||
LazDebuggerIntfBaseTypes,
|
||||
// IDE
|
||||
BaseDebugManager, InputHistory, Debugger,
|
||||
IdeDebuggerWatchResPrinter, IdeDebuggerWatchResult, IdeDebuggerWatchResUtils,
|
||||
IdeDebuggerBase, ArrayNavigationFrame, IdeDebuggerOpts,
|
||||
IdeDebuggerBackendValueConv, WatchInspectToolbar, DebuggerDlg,
|
||||
EnvironmentOpts, RecentListProcs, IdeDebuggerStringConstants;
|
||||
BaseDebugManager, InputHistory, Debugger, IdeDebuggerWatchResPrinter,
|
||||
IdeDebuggerWatchResult, IdeDebuggerWatchResUtils, IdeDebuggerBase,
|
||||
ArrayNavigationFrame, IdeDebuggerOpts, IdeDebuggerBackendValueConv,
|
||||
WatchInspectToolbar, DebuggerDlg, EnvironmentOpts, RecentListProcs,
|
||||
IdeDebuggerStringConstants, IdeDebuggerUtils;
|
||||
|
||||
type
|
||||
|
||||
@ -198,7 +198,7 @@ begin
|
||||
WatchInspectNav1.ColTypeEnabled := True;
|
||||
WatchInspectNav1.ColVisibilityEnabled := False;
|
||||
|
||||
v := FWatchPrinter.PrintWatchValue(Res, wdfDefault);
|
||||
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfDefault));
|
||||
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
||||
|
||||
GridDataSetup;
|
||||
@ -224,11 +224,11 @@ begin
|
||||
WatchInspectNav1.ColTypeEnabled := True;
|
||||
WatchInspectNav1.ColVisibilityEnabled := False;
|
||||
|
||||
v := FWatchPrinter.PrintWatchValue(Res, wdfDefault);
|
||||
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfDefault));
|
||||
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
||||
|
||||
GridDataSetup;
|
||||
v := FWatchPrinter.PrintWatchValue(Res, wdfPointer);
|
||||
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfPointer));
|
||||
FGridData.Cells[1,1]:=WatchInspectNav1.Expression;
|
||||
FGridData.Cells[2,1]:=Res.TypeName;
|
||||
FGridData.Cells[3,1]:=v;
|
||||
@ -238,7 +238,7 @@ begin
|
||||
FGridData.RowCount := 3;
|
||||
FGridData.Cells[1,2]:=Format(lisInspectPointerTo, ['']);
|
||||
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;
|
||||
|
||||
@ -260,7 +260,7 @@ begin
|
||||
WatchInspectNav1.ColTypeEnabled := True;
|
||||
WatchInspectNav1.ColVisibilityEnabled := False;
|
||||
|
||||
v := FWatchPrinter.PrintWatchValue(Res, wdfDefault);
|
||||
v := ClearMultiline(FWatchPrinter.PrintWatchValue(Res, wdfDefault));
|
||||
StatusBar1.SimpleText:=ShortenedExpression+' : '+Res.TypeName + ' = ' + v;
|
||||
|
||||
GridDataSetup;
|
||||
@ -343,7 +343,7 @@ begin
|
||||
Entry := Res.SelectedEntry;
|
||||
FGridData.Cells[1,i+1-SubStart] := IntToStr(LowBnd + ResIdxOffs + i);
|
||||
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;
|
||||
@ -457,7 +457,7 @@ begin
|
||||
else FGridData.Cells[2,f] := '';
|
||||
|
||||
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>';
|
||||
|
||||
FGridData.Cells[4,f] := FieldLocationNames[FldInfo.FieldVisibility];
|
||||
@ -1220,7 +1220,7 @@ begin
|
||||
// skDecomposable: ;
|
||||
else begin
|
||||
Clear;
|
||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, ClearMultiline(FHumanReadable)]);
|
||||
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||
PageControl.ActivePage := ErrorPage;
|
||||
end;
|
||||
@ -1280,7 +1280,7 @@ begin
|
||||
// rdkConvertRes: InspectResDataStruct;
|
||||
else begin
|
||||
Clear;
|
||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, ClearMultiline(FHumanReadable)]);
|
||||
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||
PageControl.ActivePage := ErrorPage;
|
||||
end;
|
||||
@ -1291,7 +1291,7 @@ begin
|
||||
end;
|
||||
|
||||
Clear;
|
||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||
StatusBar1.SimpleText:=Format(lisInspectUnavailableError, [ShortenedExpression, ClearMultiline(FHumanReadable)]);
|
||||
ErrorLabel.Caption :=Format(lisInspectUnavailableError, [ShortenedExpression, FHumanReadable]);
|
||||
PageControl.ActivePage := ErrorPage;
|
||||
end;
|
||||
|
@ -1188,39 +1188,6 @@ end;
|
||||
|
||||
procedure TWatchesDlg.UpdateItem(const VNode: PVirtualNode;
|
||||
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;
|
||||
begin
|
||||
// In case the debugger did ProcessMessages, and a "delete" action was triggered
|
||||
|
Loading…
Reference in New Issue
Block a user