174298Ssos//===-- RegisterContextMemory.h ---------------------------------*- C++ -*-===//
274298Ssos//
374298Ssos//                     The LLVM Compiler Infrastructure
474298Ssos//
574298Ssos// This file is distributed under the University of Illinois Open Source
674298Ssos// License. See LICENSE.TXT for details.
774298Ssos//
874298Ssos//===----------------------------------------------------------------------===//
974298Ssos
1074298Ssos#ifndef lldb_RegisterContextMemory_h_
1174298Ssos#define lldb_RegisterContextMemory_h_
1274298Ssos
1374298Ssos// C Includes
1474298Ssos// C++ Includes
1574298Ssos#include <vector>
1674298Ssos
1774298Ssos// Other libraries and framework includes
1874298Ssos// Project includes
1974298Ssos#include "lldb/lldb-private.h"
2074298Ssos#include "lldb/Core/DataExtractor.h"
2174298Ssos#include "lldb/Target/RegisterContext.h"
2274298Ssos
2374298Ssosclass DynamicRegisterInfo;
2474298Ssos
2574298Ssosclass RegisterContextMemory : public lldb_private::RegisterContext
2674298Ssos{
2774298Ssospublic:
2874298Ssos    //------------------------------------------------------------------
2974298Ssos    // Constructors and Destructors
3074298Ssos    //------------------------------------------------------------------
3174298Ssos    RegisterContextMemory (lldb_private::Thread &thread,
3274298Ssos                            uint32_t concrete_frame_idx,
3374298Ssos                            DynamicRegisterInfo &reg_info,
3474298Ssos                            lldb::addr_t reg_data_addr);
3574298Ssos
3674298Ssos    virtual
3774298Ssos    ~RegisterContextMemory ();
3882560Ssos
3982560Ssos    //------------------------------------------------------------------
4082560Ssos    // Subclasses must override these functions
4174298Ssos    //------------------------------------------------------------------
4282560Ssos    virtual void
4382560Ssos    InvalidateAllRegisters ();
4482560Ssos
4582560Ssos    virtual size_t
4682560Ssos    GetRegisterCount ();
4774298Ssos
4882560Ssos    virtual const lldb_private::RegisterInfo *
4982560Ssos    GetRegisterInfoAtIndex (size_t reg);
5082560Ssos
5182560Ssos    virtual size_t
5282560Ssos    GetRegisterSetCount ();
5382560Ssos
5474298Ssos    virtual const lldb_private::RegisterSet *
5582560Ssos    GetRegisterSet (size_t reg_set);
5682560Ssos
5782560Ssos    virtual uint32_t
5874298Ssos    ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num);
5974298Ssos
6074298Ssos
6174298Ssos    //------------------------------------------------------------------
6274298Ssos    // If all of the thread register are in a contiguous buffer in
6374298Ssos    // memory, then the default ReadRegister/WriteRegister and
6474298Ssos    // ReadAllRegisterValues/WriteAllRegisterValues will work. If thread
6574298Ssos    // registers are not contiguous, clients will want to subclass this
6674298Ssos    // class and modify the read/write functions as needed.
6774298Ssos    //------------------------------------------------------------------
6874298Ssos
6974298Ssos    virtual bool
7074298Ssos    ReadRegister (const lldb_private::RegisterInfo *reg_info,
7174298Ssos                  lldb_private::RegisterValue &reg_value);
7274298Ssos
7374298Ssos    virtual bool
7474298Ssos    WriteRegister (const lldb_private::RegisterInfo *reg_info,
7574298Ssos                   const lldb_private::RegisterValue &reg_value);
7674298Ssos
7774298Ssos    virtual bool
7874298Ssos    ReadAllRegisterValues (lldb::DataBufferSP &data_sp);
7974298Ssos
8074298Ssos    virtual bool
8174298Ssos    WriteAllRegisterValues (const lldb::DataBufferSP &data_sp);
8274298Ssos
8374298Ssos    void
8474298Ssos    SetAllRegisterData  (const lldb::DataBufferSP &data_sp);
8574298Ssosprotected:
8674298Ssos
8774298Ssos    void
8874298Ssos    SetAllRegisterValid (bool b);
8974298Ssos
9074298Ssos    DynamicRegisterInfo &m_reg_infos;
9174298Ssos    std::vector<bool> m_reg_valid;
9274298Ssos    lldb_private::DataExtractor m_reg_data;
9374298Ssos    lldb::addr_t m_reg_data_addr; // If this is valid, then we have a register context that is stored in memmory
9474298Ssos
9574298Ssosprivate:
9674298Ssos    //------------------------------------------------------------------
9782560Ssos    // For RegisterContextMemory only
9882560Ssos    //------------------------------------------------------------------
9982560Ssos    DISALLOW_COPY_AND_ASSIGN (RegisterContextMemory);
10074298Ssos};
10174298Ssos
10274298Ssos#endif  // lldb_RegisterContextMemory_h_
10374298Ssos