LLDB  mainline
RegisterContextLinux_s390x.cpp
Go to the documentation of this file.
1 //===-- RegisterContextLinux_s390x.cpp --------------------------*- 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 
11 
12 using namespace lldb_private;
13 using namespace lldb;
14 
15 // Include RegisterInfos_s390x to declare our g_register_infos_s390x structure.
16 #define DECLARE_REGISTER_INFOS_S390X_STRUCT
17 #include "RegisterInfos_s390x.h"
18 #undef DECLARE_REGISTER_INFOS_S390X_STRUCT
19 
20 static const RegisterInfo *GetRegisterInfoPtr(const ArchSpec &target_arch) {
21  switch (target_arch.GetMachine()) {
22  case llvm::Triple::systemz:
23  return g_register_infos_s390x;
24  default:
25  assert(false && "Unhandled target architecture.");
26  return nullptr;
27  }
28 }
29 
30 static uint32_t GetRegisterInfoCount(const ArchSpec &target_arch) {
31  switch (target_arch.GetMachine()) {
32  case llvm::Triple::systemz:
33  return k_num_registers_s390x;
34  default:
35  assert(false && "Unhandled target architecture.");
36  return 0;
37  }
38 }
39 
40 static uint32_t GetUserRegisterInfoCount(const ArchSpec &target_arch) {
41  switch (target_arch.GetMachine()) {
42  case llvm::Triple::systemz:
44  default:
45  assert(false && "Unhandled target architecture.");
46  return 0;
47  }
48 }
49 
51  const ArchSpec &target_arch)
52  : lldb_private::RegisterInfoInterface(target_arch),
53  m_register_info_p(GetRegisterInfoPtr(target_arch)),
54  m_register_info_count(GetRegisterInfoCount(target_arch)),
55  m_user_register_count(GetUserRegisterInfoCount(target_arch)) {}
56 
57 const std::vector<lldb_private::RegisterInfo> *
59  return &d_register_infos;
60 }
61 
62 const RegisterInfo *RegisterContextLinux_s390x::GetRegisterInfo() const {
63  return m_register_info_p;
64 }
65 
67  return m_register_info_count;
68 }
69 
71  return m_user_register_count;
72 }
73 
74 size_t RegisterContextLinux_s390x::GetGPRSize() const { return 0; }
static uint32_t GetUserRegisterInfoCount(const ArchSpec &target_arch)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
uint32_t GetUserRegisterCount() const override
uint32_t GetRegisterCount() const override
RegisterInfo interface to patch RegisterInfo structure for archs.
const std::vector< lldb_private::RegisterInfo > * GetDynamicRegisterInfoP() const override
An architecture specification class.
Definition: ArchSpec.h:32
static uint32_t GetRegisterInfoCount(const ArchSpec &target_arch)
const lldb_private::RegisterInfo * GetRegisterInfo() const override
RegisterContextLinux_s390x(const lldb_private::ArchSpec &target_arch)
static const RegisterInfo * GetRegisterInfoPtr(const ArchSpec &target_arch)
Definition: SBAddress.h:15
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:726