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.
Revert to the state prior to e507acbe and allow debugging
from project root dir with `gdb src/bitcoind`.
249@@ -249,6 +250,23 @@ Development tips and tricks
250 Run configure with `--enable-debug` to add additional compiler flags that
251 produce better debugging builds.
252
253+### Show sources in debugging
254+
255+Absolute paths are stripped from debug information with -fdebug-prefix-map and
256+-fmacro-prefix-map options. In case you move binaries after compilation or use
May be worth noting some or all of:
249@@ -249,6 +250,35 @@ Development tips and tricks
250 Run configure with `--enable-debug` to add additional compiler flags that
251 produce better debugging builds.
252
253+### Show sources in debugging
254+
255+If you have ccache enabled absolute paths are stripped from debug information
256+with -fdebug-prefix-map and -fmacro-prefix-map options (if supported by the
0with -fdebug-prefix-map and -fmacro-prefix-map options (if supported by the
from the linter
249@@ -249,6 +250,35 @@ Development tips and tricks
250 Run configure with `--enable-debug` to add additional compiler flags that
251 produce better debugging builds.
252
253+### Show sources in debugging
254+
255+If you have ccache enabled absolute paths are stripped from debug information
minor grammar nits (cont’d below), feel free to ignore:
0If you have ccache enabled, absolute paths are stripped from debug information
249@@ -249,6 +250,35 @@ Development tips and tricks
250 Run configure with `--enable-debug` to add additional compiler flags that
251 produce better debugging builds.
252
253+### Show sources in debugging
254+
255+If you have ccache enabled absolute paths are stripped from debug information
256+with -fdebug-prefix-map and -fmacro-prefix-map options (if supported by the
0with the -fdebug-prefix-map and -fmacro-prefix-map options (if supported by the
249@@ -249,6 +250,35 @@ Development tips and tricks
250 Run configure with `--enable-debug` to add additional compiler flags that
251 produce better debugging builds.
252
253+### Show sources in debugging
254+
255+If you have ccache enabled absolute paths are stripped from debug information
256+with -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 project root or use
0after compilation, debug from the directory other than the project root or use
I tested this in Clion and it didn’t change anything for me: Before and After the same error:

Reverting commit e507acb was a working workaround. Maybe #21885 (comment) also works.
I tested this in Clion and it didn’t change anything for me: Before and After the same error:
I guess I’ll still have to apply one of the workarounds you mention in the doc?
I referenced merge commit as it has PR number for the expanded context, can change to the other commit once I get to my laptop.
I tested this in Clion and it didn’t change anything for me: Before and After the same error:
I guess I’ll still have to apply one of the workarounds you mention in the doc?
Yes, unfortunately CLion uses absolute paths to set breakpoints, so you need one of the workarounds. Alternatively, you can use new “Relaxed breakpoints” feature starting from 2021.2 that uses file name only matching.
This PR makes it again possible to debug from the project root dir with gdb arc/bitcoind
Tested ACK 0bc666b053b8f4883c3f5de43959e2bbd91b95c5
lldb src/bitcoind on master:
0* thread [#13](/bitcoin-bitcoin/13/), name = 'b-httpworker.2', stop reason = step over
1 frame [#0](/bitcoin-bitcoin/0/): 0x0000000100c87baf bitcoind`LegacyScriptPubKeyMan::IsMine(this=0x000000010cbdb1e0, script=0x0000000110190988) const at scriptpubkeyman.cpp:226:1
2Target 0: (bitcoind) stopped.
Using this PR:
0* thread [#11](/bitcoin-bitcoin/11/), name = 'b-httpworker.0', stop reason = breakpoint 1.6
1 frame [#0](/bitcoin-bitcoin/0/): 0x0000000100cfca46 bitcoind`CWallet::IsMine(this=0x000000010490e310, txout=0x00000001090052c0) const at wallet.cpp:1299:5
2 1296
3 1297 isminetype CWallet::IsMine(const CTxOut& txout) const
4 1298 {
5-> 1299 AssertLockHeld(cs_wallet);
6 1300 return IsMine(txout.scriptPubKey);
7 1301 }
8 1302
9Target 0: (bitcoind) stopped.
(note lack of any line numbers in master)