vfs: check userland buffers before reading them.
[haiku.git] / headers / private / debugger / debug_info / TeamDebugInfo.h
blob817f02a6880997b8d5e85770b1ee50f9eb805267
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2014-2016, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef TEAM_DEBUG_INFO_H
7 #define TEAM_DEBUG_INFO_H
10 #include <Locker.h>
12 #include <ObjectList.h>
13 #include <Referenceable.h>
14 #include <util/OpenHashTable.h>
16 #include "GlobalTypeLookup.h"
17 #include "ImageInfo.h"
18 #include "TeamFunctionSourceInformation.h"
19 #include "TeamTypeInformation.h"
21 class Architecture;
22 class DebuggerInterface;
23 class DisassembledCode;
24 class FileManager;
25 class FileSourceCode;
26 class Function;
27 class FunctionID;
28 class FunctionInstance;
29 class ImageDebugInfo;
30 class ImageDebugInfoLoadingState;
31 class ImageInfo;
32 class LocatableFile;
33 class SourceCode;
34 class SourceLocation;
35 class SpecificTeamDebugInfo;
38 class TeamDebugInfo : public BReferenceable, public GlobalTypeLookup,
39 public TeamTypeInformation, public TeamFunctionSourceInformation {
40 public:
41 TeamDebugInfo(
42 DebuggerInterface* debuggerInterface,
43 Architecture* architecture,
44 FileManager* fileManager);
45 ~TeamDebugInfo();
47 status_t Init();
49 virtual status_t GetType(GlobalTypeCache* cache,
50 const BString& name,
51 const TypeLookupConstraints& constraints,
52 Type*& _type);
53 virtual bool HasType(GlobalTypeCache* cache,
54 const BString& name,
55 const TypeLookupConstraints& constraints);
57 virtual status_t LookupTypeByName(const BString& name,
58 const TypeLookupConstraints& constraints,
59 Type*& _type);
60 virtual bool TypeExistsByName(const BString& name,
61 const TypeLookupConstraints& constraints);
63 virtual status_t GetActiveSourceCode(FunctionDebugInfo* info,
64 SourceCode*& _code);
66 status_t LoadImageDebugInfo(const ImageInfo& imageInfo,
67 LocatableFile* imageFile,
68 ImageDebugInfoLoadingState& state,
69 ImageDebugInfo*& _imageDebugInfo);
71 status_t LoadSourceCode(LocatableFile* file,
72 FileSourceCode*& _sourceCode);
73 // returns reference
74 void ClearSourceCode(LocatableFile* file);
76 status_t DisassembleFunction(
77 FunctionInstance* functionInstance,
78 DisassembledCode*& _sourceCode);
79 // returns reference
80 FunctionInstance* MainFunction() const
81 { return fMainFunction; }
83 // team is locked
84 status_t AddImageDebugInfo(
85 ImageDebugInfo* imageDebugInfo);
86 void RemoveImageDebugInfo(
87 ImageDebugInfo* imageDebugInfo);
88 ImageDebugInfo* ImageDebugInfoByName(const char* name) const;
90 Function* FunctionAtSourceLocation(LocatableFile* file,
91 const SourceLocation& location) const;
92 Function* FunctionByID(FunctionID* functionID) const;
94 private:
95 struct FunctionHashDefinition;
96 struct SourceFileEntry;
97 struct SourceFileHashDefinition;
99 typedef BObjectList<SpecificTeamDebugInfo> SpecificInfoList;
100 typedef BObjectList<ImageDebugInfo> ImageList;
101 typedef BOpenHashTable<FunctionHashDefinition> FunctionTable;
102 typedef BOpenHashTable<SourceFileHashDefinition> SourceFileTable;
104 private:
105 status_t _AddFunction(Function* function);
106 void _RemoveFunction(Function* function);
108 private:
109 BLocker fLock;
110 DebuggerInterface* fDebuggerInterface;
111 Architecture* fArchitecture;
112 FileManager* fFileManager;
113 SpecificInfoList fSpecificInfos;
114 ImageList fImages;
115 FunctionTable* fFunctions;
116 SourceFileTable* fSourceFiles;
117 GlobalTypeCache* fTypeCache;
118 FunctionInstance* fMainFunction;
122 #endif // TEAM_DEBUG_INFO_H