1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2013-2014, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
5 */
6
7#include "DebuggerImageDebugInfo.h"
8
9#include <algorithm>
10#include <new>
11
12#include <AutoDeleter.h>
13
14#include "Architecture.h"
15#include "BasicFunctionDebugInfo.h"
16#include "DebuggerInterface.h"
17#include "Demangler.h"
18#include "SymbolInfo.h"
19
20
21DebuggerImageDebugInfo::DebuggerImageDebugInfo(const ImageInfo& imageInfo,
22	DebuggerInterface* debuggerInterface, Architecture* architecture)
23	:
24	fImageInfo(imageInfo),
25	fDebuggerInterface(debuggerInterface),
26	fArchitecture(architecture)
27{
28	fDebuggerInterface->AcquireReference();
29}
30
31
32DebuggerImageDebugInfo::~DebuggerImageDebugInfo()
33{
34	fDebuggerInterface->ReleaseReference();
35}
36
37
38status_t
39DebuggerImageDebugInfo::Init()
40{
41	return B_OK;
42}
43
44
45status_t
46DebuggerImageDebugInfo::GetFunctions(const BObjectList<SymbolInfo>& symbols,
47	BObjectList<FunctionDebugInfo>& functions)
48{
49	return SpecificImageDebugInfo::GetFunctionsFromSymbols(symbols, functions,
50		fDebuggerInterface, fImageInfo, this);
51}
52
53
54status_t
55DebuggerImageDebugInfo::GetType(GlobalTypeCache* cache,
56	const BString& name, const TypeLookupConstraints& constraints,
57	Type*& _type)
58{
59	return B_UNSUPPORTED;
60}
61
62
63bool
64DebuggerImageDebugInfo::HasType(const BString& name,
65	const TypeLookupConstraints& constraints) const
66{
67	return false;
68}
69
70
71AddressSectionType
72DebuggerImageDebugInfo::GetAddressSectionType(target_addr_t address)
73{
74	return ADDRESS_SECTION_TYPE_UNKNOWN;
75}
76
77
78status_t
79DebuggerImageDebugInfo::CreateFrame(Image* image,
80	FunctionInstance* functionInstance, CpuState* cpuState,
81	bool getFullFrameInfo, ReturnValueInfoList* returnValueInfos,
82	StackFrame*& _previousFrame, CpuState*& _previousCpuState)
83{
84	return B_UNSUPPORTED;
85}
86
87
88status_t
89DebuggerImageDebugInfo::GetStatement(FunctionDebugInfo* function,
90	target_addr_t address, Statement*& _statement)
91{
92	return fArchitecture->GetStatement(function, address, _statement);
93}
94
95
96status_t
97DebuggerImageDebugInfo::GetStatementAtSourceLocation(
98	FunctionDebugInfo* function, const SourceLocation& sourceLocation,
99	Statement*& _statement)
100{
101	return B_ENTRY_NOT_FOUND;
102}
103
104
105status_t
106DebuggerImageDebugInfo::GetSourceLanguage(FunctionDebugInfo* function,
107	SourceLanguage*& _language)
108{
109	return B_UNSUPPORTED;
110}
111
112
113ssize_t
114DebuggerImageDebugInfo::ReadCode(target_addr_t address, void* buffer,
115	size_t size)
116{
117	return fDebuggerInterface->ReadMemory(address, buffer, size);
118}
119
120
121status_t
122DebuggerImageDebugInfo::AddSourceCodeInfo(LocatableFile* file,
123	FileSourceCode* sourceCode)
124{
125	return B_UNSUPPORTED;
126}
127