From c0e793d6543fc97c328dd3cf1b6f0708f3ec11be Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Fri, 9 Nov 2018 22:33:26 +0000 Subject: Work with a gdb-remote target that doesn't handle the qWatchpointSupportInfo packet correctly. In GDBRemoteCommunicationClient::GetWatchpointSupportInfo, if the response to qWatchpointSupportInfo does not include the 'num' field, then we did not get an answer we understood, mark this target as not supporting that packet. In Target.cpp, rename the very confusingly named CheckIfWatchpointsExhausted to CheckIfWatchpointsSupported, and check the error status returned by Process::GetWatchpointSupportInfo. If we cannot determine what the number of supported watchpoints are, assume that they will work. We'll handle the failure later when we try to create/enable the watchpoint if the Z2 packet isn't supported. Add a gdb_remote_client test case. llvm-svn: 346561 --- .../TestNoWatchpointSupportInfo.py | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py new file mode 100644 index 00000000000..66a271e126d --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py @@ -0,0 +1,64 @@ +from __future__ import print_function +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +from gdbclientutils import * + +class TestNoWatchpointSupportInfo(GDBRemoteTestBase): + + @skipIfXmlSupportMissing + @skipIfRemote + def test(self): + """ + Test lldb's parsing of the tag in the target.xml register + description packet. + """ + class MyResponder(MockGDBServerResponder): + + def haltReason(self): + return "T02thread:1ff0d;thread-pcs:10001bc00;" + + def threadStopInfo(self, threadnum): + if threadnum == 0x1ff0d: + return "T02thread:1ff0d;thread-pcs:10001bc00;" + + def setBreakpoint(self, packet): + if packet.startswith("Z2,"): + return "OK" + + def qXferRead(self, obj, annex, offset, length): + if annex == "target.xml": + return """ + + i386:x86-64 + + + + """, False + else: + return None, False + + self.server.responder = MyResponder() + if self.TraceOn(): + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + interp.HandleCommand("log enable gdb-remote packets", result) + self.dbg.SetDefaultArchitecture("x86_64") + target = self.dbg.CreateTargetWithFileAndArch(None, None) + + process = self.connect(target) + + if self.TraceOn(): + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + interp.HandleCommand("target list", result) + print(result.GetOutput()) + + + err = lldb.SBError() + wp = target.WatchAddress(0x100, 8, False, True, err) + if self.TraceOn() and (err.Fail() or wp.IsValid == False): + strm = lldb.SBStream() + err.GetDescription(strm) + print("watchpoint failed: %s" % strm.GetData()) + self.assertTrue(wp.IsValid()) -- cgit v1.2.3