Merge bitcoin/bitcoin#30670: doc: Extend developer-notes with file-name-only debugging fix
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run

1b0b9b4c78 Extend possible debugging fixes with file-name-only (Lőrinc)
cb7c5ca824 Add gdb and lldb links to debugging troubleshooting (Lőrinc)

Pull request description:

  Split out of https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1714285678

  While testing the new `cmake` build with [CLion](https://youtrack.jetbrains.com/issue/CPP-15850/Debugger-doesnt-stop-on-breakpoints-in-case-of-fdebug-prefix-map#focus=Comments-27-4926356.0-0), I noticed that the tests don't always stop at the set breakpoints, so I've updated the `developer-notes.md`, hoping it will be useful for others experiencing the same.

  Added links to  gdb and lldb documentations.

  Assumed a default directory (similarly to https://github.com/hebasto/bitcoin/pull/328/files#diff-4d2a64ce14cb8b971dbba9455421b04ae7ed0c489c66d983664be5632b0de4a3R19) to make the commands more realistic.

  Extended the possible debugging fixes with `file-name-only` option.

ACKs for top commit:
  achow101:
    ACK 1b0b9b4c78
  laanwj:
    ACK 1b0b9b4c78

Tree-SHA512: 11d2fa69074d6301ee0ca94bc7adb4f251e270624b733c03abc0b91ddb4c9e810d31bd8cbebaebf893974cd85aa14fff94504b93d9c1c46ace64349a84041b41
This commit is contained in:
Ava Chow 2024-11-04 15:54:32 -05:00
commit b934954ad1
No known key found for this signature in database
GPG key ID: 17565732E08E5E41

View file

@ -369,18 +369,18 @@ 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.
an IDE that only supports absolute paths for debugging (e.g. it won't stop at breakpoints).
There are a few possible fixes:
1. Configure source file mapping.
For `gdb` create or append to `.gdbinit` file:
For `gdb` create or append to [`.gdbinit` file](https://sourceware.org/gdb/current/onlinedocs/gdb#gdbinit-man):
```
set substitute-path ./src /path/to/project/root/src
```
For `lldb` create or append to `.lldbinit` file:
For `lldb` create or append to [`.lldbinit` file](https://lldb.llvm.org/man/lldb.html#configuration-files):
```
settings set target.source-map ./src /path/to/project/root/src
```
@ -392,6 +392,8 @@ ln -s /path/to/project/root/src src
3. Use `debugedit` to modify debug information in the binary.
4. If your IDE has an option for this, change your breakpoints to use the file name only.
### `debug.log`
If the code is behaving strangely, take a look in the `debug.log` file in the data directory;