Open skopaas opened 6 years ago
@ganimaedes this sounds like a question about your client setup. Seems like you're wanting help with Vim
, or with the language-client plugin - and not with cquery
. Right?
Suggest trying /r/vim, or the language-client repository.
LanguageClient works very well and I have no issue with vim. My issue has more to do with cquery not being able to autocomplete.
From the log file, cquery is crashing very soon after startup. Likely you'll need to open a debugger on cquery and try to determine why. I'd recommend compiling with the -DASSERTS=on -DASAN=on
cmake config option.
@jacobdufault
I had to change to these to make it work for -DASSERTS
and DASAN
git clone https://github.com/cquery-project/cquery.git --recursive
cd cquery
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=release \
-DASSERTS=on -DASAN=on -DCMAKE_EXPORT_COMPILE_COMMANDS=YES \
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold -DCMAKE_BUILD_TYPE=Debug
cmake --build .
cmake --build . --target install
note : i used LanguageClient-neovim v 0.1.113 start_cquery.sh file:
#!/usr/bin/env sh
$HOME/cquery/build/cquery --log-file /tmp/cquery_log.txt --log-all-to-stderr --init='{
"cacheDirectory": "/tmp/cquery",
"progressReportFrequencyMs": -1
}'
when I stop ./start_cquery.sh by pressing <C-d>
./start_cquery.sh
2018-08-21 14:33:47.757 ( 0.003s) [ F47867C0] loguru.hpp:2049 0| Logging to '/tmp/cquery_log.txt', mode: 'w', verbosity: 9
( uptime ) [ thread name/id] file:line |
( 0.003s) [main thread ] loguru.hpp:1887 | arguments: /home/mat/cquery/build/cquery --log-file /tmp/cquery_log.txt --log-all-to-stderr --init={\n\ \ \"cacheDirectory\":\ \"/tmp/cquery\",\n\ \ \"progressReportFrequencyMs\":\ -1\n}
( 0.003s) [main thread ] loguru.hpp:1890 | Current dir: /home/mat/project
( 0.003s) [main thread ] loguru.hpp:1892 | stderr verbosity: 0
( 0.003s) [main thread ] loguru.hpp:1893 | -----------------------------------
Content-Length: 152
{"jsonrpc":"2.0","method":"$cquery/progress","params":{"indexRequestCount":0,"doIdMapCount":0,"onIdMappedCount":0,"onIndexedCount":0,"activeThreads":0}}(4112.207s) [stdin ] lsp.cc:82 | No more input when reading header
(4112.245s) [stdin ] lsp.cc:188 | Failed to read JsonRpc input; exiting
(4112.245s) [stdin ] loguru.hpp:1767 | atexit
=================================================================
==23052==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 12 byte(s) in 1 object(s) allocated from:
#0 0x7f1ef367734f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6234f)
#1 0xe82b1f in loguru::set_thread_name(char const*) /home/mat/cquery/third_party/loguru/loguru.hpp:2141
#2 0xe804e5 in loguru::init(int&, char**, char const*) /home/mat/cquery/third_party/loguru/loguru.hpp:1857
#3 0xa4216b in main /home/mat/cquery/src/command_line.cc:420
#4 0x7f1eeda3a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f1ef36ae592 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99592)
#1 0xedbf7b in WorkThread::StartThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) /home/mat/cquery/src/work_thread.cc:11
#2 0x94dcec in ClangCompleteManager::ClangCompleteManager(Project*, WorkingFiles*, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<lsDiagnostic, std::allocator<lsDiagnostic> >)>, std::function<void (lsRequestId)>) /home/mat/cquery/src/clang_complete.cc:717
#3 0xa3ea36 in RunQueryDbThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:228
#4 0xa413d8 in LanguageServerMain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:379
#5 0xa43ae7 in main /home/mat/cquery/src/command_line.cc:506
#6 0x7f1eeda3a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f1ef36ae592 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99592)
#1 0xedbf7b in WorkThread::StartThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) /home/mat/cquery/src/work_thread.cc:11
#2 0xa411f4 in LaunchStdoutThread(std::unordered_map<char const*, Timer, std::hash<char const*>, std::equal_to<char const*>, std::allocator<std::pair<char const* const, Timer> > >*) /home/mat/cquery/src/command_line.cc:365
#3 0xa413a0 in LanguageServerMain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:375
#4 0xa43ae7 in main /home/mat/cquery/src/command_line.cc:506
#5 0x7f1eeda3a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f1ef36ae592 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99592)
#1 0xedbf7b in WorkThread::StartThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) /home/mat/cquery/src/work_thread.cc:11
#2 0xa40bfd in LaunchStdinLoop(std::unordered_map<char const*, Timer, std::hash<char const*>, std::equal_to<char const*>, std::allocator<std::pair<char const* const, Timer> > >*) /home/mat/cquery/src/command_line.cc:345
#3 0xa41394 in LanguageServerMain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:371
#4 0xa43ae7 in main /home/mat/cquery/src/command_line.cc:506
#5 0x7f1eeda3a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f1ef36ae592 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99592)
#1 0xedbf7b in WorkThread::StartThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) /home/mat/cquery/src/work_thread.cc:11
#2 0x94ddac in ClangCompleteManager::ClangCompleteManager(Project*, WorkingFiles*, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<lsDiagnostic, std::allocator<lsDiagnostic> >)>, std::function<void (lsRequestId)>) /home/mat/cquery/src/clang_complete.cc:719
#3 0xa3ea36 in RunQueryDbThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:228
#4 0xa413d8 in LanguageServerMain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:379
#5 0xa43ae7 in main /home/mat/cquery/src/command_line.cc:506
#6 0x7f1eeda3a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f1ef36ae592 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99592)
#1 0xedbf7b in WorkThread::StartThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) /home/mat/cquery/src/work_thread.cc:11
#2 0x94de66 in ClangCompleteManager::ClangCompleteManager(Project*, WorkingFiles*, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<lsDiagnostic, std::allocator<lsDiagnostic> >)>, std::function<void (lsRequestId)>) /home/mat/cquery/src/clang_complete.cc:720
#3 0xa3ea36 in RunQueryDbThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:228
#4 0xa413d8 in LanguageServerMain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/mat/cquery/src/command_line.cc:379
#5 0xa43ae7 in main /home/mat/cquery/src/command_line.cc:506
#6 0x7f1eeda3a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: 52 byte(s) leaked in 6 allocation(s).
and here's the LanguageServer.log file:
2018-08-21 19:27:31.528 ( 0.001s) [ A0C107C0] loguru.hpp:2049 0| Logging to '/tmp/cq.log', mode: 'w', verbosity: 9
=================================================================
==24229==ERROR: AddressSanitizer: heap-use-after-free on address 0x60700000cb50 at pc 0x000000e862e2 bp 0x7f81943dd9f0 sp 0x7f81943dd9e0
READ of size 4 at 0x60700000cb50 thread T7 (indexer1)
Loguru caught a signal: SIGTERM
#0 0xe862e1 in log_message /home/mat/cquery/third_party/loguru/loguru.hpp:2499
#1 0xe869f2 in loguru::log_to_everywhere(int, int, char const*, unsigned int, char const*, char const*) /home/mat/cquery/third_party/loguru/loguru.hpp:2549
#2 0xe86bf7 in loguru::log(int, char const*, unsigned int, char const*, ...) /home/mat/cquery/third_party/loguru/loguru.hpp:2572
#3 0xe8897f in loguru::StreamLogger::~StreamLogger() /home/mat/cquery/third_party/loguru/loguru.hpp:2688
#4 0xac81b7 in ComputeChangeStatus /home/mat/cquery/src/import_pipeline.cc:163
#5 0xac8d9b in TryLoadFromCache /home/mat/cquery/src/import_pipeline.cc:199
#6 0xaca370 in ParseFile /home/mat/cquery/src/import_pipeline.cc:305
#7 0xacc7ef in IndexMain_DoParse /home/mat/cquery/src/import_pipeline.cc:422
#8 0xacddea in Indexer_Main(DiagnosticsEngine*, FileConsumerSharedState*, TimestampManager*, ImportManager*, ImportPipelineStatus*, Project*, WorkingFiles*) /home/mat/cquery/src/import_pipeline.cc:528
#9 0xf61d41 in (anonymous namespace)::Handler_Initialize::Run((anonymous namespace)::In_InitializeRequest*)::{lambda()#1}::operator()() const (/home/mat/cquery/build/cquery+0xf61d41)
#10 0xf6782e in _M_invoke /usr/include/c++/5/functional:1871
#11 0xa3bcd3 in std::function<void ()>::operator()() const /usr/include/c++/5/functional:2267
#12 0xedbd9e in WorkThread::StartThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>)::{lambda()#1}::operator()() const (/home/mat/cquery/build/cquery+0xedbd9e)
#13 0xedf7d4 in _M_invoke<> /usr/include/c++/5/functional:1531
#14 0xedf49d in operator() /usr/include/c++/5/functional:1520
#15 0xedf3b8 in _M_run /usr/include/c++/5/thread:115
#16 0x7f819b78b8ef (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xbd8ef)
#17 0x7f819a2756b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
#18 0x7f8199fab41c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
0x60700000cb50 is located 48 bytes inside of 80-byte region [0x60700000cb20,0x60700000cb70)
freed by thread T0 (querydb) here:
#0 0x7f819fb38b8a in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99b8a)
#1 0xeb2a03 in __gnu_cxx::new_allocator<loguru::Callback>::deallocate(loguru::Callback*, unsigned long) /usr/include/c++/5/ext/new_allocator.h:110
#2 0xeb053b in std::allocator_traits<std::allocator<loguru::Callback> >::deallocate(std::allocator<loguru::Callback>&, loguru::Callback*, unsigned long) /usr/include/c++/5/bits/alloc_traits.h:517
#3 0xeabe7c in std::_Vector_base<loguru::Callback, std::allocator<loguru::Callback> >::_M_deallocate(loguru::Callback*, unsigned long) /usr/include/c++/5/bits/stl_vector.h:178
#4 0xea32cc in std::_Vector_base<loguru::Callback, std::allocator<loguru::Callback> >::~_Vector_base() /usr/include/c++/5/bits/stl_vector.h:160
#5 0xeb6ad6 in std::vector<loguru::Callback, std::allocator<loguru::Callback> >::~vector() /usr/include/c++/5/bits/stl_vector.h:425
#6 0x7f8199eddff7 (/lib/x86_64-linux-gnu/libc.so.6+0x39ff7)
previously allocated by thread T0 (querydb) here:
#0 0x7f819fb38592 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99592)
#1 0xeb41a0 in __gnu_cxx::new_allocator<loguru::Callback>::allocate(unsigned long, void const*) /usr/include/c++/5/ext/new_allocator.h:104
#2 0xeb2aa8 in std::allocator_traits<std::allocator<loguru::Callback> >::allocate(std::allocator<loguru::Callback>&, unsigned long) /usr/include/c++/5/bits/alloc_traits.h:491
#3 0xeb0d08 in std::_Vector_base<loguru::Callback, std::allocator<loguru::Callback> >::_M_allocate(unsigned long) /usr/include/c++/5/bits/stl_vector.h:170
#4 0xeabfa4 in void std::vector<loguru::Callback, std::allocator<loguru::Callback> >::_M_emplace_back_aux<loguru::Callback>(loguru::Callback&&) /usr/include/c++/5/bits/vector.tcc:412
#5 0xea3715 in void std::vector<loguru::Callback, std::allocator<loguru::Callback> >::emplace_back<loguru::Callback>(loguru::Callback&&) /usr/include/c++/5/bits/vector.tcc:101
#6 0xe9a1da in std::vector<loguru::Callback, std::allocator<loguru::Callback> >::push_back(loguru::Callback&&) /usr/include/c++/5/bits/stl_vector.h:932
#7 0xe8224e in loguru::add_callback(char const*, void (*)(void*, loguru::Message const&), void*, int, void (*)(void*), void (*)(void*)) /home/mat/cquery/third_party/loguru/loguru.hpp:2091
#8 0xe81a83 in loguru::add_file(char const*, loguru::FileMode, int) /home/mat/cquery/third_party/loguru/loguru.hpp:2029
#9 0xa41b7f in main /home/mat/cquery/src/command_line.cc:399
#10 0x7f8199ec482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Thread T7 (indexer1) created by T0 (querydb) here:
#0 0x7f819fad51e3 in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x361e3)
#1 0x7f819b78ba03 in std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>, void (*)()) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xbda03)
SUMMARY: AddressSanitizer: heap-use-after-free /home/mat/cquery/third_party/loguru/loguru.hpp:2499 log_message
Shadow bytes around the buggy address:
0x0c0e7fff9910: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa 00 00
0x0c0e7fff9920: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
0x0c0e7fff9930: 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 00 00
0x0c0e7fff9940: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00
0x0c0e7fff9950: 00 00 fa fa fa fa 00 00 00 00 00 00 00 00 00 00
=>0x0c0e7fff9960: fa fa fa fa fd fd fd fd fd fd[fd]fd fd fd fa fa
0x0c0e7fff9970: fa fa 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
0x0c0e7fff9980: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa 00 00
0x0c0e7fff9990: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
0x0c0e7fff99a0: 00 00 00 00 00 00 fa fa fa fa 00 00 00 00 00 00
0x0c0e7fff99b0: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
==24229==ABORTING
Thank you
Does cquery/asan show any errors when you run using vim? Pressing ctrl+d when running cquery directly will cause cquery to exit; it probably shouldn't do so via a crash, but I don't think that this is the cause of the completion problem.
@jacobdufault cquery/asan do not show any errors when running vim. I think i've found an error: i have executed this command echo "export PATH=$PATH:~/cquery/build/cquery" >> ~/.bashrc
when it should have been echo "export PATH=$PATH:~/cquery/build/" >> ~/.bashrc
but i'm not sure if the latter is the correct one?? This however, still doesn't solve the completion.
Hi, I would like to have some help with cquery. I can only get completions on my c++ code if I type Ctrl+p after having written some letters. Is there a possibility to have auto completion enabled without having to type Ctrl+p? I am also not sure if I did everything accordingly to make my installation work. Any help would be greatly appreciated! Thank you.
Here are my specs: I have cquery's folder on my usb stick alongside clang in the build folder as described in the wiki. git rev-parse --short HEAD
a8971e8
OS: Ubuntu 16.04.2 LTS cquery is on my usb strick: $ /media/mat/home/cquery/build/cquery --check ~/0pr/traverse.cppin my project's root dir: /home/mat/0pr/settings.json
/home/mat/0pr/start_cquery.sh:
/home/mat/0pr/CMakeLists.txt:
I did these commands in my project root: (/home/mat/0pr) (clang ++ is also on my usb stick) $
/media/mat/home/cquery/build/clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04/bin/clang++ -MJ traverse.o.json -Wall -std=c++14 -o traverse.o -c traverse.cpp
$sed -e '1s/^/[\n/' -e '$s/,$/\n]/' *.o.json > compile_commands.json
$mkdir build
$cd build; cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=YES ..
$ln -s build/compile_commands.json
compile_commands.json:
my .vimrc:
vim --version
~/.vim/plugged/LanguageClient-neovim/bin/languageclient --version is
languageclient 0.1.106
and my log files:
cquery_log.txt
/tmp/LanguageServer.log:
Thank you