Skip to content

Commit 4fe5f83

Browse files
docs: Describe debugging using a local Clang checkout (#376)
1 parent 52b528f commit 4fe5f83

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/Development.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [Inspecting Clang ASTs](#inspecting-clang-asts)
1515
- [Automated test case reduction](#automated-test-case-reduction)
1616
- [Debugging preprocessor issues](#debugging-preprocessor-issues)
17+
- [Debugging using a local Clang checkout](#debugging-using-a-local-clang-checkout)
1718
- [Profiling](#profiling)
1819
- [Stack sampling](#stack-sampling)
1920
- [Tracing using Perfetto](#tracing-using-perfetto)
@@ -229,6 +230,23 @@ bazel build //tools:analyze_pp_trace
229230
./bazel-bin/tools/analyze_pp_trace --yaml-path pp-trace.yaml
230231
```
231232

233+
### Debugging using a local Clang checkout
234+
235+
Sometimes, the best way to debug something is to be able to put print statements
236+
inside Clang itself. For that, you can stub out the usage of `llvm-raw` in `fetch_deps.bzl`
237+
238+
```starlark
239+
# Comment out the corresponding http_archive call
240+
native.new_local_repository(
241+
name = "llvm-raw",
242+
path = "/home/me/code/llvm-project",
243+
build_file_content = "# empty",
244+
)
245+
```
246+
247+
After that, add print debugging statements inside Clang (e.g. using `llvm::errs() <<`),
248+
and rebuild `scip-clang` like usual.
249+
232250
## Profiling
233251

234252
### Stack sampling

0 commit comments

Comments
 (0)