From 62f395e32ea34dd75945b456335cd8e553020262 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Sat, 10 Feb 2018 01:13:34 +0000 Subject: [PATCH] Add test case for x86_64 architecture recognition in the target.xml packet if it is included. llvm-svn: 324792 --- .../gdb_remote_client/TestTargetXMLArch.py | 121 ++++++++++++++++++ .../gdb_remote_client/gdbclientutils.py | 2 +- 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py new file mode 100644 index 000000000000..4b464717293b --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py @@ -0,0 +1,121 @@ +from __future__ import print_function +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +from gdbclientutils import * + +class TestTargetXMLArch(GDBRemoteTestBase): + + def test(self): + """ + Test lldb's parsing of the tag in the target.xml register + description packet. + """ + class MyResponder(MockGDBServerResponder): + + def qXferRead(self, obj, annex, offset, length): + if annex == "target.xml": + return """ + + i386:x86-64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + """, False + else: + return None, False + + def qC(self): + return "QC1" + + def haltReason(self): + return "T05thread:00000001;06:9038d60f00700000;07:98b4062680ffffff;10:c0d7bf1b80ffffff;" + + def readRegister(self, register): + regs = {0x0: "00b0060000610000", + 0xa: "68fe471c80ffffff", + 0xc: "60574a1c80ffffff", + 0xd: "18f3042680ffffff", + 0xe: "be8a4d7142000000", + 0xf: "50df471c80ffffff", + 0x10: "c0d7bf1b80ffffff" } + if register in regs: + return regs[register] + else: + return "0000000000000000" + + self.server.responder = MyResponder() + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + if self.TraceOn(): + interp.HandleCommand("log enable gdb-remote packets", result) + target = self.dbg.CreateTarget('') + self.assertEqual('', target.GetTriple()) + process = self.connect(target) + if self.TraceOn(): + interp.HandleCommand("target list", result) + print(result.GetOutput()) + self.assertEqual('x86_64--', target.GetTriple()) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py index 9e175010a20d..7d19d2cf920a 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py @@ -169,7 +169,7 @@ class MockGDBServerResponder: return "OK" def qSupported(self, client_supported): - return "PacketSize=3fff;QStartNoAckMode+" + return "qXfer:features:read+;PacketSize=3fff;QStartNoAckMode+" def qfThreadInfo(self): return "l"