[haiku-commits] r33495 - in haiku/trunk/src/apps/debugger: . arch/x86 debug_info dwarf model

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 10 Oct 2009 07:05:34 +0200 (CEST)

Author: bonefish
Date: 2009-10-10 07:05:33 +0200 (Sat, 10 Oct 2009)
New Revision: 33495
Changeset: http://dev.haiku-os.org/changeset/33495/haiku

Added:
   haiku/trunk/src/apps/debugger/debug_info/DwarfTypeFactory.cpp
   haiku/trunk/src/apps/debugger/debug_info/DwarfTypeFactory.h
   haiku/trunk/src/apps/debugger/debug_info/DwarfTypes.cpp
   haiku/trunk/src/apps/debugger/debug_info/DwarfTypes.h
Modified:
   haiku/trunk/src/apps/debugger/Jamfile
   haiku/trunk/src/apps/debugger/Jobs.cpp
   haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp
   haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/DwarfTeamDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/DwarfTeamDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/GlobalTypeLookup.cpp
   haiku/trunk/src/apps/debugger/debug_info/GlobalTypeLookup.h
   haiku/trunk/src/apps/debugger/debug_info/ImageDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/ImageDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/NoOpStackFrameDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/NoOpStackFrameDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/SpecificImageDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/StackFrameDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/StackFrameDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/TeamDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/TeamDebugInfo.h
   haiku/trunk/src/apps/debugger/dwarf/DwarfFile.h
   haiku/trunk/src/apps/debugger/dwarf/DwarfManager.cpp
   haiku/trunk/src/apps/debugger/dwarf/DwarfManager.h
   haiku/trunk/src/apps/debugger/model/Type.h
Log:
* 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.


Modified: haiku/trunk/src/apps/debugger/Jamfile
===================================================================
--- haiku/trunk/src/apps/debugger/Jamfile       2009-10-09 15:56:38 UTC (rev 
33494)
+++ haiku/trunk/src/apps/debugger/Jamfile       2009-10-10 05:05:33 UTC (rev 
33495)
@@ -32,6 +32,8 @@
        DwarfImageDebugInfo.cpp
        DwarfStackFrameDebugInfo.cpp
        DwarfTeamDebugInfo.cpp
+       DwarfTypeFactory.cpp
+       DwarfTypes.cpp
        : [ FDirName $(SUBDIR) dwarf ]
 ;
 
@@ -62,6 +64,8 @@
        DwarfImageDebugInfo.cpp
        DwarfStackFrameDebugInfo.cpp
        DwarfTeamDebugInfo.cpp
+       DwarfTypeFactory.cpp
+       DwarfTypes.cpp
        Function.cpp
        FunctionDebugInfo.cpp
        FunctionInstance.cpp

Modified: haiku/trunk/src/apps/debugger/Jobs.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/Jobs.cpp      2009-10-09 15:56:38 UTC (rev 
33494)
+++ haiku/trunk/src/apps/debugger/Jobs.cpp      2009-10-10 05:05:33 UTC (rev 
33495)
@@ -634,8 +634,7 @@
                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 @@
                                // 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 @@
                                // 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 @@
                        // 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 @@
 
                        // 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;
                        }

Modified: haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp  2009-10-09 
15:56:38 UTC (rev 33494)
+++ haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp  2009-10-10 
05:05:33 UTC (rev 33495)
@@ -322,7 +322,7 @@
 
        // 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(

Modified: haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp 
2009-10-09 15:56:38 UTC (rev 33494)
+++ haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp 
2009-10-10 05:05:33 UTC (rev 33495)
@@ -79,7 +79,7 @@
 
 
 status_t
-DebuggerImageDebugInfo::GetType(GlobalTypeLookupContext* context,
+DebuggerImageDebugInfo::GetType(GlobalTypeCache* cache,
        const BString& name, Type*& _type)
 {
        return B_UNSUPPORTED;

Modified: haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h   
2009-10-09 15:56:38 UTC (rev 33494)
+++ haiku/trunk/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h   
2009-10-10 05:05:33 UTC (rev 33495)
@@ -27,7 +27,7 @@
 
        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,

Modified: haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp    
2009-10-09 15:56:38 UTC (rev 33494)
+++ haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp    
2009-10-10 05:05:33 UTC (rev 33495)
@@ -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 @@
 
 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 @@
        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 @@
 
 
 status_t
-DwarfImageDebugInfo::GetType(GlobalTypeLookupContext* context,
+DwarfImageDebugInfo::GetType(GlobalTypeCache* cache,
        const BString& name, Type*& _type)
 {
        int32 registerCount = fArchitecture->CountRegisters();
@@ -374,8 +382,8 @@
        // 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 @@
                                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 @@
                }
        )
 
-       // 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(

Modified: haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.h
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.h      
2009-10-09 15:56:38 UTC (rev 33494)
+++ haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.h      
2009-10-10 05:05:33 UTC (rev 33495)
@@ -23,6 +23,7 @@
 class FileManager;
 class FileSourceCode;
 class FunctionID;
+class GlobalTypeCache;
 class GlobalTypeLookup;
 class LocatableFile;
 class SourceCode;
@@ -36,6 +37,7 @@
                                                                        
TeamMemory* teamMemory,
                                                                        
FileManager* fileManager,
                                                                        
GlobalTypeLookup* typeLookup,
+                                                                       
GlobalTypeCache* typeCache,
                                                                        
DwarfFile* file);
        virtual                                         ~DwarfImageDebugInfo();
 
@@ -46,7 +48,7 @@
 
        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 @@
                        TeamMemory*                     fTeamMemory;
                        FileManager*            fFileManager;
                        GlobalTypeLookup*       fTypeLookup;
+                       GlobalTypeCache*        fTypeCache;
                        DwarfFile*                      fFile;
                        ElfSegment*                     fTextSegment;
                        target_addr_t           fRelocationDelta;

Modified: haiku/trunk/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp       
2009-10-09 15:56:38 UTC (rev 33494)
+++ haiku/trunk/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp       
2009-10-10 05:05:33 UTC (rev 33495)
@@ -6,186 +6,29 @@
 
 #include "DwarfStackFrameDebugInfo.h"
 
-#include <algorithm>
 #include <new>
 
-#include <AutoLocker.h>
-#include <Variant.h>
-
-#include "ArrayIndexPath.h"
 #include "Architecture.h"
 #include "CompilationUnit.h"
 #include "DebugInfoEntries.h"
 #include "Dwarf.h"
 #include "DwarfFile.h"
+#include "DwarfTargetInterface.h"
+#include "DwarfTypeFactory.h"
 #include "DwarfUtils.h"
+#include "DwarfTypes.h"
 #include "FunctionID.h"
 #include "FunctionParameterID.h"
 #include "GlobalTypeLookup.h"
 #include "LocalVariableID.h"
 #include "Register.h"
 #include "RegisterMap.h"
-#include "SourceLanguageInfo.h"
 #include "StringUtils.h"
 #include "Tracing.h"
 #include "ValueLocation.h"
 #include "Variable.h"
 
 
-namespace {
-
-
-// #pragma mark - HasTypePredicate
-
-
-template<typename EntryType>
-struct HasTypePredicate {
-       inline bool operator()(EntryType* entry) const
-       {
-               return entry->GetType() != NULL;
-       }
-};
-
-
-// #pragma mark - HasReturnTypePredicate
-
-
-template<typename EntryType>
-struct HasReturnTypePredicate {
-       inline bool operator()(EntryType* entry) const
-       {
-               return entry->ReturnType() != NULL;
-       }
-};
-
-
-// #pragma mark - HasEnumeratorsPredicate
-
-
-struct HasEnumeratorsPredicate {
-       inline bool operator()(DIEEnumerationType* entry) const
-       {
-               return !entry->Enumerators().IsEmpty();
-       }
-};
-
-
-// #pragma mark - HasDimensionsPredicate
-
-
-struct HasDimensionsPredicate {
-       inline bool operator()(DIEArrayType* entry) const
-       {
-               return !entry->Dimensions().IsEmpty();
-       }
-};
-
-
-// #pragma mark - HasMembersPredicate
-
-
-struct HasMembersPredicate {
-       inline bool operator()(DIECompoundType* entry) const
-       {
-               return !entry->DataMembers().IsEmpty();
-       }
-};
-
-
-// #pragma mark - HasBaseTypesPredicate
-
-
-struct HasBaseTypesPredicate {
-       inline bool operator()(DIEClassBaseType* entry) const
-       {
-               return !entry->BaseTypes().IsEmpty();
-       }
-};
-
-
-// #pragma mark - HasParametersPredicate
-
-
-template<typename EntryType>
-struct HasParametersPredicate {
-       inline bool operator()(EntryType* entry) const
-       {
-               return !entry->Parameters().IsEmpty();
-       }
-};
-
-
-// #pragma mark - HasLowerBoundPredicate
-
-
-struct HasLowerBoundPredicate {
-       inline bool operator()(DIESubrangeType* entry) const
-       {
-               return entry->LowerBound()->IsValid();
-       }
-};
-
-
-// #pragma mark - HasUpperBoundPredicate
-
-
-struct HasUpperBoundPredicate {
-       inline bool operator()(DIESubrangeType* entry) const
-       {
-               return entry->UpperBound()->IsValid();
-       }
-};
-
-
-// #pragma mark - HasCountPredicate
-
-
-struct HasCountPredicate {
-       inline bool operator()(DIESubrangeType* entry) const
-       {
-               return entry->Count()->IsValid();
-       }
-};
-
-
-// #pragma mark - HasBitStridePredicate
-
-
-template<typename EntryType>
-struct HasBitStridePredicate {
-       inline bool operator()(EntryType* entry) const
-       {
-               return entry->BitStride()->IsValid();
-       }
-};
-
-
-// #pragma mark - HasByteStridePredicate
-
-
-template<typename EntryType>
-struct HasByteStridePredicate {
-       inline bool operator()(EntryType* entry) const
-       {
-               return entry->ByteStride()->IsValid();
-       }
-};
-
-
-// #pragma mark - HasContainingTypePredicate
-
-
-struct HasContainingTypePredicate {
-       inline bool operator()(DIEPointerToMemberType* entry) const
-       {
-               return entry->ContainingType() != NULL;
-       }
-};
-
-
-}      // unnamed namespace
-
-
 // #pragma mark - DwarfFunctionParameterID
 
 
@@ -274,1205 +117,64 @@
 };
 
 
-// #pragma mark - DwarfType
-
-
-struct DwarfStackFrameDebugInfo::DwarfType : virtual Type {
-public:
-       DwarfType(const BString& name)
-               :
-               fName(name),
-               fByteSize(0)
-       {
-       }
-
-       virtual const char* Name() const
-       {
-               return fName.Length() > 0 ? fName.String() : NULL;
-       }
-
-       virtual target_size_t ByteSize() const
-       {
-               return fByteSize;
-       }
-
-       void SetByteSize(target_size_t size)
-       {
-               fByteSize = size;
-       }
-
-       virtual DIEType* GetDIEType() const = 0;
-
-private:
-       BString                 fName;
-       target_size_t   fByteSize;
-};
-
-
-// #pragma mark - DwarfInheritance
-
-
-struct DwarfStackFrameDebugInfo::DwarfInheritance : BaseType {
-public:
-       DwarfInheritance(DIEInheritance* entry, DwarfType* type)
-               :
-               fEntry(entry),
-               fType(type)
-       {
-               fType->AcquireReference();
-       }
-
-       ~DwarfInheritance()
-       {
-               fType->ReleaseReference();
-       }
-
-       virtual Type* GetType() const
-       {
-               return fType;
-       }
-
-       DIEInheritance* Entry() const
-       {
-               return fEntry;
-       }
-
-private:
-       DIEInheritance* fEntry;
-       DwarfType*              fType;
-
-};
-
-
-// #pragma mark - DwarfDataMember
-
-
-struct DwarfStackFrameDebugInfo::DwarfDataMember : DataMember {
-public:
-       DwarfDataMember(DIEMember* entry, const BString& name, DwarfType* type)
-               :
-               fEntry(entry),
-               fName(name),
-               fType(type)
-       {
-               fType->AcquireReference();
-       }
-
-       ~DwarfDataMember()
-       {
-               fType->ReleaseReference();
-       }
-
-       virtual const char* Name() const
-       {
-               return fName.Length() > 0 ? fName.String() : NULL;
-       }
-
-       virtual Type* GetType() const
-       {
-               return fType;
-       }
-
-       DIEMember* Entry() const
-       {
-               return fEntry;
-       }
-
-private:
-       DIEMember*      fEntry;
-       BString         fName;
-       DwarfType*      fType;
-
-};
-
-
-// #pragma mark - DwarfEnumerationValue
-
-
-struct DwarfStackFrameDebugInfo::DwarfEnumerationValue : EnumerationValue {
-public:
-       DwarfEnumerationValue(DIEEnumerator* entry, const BString& name,
-               const BVariant& value)
-               :
-               fEntry(entry),
-               fName(name),
-               fValue(value)
-       {
-       }
-
-       ~DwarfEnumerationValue()
-       {
-       }
-
-       virtual const char* Name() const
-       {
-               return fName.Length() > 0 ? fName.String() : NULL;
-       }
-
-       DIEEnumerator* Entry() const
-       {
-               return fEntry;
-       }
-
-       virtual BVariant Value() const
-       {
-               return fValue;
-       }
-
-private:
-       DIEEnumerator*  fEntry;
-       BString                 fName;
-       BVariant                fValue;
-
-};
-
-
-// #pragma mark - DwarfArrayDimension
-
-
-struct DwarfStackFrameDebugInfo::DwarfArrayDimension : ArrayDimension {
-public:
-       DwarfArrayDimension(DwarfType* type)
-               :
-               fType(type)
-       {
-               fType->AcquireReference();
-       }
-
-       ~DwarfArrayDimension()
-       {
-               fType->ReleaseReference();
-       }
-
-       virtual Type* GetType() const
-       {
-               return fType;
-       }
-
-       DwarfType* GetDwarfType() const
-       {
-               return fType;
-       }
-
-private:
-       DwarfType*      fType;
-
-};
-
-
-// #pragma mark - DwarfFunctionParameter
-
-
-struct DwarfStackFrameDebugInfo::DwarfFunctionParameter : FunctionParameter {
-public:
-       DwarfFunctionParameter(DIEFormalParameter* entry, const BString& name,
-               DwarfType* type)
-               :
-               fEntry(entry),
-               fName(name),
-               fType(type)
-       {
-               fType->AcquireReference();
-       }
-
-       ~DwarfFunctionParameter()
-       {
-               fType->ReleaseReference();
-       }
-
-       virtual const char* Name() const
-       {
-               return fName.Length() > 0 ? fName.String() : NULL;
-       }
-
-       virtual Type* GetType() const
-       {
-               return fType;
-       }
-
-       DIEFormalParameter* Entry() const
-       {
-               return fEntry;
-       }
-
-private:
-       DIEFormalParameter*     fEntry;
-       BString                         fName;
-       DwarfType*                      fType;
-
-};
-
-
-// #pragma mark - DwarfPrimitiveType
-
-
-struct DwarfStackFrameDebugInfo::DwarfPrimitiveType : PrimitiveType, DwarfType 
{
-public:
-       DwarfPrimitiveType(const BString& name, DIEBaseType* entry,
-               uint32 typeConstant)
-               :
-               DwarfType(name),
-               fEntry(entry),
-               fTypeConstant(typeConstant)
-       {
-       }
-
-       virtual DIEType* GetDIEType() const
-       {
-               return fEntry;
-       }
-
-       DIEBaseType* Entry() const
-       {
-               return fEntry;
-       }
-
-       virtual uint32 TypeConstant() const
-       {
-               return fTypeConstant;
-       }
-
-private:
-       DIEBaseType*    fEntry;
-       uint32                  fTypeConstant;
-};
-
-
-// #pragma mark - DwarfCompoundType
-
-
-struct DwarfStackFrameDebugInfo::DwarfCompoundType : CompoundType, DwarfType {
-public:
-       DwarfCompoundType(const BString& name, DIECompoundType* entry)
-               :
-               DwarfType(name),
-               fEntry(entry)
-       {
-       }
-
-       ~DwarfCompoundType()
-       {
-               for (int32 i = 0;
-                               DwarfInheritance* inheritance = 
fInheritances.ItemAt(i); i++) {
-                       inheritance->ReleaseReference();
-               }
-               for (int32 i = 0; DwarfDataMember* member = 
fDataMembers.ItemAt(i); i++)
-                       member->ReleaseReference();
-       }
-
-       virtual int32 CountBaseTypes() const
-       {
-               return fInheritances.CountItems();
-       }
-
-       virtual BaseType* BaseTypeAt(int32 index) const
-       {
-               return fInheritances.ItemAt(index);
-       }
-
-       virtual int32 CountDataMembers() const
-       {
-               return fDataMembers.CountItems();
-       }
-
-       virtual DataMember* DataMemberAt(int32 index) const
-       {
-               return fDataMembers.ItemAt(index);
-       }
-
-       virtual DIEType* GetDIEType() const
-       {
-               return fEntry;
-       }
-
-       DIECompoundType* Entry() const
-       {
-               return fEntry;
-       }
-
-       bool AddInheritance(DwarfInheritance* inheritance)
-       {
-               if (!fInheritances.AddItem(inheritance))
-                       return false;
-
-               inheritance->AcquireReference();
-               return true;
-       }
-
-       bool AddDataMember(DwarfDataMember* member)
-       {
-               if (!fDataMembers.AddItem(member))
-                       return false;
-
-               member->AcquireReference();
-               return true;
-       }
-
-private:
-       typedef BObjectList<DwarfDataMember> DataMemberList;
-       typedef BObjectList<DwarfInheritance> InheritanceList;
-
-private:
-       DIECompoundType*        fEntry;
-       InheritanceList         fInheritances;
-       DataMemberList          fDataMembers;
-};
-
-
-// #pragma mark - DwarfModifiedType
-
-
-struct DwarfStackFrameDebugInfo::DwarfModifiedType : ModifiedType, DwarfType {
-public:
-       DwarfModifiedType(const BString& name, DIEModifiedType* entry,
-               uint32 modifiers, DwarfType* baseType)
-               :
-               DwarfType(name),
-               fEntry(entry),
-               fModifiers(modifiers),
-               fBaseType(baseType)
-       {
-               fBaseType->AcquireReference();
-       }
-
-       ~DwarfModifiedType()
-       {
-               fBaseType->ReleaseReference();
-       }
-
-       virtual uint32 Modifiers() const
-       {
-               return fModifiers;
-       }
-
-       virtual Type* BaseType() const
-       {
-               return fBaseType;
-       }
-
-       virtual DIEType* GetDIEType() const
-       {
-               return fEntry;
-       }
-
-       DIEModifiedType* Entry() const
-       {
-               return fEntry;
-       }
-
-private:
-       DIEModifiedType*        fEntry;
-       uint32                          fModifiers;
-       DwarfType*                      fBaseType;
-};
-
-
-// #pragma mark - DwarfTypedefType
-
-
-struct DwarfStackFrameDebugInfo::DwarfTypedefType : TypedefType, DwarfType {
-public:
-       DwarfTypedefType(const BString& name, DIETypedef* entry,
-               DwarfType* baseType)
-               :
-               DwarfType(name),
-               fEntry(entry),
-               fBaseType(baseType)
-       {
-               fBaseType->AcquireReference();
-       }
-
-       ~DwarfTypedefType()
-       {
-               fBaseType->ReleaseReference();
-       }
-
-       virtual Type* BaseType() const
-       {
-               return fBaseType;
-       }
-
-       virtual DIEType* GetDIEType() const
-       {
-               return fEntry;
-       }
-
-       DIETypedef* Entry() const
-       {
-               return fEntry;
-       }
-
-private:
-       DIETypedef*     fEntry;
-       DwarfType*      fBaseType;
-};
-
-
-// #pragma mark - DwarfAddressType
-
-
-struct DwarfStackFrameDebugInfo::DwarfAddressType : AddressType, DwarfType {
-public:
-       DwarfAddressType(const BString& name, DIEAddressingType* entry,
-               address_type_kind addressKind, DwarfType* baseType)
-               :
-               DwarfType(name),
-               fEntry(entry),
-               fAddressKind(addressKind),
-               fBaseType(baseType)
-       {
-               fBaseType->AcquireReference();
-       }
-
-       ~DwarfAddressType()
-       {
-               fBaseType->ReleaseReference();
-       }
-
-       virtual address_type_kind AddressKind() const
-       {
-               return fAddressKind;
-       }
-
-       virtual Type* BaseType() const
-       {
-               return fBaseType;
-       }
-
-       virtual DIEType* GetDIEType() const
-       {
-               return fEntry;
-       }
-
-       DIEAddressingType* Entry() const
-       {
-               return fEntry;
-       }
-
-private:
-       DIEAddressingType*      fEntry;
-       address_type_kind       fAddressKind;
-       DwarfType*                      fBaseType;
-};
-
-
-// #pragma mark - DwarfEnumerationType
-
-
-struct DwarfStackFrameDebugInfo::DwarfEnumerationType : EnumerationType,
-       DwarfType {
-public:
-       DwarfEnumerationType(const BString& name, DIEEnumerationType* entry,
-               DwarfType* baseType)
-               :
-               DwarfType(name),
-               fEntry(entry),
-               fBaseType(baseType)
-       {
-               if (fBaseType != NULL)
-                       fBaseType->AcquireReference();
-       }
-
-       ~DwarfEnumerationType()
-       {
-               for (int32 i = 0; DwarfEnumerationValue* value = 
fValues.ItemAt(i); i++)
-                       value->ReleaseReference();
-
-               if (fBaseType != NULL)

[... truncated: 6085 lines follow ...]

Other related posts:

  • » [haiku-commits] r33495 - in haiku/trunk/src/apps/debugger: . arch/x86 debug_info dwarf model - ingo_weinhold