Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -4488,9 +4488,13 @@ } 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 (llvm::StringRef(gdb_type).startswith("vec") || + gdb_type == "i387_ext") { + reg_info.format = eFormatVectorOfUInt8; + reg_info.encoding = eEncodingVector; } } Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py =================================================================== --- /dev/null +++ lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py @@ -0,0 +1,98 @@ +from __future__ import print_function +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +from gdbclientutils import * + + +class TestGDBServerTargetXML(GDBRemoteTestBase): + + @skipIfXmlSupportMissing + @skipIfRemote + def test_x86_64_vec_regs(self): + """Test rendering of x86_64 vector registers from gdbserver.""" + class MyResponder(MockGDBServerResponder): + def qXferRead(self, obj, annex, offset, length): + if annex == "target.xml": + return """ + + + i386:x86-64 + GNU/Linux + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + """, False + else: + return None, False + + def readRegister(self, regnum): + return "" + + def readRegisters(self): + return ( + "0102030405060708" # rsp + "1112131415161718" # rip + "0102030405060708090a" # st0 + "1112131415161718191a" + # st1 + "2122232425262728292a" * 6 + # st2..st7 + "8182838485868788898a8b8c8d8e8f90" # xmm0 + "9192939495969798999a9b9c9d9e9fa0" # xmm1 + "a1a2a3a4a5a6a7a8a9aaabacadaeafb0" # xmm2..xmm7 + ) + + def haltReason(self): + return "T02thread:1ff0d;threads:1ff0d;thread-pcs:000000010001bc00;07:0102030405060708;10:1112131415161718;" + + self.server.responder = MyResponder() + + target = self.createTarget("basic_eh_frame.yaml") + process = self.connect(target) + lldbutil.expect_state_changes(self, self.dbg.GetListener(), process, + [lldb.eStateStopped]) + + # rsp and rip should be displayed as uints + self.match("register read rsp", + ["rsp = 0x0807060504030201"]) + self.match("register read rip", + ["rip = 0x1817161514131211"]) + + # 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}"])