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