Fix llgs to send triple for non-Apple platforms and lldb to interpret correctly.
This change addresses this bug:
http://llvm.org/bugs/show_bug.cgi?id=20755
This change:
* Modifies llgs to send triple instead of cputype and cpusubtype when not on Apple platforms in qProcessInfo.
* Modifies lldb's GDBRemoteCommunicationClient to handle the triple returned from qProcessInfo if given.
When given, it will prefer to use triple over cputype and cpusubtype.
* Adds gdb-remote protocol tests to verify that cputype and cpusubtype are specified on darwin, and that triple is specified on Linux.
llvm-svn: 216470
diff --git a/lldb/test/tools/lldb-gdbserver/TestGdbRemoteProcessInfo.py b/lldb/test/tools/lldb-gdbserver/TestGdbRemoteProcessInfo.py
index 4f5c5b5..6857b6a 100644
--- a/lldb/test/tools/lldb-gdbserver/TestGdbRemoteProcessInfo.py
+++ b/lldb/test/tools/lldb-gdbserver/TestGdbRemoteProcessInfo.py
@@ -1,7 +1,7 @@
-import unittest2
-
import gdbremote_testcase
import lldbgdbserverutils
+import sys
+import unittest2
from lldbtest import *
@@ -108,6 +108,42 @@
self.buildDwarf()
self.qProcessInfo_reports_valid_endian()
+ def qProcessInfo_contains_keys(self, expected_key_set):
+ procs = self.prep_debug_monitor_and_inferior()
+ self.add_process_info_collection_packets()
+
+ # Run the stream
+ context = self.expect_gdbremote_sequence()
+ self.assertIsNotNone(context)
+
+ # Gather process info response
+ process_info = self.parse_process_info_response(context)
+ self.assertIsNotNone(process_info)
+
+ # Ensure the expected keys are present and non-None within the process info.
+ missing_key_set = set()
+ for expected_key in expected_key_set:
+ if expected_key not in process_info:
+ missing_key_set.add(expected_key)
+
+ self.assertEquals(missing_key_set, set(), "the listed keys are missing in the qProcessInfo result")
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @debugserver_test
+ @dsym_test
+ def test_qProcessInfo_contains_cputype_cpusubtype_debugserver_darwin(self):
+ self.init_debugserver_test()
+ self.buildDsym()
+ self.qProcessInfo_contains_keys(set(['cputype', 'cpusubtype']))
+
+ @unittest2.skipUnless(sys.platform.startswith("linux"), "requires Linux")
+ @llgs_test
+ @dwarf_test
+ def test_qProcessInfo_contains_triple_llgs_linux(self):
+ self.init_llgs_test()
+ self.buildDwarf()
+ self.qProcessInfo_contains_keys(set(['triple']))
+
if __name__ == '__main__':
unittest2.main()