Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LLDB, swiftmodules xcode installers #97

Merged
merged 4 commits into from
Aug 3, 2020

Conversation

amberdixon
Copy link
Collaborator

This PR is part of a fix for an issue where the debugger was returning the error "Cannot create Swift scratch context (couldn't load the Swift stdlib)Shared Swift state for could not be initialized" for swift code. When breakpoints were hit, it was not possible to view variables values.

This partly fixes the issue, because it tells the debugger where to find swift modules and the SDK for swift. It also fixes an issue with the logic to copy swiftmodules into derived data.

In order for debugging to work, it is also important to set the serialize-debugging-options flag to true for the binary (so that the AST will refer to absolute paths on the machine that built the binary.) See further discussion about Swift AST Context here: https://forums.swift.org/t/improving-path-remappings-for-extraclangargs-swiftastcontext/26886

@amberdixon amberdixon requested review from segiddins and gyfelton July 31, 2020 06:55
-print0 \
| xargs -0 "$BAZEL_INSTALLERS_DIR/_swiftmodule.sh"
echo "Start copying swiftmodules at `date`"
FOUND_SWIFTMODULES=`pcregrep -o1 'primary_output: "(.*\.swiftmodule)' $BAZEL_BUILD_EVENT_TEXT_FILENAME | uniq`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what's the difference between primary_output and important_output....

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some digging, I learned that they are the same thing, but that important_output is deprecated:

https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto

// Temporarily, also report the important outputs directly. This is only to
  // allow existing clients help transition to the deduplicated representation;
  // new clients should not use it.
  repeated File important_output = 4 [deprecated = true];
  // Identifier of an event reporting that an action was completed (not all
  // actions are reported, only the ones that can be considered important;
  // this includes all failed actions).
  message ActionCompletedId {
    string primary_output = 1;
    // Optional, the label of the owner of the action, for reference.
    string label = 2;
    // Optional, the id of the configuration of the action owner.
    ConfigurationId configuration = 3;
  }

else
echo "No SWIFTMODULES found"
fi
echo "Finish copying swiftmodules at `date`"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing newline

@amberdixon amberdixon force-pushed the amber/fix-lldb-swiftmodules-scripts branch from 03e15ff to d3c4c2a Compare August 3, 2020 20:27
@amberdixon amberdixon merged commit 9b9f158 into master Aug 3, 2020
@segiddins segiddins deleted the amber/fix-lldb-swiftmodules-scripts branch June 7, 2021 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants