1/* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef TEAM_DEBUG_INFO_H 6#define TEAM_DEBUG_INFO_H 7 8 9#include <Locker.h> 10 11#include <ObjectList.h> 12#include <Referenceable.h> 13#include <util/OpenHashTable.h> 14 15#include "GlobalTypeLookup.h" 16#include "ImageInfo.h" 17#include "TeamTypeInformation.h" 18 19 20class Architecture; 21class DebuggerInterface; 22class DisassembledCode; 23class FileManager; 24class FileSourceCode; 25class Function; 26class FunctionID; 27class FunctionInstance; 28class ImageDebugInfo; 29class ImageInfo; 30class LocatableFile; 31class SourceCode; 32class SourceLocation; 33class SpecificTeamDebugInfo; 34 35 36class TeamDebugInfo : public GlobalTypeLookup, public TeamTypeInformation { 37public: 38 TeamDebugInfo( 39 DebuggerInterface* debuggerInterface, 40 Architecture* architecture, 41 FileManager* fileManager); 42 ~TeamDebugInfo(); 43 44 status_t Init(); 45 46 virtual status_t GetType(GlobalTypeCache* cache, 47 const BString& name, 48 const TypeLookupConstraints& constraints, 49 Type*& _type); 50 51 virtual status_t LookupTypeByName(const BString& name, 52 const TypeLookupConstraints& constraints, 53 Type*& _type); 54 55 status_t LoadImageDebugInfo(const ImageInfo& imageInfo, 56 LocatableFile* imageFile, 57 ImageDebugInfo*& _imageDebugInfo); 58 59 status_t LoadSourceCode(LocatableFile* file, 60 FileSourceCode*& _sourceCode); 61 // returns reference 62 status_t DisassembleFunction( 63 FunctionInstance* functionInstance, 64 DisassembledCode*& _sourceCode); 65 // returns reference 66 67 // team is locked 68 status_t AddImageDebugInfo( 69 ImageDebugInfo* imageDebugInfo); 70 void RemoveImageDebugInfo( 71 ImageDebugInfo* imageDebugInfo); 72 ImageDebugInfo* ImageDebugInfoByName(const char* name) const; 73 74 Function* FunctionAtSourceLocation(LocatableFile* file, 75 const SourceLocation& location) const; 76 Function* FunctionByID(FunctionID* functionID) const; 77 78private: 79 struct FunctionHashDefinition; 80 struct SourceFileEntry; 81 struct SourceFileHashDefinition; 82 83 typedef BObjectList<SpecificTeamDebugInfo> SpecificInfoList; 84 typedef BObjectList<ImageDebugInfo> ImageList; 85 typedef BOpenHashTable<FunctionHashDefinition> FunctionTable; 86 typedef BOpenHashTable<SourceFileHashDefinition> SourceFileTable; 87 88private: 89 status_t _AddFunction(Function* function); 90 void _RemoveFunction(Function* function); 91 92private: 93 BLocker fLock; 94 DebuggerInterface* fDebuggerInterface; 95 Architecture* fArchitecture; 96 FileManager* fFileManager; 97 SpecificInfoList fSpecificInfos; 98 ImageList fImages; 99 FunctionTable* fFunctions; 100 SourceFileTable* fSourceFiles; 101 GlobalTypeCache* fTypeCache; 102}; 103 104 105#endif // TEAM_DEBUG_INFO_H 106