[lldb-dev] [Bug 34192] New: [5.0] check-lldb-unit hangs with lldb-server running

2017-08-15 Thread via lldb-dev
https://bugs.llvm.org/show_bug.cgi?id=34192

Bug ID: 34192
   Summary: [5.0] check-lldb-unit hangs with lldb-server running
   Product: lldb
   Version: unspecified
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: All Bugs
  Assignee: lldb-dev@lists.llvm.org
  Reporter: hah...@hahnjo.de
CC: llvm-b...@lists.llvm.org

As said in the title, check-lldb-unit hangs while a process 'lldb-server' is
still running and consuming 100% CPU.

If I run tools/lldb/unittests/tools/lldb-server/tests/LLDBServerTests manually,
I get:

[==] Running 1 test from 1 test case.
[--] Global test environment set-up.
[--] 1 test from ThreadsInJstopinfoTest
[ RUN  ] ThreadsInJstopinfoTest.TestStopReplyContainsThreadPcsLlgs
lldb-server-local_buildConnection established.

[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:171::
Send Packet:
A214,0,2F746D702F6A683336363237362F636C75737465722D6870635F31373334342F6275696C642D352E302E307263322F66696E616C2F746F6F6C732F6C6C64622F756E697474657374732F746F6F6C732F6C6C64622D7365727665722F7468726561645F696E666572696F72,2,1,34
1502787553.110960007 <   1> read packet: +
1502787553.111004114 < 232> read packet:
$A214,0,2F746D702F6A683336363237362F636C75737465722D6870635F31373334342F6275696C642D352E302E307263322F66696E616C2F746F6F6C732F6C6C64622F756E697474657374732F746F6F6C732F6C6C64622D7365727665722F7468726561645F696E666572696F72,2,1,34#1a
1502787553.111036062 <   1> send packet: +
Launched
'<...>/build-5.0.0rc2/final/tools/lldb/unittests/tools/lldb-server/thread_inferior'
as process 31142...
1502787553.146780014 <   6> send packet: $OK#9a

[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:174::
Read Packet: OK

[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:171::
Send Packet: qLaunchSuccess
1502787553.146975040 <   1> read packet: +
1502787553.147003889 <  18> read packet: $qLaunchSuccess#a5
1502787553.147032976 <   1> send packet: +
1502787553.147064924 <   6> send packet: $OK#9a

[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:174::
Read Packet: OK

[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:171::
Send Packet: qProcessInfo
1502787553.147120953 <   1> read packet: +
1502787553.147138119 <  16> read packet: $qProcessInfo#dc
1502787553.147159100 <   1> send packet: +
1502787553.147363901 < 166> send packet:
$pid:79a6;parent-pid:79a4;real-uid:651e;real-gid:651e;effective-uid:651e;effective-gid:651e;triple:7838365f36342d2d6c696e7578;ostype:linux;endian:little;ptrsize:8;#1f

1502787553.147422075 <   1> read packet: +
[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:174::
Read Packet:
pid:79a6;parent-pid:79a4;real-uid:651e;real-gid:651e;effective-uid:651e;effective-gid:651e;triple:7838365f36342d2d6c696e7578;ostype:linux;endian:little;ptrsize:8;

[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:171::
Send Packet: QListThreadsInStopReply
1502787553.147484064 <  27> read packet: $QListThreadsInStopReply#21
1502787553.147500992 <   1> send packet: +
1502787553.147512913 <   6> send packet: $OK#9a

1502787553.147535086 <   1> read packet: +
[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:174::
Read Packet: OK

[  INFO ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:171::
Send Packet: vCont;c
1502787553.147579908 <  11> read packet: $vCont;c#a8
1502787553.147593975 <   1> send packet: +
1502787553.147814035 < 443> send packet:
$O2f746d702f6a683336363237362f636c75737465722d6870635f31373334342f6275696c642d352e302e307263322f66696e616c2f746f6f6c732f6c6c64622f756e697474657374732f746f6f6c732f6c6c64622d7365727665722f7468726561645f696e666572696f723a206572726f72207768696c65206c6f6164696e6720736861726564206c69627261726965733a206c6962632b2b2e736f2e313a2063616e6e6f74206f70656e20736861726564206f626a6563742066696c653a204e6f20737563682066696c65206f72206469726563746f72790d0a#09

[  INFO ] 1502787553.147836924 <   1> read packet: +
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/TestClient.cpp:174::
Read Packet:
O2f746d702f6a683336363237362f636c75737465722d6870635f31373334342f6275696c642d352e302e307263322f66696e616c2f746f6f6c732f6c6c64622f756e697474657374732f746f6f6c732f6c6c64622d7365727665722f7468726561645f696e666572696f723a206572726f72207768696c65206c6f6164696e6720736861726564206c69627261726965733a206c6962632b2b2e736f2e313a2063616e6e6f74206f70656e20736861726564206f626a6563742066696c653a204e6f20737563682066696c65206f72206469726563746f72790d0a
1502787553.147871971 <   7> send packet: $W7f#f4

[ ERROR ]
<...>/src-5.0.0rc2/tools/lldb/unittests/tools/lldb-server/tests/Te

[lldb-dev] [Bug 34194] New: LLDB fails to evaluate expressions which include string literals when linked against libLLVM.so

2017-08-15 Thread via lldb-dev
https://bugs.llvm.org/show_bug.cgi?id=34194

Bug ID: 34194
   Summary: LLDB fails to evaluate expressions which include
string literals when linked against libLLVM.so
   Product: lldb
   Version: unspecified
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: All Bugs
  Assignee: lldb-dev@lists.llvm.org
  Reporter: tsche...@redhat.com
CC: llvm-b...@lists.llvm.org

Created attachment 18986
  --> https://bugs.llvm.org/attachment.cgi?id=18986&action=edit
Shell script to reproduce the bug.

Description of problem:
LLDB fails to evaluate expressions which include string literals if built with
-DLLVM_LINK_LLVM_DYLIB=ON.

Version-Release number of selected component (if applicable):
Reproduces with trunk (r310911)

How reproducible:
100%

Steps to Reproduce:
1.
$ cat >test.c
#include 

int main(void) {
  return 0;
}

2. gcc -g test.c -o test
3.
$ lldb ./test
(lldb) target create "./test"
Current executable set to './test' (x86_64).
(lldb) b main
Breakpoint 1: where = test`main + 4 at test.c:4, address = 0x004004f1
(lldb) r
Process 196442 launched: './test' (x86_64)
Process 196442 stopped
* thread #1, name = 'test', stop reason = breakpoint 1.1
frame #0: test`main at test.c:4
   1#include 
   2
   3int main(void) {
-> 4  return 0;
   5}
(lldb) expr "hello"
error: Couldn't apply expression side effects : Couldn't dematerialize a result
variable: couldn't read its memory
(lldb) expr printf("hello")
error: Execution was interrupted, reason: signal SIGSEGV: invalid address
(fault address: 0x7fdbfac1e000).
The process has been returned to the state before expression evaluation.

Actual results:
(lldb) expr "hello"
error: Couldn't apply expression side effects : Couldn't dematerialize a result
variable: couldn't read its memory
(lldb) expr printf("hello")
error: Execution was interrupted, reason: signal SIGSEGV: invalid address
(fault address: 0x7fdbfac1e000).
The process has been returned to the state before expression evaluation.

Expected results:
(lldb) expr "hello"
(const char [6]) $0 = "hello"
(lldb) expr printf("hello")


Additional info:

Works fine in the static build (see expected results) but doesn't work with
-DLLVM_LINK_LLVM_DYLIB=ON active.

Attached is a shell script which builds trunk LLVM/Clang/LLDB separately and
with -DLLVM_LINK_LLVM_DYLIB=ON. Once the build is complete it also runs the
above test case.

I have spent a significant amount of time to debug this already and it looks
like some sort of memory corruption that happens early on during the evaluation
of the 'expr "hello"' command. E.g. in a release build of Clang/LLVM/LLDB and
with "log enable lldb all" you can see that the generated LLVM IR for the
expression is slightly different in the static and dynamic build. These
differences are not visible in the debug build but it seems that there's
definitely some memory corruption going on somewhere.

Also tried to run this with AddressSanitizer but didn't get any suspicious
reports.

Reproduces at least with GCC 4.8, GCC 6.3.1 and Clang 4.0.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Tips for building with LLVM_LINK_LLVM_DYLIB=ON

2017-08-15 Thread Tilmann Scheller via lldb-dev
Hi everyone,

I've filed https://bugs.llvm.org/show_bug.cgi?id=34194 with a script
that produces an LLDB build in the failing configuration and uses it
to run a simple test case. Assuming all dependencies for
Clang/LLVM/LLDB are installed, reproducing the bug should be as simple
as executing the build script.

This seems like a fairly nasty bug (it looks some sort of memory
corruption) that effectively breaks the -DLLVM_LINK_LLVM_DYLIB=ON
build on Linux.

Any help/hints/ideas welcome :)

Regards,

Tilmann

On Sat, Aug 12, 2017 at 6:50 AM, Tom Stellard  wrote:
>
> Hi,
>
> We've been having trouble with some strange lldb failures when building lldb
> with -DLLVM_LINK_LLVM_DYLIB=ON.  For example, this command segfaults
> with -DLLVM_LINK_LLVM_DYLIB=ON but not if we omit that option:
>
> echo "int main(void) { return 0; }" |  gcc -x c -g - && \
>lldb -b a.out -o 'b main' -o 'r' -o 'expr printf("hello")'
>
>
> Does anyone have a working LLVM_LINK_LLVM_DYLIB=ON build and if so,
> could you share the cmake flags you are using?
>
> These are the flags that I used:
>
> -DBUILD_SHARED_LIBS:BOOL=OFF
> -DCMAKE_BUILD_TYPE=Release
> -DLLVM_ENABLE_ASSERTIONS=ON
> -DLLVM_BUILD_LLVM_DYLIB=ON
> -DLLVM_LINK_LLVM_DYLIB=ON
>
> Thanks,
> Tom
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] lldb-mi doesn't work on MS-Windows

2017-08-15 Thread Eli Zaretskii via lldb-dev
Since at least two snapshots ago, lldb-mi no longer works on
MS-Windows:

  D:\usr\archive>lldb-mi d:\usr\bin\emacs.exe
  MI: Error: Driver. LLDB Debugger.
  MI: Error: Driver Manager. Driver 'Machine Interface Driver Version: 1.0.0.9' 
(ID:'MIDriver') initialise failed. Driver. LLDB Debugger.

It actually reacts the same to any invocation, even if you only want
it to display the usage:

  D:\usr\LLVM\bin>lldb-mi --help
  MI: Error: Driver. LLDB Debugger.
  MI: Error: Driver Manager. Driver 'Machine Interface Driver Version: 1.0.0.9' 
(ID:'MIDriver') initialise failed. Driver. LLDB Debugger.

What am I doing wrong?
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev