Debugger: Replace TWatchValue.DisplayFormat with TWatchValue.IsMemDump. All other DisplayFormat settings are on TWatch only.

This commit is contained in:
Martin 2024-02-24 13:36:24 +01:00
parent adc63a1a42
commit 8b491579a1
6 changed files with 62 additions and 54 deletions

View File

@ -245,7 +245,7 @@ type
function GetStackFrame: Integer; function GetStackFrame: Integer;
function GetThreadId: Integer; function GetThreadId: Integer;
function GetValidity: TDebuggerDataState; function GetValidity: TDebuggerDataState;
procedure SetTypeInfo(AValue: TDBGTypeBase); procedure SetTypeInfo(AValue: TDBGTypeBase); // Must not be used by MemDump
procedure SetValidity(AValue: TDebuggerDataState); procedure SetValidity(AValue: TDebuggerDataState);
property EvaluateFlags: TWatcheEvaluateFlags read GetEvaluateFlags; property EvaluateFlags: TWatcheEvaluateFlags read GetEvaluateFlags;
@ -256,7 +256,7 @@ type
property Expression: String read GetExpression; property Expression: String read GetExpression;
property Validity: TDebuggerDataState read GetValidity write SetValidity; property Validity: TDebuggerDataState read GetValidity write SetValidity;
property TypeInfo: TDBGTypeBase {read GetTypeInfo} write SetTypeInfo; property TypeInfo: TDBGTypeBase {read GetTypeInfo} write SetTypeInfo; // Must not be used by MemDump
end; end;

View File

@ -11580,6 +11580,7 @@ var
WatchPrinter: TWatchResultPrinter; WatchPrinter: TWatchResultPrinter;
ResultText: String; ResultText: String;
ResData: TWatchResultData; ResData: TWatchResultData;
DispFormat: TWatchDisplayFormat;
begin begin
if (Sender <> FHintWatchData.WatchValue) or (FHintWatchData.WatchValue = nil) or if (Sender <> FHintWatchData.WatchValue) or (FHintWatchData.WatchValue = nil) or
(SourceEditorManager = nil) or (SourceEditorManager = nil) or
@ -11594,15 +11595,19 @@ begin
ResultText := ''; ResultText := '';
WatchPrinter := TWatchResultPrinter.Create; WatchPrinter := TWatchResultPrinter.Create;
try try
DispFormat := wdfDefault;
if FHintWatchData.WatchValue.Watch <> nil then
DispFormat := FHintWatchData.WatchValue.Watch.DisplayFormat;
if FHintWatchData.WatchValue.Validity = ddsValid then begin if FHintWatchData.WatchValue.Validity = ddsValid then begin
ResData := FHintWatchData.WatchValue.ResultData; ResData := FHintWatchData.WatchValue.ResultData;
if (ResData <> nil) and if (ResData <> nil) and
not( (ResData.ValueKind = rdkPrePrinted) and (FHintWatchData.WatchValue.TypeInfo <> nil) ) not( (ResData.ValueKind = rdkPrePrinted) and (FHintWatchData.WatchValue.TypeInfo <> nil) )
then begin then begin
if not ValueFormatterSelectorList.FormatValue(ResData, if not ValueFormatterSelectorList.FormatValue(ResData,
FHintWatchData.WatchValue.DisplayFormat, WatchPrinter, ResultText) DispFormat, WatchPrinter, ResultText)
then begin then begin
ResultText := WatchPrinter.PrintWatchValue(ResData, FHintWatchData.WatchValue.DisplayFormat); ResultText := WatchPrinter.PrintWatchValue(ResData, DispFormat);
if (ResData.ValueKind = rdkArray) and (ResData.ArrayLength > 0) if (ResData.ValueKind = rdkArray) and (ResData.ArrayLength > 0)
then then
ResultText := Format(drsLen, [ResData.ArrayLength]) + ResultText; ResultText := Format(drsLen, [ResData.ArrayLength]) + ResultText;
@ -11612,7 +11617,7 @@ begin
else begin else begin
if (FHintWatchData.WatchValue.TypeInfo = nil) or if (FHintWatchData.WatchValue.TypeInfo = nil) or
not ValueFormatterSelectorList.FormatValue(FHintWatchData.WatchValue.TypeInfo, not ValueFormatterSelectorList.FormatValue(FHintWatchData.WatchValue.TypeInfo,
FHintWatchData.WatchValue.Value, FHintWatchData.WatchValue.DisplayFormat, ResultText) FHintWatchData.WatchValue.Value, DispFormat, ResultText)
then begin then begin
ResultText := FHintWatchData.WatchValue.Value; ResultText := FHintWatchData.WatchValue.Value;
if (FHintWatchData.WatchValue.TypeInfo <> nil) and if (FHintWatchData.WatchValue.TypeInfo <> nil) and

View File

@ -4136,7 +4136,7 @@ end;
function TCurrentWatchValue.GetIntfEvaluateFlags: TWatcheEvaluateFlags; function TCurrentWatchValue.GetIntfEvaluateFlags: TWatcheEvaluateFlags;
begin begin
Result := EvaluateFlags; Result := EvaluateFlags;
if FDisplayFormat = wdfMemDump then if IsMemDump then
Result := Result + [defMemDump]; Result := Result + [defMemDump];
end; end;
@ -4310,6 +4310,8 @@ begin
for i := 0 to c - 1 do begin for i := 0 to c - 1 do begin
e := TIdeWatchValue.Create(Watch); e := TIdeWatchValue.Create(Watch);
e.LoadDataFromXMLConfig(AConfig, APath + IntToStr(i) + '/'); e.LoadDataFromXMLConfig(AConfig, APath + IntToStr(i) + '/');
// TODO xxxx may load the same entry more than once with diff display format
// check before adding
Add(e); Add(e);
end; end;
end; end;
@ -4551,7 +4553,7 @@ begin
then Include(FEvaluateFlags, defClassAutoCast) then Include(FEvaluateFlags, defClassAutoCast)
else Exclude(FEvaluateFlags, defClassAutoCast); else Exclude(FEvaluateFlags, defClassAutoCast);
FRepeatCount := AConfig.GetValue(APath + 'RepeatCount', 0); FRepeatCount := AConfig.GetValue(APath + 'RepeatCount', 0);
AConfig.GetValue(APath + 'DisplayFormat', int64(ord(wdfDefault)), FDisplayFormat, system.TypeInfo(TWatchDisplayFormat)); FIsMemDump := AConfig.GetValue(APath + 'DisplayFormat', 'wdfDefault') = 'wdfMemDump'; // use constants from TWatchDisplayFormat
// Defaults to PrePrinted // Defaults to PrePrinted
FResultData := TWatchResultData.CreateFromXMLConfig(AConfig, APath); FResultData := TWatchResultData.CreateFromXMLConfig(AConfig, APath);
@ -4570,17 +4572,15 @@ begin
AConfig.SetDeleteValue(APath + 'ClassAutoCast', defClassAutoCast in EvaluateFlags, False); AConfig.SetDeleteValue(APath + 'ClassAutoCast', defClassAutoCast in EvaluateFlags, False);
AConfig.SetDeleteValue(APath + 'RepeatCount', RepeatCount, 0); AConfig.SetDeleteValue(APath + 'RepeatCount', RepeatCount, 0);
if (Watch <> nil) and (FDisplayFormat <> wdfMemDump) and if IsMemDump then begin
(FResultData <> nil) and AConfig.SetDeleteValue(APath + 'DisplayFormat', 'wdfMemDump', 'wdfDefault'); // use constants from TWatchDisplayFormat
(FResultData.ValueKind <> rdkPrePrinted) AConfig.SetValue(APath + 'Value', Value);
then begin
// Use same path => "Value" will be readable for older IDE (read as wdDefault)
// ResultData does not write any "path/value" conflicting with the above fields
ResultData.SaveDataToXMLConfig(AConfig, APath);
end end
else begin else begin
AConfig.SetDeleteValue(APath + 'DisplayFormat', DisplayFormat, int64(ord(wdfDefault)), system.TypeInfo(TWatchDisplayFormat)); if ResultData <> nil then
AConfig.SetValue(APath + 'Value', Value); // Use same path => "Value" will be readable for older IDE (read as wdDefault)
// ResultData does not write any "path/value" conflicting with the above fields
ResultData.SaveDataToXMLConfig(AConfig, APath);
end; end;
end; end;
@ -4588,7 +4588,7 @@ constructor TIdeWatchValue.Create(AOwnerWatch: TWatch);
begin begin
inherited Create(AOwnerWatch); inherited Create(AOwnerWatch);
Validity := ddsUnknown; Validity := ddsUnknown;
FDisplayFormat := Watch.DisplayFormat; FIsMemDump := Watch.DisplayFormat = wdfMemDump;
FEvaluateFlags := Watch.EvaluateFlags; FEvaluateFlags := Watch.EvaluateFlags;
FRepeatCount := Watch.RepeatCount; FRepeatCount := Watch.RepeatCount;
FFirstIndexOffs := Watch.FirstIndexOffs; FFirstIndexOffs := Watch.FirstIndexOffs;
@ -4607,7 +4607,7 @@ begin
inherited Assign(AnOther); inherited Assign(AnOther);
FThreadId := TIdeWatchValue(AnOther).FThreadId; FThreadId := TIdeWatchValue(AnOther).FThreadId;
FStackFrame := TIdeWatchValue(AnOther).FStackFrame; FStackFrame := TIdeWatchValue(AnOther).FStackFrame;
FDisplayFormat := TIdeWatchValue(AnOther).FDisplayFormat; FIsMemDump := TIdeWatchValue(AnOther).FIsMemDump;
end; end;
function TIdeWatchValue.ExpressionForChildField(AName: String; function TIdeWatchValue.ExpressionForChildField(AName: String;

View File

@ -39,7 +39,7 @@ type
function GetEnabled: Boolean; function GetEnabled: Boolean;
function GetValidity: TDebuggerDataState; function GetValidity: TDebuggerDataState;
function GetDisplayFormat: TWatchDisplayFormat; // function GetDisplayFormat: TWatchDisplayFormat;
function GetTypeInfo: TDBGType; deprecated; function GetTypeInfo: TDBGType; deprecated;
function GetValue: string; function GetValue: string;
function GetResultData: TWatchResultData; function GetResultData: TWatchResultData;
@ -49,7 +49,7 @@ type
property Enabled: Boolean read GetEnabled; property Enabled: Boolean read GetEnabled;
property Validity: TDebuggerDataState read GetValidity; property Validity: TDebuggerDataState read GetValidity;
property DisplayFormat: TWatchDisplayFormat read GetDisplayFormat; // property DisplayFormat: TWatchDisplayFormat read GetDisplayFormat;
property TypeInfo: TDBGType read GetTypeInfo; property TypeInfo: TDBGType read GetTypeInfo;
property Value: string read GetValue; // for <Error> etc property Value: string read GetValue; // for <Error> etc
property ResultData: TWatchResultData read GetResultData; property ResultData: TWatchResultData read GetResultData;
@ -60,9 +60,9 @@ type
{ TWatchValue } { TWatchValue }
TWatchValue = class(TRefCountedObject) TWatchValue = class(TRefCountedObject)
private
protected protected
FWatch: TWatch; FWatch: TWatch;
FIsMemDump: Boolean;
FTypeInfo: TDBGType; FTypeInfo: TDBGType;
FValidity: TDebuggerDataState; FValidity: TDebuggerDataState;
FResultData: TWatchResultData; FResultData: TWatchResultData;
@ -70,7 +70,6 @@ type
FResultDataContent: (rdcNotAnalysed, rdcNotSpecial, rdcJSon); FResultDataContent: (rdcNotAnalysed, rdcNotSpecial, rdcJSon);
procedure SetWatch(AValue: TWatch); virtual; procedure SetWatch(AValue: TWatch); virtual;
function GetDisplayFormat: TWatchDisplayFormat;
function GetEvaluateFlags: TWatcheEvaluateFlags; function GetEvaluateFlags: TWatcheEvaluateFlags;
function GetFirstIndexOffs: Int64; function GetFirstIndexOffs: Int64;
function GetRepeatCount: Integer; function GetRepeatCount: Integer;
@ -83,8 +82,9 @@ type
function GetResultData: TWatchResultData; virtual; function GetResultData: TWatchResultData; virtual;
procedure SetResultData(AResultData: TWatchResultData); procedure SetResultData(AResultData: TWatchResultData);
property IsMemDump: Boolean read FIsMemDump;
protected protected
FDisplayFormat: TWatchDisplayFormat;
FEvaluateFlags: TWatcheEvaluateFlags; FEvaluateFlags: TWatcheEvaluateFlags;
FRepeatCount: Integer; FRepeatCount: Integer;
FFirstIndexOffs: Int64; FFirstIndexOffs: Int64;
@ -102,7 +102,6 @@ type
destructor Destroy; override; destructor Destroy; override;
procedure Assign(AnOther: TWatchValue); virtual; procedure Assign(AnOther: TWatchValue); virtual;
procedure ClearDisplayData; // keep only what's needed for the snapshot procedure ClearDisplayData; // keep only what's needed for the snapshot
property DisplayFormat: TWatchDisplayFormat read GetDisplayFormat;
property EvaluateFlags: TWatcheEvaluateFlags read GetEvaluateFlags; property EvaluateFlags: TWatcheEvaluateFlags read GetEvaluateFlags;
property FirstIndexOffs: Int64 read GetFirstIndexOffs; property FirstIndexOffs: Int64 read GetFirstIndexOffs;
property RepeatCount: Integer read GetRepeatCount; property RepeatCount: Integer read GetRepeatCount;
@ -440,17 +439,6 @@ begin
FWatch := AValue; FWatch := AValue;
end; end;
function TWatchValue.GetDisplayFormat: TWatchDisplayFormat;
begin
if (FWatch = nil) or
(FDisplayFormat = wdfMemDump) or
(FWatch.FDisplayFormat = wdfMemDump)
then
Result := FDisplayFormat
else
Result := FWatch.DisplayFormat;
end;
function TWatchValue.GetRepeatCount: Integer; function TWatchValue.GetRepeatCount: Integer;
begin begin
Result := FRepeatCount; Result := FRepeatCount;
@ -823,7 +811,7 @@ begin
while i >= 0 do begin while i >= 0 do begin
Result := TWatchValue(FList[i]); Result := TWatchValue(FList[i]);
if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and
(Result.DisplayFormat = FWatch.DisplayFormat) and (Result.IsMemDump = (FWatch.DisplayFormat = wdfMemDump)) and
(Result.EvaluateFlags = FWatch.EvaluateFlags) and (Result.EvaluateFlags = FWatch.EvaluateFlags) and
(Result.FFirstIndexOffs <= AFirstIndexOffs) and (Result.FFirstIndexOffs <= AFirstIndexOffs) and
(Result.FFirstIndexOffs + Result.FRepeatCount > AFirstIndexOffs) and (Result.FFirstIndexOffs + Result.FRepeatCount > AFirstIndexOffs) and
@ -871,7 +859,7 @@ begin
while i >= 0 do begin while i >= 0 do begin
Result := TWatchValue(FList[i]); Result := TWatchValue(FList[i]);
if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and
(Result.DisplayFormat = FWatch.DisplayFormat) and (Result.IsMemDump = (FWatch.DisplayFormat = wdfMemDump)) and
(Result.RepeatCount = FWatch.RepeatCount) and (Result.RepeatCount = FWatch.RepeatCount) and
(Result.FirstIndexOffs = FWatch.FirstIndexOffs) and (Result.FirstIndexOffs = FWatch.FirstIndexOffs) and
(Result.EvaluateFlags = FWatch.EvaluateFlags) (Result.EvaluateFlags = FWatch.EvaluateFlags)

View File

@ -834,6 +834,7 @@ function TDbgTreeViewLocalsValueMgr.GetFieldAsText(Nd: PVirtualNode;
var var
ResData: TWatchResultData; ResData: TWatchResultData;
da: TDBGPtr; da: TDBGPtr;
DispFormat: TWatchDisplayFormat;
begin begin
if AWatchAbleResult = nil then if AWatchAbleResult = nil then
exit(inherited); exit(inherited);
@ -868,6 +869,7 @@ begin
end; end;
end; end;
DispFormat := wdfDefault; // TODO TIdeLocalsValue(AWatchAble).DisplayFormat
if vdoAllowMultiLine in AnOpts then if vdoAllowMultiLine in AnOpts then
FLocalsDlg.FWatchPrinter.FormatFlags := [rpfIndent, rpfMultiLine]; FLocalsDlg.FWatchPrinter.FormatFlags := [rpfIndent, rpfMultiLine];
try try
@ -876,15 +878,15 @@ begin
not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) ) not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) )
then begin then begin
if not ValueFormatterSelectorList.FormatValue(ResData, if not ValueFormatterSelectorList.FormatValue(ResData,
AWatchAbleResult.DisplayFormat, FLocalsDlg.FWatchPrinter, Result) DispFormat, FLocalsDlg.FWatchPrinter, Result)
then begin then begin
Result := FLocalsDlg.FWatchPrinter.PrintWatchValue(ResData, AWatchAbleResult.DisplayFormat); Result := FLocalsDlg.FWatchPrinter.PrintWatchValue(ResData, DispFormat);
end; end;
end end
else begin else begin
if (AWatchAbleResult.TypeInfo = nil) or if (AWatchAbleResult.TypeInfo = nil) or
not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo, not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo,
AWatchAbleResult.Value, AWatchAbleResult.DisplayFormat, Result) AWatchAbleResult.Value, DispFormat, Result)
then begin then begin
Result := AWatchAbleResult.Value; Result := AWatchAbleResult.Value;
end; end;
@ -910,21 +912,23 @@ var
WatchValueStr: String; WatchValueStr: String;
ResData: TWatchResultData; ResData: TWatchResultData;
da: TDBGPtr; da: TDBGPtr;
DispFormat: TWatchDisplayFormat;
begin begin
ResData := AWatchAbleResult.ResultData; ResData := AWatchAbleResult.ResultData;
DispFormat := wdfDefault; // TODO TIdeLocalsValue(AWatchAble).DisplayFormat
if (ResData <> nil) and if (ResData <> nil) and
not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) ) not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) )
then begin then begin
if not ValueFormatterSelectorList.FormatValue(ResData, if not ValueFormatterSelectorList.FormatValue(ResData,
AWatchAbleResult.DisplayFormat, FLocalsDlg.FWatchPrinter, WatchValueStr) DispFormat, FLocalsDlg.FWatchPrinter, WatchValueStr)
then begin then begin
WatchValueStr := FLocalsDlg.FWatchPrinter.PrintWatchValue(ResData, AWatchAbleResult.DisplayFormat); WatchValueStr := FLocalsDlg.FWatchPrinter.PrintWatchValue(ResData, DispFormat);
end; end;
end end
else begin else begin
if (AWatchAbleResult.TypeInfo = nil) or if (AWatchAbleResult.TypeInfo = nil) or
not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo, not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo,
AWatchAbleResult.Value, AWatchAbleResult.DisplayFormat, WatchValueStr) AWatchAbleResult.Value, DispFormat, WatchValueStr)
then begin then begin
WatchValueStr := AWatchAbleResult.Value; WatchValueStr := AWatchAbleResult.Value;
end; end;

View File

@ -1173,7 +1173,7 @@ begin
if (d.ResultData <> nil) and if (d.ResultData <> nil) and
not( (d.ResultData.ValueKind = rdkPrePrinted) and (t <> nil) ) not( (d.ResultData.ValueKind = rdkPrePrinted) and (t <> nil) )
then begin then begin
if ValueFormatterSelectorList.FormatValue(d.ResultData, d.DisplayFormat, FWatchPrinter, s) if ValueFormatterSelectorList.FormatValue(d.ResultData, Watch.DisplayFormat, FWatchPrinter, s)
then begin then begin
InspectMemo.WordWrap := True; InspectMemo.WordWrap := True;
InspectMemo.Text := s; InspectMemo.Text := s;
@ -1182,7 +1182,7 @@ begin
end end
else else
if (t <> nil) and if (t <> nil) and
ValueFormatterSelectorList.FormatValue(t, d.Value, d.DisplayFormat, s) ValueFormatterSelectorList.FormatValue(t, d.Value, Watch.DisplayFormat, s)
then begin then begin
InspectMemo.WordWrap := True; InspectMemo.WordWrap := True;
InspectMemo.Text := s; InspectMemo.Text := s;
@ -1191,7 +1191,7 @@ begin
if (t <> nil) and (t.Fields <> nil) and (t.Fields.Count > 0) and if (t <> nil) and (t.Fields <> nil) and (t.Fields.Count > 0) and
(d.DisplayFormat in [wdfDefault, wdfStructure]) (Watch.DisplayFormat in [wdfDefault, wdfStructure])
then begin then begin
InspectMemo.WordWrap := False; InspectMemo.WordWrap := False;
InspectMemo.Lines.BeginUpdate; InspectMemo.Lines.BeginUpdate;
@ -1221,7 +1221,7 @@ begin
InspectMemo.WordWrap := True; InspectMemo.WordWrap := True;
if d.ResultData <> nil then if d.ResultData <> nil then
s := FWatchPrinter.PrintWatchValue(d.ResultData, d.DisplayFormat) s := FWatchPrinter.PrintWatchValue(d.ResultData, Watch.DisplayFormat)
else else
s := d.Value; s := d.Value;
InspectMemo.Text := s; InspectMemo.Text := s;
@ -1434,8 +1434,10 @@ function TDbgTreeViewWatchValueMgr.GetFieldAsText(Nd: PVirtualNode;
AWatchAble: TObject; AWatchAbleResult: IWatchAbleResultIntf; AWatchAble: TObject; AWatchAbleResult: IWatchAbleResultIntf;
AField: TTreeViewDataToTextField; AnOpts: TTreeViewDataToTextOptions): String; AField: TTreeViewDataToTextField; AnOpts: TTreeViewDataToTextOptions): String;
var var
TheWatch: TIdeWatch absolute AWatchAble;
ResData: TWatchResultData; ResData: TWatchResultData;
da: TDBGPtr; da: TDBGPtr;
DispFormat: TWatchDisplayFormat;
begin begin
if AWatchAbleResult = nil then if AWatchAbleResult = nil then
exit(inherited); exit(inherited);
@ -1444,7 +1446,7 @@ begin
case AField of case AField of
vdfName: vdfName:
if AWatchAble <> nil then if AWatchAble <> nil then
Result := TIdeWatch(AWatchAble).Expression; Result := TheWatch.Expression;
vdfValue: begin vdfValue: begin
if AWatchAbleResult = nil then begin if AWatchAbleResult = nil then begin
Result := '<not evaluated>'; Result := '<not evaluated>';
@ -1470,6 +1472,9 @@ begin
end; end;
end; end;
DispFormat := wdfDefault;
if AWatchAble <> nil then
DispFormat := TheWatch.DisplayFormat;
if vdoAllowMultiLine in AnOpts then if vdoAllowMultiLine in AnOpts then
FWatchDlg.FWatchPrinter.FormatFlags := [rpfIndent, rpfMultiLine]; FWatchDlg.FWatchPrinter.FormatFlags := [rpfIndent, rpfMultiLine];
try try
@ -1478,15 +1483,15 @@ begin
not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) ) not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) )
then begin then begin
if not ValueFormatterSelectorList.FormatValue(ResData, if not ValueFormatterSelectorList.FormatValue(ResData,
AWatchAbleResult.DisplayFormat, FWatchDlg.FWatchPrinter, Result) DispFormat, FWatchDlg.FWatchPrinter, Result)
then begin then begin
Result := FWatchDlg.FWatchPrinter.PrintWatchValue(ResData, AWatchAbleResult.DisplayFormat); Result := FWatchDlg.FWatchPrinter.PrintWatchValue(ResData, DispFormat);
end; end;
end end
else begin else begin
if (AWatchAbleResult.TypeInfo = nil) or if (AWatchAbleResult.TypeInfo = nil) or
not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo, not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo,
AWatchAbleResult.Value, AWatchAbleResult.DisplayFormat, Result) AWatchAbleResult.Value, DispFormat, Result)
then begin then begin
Result := AWatchAbleResult.Value; Result := AWatchAbleResult.Value;
end; end;
@ -1509,9 +1514,11 @@ end;
procedure TDbgTreeViewWatchValueMgr.UpdateColumnsText(AWatchAble: TObject; procedure TDbgTreeViewWatchValueMgr.UpdateColumnsText(AWatchAble: TObject;
AWatchAbleResult: IWatchAbleResultIntf; AVNode: PVirtualNode); AWatchAbleResult: IWatchAbleResultIntf; AVNode: PVirtualNode);
var var
TheWatch: TIdeWatch absolute AWatchAble;
ResData: TWatchResultData; ResData: TWatchResultData;
WatchValueStr: String; WatchValueStr: String;
da: TDBGPtr; da: TDBGPtr;
DispFormat: TWatchDisplayFormat;
begin begin
TreeView.NodeText[AVNode, COL_WATCH_EXPR-1]:= TIdeWatch(AWatchAble).DisplayName; TreeView.NodeText[AVNode, COL_WATCH_EXPR-1]:= TIdeWatch(AWatchAble).DisplayName;
TreeView.NodeText[AVNode, 2] := ''; TreeView.NodeText[AVNode, 2] := '';
@ -1527,15 +1534,19 @@ begin
(AWatchAbleResult.Validity in [ddsValid, ddsInvalid, ddsError]) or // snapshot (AWatchAbleResult.Validity in [ddsValid, ddsInvalid, ddsError]) or // snapshot
(AWatchAbleResult.ResultData <> nil) (AWatchAbleResult.ResultData <> nil)
then begin then begin
DispFormat := wdfDefault;
if AWatchAble <> nil then
DispFormat := TheWatch.DisplayFormat;
ResData := AWatchAbleResult.ResultData; ResData := AWatchAbleResult.ResultData;
if (ResData <> nil) and if (ResData <> nil) and
not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) ) not( (ResData.ValueKind = rdkPrePrinted) and (AWatchAbleResult.TypeInfo <> nil) )
then begin then begin
FWatchDlg.FWatchPrinter.FormatFlags := [rpfClearMultiLine]; FWatchDlg.FWatchPrinter.FormatFlags := [rpfClearMultiLine];
if not ValueFormatterSelectorList.FormatValue(ResData, if not ValueFormatterSelectorList.FormatValue(ResData,
AWatchAbleResult.DisplayFormat, FWatchDlg.FWatchPrinter, WatchValueStr) DispFormat, FWatchDlg.FWatchPrinter, WatchValueStr)
then begin then begin
WatchValueStr := FWatchDlg.FWatchPrinter.PrintWatchValue(ResData, AWatchAbleResult.DisplayFormat); WatchValueStr := FWatchDlg.FWatchPrinter.PrintWatchValue(ResData, DispFormat);
if (ResData.ValueKind = rdkArray) and (ResData.ArrayLength > 0) if (ResData.ValueKind = rdkArray) and (ResData.ArrayLength > 0)
then then
WatchValueStr := Format(drsLen, [ResData.ArrayLength]) + WatchValueStr; WatchValueStr := Format(drsLen, [ResData.ArrayLength]) + WatchValueStr;
@ -1552,7 +1563,7 @@ begin
else begin else begin
if (AWatchAbleResult.TypeInfo = nil) or if (AWatchAbleResult.TypeInfo = nil) or
not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo, not ValueFormatterSelectorList.FormatValue(AWatchAbleResult.TypeInfo,
AWatchAbleResult.Value, AWatchAbleResult.DisplayFormat, WatchValueStr) AWatchAbleResult.Value, DispFormat, WatchValueStr)
then begin then begin
WatchValueStr := AWatchAbleResult.Value; WatchValueStr := AWatchAbleResult.Value;
if (AWatchAbleResult.TypeInfo <> nil) and if (AWatchAbleResult.TypeInfo <> nil) and