mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-10-31 04:32:33 +00:00 
			
		
		
		
	libclang -> clangIndex
							parent
							
								
									4700b4d8bc
								
							
						
					
					
						commit
						7270fc32ea
					
				
							
								
								
									
										5
									
								
								Build.md
									
									
									
									
									
								
							
							
								
								
								
								
									
									
								
								
								
							
						
						
									
										5
									
								
								Build.md
									
									
									
									
									
								
							| @ -23,8 +23,7 @@ are not supported at the moment. | ||||
| * `-DSYSTEM_CLANG=(ON|OFF)` | ||||
| 
 | ||||
|   Default: ON   | ||||
|   Enable `SYSTEM_CLANG` if you want to link ccls against a system installation | ||||
|   of Clang instead of downloading Clang from releases.llvm.org during the configure process. | ||||
|   Enable `SYSTEM_CLANG` if you want to link ccls against a system/local Clang instead of downloading Clang from releases.llvm.org during the configure process. | ||||
| 
 | ||||
|   ``` | ||||
|   % cmake -H. -Brelease -DCMAKE_INSTALL_PREFIX=/usr -DSYSTEM_CLANG=On | ||||
| @ -33,7 +32,7 @@ are not supported at the moment. | ||||
| 
 | ||||
| * `-DCLANG_USE_BUNDLED_LIBC++=on` | ||||
| 
 | ||||
|   `clang+llvm*` downloaded from releases.llvm.org also provides libc++ libraries.   | ||||
|   `clang+llvm*` downloaded from releases.llvm.org also provides libc++ libraries. | ||||
|   If your `libstdc++` is too old, you can use `libc++` in the bundled clang+llvm archive: | ||||
| 
 | ||||
|   ```zsh | ||||
|  | ||||
							
								
								
									
										14
									
								
								Debugging.md
									
									
									
									
									
								
							
							
								
								
								
								
									
									
								
								
								
							
						
						
									
										14
									
								
								Debugging.md
									
									
									
									
									
								
							| @ -1,12 +1,12 @@ | ||||
| First of all, use a `--variant=debug` [[Build]]. It is compiled with `-O0 -g` while the default `--variant=release` is `-O3 -g`. | ||||
| First of all, use a Debug [[Build]]. It is compiled with `-O0 -g` while the default Release is `-O3`. | ||||
| 
 | ||||
| ### Logs | ||||
| 
 | ||||
| `--log-file=/tmp/cq.log` | ||||
| `--log-file=/tmp/cc.log` | ||||
| 
 | ||||
| ### Dump LSP requests/responses | ||||
| 
 | ||||
| Alternatively, enable logs and pass the `--log-all-to-stderr` option to the ccls executable (`bin/ccls --log-file=/tmp/cq.log --log-all-to-stderr`). You can find stderr output in: | ||||
| Alternatively, enable logs and pass the `--log-all-to-stderr` option to the ccls executable (`bin/ccls --log-file=/tmp/cc.log --log-all-to-stderr`). You can find stderr output in: | ||||
| 
 | ||||
| * LanguageClient-neovim: `/tmp/LanguageServer.log` (default) | ||||
| * Emacs lsp-mode: `*lsp-ccls stderr*` buffer. They will also go to `*message*` buffer if `(setq lsp-print-io t)` | ||||
| @ -20,7 +20,7 @@ sudo sysdig -As999 --unbuffered -p '%evt.type %proc.name %evt.buffer' "proc.exe | ||||
| ### Stopping at the start to debug early issues | ||||
| 
 | ||||
| To debug individual LSP requests, you can attach your debugger after ccls has done indexing. However, | ||||
| for many other issues, such as project file loading (`project.cc`) and C/C++ parsing and indexing `clang_indexer.cc`, you need to set an early breakpoint to be able to trace the code. | ||||
| for many other issues, such as project file loading (`project.cc`) and C/C++ parsing and indexing `indexer.cc`, you need to set an early breakpoint to be able to trace the code. | ||||
| 
 | ||||
| It is recommended to use [[LanguageClient-neovim|Neovim]] for debugging (even if you use Emacs or VSCode) because it can be started with simple shell command. | ||||
| 
 | ||||
| @ -46,12 +46,14 @@ execute `set scheduler-locking on`. | ||||
| 
 | ||||
| Cache files are deleted to avoid possible issues related to stale cache. `CCLS_TRACEME=1` causes the ccls process to stop at the start of `main()`. You may attach to the process with: | ||||
| 
 | ||||
| Use `CCLS_TRACEME=s` to `raise(SIGSTOP)`, if `SIGTSTP` does not work. | ||||
| 
 | ||||
| * `gdb -p $(pgrep -fn ccls)`. Invoke `signal SIGCONT` if you want ccls to continue running after detaching of gdb. | ||||
| * `lldb -p $(pgrep -fn ccls)`. Invoke `pro sig SIGCONT` when the process resumes (with a `c` command) if you want ccls to continue running after detaching. | ||||
| 
 | ||||
| ### libclang or indexer callback issues | ||||
| ### Indexer issues | ||||
| 
 | ||||
| `export LIBCLANG_DISABLE_CRASH_RECOVERY=1` disables libclang crash recovery. In case of libclang or indexer callback issues, you will not see `libclang: crash detected` in the log file but get a process crash. And if you attach a debugger before it crashes, you can get the stack trace. | ||||
| `export CCLS_CRASH_RECOVERY=0` disables clang crash recovery. In case of clangIndex issues, you will not see `clang crashed` in the log file but get a process crash. And if you attach a debugger before it crashes, you can get the stack trace. | ||||
| 
 | ||||
| 
 | ||||
| ## Developing | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user