[lldb-dev] lldb-mi doesn't propagate host environment variables
Hello! lldb-mi doesn't propagate host environment variables while lldb does it: $ cat env.c #include #include int main() { printf("VAR = %s\n", getenv("VAR")); return 0; } $ gcc env.c -o env $ /home/kbaladurin/Downloads/llvm-x64-7.0/bin/lldb -v lldb version 7.0.0 $ VAR=1 /home/kbaladurin/Downloads/llvm-x64-7.0/bin/lldb env (lldb) target create "env" Current executable set to 'env' (x86_64). (lldb) r Process 13139 launched: '/home/kbaladurin/Desktop/tests/env' (x86_64) VAR = 1 Process 13139 exited with status = 0 (0x) (lldb) ^D $ VAR=1 /home/kbaladurin/Downloads/llvm-x64-7.0/bin/lldb-mi (gdb) -file-exec-and-symbols env ^done (gdb) =library-loaded,id="/home/kbaladurin/Desktop/tests/env",target-name="/home/kbaladurin/Desktop/tests/env",host-name="/home/kbaladurin/Desktop/tests/env",symbols-loaded="0",loaded_addr="-",size="0" -exec-run ^running =thread-group-started,id="i1",pid="13176" (gdb) =thread-created,id="1",group-id="i1" =thread-selected,id="1" (gdb) =library-loaded,id="/lib/x86_64-linux-gnu/ld-2.23.so",target-name="/lib/x86_64-linux-gnu/ld-2.23.so",host-name="/lib/x86_64-linux-gnu/ld-2.23.so",symbols-loaded="1",symbols-path="/usr/lib/debug/lib/x86_64-linux-gnu/ld-2.23.so",loaded_addr="-",size="0" (gdb) =library-loaded,id="[vdso]",target-name="[vdso]",host-name="[vdso]",symbols-loaded="1",symbols-path="",loaded_addr="0x77ffa000",size="0" (gdb) =library-loaded,id="/home/kbaladurin/Desktop/tests/env",target-name="/home/kbaladurin/Desktop/tests/env",host-name="/home/kbaladurin/Desktop/tests/env",symbols-loaded="0",loaded_addr="-",size="0" (gdb) *running,thread-id="all" (gdb) (gdb) =library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="1",symbols-path="/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so",loaded_addr="-",size="0" (gdb) =library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="1",symbols-path="/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so",loaded_addr="-",size="0" @"VAR = (null)\r\n" (gdb) =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1",exit-code="0" *stopped,reason="exited-normally" (gdb) Is it expected behavior? Thank you! BR, Konstantin Baladurin ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
[lldb-dev] Linux: lldb tests are failed
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: 0x0040150f 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 ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
Re: [lldb-dev] Linux: lldb tests are failed
Hello Pavel, Thank you for replying! I've created a review for this change: https://reviews.llvm.org/D49379 BR, Konstantin Baladurin On 16.07.2018 13:45, Pavel Labath wrote: Hello Konstantin, that sounds like a good idea. We've had reports of this in the past, but so far noone dug into it to find out what's going on (thank you for that). Can you create a review for this (https://reviews.llvm.org/differential/)? pl On Mon, 9 Jul 2018 at 14:17, k.baladurin via lldb-dev wrote: 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: 0x0040150f 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 ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev