1 /* 2 * Copyright 2012, Rene Gollent, rene@gollent.com. 3 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef DWARF_STACK_FRAME_DEBUG_INFO_H 7 #define DWARF_STACK_FRAME_DEBUG_INFO_H 8 9 10 #include <image.h> 11 #include <String.h> 12 13 #include "StackFrameDebugInfo.h" 14 15 16 class CompilationUnit; 17 class CpuState; 18 class DIEFormalParameter; 19 class DIESubprogram; 20 class DIEType; 21 class DIEVariable; 22 class DwarfFile; 23 class DwarfTargetInterface; 24 class DwarfTypeContext; 25 class DwarfTypeFactory; 26 class FunctionID; 27 class GlobalTypeCache; 28 class GlobalTypeLookup; 29 struct LocationDescription; 30 class ObjectID; 31 class RegisterMap; 32 class Variable; 33 34 35 class DwarfStackFrameDebugInfo : public StackFrameDebugInfo { 36 public: 37 DwarfStackFrameDebugInfo( 38 Architecture* architecture, 39 image_id imageID, DwarfFile* file, 40 CompilationUnit* compilationUnit, 41 DIESubprogram* subprogramEntry, 42 GlobalTypeLookup* typeLookup, 43 GlobalTypeCache* typeCache, 44 target_addr_t instructionPointer, 45 target_addr_t framePointer, 46 target_addr_t relocationDelta, 47 DwarfTargetInterface* targetInterface, 48 RegisterMap* fromDwarfRegisterMap); 49 ~DwarfStackFrameDebugInfo(); 50 51 status_t Init(); 52 53 status_t CreateParameter(FunctionID* functionID, 54 DIEFormalParameter* parameterEntry, 55 Variable*& _parameter); 56 // returns reference 57 status_t CreateLocalVariable(FunctionID* functionID, 58 DIEVariable* variableEntry, 59 Variable*& _variable); 60 // returns reference 61 status_t CreateReturnValue(FunctionID* functionID, 62 DIEType* returnType, 63 ValueLocation* location, 64 CpuState* state, 65 Variable*& _variable); 66 // returns reference 67 68 private: 69 struct DwarfFunctionParameterID; 70 struct DwarfLocalVariableID; 71 struct DwarfReturnValueID; 72 73 private: 74 status_t _CreateVariable(ObjectID* id, 75 const BString& name, DIEType* typeEntry, 76 LocationDescription* locationDescription, 77 Variable*& _variable); 78 79 template<typename EntryType> 80 static DIEType* _GetDIEType(EntryType* entry); 81 82 private: 83 DwarfTypeContext* fTypeContext; 84 GlobalTypeLookup* fTypeLookup; 85 GlobalTypeCache* fTypeCache; 86 DwarfTypeFactory* fTypeFactory; 87 }; 88 89 90 #endif // DWARF_STACK_FRAME_DEBUG_INFO_H 91