1 //===-- RegisterInfoInterface.h --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_RegisterInfoInterface_h
11 #define lldb_RegisterInfoInterface_h
15 #include "lldb/Core/ArchSpec.h"
17 namespace lldb_private
20 ///------------------------------------------------------------------------------
21 /// @class RegisterInfoInterface
23 /// @brief RegisterInfo interface to patch RegisterInfo structure for archs.
24 ///------------------------------------------------------------------------------
25 class RegisterInfoInterface
28 RegisterInfoInterface(const lldb_private::ArchSpec& target_arch) : m_target_arch(target_arch) {}
29 virtual ~RegisterInfoInterface () {}
32 GetGPRSize () const = 0;
34 virtual const lldb_private::RegisterInfo *
35 GetRegisterInfo () const = 0;
37 // Returns the number of registers including the user registers and the
38 // lldb internal registers also
40 GetRegisterCount () const = 0;
42 // Returns the number of the user registers (excluding the registers
43 // kept for lldb internal use only). Subclasses should override it if
44 // they belongs to an architecture with lldb internal registers.
46 GetUserRegisterCount () const
48 return GetRegisterCount();
51 const lldb_private::ArchSpec&
52 GetTargetArchitecture() const
53 { return m_target_arch; }
55 virtual const lldb_private::RegisterInfo *
56 GetDynamicRegisterInfo(const char *reg_name) const
58 const std::vector <lldb_private::RegisterInfo> * d_register_infos = GetDynamicRegisterInfoP();
59 if(d_register_infos != nullptr)
61 std::vector <lldb_private::RegisterInfo> ::const_iterator pos = d_register_infos->begin();
62 for(; pos < d_register_infos->end() ; pos++)
64 if(::strcmp(reg_name, pos->name) == 0)
65 return(d_register_infos->data() + (pos - d_register_infos->begin()) );
71 virtual const std::vector<lldb_private::RegisterInfo> *
72 GetDynamicRegisterInfoP() const
76 // FIXME make private.
77 lldb_private::ArchSpec m_target_arch;