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

View File

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