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