Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#30670: doc: Extend developer-notes with file-na…
Browse files Browse the repository at this point in the history
…me-only debugging fix

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

Pull request description:

  Split out of bitcoin/bitcoin#30454 (comment)

  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 1b0b9b4
  laanwj:
    ACK 1b0b9b4

Tree-SHA512: 11d2fa69074d6301ee0ca94bc7adb4f251e270624b733c03abc0b91ddb4c9e810d31bd8cbebaebf893974cd85aa14fff94504b93d9c1c46ace64349a84041b41
  • Loading branch information
achow101 committed Nov 4, 2024
2 parents 05aebe3 + 1b0b9b4 commit b934954
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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;
Expand Down

0 comments on commit b934954

Please sign in to comment.