Implement DwarfType::CreateDerivedArrayType().
Will be used for array typecasting.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009-2012, Ingo Weinhold, [email protected].
|
* Copyright 2009-2012, Ingo Weinhold, [email protected].
|
||||||
* Copryight 2012, Rene Gollent, [email protected].
|
* Copryight 2012-2013, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -245,6 +245,52 @@ DwarfType::CreateDerivedAddressType(address_type_kind addressType,
|
|||||||
if (resultType == NULL)
|
if (resultType == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
resultType->SetByteSize(fTypeContext->GetArchitecture()->AddressSize());
|
||||||
|
|
||||||
|
_resultType = resultType;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
DwarfType::CreateDerivedArrayType(uint64 elementCount, bool extendExisting,
|
||||||
|
ArrayType*& _resultType)
|
||||||
|
{
|
||||||
|
DwarfArrayType* resultType = NULL;
|
||||||
|
BReference<DwarfType> baseTypeReference;
|
||||||
|
if (extendExisting)
|
||||||
|
resultType = dynamic_cast<DwarfArrayType*>(this);
|
||||||
|
|
||||||
|
if (resultType == NULL) {
|
||||||
|
resultType = new(std::nothrow)
|
||||||
|
DwarfArrayType(fTypeContext, fName, NULL, this);
|
||||||
|
baseTypeReference.SetTo(resultType, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultType == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
DwarfSubrangeType* subrangeType = new(std::nothrow) DwarfSubrangeType(
|
||||||
|
fTypeContext, fName, NULL, resultType, BVariant((uint64)0),
|
||||||
|
BVariant(elementCount - 1));
|
||||||
|
if (subrangeType == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
BReference<DwarfSubrangeType> subrangeReference(subrangeType, true);
|
||||||
|
|
||||||
|
DwarfArrayDimension* dimension = new(std::nothrow) DwarfArrayDimension(
|
||||||
|
subrangeType);
|
||||||
|
if (dimension == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
BReference<DwarfArrayDimension> dimensionReference(dimension, true);
|
||||||
|
|
||||||
|
if (!resultType->AddDimension(dimension))
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
dimensionReference.Detach();
|
||||||
|
subrangeReference.Detach();
|
||||||
|
baseTypeReference.Detach();
|
||||||
|
|
||||||
_resultType = resultType;
|
_resultType = resultType;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -949,8 +995,9 @@ DwarfArrayType::ResolveElementLocation(const ArrayIndexPath& indexPath,
|
|||||||
// If the array entry has a bit stride, get it. Otherwise fall back to the
|
// If the array entry has a bit stride, get it. Otherwise fall back to the
|
||||||
// element type size.
|
// element type size.
|
||||||
int64 bitStride;
|
int64 bitStride;
|
||||||
if (DIEArrayType* bitStrideOwnerEntry = DwarfUtils::GetDIEByPredicate(
|
DIEArrayType* bitStrideOwnerEntry = NULL;
|
||||||
fEntry, HasBitStridePredicate<DIEArrayType>())) {
|
if (fEntry != NULL && (bitStrideOwnerEntry = DwarfUtils::GetDIEByPredicate(
|
||||||
|
fEntry, HasBitStridePredicate<DIEArrayType>()))) {
|
||||||
BVariant value;
|
BVariant value;
|
||||||
status_t error = typeContext->File()->EvaluateDynamicValue(
|
status_t error = typeContext->File()->EvaluateDynamicValue(
|
||||||
typeContext->GetCompilationUnit(), typeContext->AddressSize(),
|
typeContext->GetCompilationUnit(), typeContext->AddressSize(),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
* Copryight 2012, Rene Gollent, [email protected].
|
* Copyright 2012-2013, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef DWARF_TYPES_H
|
#ifndef DWARF_TYPES_H
|
||||||
@@ -114,6 +114,11 @@ public:
|
|||||||
address_type_kind kind,
|
address_type_kind kind,
|
||||||
AddressType*& _resultType);
|
AddressType*& _resultType);
|
||||||
|
|
||||||
|
virtual status_t CreateDerivedArrayType(
|
||||||
|
uint64 elementCount,
|
||||||
|
bool extendExisting,
|
||||||
|
ArrayType*& _resultType);
|
||||||
|
|
||||||
virtual status_t ResolveObjectDataLocation(
|
virtual status_t ResolveObjectDataLocation(
|
||||||
const ValueLocation& objectLocation,
|
const ValueLocation& objectLocation,
|
||||||
ValueLocation*& _location);
|
ValueLocation*& _location);
|
||||||
|
|||||||
Reference in New Issue
Block a user