LLDB  mainline
RegisterInfoInterface.h
Go to the documentation of this file.
1 //===-- RegisterInfoInterface.h --------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef lldb_RegisterInfoInterface_h
10 #define lldb_RegisterInfoInterface_h
11 
12 #include "lldb/Utility/ArchSpec.h"
14 #include <vector>
15 
16 namespace lldb_private {
17 
18 /// \class RegisterInfoInterface
19 ///
20 /// RegisterInfo interface to patch RegisterInfo structure for archs.
22 public:
24  : m_target_arch(target_arch) {}
26 
27  virtual size_t GetGPRSize() const = 0;
28 
29  virtual const lldb_private::RegisterInfo *GetRegisterInfo() const = 0;
30 
31  // Returns the number of registers including the user registers and the
32  // lldb internal registers also
33  virtual uint32_t GetRegisterCount() const = 0;
34 
35  // Returns the number of the user registers (excluding the registers
36  // kept for lldb internal use only). Subclasses should override it if
37  // they belongs to an architecture with lldb internal registers.
38  virtual uint32_t GetUserRegisterCount() const { return GetRegisterCount(); }
39 
41  return m_target_arch;
42  }
43 
44  virtual const lldb_private::RegisterInfo *
45  GetDynamicRegisterInfo(const char *reg_name) const {
46  const std::vector<lldb_private::RegisterInfo> *d_register_infos =
48  if (d_register_infos != nullptr) {
49  std::vector<lldb_private::RegisterInfo>::const_iterator pos =
50  d_register_infos->begin();
51  for (; pos < d_register_infos->end(); pos++) {
52  if (::strcmp(reg_name, pos->name) == 0)
53  return (d_register_infos->data() + (pos - d_register_infos->begin()));
54  }
55  }
56  return nullptr;
57  }
58 
59  virtual const std::vector<lldb_private::RegisterInfo> *
61  return nullptr;
62  }
63 
64 public:
65  // FIXME make private.
67 };
68 }
69 
70 #endif
virtual size_t GetGPRSize() const =0
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
virtual uint32_t GetUserRegisterCount() const
RegisterInfo interface to patch RegisterInfo structure for archs.
An architecture specification class.
Definition: ArchSpec.h:32
const lldb_private::ArchSpec & GetTargetArchitecture() const
virtual uint32_t GetRegisterCount() const =0
virtual const std::vector< lldb_private::RegisterInfo > * GetDynamicRegisterInfoP() const
virtual const lldb_private::RegisterInfo * GetRegisterInfo() const =0
RegisterInfoInterface(const lldb_private::ArchSpec &target_arch)
virtual const lldb_private::RegisterInfo * GetDynamicRegisterInfo(const char *reg_name) const