Debugger: Extend TeamTypeInformation interface.
TeamTypeInformation: - Add interface function to allow simply querying for whether a type is known to exist by a name + constraints, without actually requesting that it be instantiated, and implement in TeamDebugInfo. GlobalTypeLookup: - Add analogous type lookup function to the above, and implement in TeamDebugInfo. {Specific,Debugger,Dwarf}ImageDebugInfo: - Add function for type existence query, and implement in subclasses.
This commit is contained in:
parent
492a649b19
commit
d21bcbb0ac
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2014, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -60,6 +60,14 @@ DebuggerImageDebugInfo::GetType(GlobalTypeCache* cache,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DebuggerImageDebugInfo::HasType(const BString& name,
|
||||
const TypeLookupConstraints& constraints) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
AddressSectionType
|
||||
DebuggerImageDebugInfo::GetAddressSectionType(target_addr_t address)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2014, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef DEBUGGER_IMAGE_DEBUG_INFO_H
|
||||
@ -33,6 +33,10 @@ public:
|
||||
const BString& name,
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
virtual bool HasType(const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
const;
|
||||
|
||||
virtual AddressSectionType GetAddressSectionType(target_addr_t address);
|
||||
virtual status_t CreateFrame(Image* image,
|
||||
FunctionInstance* functionInstance,
|
||||
|
@ -567,6 +567,39 @@ DwarfImageDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DwarfImageDebugInfo::HasType(const BString& name,
|
||||
const TypeLookupConstraints& constraints) const
|
||||
{
|
||||
TypeNameEntry* entry = fTypeNameTable->Lookup(name);
|
||||
if (entry == NULL)
|
||||
return false;
|
||||
|
||||
for (int32 i = 0; TypeEntryInfo* info = entry->types.ItemAt(i); i++) {
|
||||
DIEType* typeEntry = info->type;
|
||||
if (constraints.HasTypeKind()) {
|
||||
if (dwarf_tag_to_type_kind(typeEntry->Tag())
|
||||
!= constraints.TypeKind()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_EvaluateBaseTypeConstraints(typeEntry, constraints))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (constraints.HasSubtypeKind()
|
||||
&& dwarf_tag_to_subtype_kind(typeEntry->Tag())
|
||||
!= constraints.SubtypeKind()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
AddressSectionType
|
||||
DwarfImageDebugInfo::GetAddressSectionType(target_addr_t address)
|
||||
{
|
||||
|
@ -58,6 +58,9 @@ public:
|
||||
const BString& name,
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
virtual bool HasType(const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
const;
|
||||
|
||||
virtual AddressSectionType GetAddressSectionType(target_addr_t address);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2014, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef GLOBAL_TYPE_LOOKUP_H
|
||||
@ -69,6 +70,11 @@ public:
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type) = 0;
|
||||
// returns a reference
|
||||
|
||||
virtual bool HasType(GlobalTypeCache* cache,
|
||||
const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
= 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -105,6 +105,20 @@ ImageDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ImageDebugInfo::HasType(const BString& name,
|
||||
const TypeLookupConstraints& constraints) const
|
||||
{
|
||||
for (int32 i = 0; SpecificImageDebugInfo* specificInfo
|
||||
= fSpecificInfos.ItemAt(i); i++) {
|
||||
if (specificInfo->HasType(name, constraints))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
AddressSectionType
|
||||
ImageDebugInfo::GetAddressSectionType(target_addr_t address) const
|
||||
{
|
||||
|
@ -45,6 +45,11 @@ public:
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
// returns a reference
|
||||
|
||||
bool HasType(const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
const;
|
||||
|
||||
AddressSectionType GetAddressSectionType(target_addr_t address)
|
||||
const;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2014, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SPECIFIC_IMAGE_DEBUG_INFO_H
|
||||
@ -52,6 +52,10 @@ public:
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type) = 0;
|
||||
// returns a reference
|
||||
virtual bool HasType(const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
const = 0;
|
||||
|
||||
virtual AddressSectionType GetAddressSectionType(target_addr_t address)
|
||||
= 0;
|
||||
|
||||
|
@ -380,12 +380,22 @@ TeamDebugInfo::LookupTypeByName(const BString& name,
|
||||
return GetType(fTypeCache, name, constraints, _type);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TeamDebugInfo::TypeExistsByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
{
|
||||
return HasType(fTypeCache, name, constraints);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TeamDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||
const TypeLookupConstraints& constraints, Type*& _type)
|
||||
{
|
||||
// maybe the type is already cached
|
||||
AutoLocker<GlobalTypeCache> cacheLocker(cache);
|
||||
|
||||
Type* type = cache->GetType(name, constraints);
|
||||
if (type != NULL) {
|
||||
type->AcquireReference();
|
||||
@ -425,6 +435,47 @@ TeamDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TeamDebugInfo::HasType(GlobalTypeCache* cache, const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
{
|
||||
// maybe the type is already cached
|
||||
AutoLocker<GlobalTypeCache> cacheLocker(cache);
|
||||
|
||||
Type* type = cache->GetType(name, constraints);
|
||||
if (type != NULL)
|
||||
return true;
|
||||
|
||||
cacheLocker.Unlock();
|
||||
|
||||
// Clone the image list and get references to the images, so we can iterate
|
||||
// through them without locking.
|
||||
AutoLocker<BLocker> locker(fLock);
|
||||
|
||||
ImageList images;
|
||||
for (int32 i = 0; ImageDebugInfo* imageDebugInfo = fImages.ItemAt(i); i++) {
|
||||
if (images.AddItem(imageDebugInfo))
|
||||
imageDebugInfo->AcquireReference();
|
||||
}
|
||||
|
||||
locker.Unlock();
|
||||
|
||||
bool found = false;
|
||||
for (int32 i = 0; ImageDebugInfo* imageDebugInfo = images.ItemAt(i); i++) {
|
||||
if (imageDebugInfo->HasType(name, constraints)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// release the references
|
||||
for (int32 i = 0; ImageDebugInfo* imageDebugInfo = images.ItemAt(i); i++)
|
||||
imageDebugInfo->ReleaseReference();
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TeamDebugInfo::LoadImageDebugInfo(const ImageInfo& imageInfo,
|
||||
LocatableFile* imageFile, ImageDebugInfoLoadingState& _state,
|
||||
|
@ -49,10 +49,15 @@ public:
|
||||
const BString& name,
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
virtual bool HasType(GlobalTypeCache* cache,
|
||||
const BString& name,
|
||||
const TypeLookupConstraints& constraints);
|
||||
|
||||
virtual status_t LookupTypeByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
virtual bool TypeExistsByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints);
|
||||
|
||||
status_t LoadImageDebugInfo(const ImageInfo& imageInfo,
|
||||
LocatableFile* imageFile,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2011-2014, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TEAM_TYPE_INFORMATION_H
|
||||
@ -24,6 +24,10 @@ public:
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type) = 0;
|
||||
// returns reference
|
||||
|
||||
virtual bool TypeExistsByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints)
|
||||
= 0;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user