From 64b56efefb69b357bcad78751b61004dd70fa4bf Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 5 Feb 2014 02:30:45 +0000 Subject: [PATCH] FPDebug: more Value handling / pointers git-svn-id: trunk@43886 - --- components/fpdebug/fpdbgdwarf.pas | 3 +++ components/fpdebug/fppascalparser.pas | 12 ++++++++---- components/fpdebug/test/testtypeinfo.pas | 9 ++++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/components/fpdebug/fpdbgdwarf.pas b/components/fpdebug/fpdbgdwarf.pas index c87482f9a3..aa4895fb77 100644 --- a/components/fpdebug/fpdbgdwarf.pas +++ b/components/fpdebug/fpdbgdwarf.pas @@ -1918,6 +1918,9 @@ end; function TDbgDwarfNumericSymbolValue.CanUseTypeCastAddress: Boolean; begin Result := True; + if (FTypeCastSource.FieldFlags * [svfAddress, svfSize, svfSizeOfPointer] = [svfAddress]) then + exit + else if (FTypeCastSource.FieldFlags * [svfAddress, svfSize] = [svfAddress, svfSize]) and (FTypeCastSource.Size = FSize) then diff --git a/components/fpdebug/fppascalparser.pas b/components/fpdebug/fppascalparser.pas index 298d4f43c1..934ff6c675 100644 --- a/components/fpdebug/fppascalparser.pas +++ b/components/fpdebug/fppascalparser.pas @@ -590,7 +590,7 @@ begin FSigned := ASigned; end; -{ TPasParserTypeCastSymbolValue } +{ TPasParserWrapperSymbolValue } function TPasParserWrapperSymbolValue.GetKind: TDbgSymbolKind; begin @@ -1698,13 +1698,17 @@ begin else if tmp.Kind = skPointer then begin if (svfDataAddress in tmp.FieldFlags) and (tmp.DataAddress <> 0) and - (tmp.TypeInfo <> nil) and (tmp.TypeInfo.TypeInfo <> nil) + (tmp.TypeInfo <> nil) //and (tmp.TypeInfo.TypeInfo <> nil) then begin //TODO: maybe introduce a method TypeCastFromAddress, so we can skip the twp2 object tmp2 := TPasParserDerefPointerSymbolValue.Create(tmp); - Result := tmp.TypeInfo.TypeInfo.TypeCastValue(tmp2); + if (tmp.TypeInfo.TypeInfo <> nil) then + Result := tmp.TypeInfo.TypeInfo.TypeCastValue(tmp2) + else + Result := tmp2; {$IFDEF WITH_REFCOUNT_DEBUG} if Result <> nil then Result.DbgRenameReference(nil, 'DoGetResultValue'){$ENDIF}; - tmp2.ReleaseReference; + if (tmp.TypeInfo.TypeInfo <> nil) then + tmp2.ReleaseReference; end; end //if tmp.Kind = skArray then // dynarray diff --git a/components/fpdebug/test/testtypeinfo.pas b/components/fpdebug/test/testtypeinfo.pas index 51131b42a2..26ca1c6b62 100644 --- a/components/fpdebug/test/testtypeinfo.pas +++ b/components/fpdebug/test/testtypeinfo.pas @@ -427,7 +427,14 @@ begin ExpResult(svfInteger, -299); ExpFlags([svfInteger, svfOrdinal, svfAddress], [svfDataAddress]); // svfSize; - // TODO Integer(pointer(pi)^) + StartTest('LongInt(pointer(pi)^)', skInteger, [ttHasType]); + ExpResult(svfInteger, -299); + ExpFlags([svfInteger, svfOrdinal, svfAddress], [svfDataAddress]); // svfSize; + + StartTest('LongInt(GlobTestSetup1Pointer^)', skInteger, [ttHasType]); + ExpResult(svfInteger, -299); + ExpFlags([svfInteger, svfOrdinal, svfAddress], [svfDataAddress]); // svfSize; + /////////////////////////// finally