Debugger: more utf8 for strings in watches

git-svn-id: trunk@41298 -
This commit is contained in:
martin 2013-05-19 15:38:54 +00:00
parent c990f3d7c8
commit 7ad5db263c
2 changed files with 22 additions and 19 deletions

View File

@ -12721,7 +12721,7 @@ var
if (i <= length(FTextValue)) and (FTextValue[i] in ['''', '#'])
then
FTextValue := MakePrintable(ProcessGDBResultText(
copy(FTextValue, i, length(FTextValue) - i + 1), [prNoLeadingTab, prKeepBackSlash]))
copy(FTextValue, i, length(FTextValue) - i + 1), [prNoLeadingTab]))
else
if Addr = 0
then
@ -12736,7 +12736,7 @@ var
else begin
AnExpression := GetClassName(Addr);
if AnExpression = '' then AnExpression := '???';
FTextValue := 'class of ' + AnExpression + ' ' + FTextValue;
FTextValue := 'class of ' + AnExpression + ' ' + UnEscapeBackslashed(FTextValue);
end;
end;
4,5,6,7: begin // 'wchar', 'widechar'
@ -12749,7 +12749,7 @@ var
8: begin // pointer
if Addr = 0
then FTextValue := 'nil';
FTextValue := PascalizePointer(FTextValue);
FTextValue := PascalizePointer(UnEscapeBackslashed(FTextValue));
end;
else
if Addr = 0
@ -12761,7 +12761,7 @@ var
AnExpression[1] := 'T';
if Length(AnExpression) > 1 then AnExpression[2] := UpperCase(AnExpression[2])[1];
end;
FTextValue := PascalizePointer(FTextValue, AnExpression);
FTextValue := PascalizePointer(UnEscapeBackslashed(FTextValue), AnExpression);
end;
end;
@ -12780,38 +12780,41 @@ var
if (FTextValue <> '') and (FTypeInfo <> nil)
then begin
FTextValue := '<' + FTypeInfo.TypeName + '> = ' + FTextValue;
FTextValue := '<' + FTypeInfo.TypeName + '> = ' +
ProcessGDBResultStruct(FTextValue, [prNoLeadingTab, prMakePrintAble, prStripAddressFromString]);
end
else
if (e = 0) and (addr <> 0)
then begin //No error ?
AnExpression := GetInstanceClassName(Addr);
if AnExpression = '' then AnExpression := '???'; //No instanced class found
FTextValue := 'instance of ' + AnExpression + ' ' + FTextValue;
FTextValue := 'instance of ' + AnExpression + ' ' +
ProcessGDBResultStruct(FTextValue, [prNoLeadingTab, prMakePrintAble, prStripAddressFromString]);
end;
end;
skVariant: begin
FTextValue := GetVariantValue(FTextValue);
FTextValue := UnEscapeBackslashed(GetVariantValue(FTextValue));
end;
skRecord: begin
FTextValue := 'record ' + ResultInfo.TypeName + ' '+ FTextValue;
FTextValue := 'record ' + ResultInfo.TypeName + ' '+
ProcessGDBResultStruct(FTextValue, [prNoLeadingTab, prMakePrintAble, prStripAddressFromString]);
end;
skSimple: begin
if ResultInfo.TypeName = 'CURRENCY' then
FTextValue := FormatCurrency(FTextValue)
FTextValue := FormatCurrency(UnEscapeBackslashed(FTextValue))
else
if ResultInfo.TypeName = 'ShortString' then
FTextValue := MakePrintable(ProcessGDBResultText(FTextValue, [prNoLeadingTab, prKeepBackSlash]))
FTextValue := MakePrintable(ProcessGDBResultText(FTextValue, [prNoLeadingTab]))
else
if (ResultInfo.TypeName = '&ShortString') then // should no longer happen
FTextValue := GetStrValue('ShortString(%s)', [AnExpression]) // we have an address here, so we need to typecast
else
if saDynArray in ResultInfo.Attributes then // may also be a string
FTextValue := PascalizePointer(FTextValue)
FTextValue := PascalizePointer(UnEscapeBackslashed(FTextValue))
else
FTextValue := FTextValue;
FTextValue := UnEscapeBackslashed(FTextValue); // TODO: Check for string
end;
end;
@ -13048,7 +13051,7 @@ var
end;
if FTypeInfo.HasExprEvaluatedAsText then begin
FTextValue := FTypeInfo.ExprEvaluatedAsText;
FTextValue := DeleteEscapeChars(FTextValue); // TODO: move to FixUpResult / only if really needed
//FTextValue := DeleteEscapeChars(FTextValue); // TODO: move to FixUpResult / only if really needed
FValidity := ddsValid;
Result := True;
FixUpResult(AnExpression, FTypeInfo);
@ -13056,7 +13059,7 @@ var
if FTypeInfo.HasStringExprEvaluatedAsText then begin
s := FTextValue;
FTextValue := FTypeInfo.StringExprEvaluatedAsText;
FTextValue := DeleteEscapeChars(FTextValue); // TODO: move to FixUpResult / only if really needed
//FTextValue := DeleteEscapeChars(FTextValue); // TODO: move to FixUpResult / only if really needed
FixUpResult(AnExpression, FTypeInfo);
FTextValue := 'PCHAR: ' + s + LineEnding + 'STRING: ' + FTextValue;
end;

View File

@ -413,21 +413,21 @@
const
ConstUtf8TextAnsi: AnsiString = 'a üü1'' \\t 2 \t 3'#9'4'#13'5\n6';
ConstUtf8TextShortStr: ShortString = 'a üü1'' \\t 2 \t 3'#9'4'#13'5\n6';
ConstUtf8TextShort: String[40] = 'a üü1'' \\t 2 \t 3'#9'4'#13'5\n6';
ConstUtf8TextShort: String[80] = 'a üü1'' \\t 2 \t 3'#9'4'#13'5\n6';
ConstUtf8TextAnsi2: AnsiString = 'üü''1'; // start with utf8
ConstUtf8TextShortStr2: ShortString = 'üü''1';
ConstUtf8TextShort2: String[40] = 'üü''1';
ConstUtf8TextShort2: String[80] = 'üü''1';
ConstUtf8TextAnsiBad: AnsiString = 'a '#170'b';
ConstUtf8TextShortStrBad: ShortString = 'a '#170'b';
ConstUtf8TextShortBad: String[40] = 'a '#170'b';
ConstUtf8TextShortBad: String[80] = 'a '#170'b';
var
VarUtf8TextAnsi, VarUtf8TextAnsi2: AnsiString;
VarUtf8TextShort, VarUtf8TextShort2: String[40];
VarUtf8TextShort, VarUtf8TextShort2: String[80];
VarUtf8TextShortStr, VarUtf8TextShortStr2: ShortString;
VarUtf8TextAnsiBad: AnsiString;
VarUtf8TextShortBad: String[40];
VarUtf8TextShortBad: String[80];
VarUtf8TextShortStrBad: ShortString;
{$ENDIF}