Home | History | Annotate | Download | only in Core
      1 //===-- ValueObjectConstResultImpl.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_ValueObjectConstResultImpl_h_
     11 #define liblldb_ValueObjectConstResultImpl_h_
     12 
     13 // C Includes
     14 // C++ Includes
     15 // Other libraries and framework includes
     16 // Project includes
     17 #include "lldb/Core/ValueObject.h"
     18 
     19 namespace lldb_private {
     20 
     21 //----------------------------------------------------------------------
     22 // A class wrapping common implementation details for operations in
     23 // ValueObjectConstResult ( & Child ) that may need to jump from the host
     24 // memory space into the target's memory space
     25 //----------------------------------------------------------------------
     26 class ValueObjectConstResultImpl
     27 {
     28 public:
     29 
     30     ValueObjectConstResultImpl (ValueObject* valobj,
     31                                 lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
     32 
     33     virtual
     34     ~ValueObjectConstResultImpl()
     35     {
     36     }
     37 
     38     lldb::ValueObjectSP
     39     Dereference (Error &error);
     40 
     41     ValueObject *
     42     CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
     43 
     44     lldb::ValueObjectSP
     45     GetSyntheticChildAtOffset (uint32_t offset, const ClangASTType& type, bool can_create);
     46 
     47     lldb::ValueObjectSP
     48     AddressOf (Error &error);
     49 
     50     bool
     51     NeedsDerefOnTarget()
     52     {
     53         m_impl_backend->UpdateValueIfNeeded(false);
     54         return (m_impl_backend->GetValue().GetValueType() == Value::eValueTypeHostAddress);
     55     }
     56 
     57     lldb::addr_t
     58     GetLiveAddress()
     59     {
     60         return m_live_address;
     61     }
     62 
     63     void
     64     SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
     65                    AddressType address_type = eAddressTypeLoad)
     66     {
     67         m_live_address = addr;
     68         m_live_address_type = address_type;
     69     }
     70 
     71     lldb::ValueObjectSP
     72     DerefOnTarget();
     73 
     74     virtual lldb::addr_t
     75     GetAddressOf (bool scalar_is_load_address = true,
     76                   AddressType *address_type = NULL);
     77 
     78     virtual size_t
     79     GetPointeeData (DataExtractor& data,
     80                     uint32_t item_idx = 0,
     81 					uint32_t item_count = 1);
     82 
     83 private:
     84 
     85     ValueObject *m_impl_backend;
     86     lldb::addr_t m_live_address;
     87     AddressType m_live_address_type;
     88     lldb::ValueObjectSP m_load_addr_backend;
     89     lldb::ValueObjectSP m_address_of_backend;
     90 
     91     DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResultImpl);
     92 };
     93 
     94 } // namespace lldb_private
     95 
     96 #endif  // liblldb_ValueObjectConstResultImpl_h_
     97