Skip to content

Commit 4417919

Browse files
Debugging tips: all.sh component with debugging
Signed-off-by: Gilles Peskine <[email protected]> Signed-off-by: Gilles Peskine <[email protected]>
1 parent f5fab75 commit 4417919

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

kb/development/debugging_tips.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ This document assumes some familiarity with the project, e.g. that you already k
77

88
This document is written primarily with Linux in mind. Similar platforms such as macOS will require few adaptations. Windows (except WSL) is out of scope.
99

10+
## Reproducing CI builds with debugging
11+
12+
### Getting the build products from `all.sh`
13+
14+
Normally, `all.sh` cleans up after itself. However, it will leave build products around if a compilation or runtime step fails. If you want to see build products from a passing component, add the command `false` after the build steps.
15+
16+
If you have a wrapper around `all.sh`, note that passing `--keep-going` (`-k`) makes it clean up on errors as well.
17+
18+
Cancelling `all.sh` with `Ctrl+C` (SIGINT) makes it clean up. But using `Ctrl+\\` (SIGQUIT) bypassing the cleanup. Also, you can use `Ctrl+Z` to inspect an intermediate step.
19+
20+
### Editing `all.sh` for debugging
21+
22+
To reproduce an `all.sh` component locally, but with debugging enabled:
23+
24+
* For most builds using `make` (without CMake), in particular including all driver builds: add `ASAN_OPTIONS='-Og -g3'` or `ASAN_OPTIONS='-O0 -g3'` before the build step.
25+
* For builds using CMake: add or change the build type to `Debug` or `ASanDbg`, e.g. `cmake -DCMAKE_BUILD_TYPE=Debug`.
26+
27+
After changing the source, you'll need to re-run `all.sh`, including its initial cleanup state which is not trivial to bypass. To speed this up, enable [ccache](https://ccache.dev/). In most `all.sh` components, you can enable ccache by setting
28+
```
29+
CC="ccache ${CC:cc}" ASAN_CC="ccache clang"
30+
```
31+
1032
## Sanitizers
1133

1234
### Sanitizers used in test scripts

0 commit comments

Comments
 (0)