[lldb-dev] Linux: lldb tests are failed

k.baladurin via lldb-dev lldb-dev at lists.llvm.org
Mon Jul 9 06:17:09 PDT 2018


Hello!

Some lldb tests, for example test_hello_watchlocation_gmodules, are 
failed due to UnicodeDecodeError:

Config=x86_64-/home/jenkins/workspace/CS_for_Tizen/custom_test/llvm-x64/bin/clang-5.0
======================================================================
ERROR: test_hello_watchlocation_gmodules (TestWatchLocation.HelloWatchLocationTestCase)
    Test watching a location with '-s size' option.
----------------------------------------------------------------------
Traceback (most recent call last):
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1752, in gmodules_test_method
     return attrvalue(self)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/decorators.py", line 110, in wrapper
     func(*args, **kwargs)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/decorators.py", line 110, in wrapper
     func(*args, **kwargs)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/decorators.py", line 110, in wrapper
     func(*args, **kwargs)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/decorators.py", line 110, in wrapper
     func(*args, **kwargs)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/decorators.py", line 110, in wrapper
     func(*args, **kwargs)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py", line 102, in test_hello_watchlocation
     self.runCmd("process continue")
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2070, in runCmd
     print(self.res.GetError(), file=sbuf)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 293, in __exit__
     print(self.getvalue(), file=self.session)
   File "/home/jenkins/workspace/CS_for_Tizen/custom_test/lldb/packages/Python/lldbsuite/support/encoded_file.py", line 34, in impl
     s = s.decode(encoding)
   File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
     return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xfb in position 257: invalid start byte

This error occurs when we try to decode following string:

runCmd: process continue
output: Process 579 resuming
Process 579 stopped
* thread #2, name = 'test_hello_watc', stop reason = watchpoint 1
     frame #0: 0x000000000040150f 
test_hello_watchlocation_gmodules`do_bad_thing_with_location(char_ptr="\x01$\xad�, 
new_val='\x01') at main.cpp:40
    37          unsigned what = new_val;
    38          printf("new value written to location(%p) = %u\n", 
char_ptr, what);
    39          *char_ptr = new_val;
-> 40      }
    41
    42      uint32_t
    43      access_pool (bool flag = false)

Should we ignore such errors?

With the following patch tests are passed:

diff --git a/lldb/packages/Python/lldbsuite/support/encoded_file.py 
b/lldb/packages/Python/lldbsuite/support/encoded_file.py
index 2c2fef3..6412e76 100644
--- a/lldb/packages/Python/lldbsuite/support/encoded_file.py
+++ b/lldb/packages/Python/lldbsuite/support/encoded_file.py
@@ -31,7 +31,7 @@ def _encoded_write(old_write, encoding):
          # If we were asked to write a `str` (in Py2) or a `bytes` (in 
Py3) decode it
          # as unicode before attempting to write.
          if isinstance(s, six.binary_type):
-            s = s.decode(encoding)
+            s = s.decode(encoding, 'ignore')
          return old_write(s)
      return impl

Thank you!

BR,
Konstantin Baladurin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180709/656770f6/attachment.html>


More information about the lldb-dev mailing list