[Lldb-commits] [lldb] r245371 - Fix TestArrayTypes on Windows.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 18 15:25:40 PDT 2015


Author: zturner
Date: Tue Aug 18 17:25:40 2015
New Revision: 245371

URL: http://llvm.org/viewvc/llvm-project?rev=245371&view=rev
Log:
Fix TestArrayTypes on Windows.

Whether or not frames print their tid in hex or decimal is apparently
hardcoded to depend on the operating system.  For now a comment was
added that this should be changed to a more sane check (for example
a setting), and the OS check is updated to do the right thing for
Windows.

Modified:
    lldb/trunk/source/Core/FormatEntity.cpp
    lldb/trunk/test/lang/c/array_types/TestArrayTypes.py

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=245371&r1=245370&r2=245371&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Tue Aug 18 17:25:40 2015
@@ -1304,6 +1304,8 @@ FormatEntity::Format (const Entry &entry
                         // Watch for the special "tid" format...
                         if (entry.printf_format == "tid")
                         {
+                            // TODO(zturner): Rather than hardcoding this to be platform specific, it should be controlled by a
+                            // setting and the default value of the setting can be different depending on the platform.
                             Target &target = thread->GetProcess()->GetTarget();
                             ArchSpec arch (target.GetArchitecture ());
                             llvm::Triple::OSType ostype = arch.IsValid() ? arch.GetTriple().getOS() : llvm::Triple::UnknownOS;

Modified: lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/array_types/TestArrayTypes.py?rev=245371&r1=245370&r2=245371&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/lang/c/array_types/TestArrayTypes.py Tue Aug 18 17:25:40 2015
@@ -130,10 +130,14 @@ class ArrayTypesTestCase(TestBase):
 
         # Sanity check the print representation of thread.
         thr = str(thread)
-        if self.platformIsDarwin():
-            tidstr = "tid = 0x%4.4x" % thread.GetThreadID()
-        else:
+        # TODO(zturner): Whether the TID is printed in hex or decimal should be controlled by a setting,
+        # and this test should read the value of the setting.  This check is currently hardcoded to
+        # match the check in Core/FormatEntity.cpp in the function FormatEntity::Format() for
+        # the Entry::Type::ThreadID case of the switch statement.
+        if self.getPlatform() == "linux" or self.getPlatform() == "freebsd":
             tidstr = "tid = %u" % thread.GetThreadID()
+        else:
+            tidstr = "tid = 0x%4.4x" % thread.GetThreadID()
         self.expect(thr, "Thread looks good with stop reason = breakpoint", exe=False,
             substrs = [tidstr])
 




More information about the lldb-commits mailing list