mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
Merge bitcoin/bitcoin#22409: configure: keep relative paths in debug info
0bc666b053
doc: add info for debugging with relative paths (S3RK)a8b515c317
configure: keep relative paths in debug info (S3RK) Pull request description: This is a follow-up for #20353 that fixes #21885 It also adds a small section to assist debugging without absolute paths in debug info. ACKs for top commit: kallewoof: Tested ACK0bc666b053
Zero-1729: Light crACK0bc666b053
Tree-SHA512: d4b75183c3d3a0f59fe786841fb230581de87f6fe04cf7224e4b89c520d45513ba729d4ad8c0e62dd1dbaaa7a25741f04d036bc047f92842e76c9cc31ea47fb2
This commit is contained in:
commit
5b7210c874
2 changed files with 32 additions and 2 deletions
|
@ -1661,8 +1661,8 @@ if test "x$use_ccache" != "xno"; then
|
|||
fi
|
||||
AC_MSG_RESULT($use_ccache)
|
||||
if test "x$use_ccache" = "xyes"; then
|
||||
AX_CHECK_COMPILE_FLAG([-fdebug-prefix-map=A=B],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -fdebug-prefix-map=\$(abs_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_PREPROC_FLAG([-fmacro-prefix-map=A=B],[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -fmacro-prefix-map=\$(abs_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_COMPILE_FLAG([-fdebug-prefix-map=A=B],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -fdebug-prefix-map=\$(abs_top_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_PREPROC_FLAG([-fmacro-prefix-map=A=B],[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -fmacro-prefix-map=\$(abs_top_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ Developer Notes
|
|||
- [Generating Documentation](#generating-documentation)
|
||||
- [Development tips and tricks](#development-tips-and-tricks)
|
||||
- [Compiling for debugging](#compiling-for-debugging)
|
||||
- [Show sources in debugging](#show-sources-in-debugging)
|
||||
- [Compiling for gprof profiling](#compiling-for-gprof-profiling)
|
||||
- [`debug.log`](#debuglog)
|
||||
- [Signet, testnet, and regtest modes](#signet-testnet-and-regtest-modes)
|
||||
|
@ -253,6 +254,35 @@ Development tips and tricks
|
|||
Run configure with `--enable-debug` to add additional compiler flags that
|
||||
produce better debugging builds.
|
||||
|
||||
### Show sources in debugging
|
||||
|
||||
If you have ccache enabled, absolute paths are stripped from debug information
|
||||
with the -fdebug-prefix-map and -fmacro-prefix-map options (if supported by the
|
||||
compiler). This might break source file detection in case you move binaries
|
||||
after compilation, debug from the directory other than the project root or use
|
||||
an IDE that only supports absolute paths for debugging.
|
||||
|
||||
There are a few possible fixes:
|
||||
|
||||
1. Configure source file mapping.
|
||||
|
||||
For `gdb` create or append to `.gdbinit` file:
|
||||
```
|
||||
set substitute-path ./src /path/to/project/root/src
|
||||
```
|
||||
|
||||
For `lldb` create or append to `.lldbinit` file:
|
||||
```
|
||||
settings set target.source-map ./src /path/to/project/root/src
|
||||
```
|
||||
|
||||
2. Add a symlink to the `./src` directory:
|
||||
```
|
||||
ln -s /path/to/project/root/src src
|
||||
```
|
||||
|
||||
3. Use `debugedit` to modify debug information in the binary.
|
||||
|
||||
### Compiling for gprof profiling
|
||||
|
||||
Run configure with the `--enable-gprof` option, then make.
|
||||
|
|
Loading…
Reference in a new issue