1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2010, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
5 */
6#ifndef IMAGE_DEBUG_INFO_H
7#define IMAGE_DEBUG_INFO_H
8
9
10#include <String.h>
11
12#include <ObjectList.h>
13#include <Referenceable.h>
14
15#include "AddressSectionTypes.h"
16#include "ImageInfo.h"
17#include "Types.h"
18
19
20class Architecture;
21class DebuggerInterface;
22class FileSourceCode;
23class FunctionDebugInfo;
24class FunctionInstance;
25class GlobalTypeCache;
26class LocatableFile;
27class SpecificImageDebugInfo;
28class Type;
29class TypeLookupConstraints;
30
31
32class ImageDebugInfo : public BReferenceable {
33public:
34								ImageDebugInfo(const ImageInfo& imageInfo);
35								~ImageDebugInfo();
36
37			const ImageInfo&	GetImageInfo() const	{ return fImageInfo; }
38
39			bool				AddSpecificInfo(SpecificImageDebugInfo* info);
40			status_t			FinishInit();
41
42			status_t			GetType(GlobalTypeCache* cache,
43									const BString& name,
44									const TypeLookupConstraints& constraints,
45									Type*& _type);
46									// returns a reference
47			AddressSectionType	GetAddressSectionType(target_addr_t address)
48									const;
49
50			int32				CountFunctions() const;
51			FunctionInstance*	FunctionAt(int32 index) const;
52			FunctionInstance*	FunctionAtAddress(target_addr_t address) const;
53			FunctionInstance*	FunctionByName(const char* name) const;
54
55			status_t			AddSourceCodeInfo(LocatableFile* file,
56									FileSourceCode* sourceCode) const;
57
58private:
59			typedef BObjectList<SpecificImageDebugInfo> SpecificInfoList;
60			typedef BObjectList<FunctionInstance> FunctionList;
61
62private:
63	static	int					_CompareFunctions(const FunctionInstance* a,
64									const FunctionInstance* b);
65	static	int					_CompareAddressFunction(
66									const target_addr_t* address,
67									const FunctionInstance* function);
68
69private:
70			ImageInfo			fImageInfo;
71			SpecificInfoList	fSpecificInfos;
72			FunctionList		fFunctions;
73};
74
75
76#endif	// IMAGE_DEBUG_INFO_H
77