DWARFExpression.h revision 24943d2ee8bfaa7cf5893e4709143924157a5c1e
1//===-- DWARFExpression.h ---------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_DWARFExpression_h_ 11#define liblldb_DWARFExpression_h_ 12 13#include "lldb/lldb-private.h" 14#include "lldb/Core/ClangForward.h" 15#include "lldb/Core/Address.h" 16#include "lldb/Core/DataExtractor.h" 17#include "lldb/Core/Error.h" 18#include "lldb/Core/Scalar.h" 19 20class ClangExpressionVariable; 21class ClangExpressionVariableList; 22 23namespace lldb_private { 24 25class ClangExpressionDeclMap; 26 27//---------------------------------------------------------------------- 28// A class designed to evaluate the DWARF expression opcodes. We will 29// likely augment its abilities to handle features not supported by 30// the DWARF expression engine. 31//---------------------------------------------------------------------- 32class DWARFExpression 33{ 34public: 35 36 //------------------------------------------------------------------ 37 // Constructors and Destructors 38 //------------------------------------------------------------------ 39 DWARFExpression(); 40 41 DWARFExpression(const DataExtractor& data, 42 uint32_t data_offset, 43 uint32_t data_length, 44 const Address* loclist_base_addr_ptr); 45 46 DWARFExpression(const DWARFExpression& rhs); 47 48 virtual 49 ~DWARFExpression(); 50 51 void 52 GetDescription (Stream *s, lldb::DescriptionLevel level) const; 53 54 bool 55 IsValid() const; 56 57 bool 58 IsLocationList() const; 59 60 bool 61 LocationListContainsLoadAddress (Process* process, const Address &addr) const; 62 63 void 64 SetOpcodeData(const DataExtractor& data, const Address* loclist_base_addr_ptr); 65 66 void 67 SetOpcodeData(const DataExtractor& data, uint32_t data_offset, uint32_t data_length, const Address* loclist_base_addr_ptr); 68 69 void 70 SetLocationListBaseAddress(Address& base_addr); 71 72 int 73 GetRegisterKind (); 74 75 void 76 SetRegisterKind (int reg_kind); 77 78 bool 79 Evaluate (ExecutionContextScope *exe_scope, 80 clang::ASTContext *ast_context, 81 const Value* initial_value_ptr, 82 Value& result, 83 Error *error_ptr) const; 84 85 bool 86 Evaluate (ExecutionContext *exe_ctx, 87 clang::ASTContext *ast_context, 88 const Value* initial_value_ptr, 89 Value& result, 90 Error *error_ptr) const; 91 92 static bool 93 Evaluate (ExecutionContext *exe_ctx, 94 clang::ASTContext *ast_context, 95 const DataExtractor& opcodes, 96 ClangExpressionVariableList *expr_locals, 97 ClangExpressionDeclMap *decl_map, 98 const uint32_t offset, 99 const uint32_t length, 100 const uint32_t reg_set, 101 const Value* initial_value_ptr, 102 Value& result, 103 Error *error_ptr); 104 105 void 106 SetExpressionLocalVariableList (ClangExpressionVariableList *locals); 107 108 void 109 SetExpressionDeclMap (ClangExpressionDeclMap *decl_map); 110 111protected: 112 113 void DumpLocation(Stream *s, uint32_t offset, uint32_t length, lldb::DescriptionLevel level) const; 114 //------------------------------------------------------------------ 115 // Classes that inherit from DWARFExpression can see and modify these 116 //------------------------------------------------------------------ 117 DataExtractor m_data; 118 int m_reg_kind; // One of the defines that starts with LLDB_REGKIND_ 119 Address m_loclist_base_addr; // Base address needed for location lists 120 ClangExpressionVariableList *m_expr_locals; 121 ClangExpressionDeclMap *m_decl_map; 122}; 123 124} // namespace lldb_private 125 126#endif // liblldb_DWARFExpression_h_ 127