[lldb] [gdb-remote] Fix displaying i387_ext & vec regs with gdbserver

Adjust the encoding and format applied to i387_ext and vec* type
registers from gdbserver to match lldb-server.  Both types are now
displayed as vector of uint8 instead of float and integer formats used
before.  Additionally, this fixes display of STi registers when they do
not carry floating-point data (they are also used to hold MMX vectors).

Differential Revision: https://reviews.llvm.org/D108468
This commit is contained in:
Michał Górny 2021-08-20 12:11:45 +02:00
parent c74ab84ea2
commit bda5fe8f0c
2 changed files with 28 additions and 2 deletions

View File

@ -4312,10 +4312,12 @@ bool ParseRegisters(XMLNode feature_node, GdbServerTargetInfo &target_info,
} else if (gdb_type == "data_ptr" || gdb_type == "code_ptr") {
reg_info.format = eFormatAddressInfo;
reg_info.encoding = eEncodingUint;
} else if (gdb_type == "i387_ext" || gdb_type == "float") {
} else if (gdb_type == "float") {
reg_info.format = eFormatFloat;
reg_info.encoding = eEncodingIEEE754;
} else if (gdb_type == "aarch64v") {
} else if (gdb_type == "aarch64v" ||
llvm::StringRef(gdb_type).startswith("vec") ||
gdb_type == "i387_ext") {
reg_info.format = eFormatVectorOfUInt8;
reg_info.encoding = eEncodingVector;
}

View File

@ -151,6 +151,18 @@ class TestGDBServerTargetXML(GDBRemoteTestBase):
self.match("register read flags",
["eflags = 0x94939291"])
# both stX and xmmX should be displayed as vectors
self.match("register read st0",
["st0 = {0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a}"])
self.match("register read st1",
["st1 = {0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a}"])
self.match("register read xmm0",
["xmm0 = {0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 "
"0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90}"])
self.match("register read xmm1",
["xmm1 = {0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 "
"0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f 0xa0}"])
@skipIfXmlSupportMissing
@skipIfRemote
@skipIfLLVMTargetMissing("X86")
@ -265,6 +277,18 @@ class TestGDBServerTargetXML(GDBRemoteTestBase):
self.match("register read flags",
["eflags = 0x94939291"])
# both stX and xmmX should be displayed as vectors
self.match("register read st0",
["st0 = {0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a}"])
self.match("register read st1",
["st1 = {0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a}"])
self.match("register read xmm0",
["xmm0 = {0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 "
"0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90}"])
self.match("register read xmm1",
["xmm1 = {0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 "
"0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f 0xa0}"])
@skipIfXmlSupportMissing
@skipIfRemote
@skipIfLLVMTargetMissing("AArch64")