<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello!<br>
      <br>
      Some lldb tests, for example test_hello_watchlocation_gmodules,
      are failed due to UnicodeDecodeError:<br>
    </p>
    <pre class="console-output">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</pre>
    <p>This error occurs when we try to decode following string:<br>
      <br>
      <tt>runCmd: process continue</tt><tt><br>
      </tt><tt>output: Process 579 resuming</tt><tt><br>
      </tt><tt>Process 579 stopped</tt><tt><br>
      </tt><tt>* thread #2, name = 'test_hello_watc', stop reason =
        watchpoint 1</tt><tt><br>
      </tt><tt>    frame #0: 0x000000000040150f
test_hello_watchlocation_gmodules`do_bad_thing_with_location(char_ptr="\x01$\xad�,
        new_val='\x01') at main.cpp:40</tt><tt><br>
      </tt><tt>   37          unsigned what = new_val;</tt><tt><br>
      </tt><tt>   38          printf("new value written to location(%p)
        = %u\n", char_ptr, what);</tt><tt><br>
      </tt><tt>   39          *char_ptr = new_val;</tt><tt><br>
      </tt><tt>-> 40      }</tt><tt><br>
      </tt><tt>   41      </tt><tt><br>
      </tt><tt>   42      uint32_t</tt><tt><br>
      </tt><tt>   43      access_pool (bool flag = false)</tt><br>
      <br>
      Should we ignore such errors?<br>
      <br>
      With the following patch tests are passed:<br>
      <br>
      <tt>diff --git
        a/lldb/packages/Python/lldbsuite/support/encoded_file.py
        b/lldb/packages/Python/lldbsuite/support/encoded_file.py</tt><tt><br>
      </tt><tt>index 2c2fef3..6412e76 100644</tt><tt><br>
      </tt><tt>---
        a/lldb/packages/Python/lldbsuite/support/encoded_file.py</tt><tt><br>
      </tt><tt>+++
        b/lldb/packages/Python/lldbsuite/support/encoded_file.py</tt><tt><br>
      </tt><tt>@@ -31,7 +31,7 @@ def _encoded_write(old_write,
        encoding):</tt><tt><br>
      </tt><tt>         # If we were asked to write a `str` (in Py2) or
        a `bytes` (in Py3) decode it</tt><tt><br>
      </tt><tt>         # as unicode before attempting to write.</tt><tt><br>
      </tt><tt>         if isinstance(s, six.binary_type):</tt><tt><br>
      </tt><tt>-            s = s.decode(encoding)</tt><tt><br>
      </tt><tt>+            s = s.decode(encoding, 'ignore')</tt><tt><br>
      </tt><tt>         return old_write(s)</tt><tt><br>
      </tt><tt>     return impl</tt><br>
      <br>
      Thank you!<br>
      <br>
      BR,<br>
      Konstantin Baladurin<br>
    </p>
  </body>
</html>