Golevka / emacs-clang-complete-async

An emacs plugin to complete C and C++ code using libclang
360 stars 71 forks source link

clang-check crashes when run with no arguments #6

Open arsenm opened 12 years ago

arsenm commented 12 years ago

I'm having trouble getting it to work, but I was noticing that the clang-complete process was never running. Trying to run it resulted in crashes. I'm using a recent git build of clang.

$ gdb --args ./clang-complete Reading symbols from /home/marsenau/.emacs.d/clang-complete...done. (gdb) r Starting program: /home/marsenau/.emacs.d/clang-complete [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff519f700 (LWP 18021)]

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff519f700 (LWP 18021)] 0x00007ffff65eb7a6 in clang_parseTranslationUnit_Impl (UserData=0x7fffffffda90) at /home/marsenau/src/llvm/tools/clang/tools/libclang/CIndex.cpp:2571 2571 if (strcmp(command_line_args[I], "-fno-spell-checking") == 0 || (gdb) bt

0 0x00007ffff65eb7a6 in clang_parseTranslationUnit_Impl (UserData=0x7fffffffda90)

at /home/marsenau/src/llvm/tools/clang/tools/libclang/CIndex.cpp:2571

1 0x00007ffff66ace25 in llvm::CrashRecoveryContext::RunSafely (this=0x7fffffffdad0,

Fn=0x7ffff65eb414 <clang_parseTranslationUnit_Impl(void*)>, UserData=0x7fffffffda90)
at /home/marsenau/src/llvm/lib/Support/CrashRecoveryContext.cpp:308

2 0x00007ffff66acf2d in RunSafelyOnThread_Dispatch (UserData=0x7fffffffda00)

at /home/marsenau/src/llvm/lib/Support/CrashRecoveryContext.cpp:339

3 0x00007ffff66cda23 in ExecuteOnThread_Dispatch (Arg=0x7fffffffd970)

at /home/marsenau/src/llvm/lib/Support/Threading.cpp:75

4 0x00007ffff59b7e9a in start_thread (arg=0x7ffff519f700) at pthread_create.c:308

5 0x00007ffff5ec34bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

6 0x0000000000000000 in ?? ()

(gdb) p command_line_args $1 = (const char * const *) 0x0

Golevka commented 12 years ago

It is a known issue that clang_complete would crash when being brought up with no command line arguments specified, it expects to accept one sourcefile name plus some other compiler options and it would work well when invoked by the (start-process) call in (launch-completion-proc), maybe it is time to check if the clang_complete executable has been placed to the right path, and if (launch-completion-proc) is properly called and completion-proc refered to a valid process.