LLDB
mainline
llvm-project
lldb
source
Plugins
Process
Utility
RegisterInfoPOSIX_ppc64.cpp
Go to the documentation of this file.
1
//===-- RegisterInfoPOSIX_ppc64.cpp ---------------------------------------===//
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
#include <cassert>
10
#include <cstddef>
11
#include <vector>
12
13
#include "
lldb/lldb-defines.h
"
14
#include "llvm/Support/Compiler.h"
15
16
#include "
RegisterInfoPOSIX_ppc64.h
"
17
18
// Include RegisterInfoPOSIX_ppc64 to declare our g_register_infos_ppc64
19
#define DECLARE_REGISTER_INFOS_PPC64_STRUCT
20
#include "
RegisterInfos_ppc64.h
"
21
#undef DECLARE_REGISTER_INFOS_PPC64_STRUCT
22
23
static
const
lldb_private::RegisterInfo
*
24
GetRegisterInfoPtr
(
const
lldb_private::ArchSpec
&target_arch) {
25
switch
(target_arch.
GetMachine
()) {
26
case
llvm::Triple::ppc:
27
return
g_register_infos_ppc;
28
case
llvm::Triple::ppc64:
29
return
g_register_infos_ppc64;
30
default
:
31
assert(
false
&&
"Unhandled target architecture."
);
32
return
nullptr
;
33
}
34
}
35
36
static
uint32_t
37
GetRegisterInfoCount
(
const
lldb_private::ArchSpec
&target_arch) {
38
switch
(target_arch.
GetMachine
()) {
39
case
llvm::Triple::ppc:
40
return
static_cast<
uint32_t
>
(
sizeof
(g_register_infos_ppc) /
41
sizeof
(g_register_infos_ppc[0]));
42
case
llvm::Triple::ppc64:
43
return
static_cast<
uint32_t
>
(
sizeof
(g_register_infos_ppc64) /
44
sizeof
(g_register_infos_ppc64[0]));
45
default
:
46
assert(
false
&&
"Unhandled target architecture."
);
47
return
0;
48
}
49
}
50
51
RegisterInfoPOSIX_ppc64::RegisterInfoPOSIX_ppc64
(
52
const
lldb_private::ArchSpec
&target_arch)
53
:
lldb_private
::
RegisterInfoInterface
(target_arch),
54
m_register_info_p
(
GetRegisterInfoPtr
(target_arch)),
55
m_register_info_count
(
GetRegisterInfoCount
(target_arch)),
m_gpr_size
(0) {
56
switch
(target_arch.
GetMachine
()) {
57
case llvm::Triple::ppc:
58
m_gpr_size = sizeof(GPR_PPC);
59
break;
60
case llvm::Triple::ppc64:
61
m_gpr_size = sizeof(GPR_PPC64);
62
break;
63
default:
64
assert(false &&
"Unhandled target architecture."
);
65
break;
66
}
67
}
68
69
size_t
RegisterInfoPOSIX_ppc64::GetGPRSize
()
const
{
return
m_gpr_size
; }
70
71
const
lldb_private::RegisterInfo
*
72
RegisterInfoPOSIX_ppc64::GetRegisterInfo
()
const
{
73
return
m_register_info_p
;
74
}
75
76
uint32_t
RegisterInfoPOSIX_ppc64::GetRegisterCount
()
const
{
77
return
m_register_info_count
;
78
}
GetRegisterInfoPtr
static const RegisterInfo * GetRegisterInfoPtr(const ArchSpec &target_arch)
Definition
RegisterContextLinux_s390x.cpp:20
GetRegisterInfoCount
static uint32_t GetRegisterInfoCount(const ArchSpec &target_arch)
Definition
RegisterContextLinux_s390x.cpp:30
GetRegisterInfoCount
static uint32_t GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch)
Definition
RegisterInfoPOSIX_ppc64.cpp:37
GetRegisterInfoPtr
static const lldb_private::RegisterInfo * GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch)
Definition
RegisterInfoPOSIX_ppc64.cpp:24
RegisterInfoPOSIX_ppc64.h
RegisterInfos_ppc64.h
RegisterInfoPOSIX_ppc64::RegisterInfoPOSIX_ppc64
RegisterInfoPOSIX_ppc64(const lldb_private::ArchSpec &target_arch)
Definition
RegisterInfoPOSIX_ppc64.cpp:51
RegisterInfoPOSIX_ppc64::m_register_info_count
uint32_t m_register_info_count
Definition
RegisterInfoPOSIX_ppc64.h:28
RegisterInfoPOSIX_ppc64::GetRegisterCount
uint32_t GetRegisterCount() const override
Definition
RegisterInfoPOSIX_ppc64.cpp:76
RegisterInfoPOSIX_ppc64::GetRegisterInfo
const lldb_private::RegisterInfo * GetRegisterInfo() const override
Definition
RegisterInfoPOSIX_ppc64.cpp:72
RegisterInfoPOSIX_ppc64::GetGPRSize
size_t GetGPRSize() const override
Definition
RegisterInfoPOSIX_ppc64.cpp:69
RegisterInfoPOSIX_ppc64::m_register_info_p
const lldb_private::RegisterInfo * m_register_info_p
Definition
RegisterInfoPOSIX_ppc64.h:27
RegisterInfoPOSIX_ppc64::m_gpr_size
size_t m_gpr_size
Definition
RegisterInfoPOSIX_ppc64.h:29
lldb_private::ArchSpec
An architecture specification class.
Definition
ArchSpec.h:32
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition
ArchSpec.cpp:682
lldb_private::RegisterInfoInterface::RegisterInfoInterface
RegisterInfoInterface(const lldb_private::ArchSpec &target_arch)
Definition
RegisterInfoInterface.h:23
lldb-defines.h
lldb_private
A class that represents a running process on the host machine.
Definition
SBAddressRange.h:14
lldb_private::RegisterInfo
Every register is described in detail including its name, alternate name (optional),...
Definition
lldb-private-types.h:35
Generated on
for LLDB by
1.14.0