* Moved the data location resolution methods from StackFrameDebugInfo to the
respective Type classes. StackFrameDebugInfo is pretty much out of work now,
but maybe something comes up later.
* Renamed GlobalTypeLookupContext to GlobalTypeCache and renamed its methods.
* A TeamDebugInfo does now have a GlobalTypeCache which is used for resolving
types. Formerly it was created per stack frame, so all types had to be
resolved after each single step. Single-stepping is usably fast again.
The disadvantage is that DWARF theoretically allows types properties to
depend on instruction/frame/frame base pointer and we don't support that
anymore. I can't think of a reasonable application for that feature, though.
* Refactored DwarfStackFrameDebugInfo:
- Moved the type classes into new DwarfTypes.{h,cpp}.
- Moved the creation of types into new class DwarfTypeFactory.
- Added class DwarfTypeContext which bundles all the dependencies of the type
classes.
* Made DwarfFile a BReferenceable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33495 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -32,6 +32,8 @@ SourceHdrs
|
||||
DwarfImageDebugInfo.cpp
|
||||
DwarfStackFrameDebugInfo.cpp
|
||||
DwarfTeamDebugInfo.cpp
|
||||
DwarfTypeFactory.cpp
|
||||
DwarfTypes.cpp
|
||||
: [ FDirName $(SUBDIR) dwarf ]
|
||||
;
|
||||
|
||||
@@ -62,6 +64,8 @@ Application Debugger :
|
||||
DwarfImageDebugInfo.cpp
|
||||
DwarfStackFrameDebugInfo.cpp
|
||||
DwarfTeamDebugInfo.cpp
|
||||
DwarfTypeFactory.cpp
|
||||
DwarfTypes.cpp
|
||||
Function.cpp
|
||||
FunctionDebugInfo.cpp
|
||||
FunctionInstance.cpp
|
||||
|
||||
+10
-13
@@ -634,8 +634,7 @@ GetStackFrameValueJob::_GetValue()
|
||||
ValuePieceLocation piece = location->PieceAt(0);
|
||||
if (piece.type == VALUE_PIECE_LOCATION_MEMORY) {
|
||||
ValueLocation* dataLocation;
|
||||
error = fStackFrame->DebugInfo()->ResolveObjectDataLocation(
|
||||
fStackFrame, type, *location, dataLocation);
|
||||
error = type->ResolveObjectDataLocation(*location, dataLocation);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
@@ -866,9 +865,8 @@ GetStackFrameValueJob::_ResolveTypeAndLocation(Type*& _type,
|
||||
// The parent's location refers to the location of the complete
|
||||
// object. We want to extract the location of a member.
|
||||
ValueLocation* location;
|
||||
error = fStackFrame->DebugInfo()->ResolveBaseTypeLocation(
|
||||
fStackFrame, parentType, baseType, *parentLocation,
|
||||
location);
|
||||
error = compoundType->ResolveBaseTypeLocation(baseType,
|
||||
*parentLocation, location);
|
||||
if (error != B_OK) {
|
||||
TRACE_LOCALS("GetStackFrameValueJob::"
|
||||
"_ResolveTypeAndLocation(): TYPE_COMPOUND: "
|
||||
@@ -895,9 +893,8 @@ GetStackFrameValueJob::_ResolveTypeAndLocation(Type*& _type,
|
||||
// The parent's location refers to the location of the complete
|
||||
// object. We want to extract the location of a member.
|
||||
ValueLocation* location;
|
||||
error = fStackFrame->DebugInfo()->ResolveDataMemberLocation(
|
||||
fStackFrame, parentType, dataMember, *parentLocation,
|
||||
location);
|
||||
error = compoundType->ResolveDataMemberLocation(dataMember,
|
||||
*parentLocation, location);
|
||||
if (error != B_OK) {
|
||||
TRACE_LOCALS("GetStackFrameValueJob::"
|
||||
"_ResolveTypeAndLocation(): TYPE_COMPOUND: "
|
||||
@@ -931,8 +928,8 @@ GetStackFrameValueJob::_ResolveTypeAndLocation(Type*& _type,
|
||||
// resolve the location
|
||||
Type* type = dynamic_cast<AddressType*>(parentType)->BaseType();
|
||||
ValueLocation* location;
|
||||
error = fStackFrame->DebugInfo()->ResolveObjectDataLocation(
|
||||
fStackFrame, type, parentValue.ToUInt64(), location);
|
||||
error = type->ResolveObjectDataLocation(parentValue.ToUInt64(),
|
||||
location);
|
||||
if (error != B_OK) {
|
||||
TRACE_LOCALS("GetStackFrameValueJob::"
|
||||
"_ResolveTypeAndLocation(): "
|
||||
@@ -967,12 +964,12 @@ GetStackFrameValueJob::_ResolveTypeAndLocation(Type*& _type,
|
||||
|
||||
// resolve the element location
|
||||
ValueLocation* location;
|
||||
error = fStackFrame->DebugInfo()->ResolveArrayElementLocation(
|
||||
fStackFrame, arrayType, indexPath, *parentLocation, location);
|
||||
error = arrayType->ResolveElementLocation(indexPath,
|
||||
*parentLocation, location);
|
||||
if (error != B_OK) {
|
||||
TRACE_LOCALS("GetStackFrameValueJob::"
|
||||
"_ResolveTypeAndLocation(): TYPE_ARRAY: "
|
||||
"ResolveArrayElementLocation() failed: %s\n",
|
||||
"ResolveElementLocation() failed: %s\n",
|
||||
strerror(error));
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ ArchitectureX86::CreateStackFrame(Image* image, FunctionDebugInfo* function,
|
||||
|
||||
// create the stack frame
|
||||
StackFrameDebugInfo* stackFrameDebugInfo
|
||||
= new(std::nothrow) NoOpStackFrameDebugInfo(this);
|
||||
= new(std::nothrow) NoOpStackFrameDebugInfo;
|
||||
if (stackFrameDebugInfo == NULL)
|
||||
return B_NO_MEMORY;
|
||||
Reference<StackFrameDebugInfo> stackFrameDebugInfoReference(
|
||||
|
||||
@@ -79,7 +79,7 @@ DebuggerImageDebugInfo::GetFunctions(BObjectList<FunctionDebugInfo>& functions)
|
||||
|
||||
|
||||
status_t
|
||||
DebuggerImageDebugInfo::GetType(GlobalTypeLookupContext* context,
|
||||
DebuggerImageDebugInfo::GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
virtual status_t GetFunctions(
|
||||
BObjectList<FunctionDebugInfo>& functions);
|
||||
virtual status_t GetType(GlobalTypeLookupContext* context,
|
||||
virtual status_t GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type);
|
||||
virtual status_t CreateFrame(Image* image,
|
||||
FunctionInstance* functionInstance,
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "DwarfFunctionDebugInfo.h"
|
||||
#include "DwarfStackFrameDebugInfo.h"
|
||||
#include "DwarfTargetInterface.h"
|
||||
#include "DwarfTypeFactory.h"
|
||||
#include "DwarfTypes.h"
|
||||
#include "DwarfUtils.h"
|
||||
#include "ElfFile.h"
|
||||
#include "FileManager.h"
|
||||
@@ -201,7 +203,8 @@ struct DwarfImageDebugInfo::EntryListWrapper {
|
||||
|
||||
DwarfImageDebugInfo::DwarfImageDebugInfo(const ImageInfo& imageInfo,
|
||||
Architecture* architecture, TeamMemory* teamMemory,
|
||||
FileManager* fileManager, GlobalTypeLookup* typeLookup, DwarfFile* file)
|
||||
FileManager* fileManager, GlobalTypeLookup* typeLookup,
|
||||
GlobalTypeCache* typeCache, DwarfFile* file)
|
||||
:
|
||||
fLock("dwarf image debug info"),
|
||||
fImageInfo(imageInfo),
|
||||
@@ -209,15 +212,20 @@ DwarfImageDebugInfo::DwarfImageDebugInfo(const ImageInfo& imageInfo,
|
||||
fTeamMemory(teamMemory),
|
||||
fFileManager(fileManager),
|
||||
fTypeLookup(typeLookup),
|
||||
fTypeCache(typeCache),
|
||||
fFile(file),
|
||||
fTextSegment(NULL),
|
||||
fRelocationDelta(0)
|
||||
{
|
||||
fFile->AcquireReference();
|
||||
fTypeCache->AcquireReference();
|
||||
}
|
||||
|
||||
|
||||
DwarfImageDebugInfo::~DwarfImageDebugInfo()
|
||||
{
|
||||
fFile->ReleaseReference();
|
||||
fTypeCache->ReleaseReference();
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +362,7 @@ DwarfImageDebugInfo::GetFunctions(BObjectList<FunctionDebugInfo>& functions)
|
||||
|
||||
|
||||
status_t
|
||||
DwarfImageDebugInfo::GetType(GlobalTypeLookupContext* context,
|
||||
DwarfImageDebugInfo::GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type)
|
||||
{
|
||||
int32 registerCount = fArchitecture->CountRegisters();
|
||||
@@ -374,8 +382,8 @@ DwarfImageDebugInfo::GetType(GlobalTypeLookupContext* context,
|
||||
// iterate through all compilation units
|
||||
for (int32 i = 0; CompilationUnit* unit = fFile->CompilationUnitAt(i);
|
||||
i++) {
|
||||
DwarfStackFrameDebugInfo* stackFrameDebugInfo = NULL;
|
||||
Reference<DwarfStackFrameDebugInfo> stackFrameDebugInfoReference;
|
||||
DwarfTypeContext* typeContext = NULL;
|
||||
Reference<DwarfTypeContext> typeContextReference;
|
||||
|
||||
// iterate through all types of the compilation unit
|
||||
for (DebugInfoEntryList::ConstIterator it
|
||||
@@ -390,23 +398,20 @@ DwarfImageDebugInfo::GetType(GlobalTypeLookupContext* context,
|
||||
continue;
|
||||
|
||||
// The name matches and the entry is not just a declaration --
|
||||
// create the type. First create the StackFrameDebugInfo lazily.
|
||||
if (stackFrameDebugInfo == NULL) {
|
||||
stackFrameDebugInfo = new(std::nothrow)
|
||||
DwarfStackFrameDebugInfo(fArchitecture, fFile, unit, NULL,
|
||||
fTypeLookup, context, 0, 0, &inputInterface, fromDwarfMap);
|
||||
if (stackFrameDebugInfo == NULL)
|
||||
// create the type. First create the type context lazily.
|
||||
if (typeContext == NULL) {
|
||||
typeContext = new(std::nothrow)
|
||||
DwarfTypeContext(fArchitecture, fImageInfo.ImageID(), fFile,
|
||||
unit, NULL, 0, 0, &inputInterface, fromDwarfMap);
|
||||
if (typeContext == NULL)
|
||||
return B_NO_MEMORY;
|
||||
stackFrameDebugInfoReference.SetTo(stackFrameDebugInfo, true);
|
||||
|
||||
error = stackFrameDebugInfo->Init();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
typeContextReference.SetTo(typeContext, true);
|
||||
}
|
||||
|
||||
// create the type
|
||||
Type* type;
|
||||
error = stackFrameDebugInfo->CreateType(typeEntry, type);
|
||||
DwarfType* type;
|
||||
DwarfTypeFactory typeFactory(typeContext, fTypeLookup, cache);
|
||||
error = typeFactory.CreateType(typeEntry, type);
|
||||
if (error != B_OK)
|
||||
continue;
|
||||
|
||||
@@ -492,24 +497,13 @@ DwarfImageDebugInfo::CreateFrame(Image* image,
|
||||
}
|
||||
)
|
||||
|
||||
// create a type lookup context
|
||||
GlobalTypeLookupContext* typeLookupContext
|
||||
= new(std::nothrow) GlobalTypeLookupContext;
|
||||
if (typeLookupContext == NULL)
|
||||
return B_NO_MEMORY;
|
||||
Reference<GlobalTypeLookupContext> typeLookupContextReference(
|
||||
typeLookupContext, true);
|
||||
|
||||
error = typeLookupContext->Init();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// create the stack frame debug info
|
||||
DIESubprogram* subprogramEntry = function->SubprogramEntry();
|
||||
DwarfStackFrameDebugInfo* stackFrameDebugInfo
|
||||
= new(std::nothrow) DwarfStackFrameDebugInfo(fArchitecture, fFile, unit,
|
||||
subprogramEntry, fTypeLookup, typeLookupContext, instructionPointer,
|
||||
framePointer, inputInterface, fromDwarfMap);
|
||||
= new(std::nothrow) DwarfStackFrameDebugInfo(fArchitecture,
|
||||
fImageInfo.ImageID(), fFile, unit, subprogramEntry, fTypeLookup,
|
||||
fTypeCache, instructionPointer, framePointer, inputInterface,
|
||||
fromDwarfMap);
|
||||
if (stackFrameDebugInfo == NULL)
|
||||
return B_NO_MEMORY;
|
||||
Reference<DwarfStackFrameDebugInfo> stackFrameDebugInfoReference(
|
||||
|
||||
@@ -23,6 +23,7 @@ class ElfSegment;
|
||||
class FileManager;
|
||||
class FileSourceCode;
|
||||
class FunctionID;
|
||||
class GlobalTypeCache;
|
||||
class GlobalTypeLookup;
|
||||
class LocatableFile;
|
||||
class SourceCode;
|
||||
@@ -36,6 +37,7 @@ public:
|
||||
TeamMemory* teamMemory,
|
||||
FileManager* fileManager,
|
||||
GlobalTypeLookup* typeLookup,
|
||||
GlobalTypeCache* typeCache,
|
||||
DwarfFile* file);
|
||||
virtual ~DwarfImageDebugInfo();
|
||||
|
||||
@@ -46,7 +48,7 @@ public:
|
||||
|
||||
virtual status_t GetFunctions(
|
||||
BObjectList<FunctionDebugInfo>& functions);
|
||||
virtual status_t GetType(GlobalTypeLookupContext* context,
|
||||
virtual status_t GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type);
|
||||
virtual status_t CreateFrame(Image* image,
|
||||
FunctionInstance* functionInstance,
|
||||
@@ -97,6 +99,7 @@ private:
|
||||
TeamMemory* fTeamMemory;
|
||||
FileManager* fFileManager;
|
||||
GlobalTypeLookup* fTypeLookup;
|
||||
GlobalTypeCache* fTypeCache;
|
||||
DwarfFile* fFile;
|
||||
ElfSegment* fTextSegment;
|
||||
target_addr_t fRelocationDelta;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,39 +2,29 @@
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef DWARF_INTERFACE_FACTORY_H
|
||||
#define DWARF_INTERFACE_FACTORY_H
|
||||
#ifndef DWARF_STACK_FRAME_DEBUG_INFO_H
|
||||
#define DWARF_STACK_FRAME_DEBUG_INFO_H
|
||||
|
||||
|
||||
#include <image.h>
|
||||
#include <String.h>
|
||||
|
||||
#include "StackFrameDebugInfo.h"
|
||||
#include "Type.h"
|
||||
|
||||
|
||||
class CompilationUnit;
|
||||
class DIEAddressingType;
|
||||
class DIEArrayType;
|
||||
class DIEBaseType;
|
||||
class DIECompoundType;
|
||||
class DIEEnumerationType;
|
||||
class DIEFormalParameter;
|
||||
class DIEModifiedType;
|
||||
class DIEPointerToMemberType;
|
||||
class DIESubprogram;
|
||||
class DIESubrangeType;
|
||||
class DIESubroutineType;
|
||||
class DIEType;
|
||||
class DIETypedef;
|
||||
class DIEUnspecifiedType;
|
||||
class DIEVariable;
|
||||
class DwarfFile;
|
||||
class DwarfTargetInterface;
|
||||
class DwarfTypeContext;
|
||||
class DwarfTypeFactory;
|
||||
class FunctionID;
|
||||
class GlobalTypeCache;
|
||||
class GlobalTypeLookup;
|
||||
class GlobalTypeLookupContext;
|
||||
class LocationDescription;
|
||||
class MemberLocation;
|
||||
class ObjectID;
|
||||
class RegisterMap;
|
||||
class Variable;
|
||||
@@ -43,11 +33,12 @@ class Variable;
|
||||
class DwarfStackFrameDebugInfo : public StackFrameDebugInfo {
|
||||
public:
|
||||
DwarfStackFrameDebugInfo(
|
||||
Architecture* architecture, DwarfFile* file,
|
||||
Architecture* architecture,
|
||||
image_id imageID, DwarfFile* file,
|
||||
CompilationUnit* compilationUnit,
|
||||
DIESubprogram* subprogramEntry,
|
||||
GlobalTypeLookup* typeLookup,
|
||||
GlobalTypeLookupContext* typeLookupContext,
|
||||
GlobalTypeCache* typeCache,
|
||||
target_addr_t instructionPointer,
|
||||
target_addr_t framePointer,
|
||||
DwarfTargetInterface* targetInterface,
|
||||
@@ -56,28 +47,6 @@ public:
|
||||
|
||||
status_t Init();
|
||||
|
||||
virtual status_t ResolveObjectDataLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
const ValueLocation& objectLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveBaseTypeLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
BaseType* baseType,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveDataMemberLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
DataMember* member,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveArrayElementLocation(
|
||||
StackFrame* stackFrame, ArrayType* type,
|
||||
const ArrayIndexPath& indexPath,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
|
||||
status_t CreateType(DIEType* typeEntry, Type*& _type);
|
||||
// returns reference
|
||||
status_t CreateParameter(FunctionID* functionID,
|
||||
DIEFormalParameter* parameterEntry,
|
||||
Variable*& _parameter);
|
||||
@@ -90,102 +59,22 @@ public:
|
||||
private:
|
||||
struct DwarfFunctionParameterID;
|
||||
struct DwarfLocalVariableID;
|
||||
struct DwarfType;
|
||||
struct DwarfInheritance;
|
||||
struct DwarfDataMember;
|
||||
struct DwarfEnumerationValue;
|
||||
struct DwarfArrayDimension;
|
||||
struct DwarfFunctionParameter;
|
||||
struct DwarfPrimitiveType;
|
||||
struct DwarfCompoundType;
|
||||
struct DwarfModifiedType;
|
||||
struct DwarfTypedefType;
|
||||
struct DwarfAddressType;
|
||||
struct DwarfEnumerationType;
|
||||
struct DwarfSubrangeType;
|
||||
struct DwarfArrayType;
|
||||
struct DwarfUnspecifiedType;
|
||||
struct DwarfFunctionType;
|
||||
struct DwarfPointerToMemberType;
|
||||
|
||||
private:
|
||||
status_t _ResolveDataMemberLocation(
|
||||
StackFrame* stackFrame,
|
||||
DwarfCompoundType* type,
|
||||
Type* memberType,
|
||||
const MemberLocation* memberLocation,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
// returns a new location
|
||||
|
||||
status_t _CreateType(DIEType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateTypeInternal(const BString& name,
|
||||
DIEType* typeEntry, DwarfType*& _type);
|
||||
|
||||
status_t _CreateCompoundType(const BString& name,
|
||||
DIECompoundType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreatePrimitiveType(const BString& name,
|
||||
DIEBaseType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateAddressType(const BString& name,
|
||||
DIEAddressingType* typeEntry,
|
||||
address_type_kind addressKind,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateModifiedType(const BString& name,
|
||||
DIEModifiedType* typeEntry,
|
||||
uint32 modifiers, DwarfType*& _type);
|
||||
status_t _CreateTypedefType(const BString& name,
|
||||
DIETypedef* typeEntry, DwarfType*& _type);
|
||||
status_t _CreateArrayType(const BString& name,
|
||||
DIEArrayType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateEnumerationType(const BString& name,
|
||||
DIEEnumerationType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateSubrangeType(const BString& name,
|
||||
DIESubrangeType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateUnspecifiedType(const BString& name,
|
||||
DIEUnspecifiedType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateFunctionType(const BString& name,
|
||||
DIESubroutineType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreatePointerToMemberType(const BString& name,
|
||||
DIEPointerToMemberType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
|
||||
status_t _CreateVariable(ObjectID* id,
|
||||
const BString& name, DIEType* typeEntry,
|
||||
LocationDescription* locationDescription,
|
||||
Variable*& _variable);
|
||||
|
||||
status_t _ResolveTypedef(DIETypedef* entry,
|
||||
DIEType*& _baseTypeEntry);
|
||||
status_t _ResolveTypeByteSize(DIEType* typeEntry,
|
||||
uint64& _size);
|
||||
|
||||
status_t _ResolveLocation(
|
||||
const LocationDescription* description,
|
||||
target_addr_t objectAddress, Type* type,
|
||||
ValueLocation& _location);
|
||||
|
||||
template<typename EntryType>
|
||||
static DIEType* _GetDIEType(EntryType* entry);
|
||||
|
||||
private:
|
||||
DwarfFile* fFile;
|
||||
CompilationUnit* fCompilationUnit;
|
||||
DIESubprogram* fSubprogramEntry;
|
||||
DwarfTypeContext* fTypeContext;
|
||||
GlobalTypeLookup* fTypeLookup;
|
||||
GlobalTypeLookupContext* fTypeLookupContext;
|
||||
target_addr_t fInstructionPointer;
|
||||
target_addr_t fFramePointer;
|
||||
DwarfTargetInterface* fTargetInterface;
|
||||
RegisterMap* fFromDwarfRegisterMap;
|
||||
GlobalTypeCache* fTypeCache;
|
||||
DwarfTypeFactory* fTypeFactory;
|
||||
};
|
||||
|
||||
|
||||
#endif // DWARF_INTERFACE_FACTORY_H
|
||||
#endif // DWARF_STACK_FRAME_DEBUG_INFO_H
|
||||
|
||||
@@ -9,26 +9,31 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "DwarfFile.h"
|
||||
#include "DwarfImageDebugInfo.h"
|
||||
#include "DwarfManager.h"
|
||||
#include "GlobalTypeLookup.h"
|
||||
#include "LocatableFile.h"
|
||||
|
||||
|
||||
DwarfTeamDebugInfo::DwarfTeamDebugInfo(Architecture* architecture,
|
||||
TeamMemory* teamMemory, FileManager* fileManager,
|
||||
GlobalTypeLookup* typeLookup)
|
||||
GlobalTypeLookup* typeLookup, GlobalTypeCache* typeCache)
|
||||
:
|
||||
fArchitecture(architecture),
|
||||
fTeamMemory(teamMemory),
|
||||
fFileManager(fileManager),
|
||||
fManager(NULL),
|
||||
fTypeLookup(typeLookup)
|
||||
fTypeLookup(typeLookup),
|
||||
fTypeCache(typeCache)
|
||||
{
|
||||
fTypeCache->AcquireReference();
|
||||
}
|
||||
|
||||
|
||||
DwarfTeamDebugInfo::~DwarfTeamDebugInfo()
|
||||
{
|
||||
fTypeCache->ReleaseReference();
|
||||
delete fManager;
|
||||
}
|
||||
|
||||
@@ -60,14 +65,18 @@ DwarfTeamDebugInfo::CreateImageDebugInfo(const ImageInfo& imageInfo,
|
||||
// try to load the DWARF file
|
||||
DwarfFile* file;
|
||||
status_t error = fManager->LoadFile(filePath, file);
|
||||
if (error == B_OK)
|
||||
error = fManager->FinishLoading();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
Reference<DwarfFile> fileReference(file, true);
|
||||
|
||||
error = fManager->FinishLoading();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// create the image debug info
|
||||
DwarfImageDebugInfo* debugInfo = new(std::nothrow) DwarfImageDebugInfo(
|
||||
imageInfo, fArchitecture, fTeamMemory, fFileManager, fTypeLookup, file);
|
||||
imageInfo, fArchitecture, fTeamMemory, fFileManager, fTypeLookup,
|
||||
fTypeCache, file);
|
||||
if (debugInfo == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ class Architecture;
|
||||
class DwarfManager;
|
||||
class FileManager;
|
||||
class ImageInfo;
|
||||
class GlobalTypeCache;
|
||||
class GlobalTypeLookup;
|
||||
class TeamMemory;
|
||||
|
||||
@@ -21,7 +22,8 @@ public:
|
||||
DwarfTeamDebugInfo(Architecture* architecture,
|
||||
TeamMemory* teamMemory,
|
||||
FileManager* fileManager,
|
||||
GlobalTypeLookup* typeLookup);
|
||||
GlobalTypeLookup* typeLookup,
|
||||
GlobalTypeCache* typeCache);
|
||||
virtual ~DwarfTeamDebugInfo();
|
||||
|
||||
status_t Init();
|
||||
@@ -36,6 +38,7 @@ private:
|
||||
FileManager* fFileManager;
|
||||
DwarfManager* fManager;
|
||||
GlobalTypeLookup* fTypeLookup;
|
||||
GlobalTypeCache* fTypeCache;
|
||||
};
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef DWARF_TYPE_FACTORY_H
|
||||
#define DWARF_TYPE_FACTORY_H
|
||||
|
||||
|
||||
#include <String.h>
|
||||
|
||||
#include "Type.h"
|
||||
|
||||
|
||||
class CompilationUnit;
|
||||
class DIEAddressingType;
|
||||
class DIEArrayType;
|
||||
class DIEBaseType;
|
||||
class DIECompoundType;
|
||||
class DIEEnumerationType;
|
||||
class DIEFormalParameter;
|
||||
class DIEModifiedType;
|
||||
class DIEPointerToMemberType;
|
||||
class DIESubprogram;
|
||||
class DIESubrangeType;
|
||||
class DIESubroutineType;
|
||||
class DIEType;
|
||||
class DIETypedef;
|
||||
class DIEUnspecifiedType;
|
||||
class DwarfAddressType;
|
||||
class DwarfArrayDimension;
|
||||
class DwarfArrayType;
|
||||
class DwarfCompoundType;
|
||||
class DwarfDataMember;
|
||||
class DwarfEnumerationType;
|
||||
class DwarfEnumerationValue;
|
||||
class DwarfFile;
|
||||
class DwarfFunctionParameter;
|
||||
class DwarfFunctionType;
|
||||
class DwarfInheritance;
|
||||
class DwarfModifiedType;
|
||||
class DwarfPointerToMemberType;
|
||||
class DwarfPrimitiveType;
|
||||
class DwarfSubrangeType;
|
||||
class DwarfTargetInterface;
|
||||
class DwarfType;
|
||||
class DwarfTypeContext;
|
||||
class DwarfTypedefType;
|
||||
class DwarfUnspecifiedType;
|
||||
class GlobalTypeCache;
|
||||
class GlobalTypeLookup;
|
||||
class LocationDescription;
|
||||
class MemberLocation;
|
||||
class RegisterMap;
|
||||
|
||||
|
||||
class DwarfTypeFactory {
|
||||
public:
|
||||
DwarfTypeFactory(DwarfTypeContext* typeContext,
|
||||
GlobalTypeLookup* typeLookup,
|
||||
GlobalTypeCache* typeCache);
|
||||
~DwarfTypeFactory();
|
||||
|
||||
status_t CreateType(DIEType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
// returns reference
|
||||
|
||||
private:
|
||||
status_t _CreateTypeInternal(const BString& name,
|
||||
DIEType* typeEntry, DwarfType*& _type);
|
||||
|
||||
status_t _CreateCompoundType(const BString& name,
|
||||
DIECompoundType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreatePrimitiveType(const BString& name,
|
||||
DIEBaseType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateAddressType(const BString& name,
|
||||
DIEAddressingType* typeEntry,
|
||||
address_type_kind addressKind,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateModifiedType(const BString& name,
|
||||
DIEModifiedType* typeEntry,
|
||||
uint32 modifiers, DwarfType*& _type);
|
||||
status_t _CreateTypedefType(const BString& name,
|
||||
DIETypedef* typeEntry, DwarfType*& _type);
|
||||
status_t _CreateArrayType(const BString& name,
|
||||
DIEArrayType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateEnumerationType(const BString& name,
|
||||
DIEEnumerationType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateSubrangeType(const BString& name,
|
||||
DIESubrangeType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateUnspecifiedType(const BString& name,
|
||||
DIEUnspecifiedType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreateFunctionType(const BString& name,
|
||||
DIESubroutineType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
status_t _CreatePointerToMemberType(const BString& name,
|
||||
DIEPointerToMemberType* typeEntry,
|
||||
DwarfType*& _type);
|
||||
|
||||
status_t _ResolveTypedef(DIETypedef* entry,
|
||||
DIEType*& _baseTypeEntry);
|
||||
status_t _ResolveTypeByteSize(DIEType* typeEntry,
|
||||
uint64& _size);
|
||||
|
||||
private:
|
||||
DwarfTypeContext* fTypeContext;
|
||||
GlobalTypeLookup* fTypeLookup;
|
||||
GlobalTypeCache* fTypeCache;
|
||||
};
|
||||
|
||||
|
||||
#endif // DWARF_TYPE_FACTORY_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,526 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef DWARF_TYPES_H
|
||||
#define DWARF_TYPES_H
|
||||
|
||||
|
||||
#include <String.h>
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <Referenceable.h>
|
||||
|
||||
#include "Type.h"
|
||||
|
||||
|
||||
class Architecture;
|
||||
class CompilationUnit;
|
||||
class DIEAddressingType;
|
||||
class DIEArrayType;
|
||||
class DIEBaseType;
|
||||
class DIECompoundType;
|
||||
class DIEEnumerationType;
|
||||
class DIEEnumerator;
|
||||
class DIEFormalParameter;
|
||||
class DIEInheritance;
|
||||
class DIEMember;
|
||||
class DIEModifiedType;
|
||||
class DIEPointerToMemberType;
|
||||
class DIESubprogram;
|
||||
class DIESubrangeType;
|
||||
class DIESubroutineType;
|
||||
class DIEType;
|
||||
class DIETypedef;
|
||||
class DIEUnspecifiedType;
|
||||
class DwarfFile;
|
||||
class DwarfTargetInterface;
|
||||
struct LocationDescription;
|
||||
struct MemberLocation;
|
||||
class RegisterMap;
|
||||
class ValueLocation;
|
||||
|
||||
|
||||
class DwarfTypeContext : public BReferenceable {
|
||||
public:
|
||||
DwarfTypeContext(Architecture* architecture,
|
||||
image_id imageID, DwarfFile* file,
|
||||
CompilationUnit* compilationUnit,
|
||||
DIESubprogram* subprogramEntry,
|
||||
target_addr_t instructionPointer,
|
||||
target_addr_t framePointer,
|
||||
DwarfTargetInterface* targetInterface,
|
||||
RegisterMap* fromDwarfRegisterMap);
|
||||
~DwarfTypeContext();
|
||||
|
||||
Architecture* GetArchitecture() const
|
||||
{ return fArchitecture; }
|
||||
image_id ImageID() const
|
||||
{ return fImageID; }
|
||||
DwarfFile* File() const
|
||||
{ return fFile; }
|
||||
CompilationUnit* GetCompilationUnit() const
|
||||
{ return fCompilationUnit; }
|
||||
DIESubprogram* SubprogramEntry() const
|
||||
{ return fSubprogramEntry; }
|
||||
target_addr_t InstructionPointer() const
|
||||
{ return fInstructionPointer; }
|
||||
target_addr_t FramePointer() const
|
||||
{ return fFramePointer; }
|
||||
DwarfTargetInterface* TargetInterface() const
|
||||
{ return fTargetInterface; }
|
||||
RegisterMap* FromDwarfRegisterMap() const
|
||||
{ return fFromDwarfRegisterMap; }
|
||||
|
||||
private:
|
||||
Architecture* fArchitecture;
|
||||
image_id fImageID;
|
||||
DwarfFile* fFile;
|
||||
CompilationUnit* fCompilationUnit;
|
||||
DIESubprogram* fSubprogramEntry;
|
||||
target_addr_t fInstructionPointer;
|
||||
target_addr_t fFramePointer;
|
||||
DwarfTargetInterface* fTargetInterface;
|
||||
RegisterMap* fFromDwarfRegisterMap;
|
||||
};
|
||||
|
||||
|
||||
class DwarfType : public virtual Type {
|
||||
public:
|
||||
DwarfType(DwarfTypeContext* typeContext,
|
||||
const BString& name);
|
||||
~DwarfType();
|
||||
|
||||
virtual image_id ImageID() const;
|
||||
virtual const char* Name() const;
|
||||
virtual target_size_t ByteSize() const;
|
||||
|
||||
virtual status_t ResolveObjectDataLocation(
|
||||
const ValueLocation& objectLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveObjectDataLocation(
|
||||
target_addr_t objectAddress,
|
||||
ValueLocation*& _location);
|
||||
|
||||
DwarfTypeContext* TypeContext() const
|
||||
{ return fTypeContext; }
|
||||
|
||||
void SetByteSize(target_size_t size)
|
||||
{ fByteSize = size; }
|
||||
|
||||
virtual DIEType* GetDIEType() const = 0;
|
||||
|
||||
status_t ResolveLocation(DwarfTypeContext* typeContext,
|
||||
const LocationDescription* description,
|
||||
target_addr_t objectAddress,
|
||||
ValueLocation& _location);
|
||||
|
||||
private:
|
||||
DwarfTypeContext* fTypeContext;
|
||||
BString fName;
|
||||
target_size_t fByteSize;
|
||||
};
|
||||
|
||||
|
||||
class DwarfInheritance : public BaseType {
|
||||
public:
|
||||
DwarfInheritance(DIEInheritance* entry,
|
||||
DwarfType* type);
|
||||
~DwarfInheritance();
|
||||
|
||||
virtual Type* GetType() const;
|
||||
|
||||
DwarfType* GetDwarfType() const
|
||||
{ return fType; }
|
||||
DIEInheritance* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEInheritance* fEntry;
|
||||
DwarfType* fType;
|
||||
};
|
||||
|
||||
|
||||
class DwarfDataMember : public DataMember {
|
||||
public:
|
||||
DwarfDataMember(DIEMember* entry,
|
||||
const BString& name, DwarfType* type);
|
||||
~DwarfDataMember();
|
||||
|
||||
virtual const char* Name() const;
|
||||
virtual Type* GetType() const;
|
||||
|
||||
DwarfType* GetDwarfType() const
|
||||
{ return fType; }
|
||||
DIEMember* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEMember* fEntry;
|
||||
BString fName;
|
||||
DwarfType* fType;
|
||||
};
|
||||
|
||||
|
||||
class DwarfEnumerationValue : public EnumerationValue {
|
||||
public:
|
||||
DwarfEnumerationValue(DIEEnumerator* entry,
|
||||
const BString& name, const BVariant& value);
|
||||
~DwarfEnumerationValue();
|
||||
|
||||
virtual const char* Name() const;
|
||||
virtual BVariant Value() const;
|
||||
|
||||
DIEEnumerator* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEEnumerator* fEntry;
|
||||
BString fName;
|
||||
BVariant fValue;
|
||||
};
|
||||
|
||||
|
||||
class DwarfArrayDimension : public ArrayDimension {
|
||||
public:
|
||||
DwarfArrayDimension(DwarfType* type);
|
||||
~DwarfArrayDimension();
|
||||
|
||||
virtual Type* GetType() const;
|
||||
|
||||
DwarfType* GetDwarfType() const
|
||||
{ return fType; }
|
||||
|
||||
private:
|
||||
DwarfType* fType;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class DwarfFunctionParameter : public FunctionParameter {
|
||||
public:
|
||||
DwarfFunctionParameter(
|
||||
DIEFormalParameter* entry,
|
||||
const BString& name, DwarfType* type);
|
||||
~DwarfFunctionParameter();
|
||||
|
||||
virtual const char* Name() const;
|
||||
virtual Type* GetType() const;
|
||||
|
||||
DIEFormalParameter* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEFormalParameter* fEntry;
|
||||
BString fName;
|
||||
DwarfType* fType;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class DwarfPrimitiveType : public PrimitiveType, public DwarfType {
|
||||
public:
|
||||
DwarfPrimitiveType(
|
||||
DwarfTypeContext* typeContext,
|
||||
const BString& name, DIEBaseType* entry,
|
||||
uint32 typeConstant);
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
virtual uint32 TypeConstant() const;
|
||||
|
||||
DIEBaseType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEBaseType* fEntry;
|
||||
uint32 fTypeConstant;
|
||||
};
|
||||
|
||||
|
||||
class DwarfCompoundType : public CompoundType, public DwarfType {
|
||||
public:
|
||||
DwarfCompoundType(DwarfTypeContext* typeContext,
|
||||
const BString& name, DIECompoundType* entry);
|
||||
~DwarfCompoundType();
|
||||
|
||||
virtual int32 CountBaseTypes() const;
|
||||
virtual BaseType* BaseTypeAt(int32 index) const;
|
||||
|
||||
virtual int32 CountDataMembers() const;
|
||||
virtual DataMember* DataMemberAt(int32 index) const;
|
||||
|
||||
virtual status_t ResolveBaseTypeLocation(BaseType* _baseType,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveDataMemberLocation(DataMember* _member,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
DIECompoundType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
bool AddInheritance(DwarfInheritance* inheritance);
|
||||
bool AddDataMember(DwarfDataMember* member);
|
||||
|
||||
private:
|
||||
typedef BObjectList<DwarfDataMember> DataMemberList;
|
||||
typedef BObjectList<DwarfInheritance> InheritanceList;
|
||||
|
||||
private:
|
||||
status_t _ResolveDataMemberLocation(
|
||||
DwarfType* memberType,
|
||||
const MemberLocation* memberLocation,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
|
||||
private:
|
||||
DIECompoundType* fEntry;
|
||||
InheritanceList fInheritances;
|
||||
DataMemberList fDataMembers;
|
||||
};
|
||||
|
||||
|
||||
class DwarfArrayType : public ArrayType, public DwarfType {
|
||||
public:
|
||||
DwarfArrayType(DwarfTypeContext* typeContext,
|
||||
const BString& name, DIEArrayType* entry,
|
||||
DwarfType* baseType);
|
||||
~DwarfArrayType();
|
||||
|
||||
virtual Type* BaseType() const;
|
||||
|
||||
virtual int32 CountDimensions() const;
|
||||
virtual ArrayDimension* DimensionAt(int32 index) const;
|
||||
|
||||
virtual status_t ResolveElementLocation(
|
||||
const ArrayIndexPath& indexPath,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
bool AddDimension(DwarfArrayDimension* dimension);
|
||||
|
||||
DwarfArrayDimension* DwarfDimensionAt(int32 index) const
|
||||
{ return fDimensions.ItemAt(index); }
|
||||
DIEArrayType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
typedef BObjectList<DwarfArrayDimension> DimensionList;
|
||||
|
||||
private:
|
||||
DIEArrayType* fEntry;
|
||||
DwarfType* fBaseType;
|
||||
DimensionList fDimensions;
|
||||
};
|
||||
|
||||
|
||||
class DwarfModifiedType : public ModifiedType, public DwarfType {
|
||||
public:
|
||||
DwarfModifiedType(DwarfTypeContext* typeContext,
|
||||
const BString& name, DIEModifiedType* entry,
|
||||
uint32 modifiers, DwarfType* baseType);
|
||||
~DwarfModifiedType();
|
||||
|
||||
virtual uint32 Modifiers() const;
|
||||
virtual Type* BaseType() const;
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
DIEModifiedType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEModifiedType* fEntry;
|
||||
uint32 fModifiers;
|
||||
DwarfType* fBaseType;
|
||||
};
|
||||
|
||||
|
||||
class DwarfTypedefType : public TypedefType, public DwarfType {
|
||||
public:
|
||||
DwarfTypedefType(DwarfTypeContext* typeContext,
|
||||
const BString& name, DIETypedef* entry,
|
||||
DwarfType* baseType);
|
||||
~DwarfTypedefType();
|
||||
|
||||
virtual Type* BaseType() const;
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
DIETypedef* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIETypedef* fEntry;
|
||||
DwarfType* fBaseType;
|
||||
};
|
||||
|
||||
|
||||
class DwarfAddressType : public AddressType, public DwarfType {
|
||||
public:
|
||||
DwarfAddressType(DwarfTypeContext* typeContext,
|
||||
const BString& name,
|
||||
DIEAddressingType* entry,
|
||||
address_type_kind addressKind,
|
||||
DwarfType* baseType);
|
||||
~DwarfAddressType();
|
||||
|
||||
virtual address_type_kind AddressKind() const;
|
||||
virtual Type* BaseType() const;
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
DIEAddressingType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEAddressingType* fEntry;
|
||||
address_type_kind fAddressKind;
|
||||
DwarfType* fBaseType;
|
||||
};
|
||||
|
||||
|
||||
class DwarfEnumerationType : public EnumerationType, public DwarfType {
|
||||
public:
|
||||
DwarfEnumerationType(
|
||||
DwarfTypeContext* typeContext,
|
||||
const BString& name,
|
||||
DIEEnumerationType* entry,
|
||||
DwarfType* baseType);
|
||||
~DwarfEnumerationType();
|
||||
|
||||
virtual Type* BaseType() const;
|
||||
|
||||
virtual int32 CountValues() const;
|
||||
virtual EnumerationValue* ValueAt(int32 index) const;
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
bool AddValue(DwarfEnumerationValue* value);
|
||||
|
||||
DIEEnumerationType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
typedef BObjectList<DwarfEnumerationValue> ValueList;
|
||||
|
||||
private:
|
||||
DIEEnumerationType* fEntry;
|
||||
DwarfType* fBaseType;
|
||||
ValueList fValues;
|
||||
};
|
||||
|
||||
|
||||
class DwarfSubrangeType : public SubrangeType, public DwarfType {
|
||||
public:
|
||||
DwarfSubrangeType(DwarfTypeContext* typeContext,
|
||||
const BString& name, DIESubrangeType* entry,
|
||||
DwarfType* baseType,
|
||||
const BVariant& lowerBound,
|
||||
const BVariant& upperBound);
|
||||
~DwarfSubrangeType();
|
||||
|
||||
virtual Type* BaseType() const;
|
||||
|
||||
virtual BVariant LowerBound() const;
|
||||
virtual BVariant UpperBound() const;
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
DIESubrangeType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIESubrangeType* fEntry;
|
||||
DwarfType* fBaseType;
|
||||
BVariant fLowerBound;
|
||||
BVariant fUpperBound;
|
||||
};
|
||||
|
||||
|
||||
struct DwarfUnspecifiedType : public UnspecifiedType, public DwarfType {
|
||||
public:
|
||||
DwarfUnspecifiedType(
|
||||
DwarfTypeContext* typeContext,
|
||||
const BString& name,
|
||||
DIEUnspecifiedType* entry);
|
||||
// entry may be NULL
|
||||
~DwarfUnspecifiedType();
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
DIEUnspecifiedType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEUnspecifiedType* fEntry;
|
||||
};
|
||||
|
||||
|
||||
class DwarfFunctionType : public FunctionType, public DwarfType {
|
||||
public:
|
||||
DwarfFunctionType(DwarfTypeContext* typeContext,
|
||||
const BString& name,
|
||||
DIESubroutineType* entry,
|
||||
DwarfType* returnType);
|
||||
~DwarfFunctionType();
|
||||
|
||||
virtual Type* ReturnType() const;
|
||||
|
||||
virtual int32 CountParameters() const;
|
||||
virtual FunctionParameter* ParameterAt(int32 index) const;
|
||||
|
||||
virtual bool HasVariableArguments() const;
|
||||
void SetHasVariableArguments(bool hasVarArgs);
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
bool AddParameter(DwarfFunctionParameter* parameter);
|
||||
|
||||
DwarfFunctionParameter* DwarfParameterAt(int32 index) const
|
||||
{ return fParameters.ItemAt(index); }
|
||||
|
||||
DIESubroutineType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
typedef BObjectList<DwarfFunctionParameter> ParameterList;
|
||||
|
||||
private:
|
||||
DIESubroutineType* fEntry;
|
||||
DwarfType* fReturnType;
|
||||
ParameterList fParameters;
|
||||
bool fHasVariableArguments;
|
||||
};
|
||||
|
||||
|
||||
class DwarfPointerToMemberType : public PointerToMemberType, public DwarfType {
|
||||
public:
|
||||
DwarfPointerToMemberType(
|
||||
DwarfTypeContext* typeContext,
|
||||
const BString& name,
|
||||
DIEPointerToMemberType* entry,
|
||||
DwarfCompoundType* containingType,
|
||||
DwarfType* baseType);
|
||||
~DwarfPointerToMemberType();
|
||||
|
||||
virtual CompoundType* ContainingType() const;
|
||||
virtual Type* BaseType() const;
|
||||
|
||||
virtual DIEType* GetDIEType() const;
|
||||
|
||||
DIEPointerToMemberType* Entry() const
|
||||
{ return fEntry; }
|
||||
|
||||
private:
|
||||
DIEPointerToMemberType* fEntry;
|
||||
DwarfCompoundType* fContainingType;
|
||||
DwarfType* fBaseType;
|
||||
};
|
||||
|
||||
|
||||
#endif // DWARF_TYPES_H
|
||||
@@ -10,11 +10,13 @@
|
||||
|
||||
#include <String.h>
|
||||
|
||||
#include <AutoLocker.h>
|
||||
|
||||
#include "StringUtils.h"
|
||||
#include "Type.h"
|
||||
|
||||
|
||||
struct GlobalTypeLookupContext::TypeEntry {
|
||||
struct GlobalTypeCache::TypeEntry {
|
||||
BString name;
|
||||
Type* type;
|
||||
TypeEntry* fNext;
|
||||
@@ -34,7 +36,7 @@ struct GlobalTypeLookupContext::TypeEntry {
|
||||
};
|
||||
|
||||
|
||||
struct GlobalTypeLookupContext::TypeEntryHashDefinition {
|
||||
struct GlobalTypeCache::TypeEntryHashDefinition {
|
||||
typedef const BString KeyType;
|
||||
typedef TypeEntry ValueType;
|
||||
|
||||
@@ -60,22 +62,22 @@ struct GlobalTypeLookupContext::TypeEntryHashDefinition {
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark - GlobalTypeLookupContext
|
||||
// #pragma mark - GlobalTypeCache
|
||||
|
||||
|
||||
GlobalTypeLookupContext::GlobalTypeLookupContext()
|
||||
GlobalTypeCache::GlobalTypeCache()
|
||||
:
|
||||
fLock("global type lookup"),
|
||||
fCachedTypes(NULL)
|
||||
fTypes(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GlobalTypeLookupContext::~GlobalTypeLookupContext()
|
||||
GlobalTypeCache::~GlobalTypeCache()
|
||||
{
|
||||
// release all cached type references
|
||||
if (fCachedTypes != NULL) {
|
||||
TypeEntry* entry = fCachedTypes->Clear(true);
|
||||
if (fTypes != NULL) {
|
||||
TypeEntry* entry = fTypes->Clear(true);
|
||||
while (entry != NULL) {
|
||||
TypeEntry* nextEntry = entry->fNext;
|
||||
delete entry;
|
||||
@@ -86,32 +88,32 @@ GlobalTypeLookupContext::~GlobalTypeLookupContext()
|
||||
|
||||
|
||||
status_t
|
||||
GlobalTypeLookupContext::Init()
|
||||
GlobalTypeCache::Init()
|
||||
{
|
||||
status_t error = fLock.InitCheck();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fCachedTypes = new(std::nothrow) TypeTable;
|
||||
if (fCachedTypes == NULL)
|
||||
fTypes = new(std::nothrow) TypeTable;
|
||||
if (fTypes == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
return fCachedTypes->Init();
|
||||
return fTypes->Init();
|
||||
}
|
||||
|
||||
|
||||
Type*
|
||||
GlobalTypeLookupContext::CachedType(const BString& name) const
|
||||
GlobalTypeCache::GetType(const BString& name) const
|
||||
{
|
||||
TypeEntry* typeEntry = fCachedTypes->Lookup(name);
|
||||
TypeEntry* typeEntry = fTypes->Lookup(name);
|
||||
return typeEntry != NULL ? typeEntry->type : NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
GlobalTypeLookupContext::AddCachedType(const BString& name, Type* type)
|
||||
GlobalTypeCache::AddType(const BString& name, Type* type)
|
||||
{
|
||||
TypeEntry* typeEntry = fCachedTypes->Lookup(name);
|
||||
TypeEntry* typeEntry = fTypes->Lookup(name);
|
||||
if (typeEntry != NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
@@ -119,21 +121,36 @@ GlobalTypeLookupContext::AddCachedType(const BString& name, Type* type)
|
||||
if (typeEntry == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
fCachedTypes->Insert(typeEntry);
|
||||
fTypes->Insert(typeEntry);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GlobalTypeLookupContext::RemoveCachedType(const BString& name)
|
||||
GlobalTypeCache::RemoveType(const BString& name)
|
||||
{
|
||||
if (TypeEntry* typeEntry = fCachedTypes->Lookup(name)) {
|
||||
fCachedTypes->Remove(typeEntry);
|
||||
if (TypeEntry* typeEntry = fTypes->Lookup(name)) {
|
||||
fTypes->Remove(typeEntry);
|
||||
delete typeEntry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GlobalTypeCache::RemoveTypes(image_id imageID)
|
||||
{
|
||||
AutoLocker<GlobalTypeCache> locker(this);
|
||||
|
||||
for (TypeTable::Iterator it = fTypes->GetIterator();
|
||||
TypeEntry* typeEntry = it.Next();) {
|
||||
if (typeEntry->type->ImageID() == imageID) {
|
||||
fTypes->RemoveUnchecked(typeEntry);
|
||||
delete typeEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - GlobalTypeLookup
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define GLOBAL_TYPE_LOOKUP_H
|
||||
|
||||
|
||||
#include <image.h>
|
||||
#include <Locker.h>
|
||||
|
||||
#include <Referenceable.h>
|
||||
@@ -16,20 +17,23 @@ class BString;
|
||||
class Type;
|
||||
|
||||
|
||||
class GlobalTypeLookupContext : public Referenceable {
|
||||
class GlobalTypeCache : public Referenceable {
|
||||
public:
|
||||
GlobalTypeLookupContext();
|
||||
~GlobalTypeLookupContext();
|
||||
GlobalTypeCache();
|
||||
~GlobalTypeCache();
|
||||
|
||||
status_t Init();
|
||||
|
||||
inline bool Lock();
|
||||
inline void Unlock();
|
||||
|
||||
// context must be locked
|
||||
Type* CachedType(const BString& name) const;
|
||||
status_t AddCachedType(const BString& name, Type* type);
|
||||
void RemoveCachedType(const BString& name);
|
||||
// cache must be locked
|
||||
Type* GetType(const BString& name) const;
|
||||
status_t AddType(const BString& name, Type* type);
|
||||
void RemoveType(const BString& name);
|
||||
|
||||
// cache locked by method
|
||||
void RemoveTypes(image_id imageID);
|
||||
|
||||
private:
|
||||
struct TypeEntry;
|
||||
@@ -39,7 +43,7 @@ private:
|
||||
|
||||
private:
|
||||
BLocker fLock;
|
||||
TypeTable* fCachedTypes;
|
||||
TypeTable* fTypes;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,21 +51,21 @@ class GlobalTypeLookup {
|
||||
public:
|
||||
virtual ~GlobalTypeLookup();
|
||||
|
||||
virtual status_t GetType(GlobalTypeLookupContext* context,
|
||||
virtual status_t GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type) = 0;
|
||||
// returns a reference
|
||||
};
|
||||
|
||||
|
||||
bool
|
||||
GlobalTypeLookupContext::Lock()
|
||||
GlobalTypeCache::Lock()
|
||||
{
|
||||
return fLock.Lock();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GlobalTypeLookupContext::Unlock()
|
||||
GlobalTypeCache::Unlock()
|
||||
{
|
||||
fLock.Unlock();
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ ImageDebugInfo::FinishInit()
|
||||
|
||||
|
||||
status_t
|
||||
ImageDebugInfo::GetType(GlobalTypeLookupContext* context, const BString& name,
|
||||
ImageDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||
Type*& _type)
|
||||
{
|
||||
for (int32 i = 0; SpecificImageDebugInfo* specificInfo
|
||||
= fSpecificInfos.ItemAt(i); i++) {
|
||||
status_t error = specificInfo->GetType(context, name, _type);
|
||||
status_t error = specificInfo->GetType(cache, name, _type);
|
||||
if (error == B_OK || error == B_NO_MEMORY)
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class DebuggerInterface;
|
||||
class FileSourceCode;
|
||||
class FunctionDebugInfo;
|
||||
class FunctionInstance;
|
||||
class GlobalTypeLookupContext;
|
||||
class GlobalTypeCache;
|
||||
class LocatableFile;
|
||||
class SpecificImageDebugInfo;
|
||||
class Type;
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
bool AddSpecificInfo(SpecificImageDebugInfo* info);
|
||||
status_t FinishInit();
|
||||
|
||||
status_t GetType(GlobalTypeLookupContext* context,
|
||||
status_t GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type);
|
||||
// returns a reference
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "NoOpStackFrameDebugInfo.h"
|
||||
|
||||
|
||||
NoOpStackFrameDebugInfo::NoOpStackFrameDebugInfo(Architecture* architecture)
|
||||
NoOpStackFrameDebugInfo::NoOpStackFrameDebugInfo()
|
||||
:
|
||||
StackFrameDebugInfo(architecture)
|
||||
StackFrameDebugInfo()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,38 +17,3 @@ NoOpStackFrameDebugInfo::NoOpStackFrameDebugInfo(Architecture* architecture)
|
||||
NoOpStackFrameDebugInfo::~NoOpStackFrameDebugInfo()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NoOpStackFrameDebugInfo::ResolveObjectDataLocation(StackFrame* stackFrame,
|
||||
Type* type, const ValueLocation& objectLocation, ValueLocation*& _location)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NoOpStackFrameDebugInfo::ResolveBaseTypeLocation(StackFrame* stackFrame,
|
||||
Type* type, BaseType* baseType, const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NoOpStackFrameDebugInfo::ResolveDataMemberLocation(StackFrame* stackFrame,
|
||||
Type* type, DataMember* member, const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NoOpStackFrameDebugInfo::ResolveArrayElementLocation(StackFrame* stackFrame,
|
||||
ArrayType* type, const ArrayIndexPath& indexPath,
|
||||
const ValueLocation& parentLocation, ValueLocation*& _location)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -11,29 +11,9 @@
|
||||
|
||||
class NoOpStackFrameDebugInfo : public StackFrameDebugInfo {
|
||||
public:
|
||||
NoOpStackFrameDebugInfo(
|
||||
Architecture* architecture);
|
||||
NoOpStackFrameDebugInfo();
|
||||
virtual ~NoOpStackFrameDebugInfo();
|
||||
|
||||
virtual status_t ResolveObjectDataLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
const ValueLocation& objectLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveBaseTypeLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
BaseType* baseType,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveDataMemberLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
DataMember* member,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
virtual status_t ResolveArrayElementLocation(
|
||||
StackFrame* stackFrame, ArrayType* type,
|
||||
const ArrayIndexPath& indexPath,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class DebuggerInterface;
|
||||
class FileSourceCode;
|
||||
class FunctionDebugInfo;
|
||||
class FunctionInstance;
|
||||
class GlobalTypeLookupContext;
|
||||
class GlobalTypeCache;
|
||||
class Image;
|
||||
class LocatableFile;
|
||||
class SourceLanguage;
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
= 0;
|
||||
// returns references
|
||||
|
||||
virtual status_t GetType(GlobalTypeLookupContext* context,
|
||||
virtual status_t GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type) = 0;
|
||||
// returns a reference
|
||||
|
||||
|
||||
@@ -10,35 +10,11 @@
|
||||
#include "ValueLocation.h"
|
||||
|
||||
|
||||
StackFrameDebugInfo::StackFrameDebugInfo(Architecture* architecture)
|
||||
:
|
||||
fArchitecture(architecture)
|
||||
StackFrameDebugInfo::StackFrameDebugInfo()
|
||||
{
|
||||
fArchitecture->AcquireReference();
|
||||
}
|
||||
|
||||
|
||||
StackFrameDebugInfo::~StackFrameDebugInfo()
|
||||
{
|
||||
fArchitecture->ReleaseReference();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
StackFrameDebugInfo::ResolveObjectDataLocation(StackFrame* stackFrame,
|
||||
Type* type, target_addr_t objectAddress, ValueLocation*& _location)
|
||||
{
|
||||
ValuePieceLocation piece;
|
||||
piece.SetToMemory(objectAddress);
|
||||
piece.SetSize(0);
|
||||
// We set the piece size to 0 as an indicator that the size has to be
|
||||
// set.
|
||||
// TODO: We could set the byte size from type, but that may not be
|
||||
// accurate. We may want to add bit offset and size to Type.
|
||||
|
||||
ValueLocation location(fArchitecture->IsBigEndian());
|
||||
if (!location.AddPiece(piece))
|
||||
return B_NO_MEMORY;
|
||||
|
||||
return ResolveObjectDataLocation(stackFrame, type, location, _location);
|
||||
}
|
||||
|
||||
@@ -23,40 +23,8 @@ class ValueLocation;
|
||||
|
||||
class StackFrameDebugInfo : public Referenceable {
|
||||
public:
|
||||
StackFrameDebugInfo(Architecture* architecture);
|
||||
StackFrameDebugInfo();
|
||||
virtual ~StackFrameDebugInfo();
|
||||
|
||||
virtual status_t ResolveObjectDataLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
const ValueLocation& objectLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
status_t ResolveObjectDataLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
target_addr_t objectAddress,
|
||||
ValueLocation*& _location);
|
||||
// returns a reference
|
||||
virtual status_t ResolveBaseTypeLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
BaseType* baseType,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
virtual status_t ResolveDataMemberLocation(
|
||||
StackFrame* stackFrame, Type* type,
|
||||
DataMember* member,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
virtual status_t ResolveArrayElementLocation(
|
||||
StackFrame* stackFrame, ArrayType* type,
|
||||
const ArrayIndexPath& indexPath,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
|
||||
protected:
|
||||
Architecture* fArchitecture;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -258,13 +258,17 @@ TeamDebugInfo::TeamDebugInfo(DebuggerInterface* debuggerInterface,
|
||||
fFileManager(fileManager),
|
||||
fSpecificInfos(10, true),
|
||||
fFunctions(NULL),
|
||||
fSourceFiles(NULL)
|
||||
fSourceFiles(NULL),
|
||||
fTypeCache(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TeamDebugInfo::~TeamDebugInfo()
|
||||
{
|
||||
if (fTypeCache != NULL)
|
||||
fTypeCache->ReleaseReference();
|
||||
|
||||
if (fSourceFiles != NULL) {
|
||||
SourceFileEntry* entry = fSourceFiles->Clear(true);
|
||||
while (entry != NULL) {
|
||||
@@ -315,12 +319,21 @@ TeamDebugInfo::Init()
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// create a type cache
|
||||
fTypeCache = new(std::nothrow) GlobalTypeCache;
|
||||
if (fTypeCache == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
error = fTypeCache->Init();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// Create specific infos for all types of debug info we support, in
|
||||
// descending order of expressiveness.
|
||||
|
||||
// DWARF
|
||||
DwarfTeamDebugInfo* dwarfInfo = new(std::nothrow) DwarfTeamDebugInfo(
|
||||
fArchitecture, fDebuggerInterface, fFileManager, this);
|
||||
fArchitecture, fDebuggerInterface, fFileManager, this, fTypeCache);
|
||||
if (dwarfInfo == NULL || !fSpecificInfos.AddItem(dwarfInfo)) {
|
||||
delete dwarfInfo;
|
||||
return B_NO_MEMORY;
|
||||
@@ -348,19 +361,19 @@ TeamDebugInfo::Init()
|
||||
|
||||
|
||||
status_t
|
||||
TeamDebugInfo::GetType(GlobalTypeLookupContext* context, const BString& name,
|
||||
TeamDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||
Type*& _type)
|
||||
{
|
||||
// maybe the type is already cached
|
||||
AutoLocker<GlobalTypeLookupContext> contextLocker(context);
|
||||
Type* type = context->CachedType(name);
|
||||
AutoLocker<GlobalTypeCache> cacheLocker(cache);
|
||||
Type* type = cache->GetType(name);
|
||||
if (type != NULL) {
|
||||
type->AcquireReference();
|
||||
_type = type;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
contextLocker.Unlock();
|
||||
cacheLocker.Unlock();
|
||||
|
||||
// Clone the image list and get references to the images, so we can iterate
|
||||
// through them without locking.
|
||||
@@ -377,7 +390,7 @@ TeamDebugInfo::GetType(GlobalTypeLookupContext* context, const BString& name,
|
||||
// get the type
|
||||
status_t error = B_ENTRY_NOT_FOUND;
|
||||
for (int32 i = 0; ImageDebugInfo* imageDebugInfo = images.ItemAt(i); i++) {
|
||||
error = imageDebugInfo->GetType(context, name, type);
|
||||
error = imageDebugInfo->GetType(cache, name, type);
|
||||
if (error == B_OK) {
|
||||
_type = type;
|
||||
break;
|
||||
@@ -621,6 +634,9 @@ TeamDebugInfo::RemoveImageDebugInfo(ImageDebugInfo* imageDebugInfo)
|
||||
}
|
||||
}
|
||||
|
||||
// remove cached types from that image
|
||||
fTypeCache->RemoveTypes(imageDebugInfo->GetImageInfo().ImageID());
|
||||
|
||||
fImages.RemoveItem(imageDebugInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
status_t Init();
|
||||
|
||||
virtual status_t GetType(GlobalTypeLookupContext* context,
|
||||
virtual status_t GetType(GlobalTypeCache* cache,
|
||||
const BString& name, Type*& _type);
|
||||
|
||||
status_t LoadImageDebugInfo(const ImageInfo& imageInfo,
|
||||
@@ -91,6 +91,7 @@ private:
|
||||
ImageList fImages;
|
||||
FunctionTable* fFunctions;
|
||||
SourceFileTable* fSourceFiles;
|
||||
GlobalTypeCache* fTypeCache;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <Referenceable.h>
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "DebugInfoEntries.h"
|
||||
@@ -25,7 +26,8 @@ class TargetAddressRangeList;
|
||||
class ValueLocation;
|
||||
|
||||
|
||||
class DwarfFile : public DoublyLinkedListLinkImpl<DwarfFile> {
|
||||
class DwarfFile : public BReferenceable,
|
||||
public DoublyLinkedListLinkImpl<DwarfFile> {
|
||||
public:
|
||||
DwarfFile();
|
||||
~DwarfFile();
|
||||
|
||||
@@ -48,7 +48,9 @@ DwarfManager::LoadFile(const char* fileName, DwarfFile*& _file)
|
||||
}
|
||||
|
||||
fFiles.Add(file);
|
||||
// we keep the initial reference for ourselves
|
||||
|
||||
file->AcquireReference();
|
||||
_file = file;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
|
||||
status_t LoadFile(const char* fileName,
|
||||
DwarfFile*& _file);
|
||||
// returns a reference
|
||||
status_t FinishLoading();
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#define TYPE_H
|
||||
|
||||
|
||||
#include <image.h>
|
||||
|
||||
#include <Referenceable.h>
|
||||
#include <Variant.h>
|
||||
|
||||
@@ -42,7 +44,9 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
class ArrayIndexPath;
|
||||
class Type;
|
||||
class ValueLocation;
|
||||
|
||||
|
||||
class BaseType : public Referenceable {
|
||||
@@ -95,11 +99,21 @@ class Type : public Referenceable {
|
||||
public:
|
||||
virtual ~Type();
|
||||
|
||||
virtual image_id ImageID() const = 0;
|
||||
virtual const char* Name() const = 0;
|
||||
virtual type_kind Kind() const = 0;
|
||||
virtual target_size_t ByteSize() const = 0;
|
||||
virtual Type* ResolveRawType() const;
|
||||
// strips modifiers and typedefs
|
||||
|
||||
virtual status_t ResolveObjectDataLocation(
|
||||
const ValueLocation& objectLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
virtual status_t ResolveObjectDataLocation(
|
||||
target_addr_t objectAddress,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
};
|
||||
|
||||
|
||||
@@ -124,6 +138,15 @@ public:
|
||||
|
||||
virtual int32 CountDataMembers() const = 0;
|
||||
virtual DataMember* DataMemberAt(int32 index) const = 0;
|
||||
|
||||
virtual status_t ResolveBaseTypeLocation(BaseType* baseType,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
virtual status_t ResolveDataMemberLocation(DataMember* member,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
};
|
||||
|
||||
|
||||
@@ -199,6 +222,12 @@ public:
|
||||
|
||||
virtual int32 CountDimensions() const = 0;
|
||||
virtual ArrayDimension* DimensionAt(int32 index) const = 0;
|
||||
|
||||
virtual status_t ResolveElementLocation(
|
||||
const ArrayIndexPath& indexPath,
|
||||
const ValueLocation& parentLocation,
|
||||
ValueLocation*& _location) = 0;
|
||||
// returns a reference
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user