Skip to content

Commit 146be6d

Browse files
committed
[lldb][FreeBSD][AArch64] Enable register field detection
This extends the existing register fields support from AArch64 Linux to AArch64 FreeBSD. So you will now see output like this: ``` (lldb) register read cpsr cpsr = 0x60000200 = (N = 0, Z = 1, C = 1, V = 0, DIT = 0, SS = 0, IL = 0, SSBS = 0, D = 1, A = 0, I = 0, F = 0, nRW = 0, EL = 0, SP = 0) ``` Linux and FreeBSD both have HWCAP/HWCAP2 so the detection mechanism is the same and I've renamed the detector class to reflect that. I have confirmed that FreeBSD's treatment of CPSR (spsr as the kernel calls it) is similair enough that we can use the same field information. (see `sys/arm64/include/armreg.h` and `PSR_SETTABLE_64`) For testing I've enabled the same live process test as Linux and added a shell test using an existing FreeBSD core file. Note that the latter does not need XML support because when reading a core file we are not sending the information via target.xml, it's just internal to LLDB. The `svcr` and `mte_ctrl` registers will not appear on FreeBSD at all so I've not made their information conditional, it'll just never be used.
1 parent 546c7a7 commit 146be6d

19 files changed

+114
-65
lines changed

lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
#ifndef lldb_NativeRegisterContextFreeBSD_h
1010
#define lldb_NativeRegisterContextFreeBSD_h
1111

12-
#include "lldb/Host/common/NativeThreadProtocol.h"
13-
1412
#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
1513

1614
namespace lldb_private {
1715
namespace process_freebsd {
1816

1917
class NativeProcessFreeBSD;
18+
class NativeThreadFreeBSD;
2019

2120
class NativeRegisterContextFreeBSD
2221
: public virtual NativeRegisterContextRegisterInfo {
@@ -28,7 +27,7 @@ class NativeRegisterContextFreeBSD
2827
// executable.
2928
static NativeRegisterContextFreeBSD *
3029
CreateHostNativeRegisterContextFreeBSD(const ArchSpec &target_arch,
31-
NativeThreadProtocol &native_thread);
30+
NativeThreadFreeBSD &native_thread);
3231
virtual llvm::Error
3332
CopyHardwareWatchpointsFrom(NativeRegisterContextFreeBSD &source) = 0;
3433

lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ using namespace lldb_private::process_freebsd;
2929

3030
NativeRegisterContextFreeBSD *
3131
NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
32-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
32+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread) {
3333
return new NativeRegisterContextFreeBSD_arm(target_arch, native_thread);
3434
}
3535

3636
NativeRegisterContextFreeBSD_arm::NativeRegisterContextFreeBSD_arm(
37-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
37+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread)
3838
: NativeRegisterContextRegisterInfo(
3939
native_thread, new RegisterInfoPOSIX_arm(target_arch)) {}
4040

lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "Plugins/Process/FreeBSD/NativeProcessFreeBSD.h"
1818
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
19+
#include "Plugins/Process/Utility/RegisterFlagsDetector_arm64.h"
1920
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
2021

2122
// clang-format off
@@ -28,21 +29,40 @@ using namespace lldb;
2829
using namespace lldb_private;
2930
using namespace lldb_private::process_freebsd;
3031

32+
// A NativeRegisterContext is constructed per thread, but all threads' registers
33+
// will contain the same fields. Therefore this mutex prevents each instance
34+
// competing with the other, and subsequent instances from having to detect the
35+
// fields all over again.
36+
static std::mutex g_register_flags_detector_mutex;
37+
static Arm64RegisterFlagsDetector g_register_flags_detector;
38+
3139
NativeRegisterContextFreeBSD *
3240
NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
33-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
41+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread) {
42+
std::lock_guard<std::mutex> lock(g_register_flags_detector_mutex);
43+
if (!g_register_flags_detector.HasDetected()) {
44+
NativeProcessFreeBSD &process = native_thread.GetProcess();
45+
g_register_flags_detector.DetectFields(
46+
process.GetAuxValue(AuxVector::AUXV_FREEBSD_AT_HWCAP).value_or(0),
47+
process.GetAuxValue(AuxVector::AUXV_AT_HWCAP2).value_or(0));
48+
}
49+
3450
return new NativeRegisterContextFreeBSD_arm64(target_arch, native_thread);
3551
}
3652

3753
NativeRegisterContextFreeBSD_arm64::NativeRegisterContextFreeBSD_arm64(
38-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
54+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread)
3955
: NativeRegisterContextRegisterInfo(
4056
native_thread, new RegisterInfoPOSIX_arm64(target_arch, 0))
4157
#ifdef LLDB_HAS_FREEBSD_WATCHPOINT
4258
,
4359
m_read_dbreg(false)
4460
#endif
4561
{
62+
g_register_flags_detector.UpdateRegisterInfo(
63+
GetRegisterInfoInterface().GetRegisterInfo(),
64+
GetRegisterInfoInterface().GetRegisterCount());
65+
4666
::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
4767
::memset(&m_hbp_regs, 0, sizeof(m_hbp_regs));
4868
}

lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class NativeRegisterContextFreeBSD_arm64
3737
public NativeRegisterContextDBReg_arm64 {
3838
public:
3939
NativeRegisterContextFreeBSD_arm64(const ArchSpec &target_arch,
40-
NativeThreadProtocol &native_thread);
40+
NativeThreadFreeBSD &native_thread);
4141

4242
uint32_t GetRegisterSetCount() const override;
4343

lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ using namespace lldb_private::process_freebsd;
3030

3131
NativeRegisterContextFreeBSD *
3232
NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
33-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
33+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread) {
3434
return new NativeRegisterContextFreeBSD_mips64(target_arch, native_thread);
3535
}
3636

3737
NativeRegisterContextFreeBSD_mips64::NativeRegisterContextFreeBSD_mips64(
38-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
38+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread)
3939
: NativeRegisterContextRegisterInfo(
4040
native_thread, new RegisterContextFreeBSD_mips64(target_arch)) {}
4141

lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static const RegisterSet g_reg_sets_powerpc[k_num_register_sets] = {
6767

6868
NativeRegisterContextFreeBSD *
6969
NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
70-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
70+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread) {
7171
return new NativeRegisterContextFreeBSD_powerpc(target_arch, native_thread);
7272
}
7373

@@ -83,7 +83,7 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
8383
}
8484

8585
NativeRegisterContextFreeBSD_powerpc::NativeRegisterContextFreeBSD_powerpc(
86-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
86+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread)
8787
: NativeRegisterContextRegisterInfo(
8888
native_thread, CreateRegisterInfoInterface(target_arch)) {}
8989

lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static const RegisterSet g_reg_sets_x86_64[k_num_register_sets] = {
237237

238238
NativeRegisterContextFreeBSD *
239239
NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
240-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
240+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread) {
241241
return new NativeRegisterContextFreeBSD_x86_64(target_arch, native_thread);
242242
}
243243

@@ -258,7 +258,7 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
258258
}
259259

260260
NativeRegisterContextFreeBSD_x86_64::NativeRegisterContextFreeBSD_x86_64(
261-
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
261+
const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread)
262262
: NativeRegisterContextRegisterInfo(
263263
native_thread, CreateRegisterInfoInterface(target_arch)),
264264
NativeRegisterContextDBReg_x86(native_thread), m_regset_offsets({0}) {

lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ NativeThreadFreeBSD::CopyWatchpointsFrom(NativeThreadFreeBSD &source) {
316316
return s;
317317
}
318318

319+
NativeProcessFreeBSD &NativeThreadFreeBSD::GetProcess() {
320+
return static_cast<NativeProcessFreeBSD &>(m_process);
321+
}
322+
319323
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
320324
NativeThreadFreeBSD::GetSiginfo() const {
321325
Log *log = GetLog(POSIXLog::Process);

lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class NativeThreadFreeBSD : public NativeThreadProtocol {
4747

4848
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override;
4949

50+
NativeProcessFreeBSD &GetProcess();
51+
5052
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
5153
GetSiginfo() const override;
5254

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "Plugins/Process/Linux/Procfs.h"
2424
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
2525
#include "Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h"
26-
#include "Plugins/Process/Utility/RegisterFlagsLinux_arm64.h"
26+
#include "Plugins/Process/Utility/RegisterFlagsDetector_arm64.h"
2727
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
2828

2929
// System includes - They have to be included after framework includes because
@@ -72,8 +72,8 @@ using namespace lldb_private::process_linux;
7272
// will contain the same fields. Therefore this mutex prevents each instance
7373
// competing with the other, and subsequent instances from having to detect the
7474
// fields all over again.
75-
static std::mutex g_register_flags_mutex;
76-
static LinuxArm64RegisterFlags g_register_flags;
75+
static std::mutex g_register_flags_detector_mutex;
76+
static Arm64RegisterFlagsDetector g_register_flags_detector;
7777

7878
std::unique_ptr<NativeRegisterContextLinux>
7979
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
@@ -144,10 +144,10 @@ NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
144144

145145
opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskTLS);
146146

147-
std::lock_guard<std::mutex> lock(g_register_flags_mutex);
148-
if (!g_register_flags.HasDetected())
149-
g_register_flags.DetectFields(auxv_at_hwcap.value_or(0),
150-
auxv_at_hwcap2.value_or(0));
147+
std::lock_guard<std::mutex> lock(g_register_flags_detector_mutex);
148+
if (!g_register_flags_detector.HasDetected())
149+
g_register_flags_detector.DetectFields(auxv_at_hwcap.value_or(0),
150+
auxv_at_hwcap2.value_or(0));
151151

152152
auto register_info_up =
153153
std::make_unique<RegisterInfoPOSIX_arm64>(target_arch, opt_regsets);
@@ -171,7 +171,7 @@ NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
171171
: NativeRegisterContextRegisterInfo(native_thread,
172172
register_info_up.release()),
173173
NativeRegisterContextLinux(native_thread) {
174-
g_register_flags.UpdateRegisterInfo(
174+
g_register_flags_detector.UpdateRegisterInfo(
175175
GetRegisterInfoInterface().GetRegisterInfo(),
176176
GetRegisterInfoInterface().GetRegisterCount());
177177

lldb/source/Plugins/Process/Utility/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ add_lldb_library(lldbPluginProcessUtility
4747
RegisterContextThreadMemory.cpp
4848
RegisterContextWindows_i386.cpp
4949
RegisterContextWindows_x86_64.cpp
50-
RegisterFlagsLinux_arm64.cpp
50+
RegisterFlagsDetector_arm64.cpp
5151
RegisterInfos_x86_64_with_base_shared.cpp
5252
RegisterInfoPOSIX_arm.cpp
5353
RegisterInfoPOSIX_arm64.cpp

lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.cpp renamed to lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.cpp

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
//===-- RegisterFlagsLinux_arm64.cpp --------------------------------------===//
1+
//===-- RegisterFlagsDetector_arm64.cpp -----------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "RegisterFlagsLinux_arm64.h"
9+
#include "RegisterFlagsDetector_arm64.h"
1010
#include "lldb/lldb-private-types.h"
1111

1212
// This file is built on all systems because it is used by native processes and
1313
// core files, so we manually define the needed HWCAP values here.
14+
// These values are the same for Linux and FreeBSD.
1415

1516
#define HWCAP_FPHP (1ULL << 9)
1617
#define HWCAP_ASIMDHP (1ULL << 10)
@@ -24,34 +25,35 @@
2425

2526
using namespace lldb_private;
2627

27-
LinuxArm64RegisterFlags::Fields
28-
LinuxArm64RegisterFlags::DetectSVCRFields(uint64_t hwcap, uint64_t hwcap2) {
28+
Arm64RegisterFlagsDetector::Fields
29+
Arm64RegisterFlagsDetector::DetectSVCRFields(uint64_t hwcap, uint64_t hwcap2) {
2930
(void)hwcap;
3031
(void)hwcap2;
31-
// Represents the pseudo register that lldb-server builds, which itself
32-
// matches the architectural register SCVR. The fields match SVCR in the Arm
33-
// manual.
32+
// Represents the pseudo register that lldb-server on Linux builds, which
33+
// itself matches the architectural register SCVR. The fields match SVCR in
34+
// the Arm manual.
3435
return {
3536
{"ZA", 1},
3637
{"SM", 0},
3738
};
3839
}
3940

40-
LinuxArm64RegisterFlags::Fields
41-
LinuxArm64RegisterFlags::DetectMTECtrlFields(uint64_t hwcap, uint64_t hwcap2) {
41+
Arm64RegisterFlagsDetector::Fields
42+
Arm64RegisterFlagsDetector::DetectMTECtrlFields(uint64_t hwcap,
43+
uint64_t hwcap2) {
4244
(void)hwcap;
4345
(void)hwcap2;
44-
// Represents the contents of NT_ARM_TAGGED_ADDR_CTRL and the value passed
45-
// to prctl(PR_TAGGED_ADDR_CTRL...). Fields are derived from the defines
46-
// used to build the value.
46+
// Represents the contents of Linux's NT_ARM_TAGGED_ADDR_CTRL and the value
47+
// passed to prctl(PR_TAGGED_ADDR_CTRL...). Fields are derived from the
48+
// defines used to build the value.
4749
return {{"TAGS", 3, 18}, // 16 bit bitfield shifted up by PR_MTE_TAG_SHIFT.
4850
{"TCF_ASYNC", 2},
4951
{"TCF_SYNC", 1},
5052
{"TAGGED_ADDR_ENABLE", 0}};
5153
}
5254

53-
LinuxArm64RegisterFlags::Fields
54-
LinuxArm64RegisterFlags::DetectFPCRFields(uint64_t hwcap, uint64_t hwcap2) {
55+
Arm64RegisterFlagsDetector::Fields
56+
Arm64RegisterFlagsDetector::DetectFPCRFields(uint64_t hwcap, uint64_t hwcap2) {
5557
std::vector<RegisterFlags::Field> fpcr_fields{
5658
{"AHP", 26}, {"DN", 25}, {"FZ", 24}, {"RMode", 22, 23},
5759
// Bits 21-20 are "Stride" which is unused in AArch64 state.
@@ -86,8 +88,8 @@ LinuxArm64RegisterFlags::DetectFPCRFields(uint64_t hwcap, uint64_t hwcap2) {
8688
return fpcr_fields;
8789
}
8890

89-
LinuxArm64RegisterFlags::Fields
90-
LinuxArm64RegisterFlags::DetectFPSRFields(uint64_t hwcap, uint64_t hwcap2) {
91+
Arm64RegisterFlagsDetector::Fields
92+
Arm64RegisterFlagsDetector::DetectFPSRFields(uint64_t hwcap, uint64_t hwcap2) {
9193
// fpsr's contents are constant.
9294
(void)hwcap;
9395
(void)hwcap2;
@@ -106,8 +108,8 @@ LinuxArm64RegisterFlags::DetectFPSRFields(uint64_t hwcap, uint64_t hwcap2) {
106108
};
107109
}
108110

109-
LinuxArm64RegisterFlags::Fields
110-
LinuxArm64RegisterFlags::DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2) {
111+
Arm64RegisterFlagsDetector::Fields
112+
Arm64RegisterFlagsDetector::DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2) {
111113
// The fields here are a combination of the Arm manual's SPSR_EL1,
112114
// plus a few changes where Linux has decided not to make use of them at all,
113115
// or at least not from userspace.
@@ -124,7 +126,7 @@ LinuxArm64RegisterFlags::DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2) {
124126
cpsr_fields.push_back({"DIT", 24});
125127

126128
// UAO and PAN are bits 23 and 22 and have no meaning for userspace so
127-
// are treated as reserved by the kernel.
129+
// are treated as reserved by the kernels.
128130

129131
cpsr_fields.push_back({"SS", 21});
130132
cpsr_fields.push_back({"IL", 20});
@@ -152,14 +154,14 @@ LinuxArm64RegisterFlags::DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2) {
152154
return cpsr_fields;
153155
}
154156

155-
void LinuxArm64RegisterFlags::DetectFields(uint64_t hwcap, uint64_t hwcap2) {
157+
void Arm64RegisterFlagsDetector::DetectFields(uint64_t hwcap, uint64_t hwcap2) {
156158
for (auto &reg : m_registers)
157159
reg.m_flags.SetFields(reg.m_detector(hwcap, hwcap2));
158160
m_has_detected = true;
159161
}
160162

161-
void LinuxArm64RegisterFlags::UpdateRegisterInfo(const RegisterInfo *reg_info,
162-
uint32_t num_regs) {
163+
void Arm64RegisterFlagsDetector::UpdateRegisterInfo(
164+
const RegisterInfo *reg_info, uint32_t num_regs) {
163165
assert(m_has_detected &&
164166
"Must call DetectFields before updating register info.");
165167

lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.h renamed to lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- RegisterFlagsLinux_arm64.h ------------------------------*- C++ -*-===//
1+
//===-- RegisterFlagsDetector_arm64.h ---------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSLINUX_ARM64_H
10-
#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSLINUX_ARM64_H
9+
#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSDETECTOR_ARM64_H
10+
#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSDETECTOR_ARM64_H
1111

1212
#include "lldb/Target/RegisterFlags.h"
1313
#include "llvm/ADT/StringRef.h"
@@ -18,9 +18,9 @@ namespace lldb_private {
1818
struct RegisterInfo;
1919

2020
/// This class manages the storage and detection of register field information
21-
/// for Arm64 Linux registers. The same register may have different fields on
22-
/// different CPUs. This class abstracts out the field detection process so we
23-
/// can use it on live processes and core files.
21+
/// for Arm64 Linux and FreeBSD registers. The same register may have different
22+
/// fields on different CPUs. This class abstracts out the field detection
23+
/// process so we can use it on live processes and core files.
2424
///
2525
/// The general way to use this class is:
2626
/// * Make an instance somewhere that will last as long as the debug session
@@ -33,7 +33,7 @@ struct RegisterInfo;
3333
/// This must be done in that order, and you should ensure that if multiple
3434
/// threads will reference the information, a mutex is used to make sure only
3535
/// one calls DetectFields.
36-
class LinuxArm64RegisterFlags {
36+
class Arm64RegisterFlagsDetector {
3737
public:
3838
/// For the registers listed in this class, detect which fields are
3939
/// present. Must be called before UpdateRegisterInfos.
@@ -73,7 +73,9 @@ class LinuxArm64RegisterFlags {
7373
RegisterEntry("cpsr", 4, DetectCPSRFields),
7474
RegisterEntry("fpsr", 4, DetectFPSRFields),
7575
RegisterEntry("fpcr", 4, DetectFPCRFields),
76+
// Linux only, won't be found on FreeBSD.
7677
RegisterEntry("mte_ctrl", 8, DetectMTECtrlFields),
78+
// Linux only, won't be found on FreeBSD.
7779
RegisterEntry("svcr", 8, DetectSVCRFields),
7880
};
7981

@@ -83,4 +85,4 @@ class LinuxArm64RegisterFlags {
8385

8486
} // namespace lldb_private
8587

86-
#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSLINUX_ARM64_H
88+
#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSDETECTOR_ARM64_H

0 commit comments

Comments
 (0)