Skip to content

Commit 14b5abb

Browse files
[lldb][AArch64][Linux] Add field information for the fpsr register (#71651)
This one is easy because none of the fields depend on extensions. Only thing to note is that I've ignored some AArch32 only fields. ``` (lldb) register read fpsr fpsr = 0x00000000 = (QC = 0, IDC = 0, IXC = 0, UFC = 0, OFC = 0, DZC = 0, IOC = 0) ```
1 parent c4b096a commit 14b5abb

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@
2020

2121
using namespace lldb_private;
2222

23+
LinuxArm64RegisterFlags::Fields
24+
LinuxArm64RegisterFlags::DetectFPSRFields(uint64_t hwcap, uint64_t hwcap2) {
25+
// fpsr's contents are constant.
26+
(void)hwcap;
27+
(void)hwcap2;
28+
29+
return {
30+
// Bits 31-28 are N/Z/C/V, only used by AArch32.
31+
{"QC", 27},
32+
// Bits 26-8 reserved.
33+
{"IDC", 7},
34+
// Bits 6-5 reserved.
35+
{"IXC", 4},
36+
{"UFC", 3},
37+
{"OFC", 2},
38+
{"DZC", 1},
39+
{"IOC", 0},
40+
};
41+
}
42+
2343
LinuxArm64RegisterFlags::Fields
2444
LinuxArm64RegisterFlags::DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2) {
2545
// The fields here are a combination of the Arm manual's SPSR_EL1,

lldb/source/Plugins/Process/Utility/RegisterFlagsLinux_arm64.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class LinuxArm64RegisterFlags {
5656
using DetectorFn = std::function<Fields(uint64_t, uint64_t)>;
5757

5858
static Fields DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2);
59+
static Fields DetectFPSRFields(uint64_t hwcap, uint64_t hwcap2);
5960

6061
struct RegisterEntry {
6162
RegisterEntry(llvm::StringRef name, unsigned size, DetectorFn detector)
@@ -65,8 +66,9 @@ class LinuxArm64RegisterFlags {
6566
llvm::StringRef m_name;
6667
RegisterFlags m_flags;
6768
DetectorFn m_detector;
68-
} m_registers[1] = {
69+
} m_registers[2] = {
6970
RegisterEntry("cpsr", 4, DetectCPSRFields),
71+
RegisterEntry("fpsr", 4, DetectFPSRFields),
7072
};
7173

7274
// Becomes true once field detection has been run for all registers.

lldb/test/API/commands/register/register/register_command/TestRegisters.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,14 @@ def test_info_register(self):
622622
@skipUnlessPlatform(["linux"])
623623
@skipIf(archs=no_match(["aarch64"]))
624624
def test_register_read_fields(self):
625-
"""Test that when debugging a live process, we see the fields of the
626-
CPSR register."""
625+
"""Test that when debugging a live process, we see the fields of certain
626+
registers."""
627627
self.build()
628628
self.common_setup()
629629

630630
# N/Z/C/V bits will always be present, so check only for those.
631631
self.expect("register read cpsr", substrs=["= (N = 0, Z = 1, C = 1, V = 0"])
632+
self.expect("register read fpsr", substrs=["= (QC = 0, IDC = 0, IXC = 0"])
632633

633634
@skipUnlessPlatform(["linux"])
634635
@skipIf(archs=no_match(["x86_64"]))

lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ def test_aarch64_sve_regs_full(self):
577577
# Register field information should work with core files as it does a live process.
578578
# The N/Z/C/V bits are always present so just check for those.
579579
self.expect("register read cpsr", substrs=["= (N = 0, Z = 0, C = 0, V = 0"])
580+
self.expect("register read fpsr", substrs=["= (QC = 0, IDC = 0, IXC = 0"])
580581

581582
@skipIfLLVMTargetMissing("AArch64")
582583
def test_aarch64_pac_regs(self):

0 commit comments

Comments
 (0)