@@ -12,6 +12,7 @@ Developer Notes
12
12
- [ Generating Documentation] ( #generating-documentation )
13
13
- [ Development tips and tricks] ( #development-tips-and-tricks )
14
14
- [ Compiling for debugging] ( #compiling-for-debugging )
15
+ - [ Show sources in debugging] ( #show-sources-in-debugging )
15
16
- [ Compiling for gprof profiling] ( #compiling-for-gprof-profiling )
16
17
- [ ` debug.log ` ] ( #debuglog )
17
18
- [ Signet, testnet, and regtest modes] ( #signet-testnet-and-regtest-modes )
@@ -249,6 +250,35 @@ Development tips and tricks
249
250
Run configure with ` --enable-debug ` to add additional compiler flags that
250
251
produce better debugging builds.
251
252
253
+ ### Show sources in debugging
254
+
255
+ If you have ccache enabled, absolute paths are stripped from debug information
256
+ with the -fdebug-prefix-map and -fmacro-prefix-map options (if supported by the
257
+ compiler). This might break source file detection in case you move binaries
258
+ after compilation, debug from the directory other than the project root or use
259
+ an IDE that only supports absolute paths for debugging.
260
+
261
+ There are a few possible fixes:
262
+
263
+ 1 . Configure source file mapping.
264
+
265
+ For ` gdb ` create or append to ` .gdbinit ` file:
266
+ ```
267
+ set substitute-path ./src /path/to/project/root/src
268
+ ```
269
+
270
+ For ` lldb ` create or append to ` .lldbinit ` file:
271
+ ```
272
+ settings set target.source-map ./src /path/to/project/root/src
273
+ ```
274
+
275
+ 2 . Add a symlink to the ` ./src ` directory:
276
+ ```
277
+ ln -s /path/to/project/root/src src
278
+ ```
279
+
280
+ 3 . Use ` debugedit ` to modify debug information in the binary.
281
+
252
282
### Compiling for gprof profiling
253
283
254
284
Run configure with the ` --enable-gprof ` option, then make.
0 commit comments