mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 13:20:23 +02:00
DBG: Fix getting Exception Classname
git-svn-id: trunk@32233 -
This commit is contained in:
parent
b69181fb52
commit
cd4aa1aa02
@ -9659,23 +9659,31 @@ var
|
|||||||
S: String;
|
S: String;
|
||||||
R: TGDBMIExecResult;
|
R: TGDBMIExecResult;
|
||||||
ResultList: TGDBMINameValueList;
|
ResultList: TGDBMINameValueList;
|
||||||
|
UseShortString: Boolean;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
|
UseShortString := False;
|
||||||
|
|
||||||
if dfImplicidTypes in FTheDebugger.DebuggerFlags
|
if dfImplicidTypes in FTheDebugger.DebuggerFlags
|
||||||
then begin
|
then begin
|
||||||
S := Format(AExpression, AValues);
|
S := Format(AExpression, AValues);
|
||||||
if tfFlagHasTypeShortstring in TargetInfo^.TargetFlags
|
UseShortString := tfFlagHasTypeShortstring in TargetInfo^.TargetFlags;
|
||||||
|
if UseShortString
|
||||||
then s := Format('^^shortstring(%s+%d)^^', [S, TargetInfo^.TargetPtrSize * 3])
|
then s := Format('^^shortstring(%s+%d)^^', [S, TargetInfo^.TargetPtrSize * 3])
|
||||||
else s := Format('^^char(%s+%d)^+1', [S, TargetInfo^.TargetPtrSize * 3]);
|
else s := Format('^^char(%s+%d)^', [S, TargetInfo^.TargetPtrSize * 3]);
|
||||||
OK := ExecuteCommand('-data-evaluate-expression %s',
|
OK := ExecuteCommand('-data-evaluate-expression %s',
|
||||||
[S], R);
|
[S], R);
|
||||||
if (not OK) or (LastExecResult.State = dsError)
|
if (not OK) or (LastExecResult.State = dsError)
|
||||||
or (pos('value="#0', LastExecResult.Values) > 0)
|
or (pos('value="#0', LastExecResult.Values) > 0)
|
||||||
then OK := ExecuteCommand('-data-evaluate-expression ^char(^pointer(%s+%d)^+1)',
|
then begin
|
||||||
|
OK := ExecuteCommand('-data-evaluate-expression ^char(^pointer(%s+%d)^)',
|
||||||
[S, TargetInfo^.TargetPtrSize * 3], R);
|
[S, TargetInfo^.TargetPtrSize * 3], R);
|
||||||
|
UseShortString := False;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
|
UseShortString := True;
|
||||||
Str(TDbgPtr(GetData(AExpression + '+12', AValues)), S);
|
Str(TDbgPtr(GetData(AExpression + '+12', AValues)), S);
|
||||||
OK := ExecuteCommand('-data-evaluate-expression pshortstring(%s)^', [S], R);
|
OK := ExecuteCommand('-data-evaluate-expression pshortstring(%s)^', [S], R);
|
||||||
end;
|
end;
|
||||||
@ -9683,8 +9691,25 @@ begin
|
|||||||
if OK
|
if OK
|
||||||
then begin
|
then begin
|
||||||
ResultList := TGDBMINameValueList.Create(R);
|
ResultList := TGDBMINameValueList.Create(R);
|
||||||
S := DeleteEscapeChars(ResultList.Values['value']);
|
S := ResultList.Values['value'];
|
||||||
|
if UseShortString then begin
|
||||||
Result := GetPart('''', '''', S);
|
Result := GetPart('''', '''', S);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
s := ParseGDBString(s);
|
||||||
|
if s <> ''
|
||||||
|
then i := ord(s[1])
|
||||||
|
else i := 1;
|
||||||
|
if i <= length(s)-1 then begin
|
||||||
|
Result := copy(s, 2, i);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// fall back
|
||||||
|
S := DeleteEscapeChars(S);
|
||||||
|
Result := GetPart('''', '''', S);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
ResultList.Free;
|
ResultList.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user