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 21 DebuggerImageDebugInfo::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 32 DebuggerImageDebugInfo::~DebuggerImageDebugInfo() 33 { 34 fDebuggerInterface->ReleaseReference(); 35 } 36 37 38 status_t 39 DebuggerImageDebugInfo::Init() 40 { 41 return B_OK; 42 } 43 44 45 status_t 46 DebuggerImageDebugInfo::GetFunctions(const BObjectList<SymbolInfo>& symbols, 47 BObjectList<FunctionDebugInfo>& functions) 48 { 49 return SpecificImageDebugInfo::GetFunctionsFromSymbols(symbols, functions, 50 fDebuggerInterface, fImageInfo, this); 51 } 52 53 54 status_t 55 DebuggerImageDebugInfo::GetType(GlobalTypeCache* cache, 56 const BString& name, const TypeLookupConstraints& constraints, 57 Type*& _type) 58 { 59 return B_UNSUPPORTED; 60 } 61 62 63 bool 64 DebuggerImageDebugInfo::HasType(const BString& name, 65 const TypeLookupConstraints& constraints) const 66 { 67 return false; 68 } 69 70 71 AddressSectionType 72 DebuggerImageDebugInfo::GetAddressSectionType(target_addr_t address) 73 { 74 return ADDRESS_SECTION_TYPE_UNKNOWN; 75 } 76 77 78 status_t 79 DebuggerImageDebugInfo::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 88 status_t 89 DebuggerImageDebugInfo::GetStatement(FunctionDebugInfo* function, 90 target_addr_t address, Statement*& _statement) 91 { 92 return fArchitecture->GetStatement(function, address, _statement); 93 } 94 95 96 status_t 97 DebuggerImageDebugInfo::GetStatementAtSourceLocation( 98 FunctionDebugInfo* function, const SourceLocation& sourceLocation, 99 Statement*& _statement) 100 { 101 return B_ENTRY_NOT_FOUND; 102 } 103 104 105 status_t 106 DebuggerImageDebugInfo::GetSourceLanguage(FunctionDebugInfo* function, 107 SourceLanguage*& _language) 108 { 109 return B_UNSUPPORTED; 110 } 111 112 113 ssize_t 114 DebuggerImageDebugInfo::ReadCode(target_addr_t address, void* buffer, 115 size_t size) 116 { 117 return fDebuggerInterface->ReadMemory(address, buffer, size); 118 } 119 120 121 status_t 122 DebuggerImageDebugInfo::AddSourceCodeInfo(LocatableFile* file, 123 FileSourceCode* sourceCode) 124 { 125 return B_UNSUPPORTED; 126 } 127