[DAP] Prioritize information from module_info when available #1421
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Certain build systems (most notoriously Buck2) store build artifacts (including a copy of the source files) in custom folders (e.g.
buck-out
in Buck2). This can lead to an incorrect path to be returned by the debugger to the client whenever a breakpoint triggers. In turn, this result in the editor opening a buffer from the build system custom folder rather than the original source file and confusion among the users.This PR changes the logic how the location of source files is identified. The current logic is:
compile
info frommodule_info
.The
module_info
is supposed to contain the most accurate information, but - in the case of non hermetic builds - it can contain a path to a non-existing file (e.g. if the code was built on a machine and ported to a different one). That's the main reason the current logic looks like the above (see this PR for context).Instead:
compile
info frommodule_info
points to a regular fileThe logic has been refactored into separate functions to ease reading. Debug logs have also been added to simplify eventual troubleshooting.