Skip to content

[lldb] Mark parsing Swift expressions with generics as not cacheable #7492

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

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

augusto2112
Copy link

Because a Swift expression may have different generic instantiations in different invocations, we cannot cache the parsing of them.

When setting conditional breakpoints, we currently assume that a call to
UserExpression::Parse() can be cached and resued multiple times. This
may not be true for every user expression. Add a new method so
subclasses of UserExpression can customize if they are parseable or not.
Because a Swift expression may have different generic instantiations in
different invocations, we cannot cache the parsing of them.
@augusto2112 augusto2112 merged commit 867cc22 into swiftlang:stable/20230725 Sep 19, 2023
@bnbarham
Copy link

There were only a couple LLVM PRs when macOS PR testing started failing in https://ci.swift.org/view/Swift%20rebranch/job/oss-swift-rebranch-pr-test-macoss/2324/ with:

  lldb-api :: lang/swift/playgrounds-repl/old_playground/TestNonREPLPlayground.py
  lldb-api :: lang/swift/playgrounds/TestPlaygrounds.py

#7461 ran PR testing and those two tests succeeded, so I suspect this PR is probably the cause? From a very quick look, it seems like code_manipulator may not be set for playgrounds (though I'm not sure if the TestPlaygrounds.py case has repl set or not)?

  std::unique_ptr<SwiftASTManipulator> code_manipulator;
  if (repl || !playground) {
    code_manipulator = std::make_unique<SwiftASTManipulator>(
        *source_file, repl, options.GetBindGenericTypes());

    if (!playground) {
      code_manipulator->RewriteResult();
    }
  }

@augusto2112
Copy link
Author

augusto2112 commented Sep 20, 2023

There were only a couple LLVM PRs when macOS PR testing started failing in https://ci.swift.org/view/Swift%20rebranch/job/oss-swift-rebranch-pr-test-macoss/2324/ with:

  lldb-api :: lang/swift/playgrounds-repl/old_playground/TestNonREPLPlayground.py
  lldb-api :: lang/swift/playgrounds/TestPlaygrounds.py

#7461 ran PR testing and those two tests succeeded, so I suspect this PR is probably the cause? From a very quick look, it seems like code_manipulator may not be set for playgrounds (though I'm not sure if the TestPlaygrounds.py case has repl set or not)?

  std::unique_ptr<SwiftASTManipulator> code_manipulator;
  if (repl || !playground) {
    code_manipulator = std::make_unique<SwiftASTManipulator>(
        *source_file, repl, options.GetBindGenericTypes());

    if (!playground) {
      code_manipulator->RewriteResult();
    }
  }

Yeah that was the problem. I merged #7494 around half an hour ago, which should solve the issue.

@bnbarham
Copy link

Ah I missed that, thanks! FWIW PR testing should be in a fairly reasonable state for macOS and Linux at least (minus a debug info crash on Linux, but easy to check the current crashes). So would be good to run PR testing 🙏

@augusto2112
Copy link
Author

Ah I missed that, thanks! FWIW PR testing should be in a fairly reasonable state for macOS and Linux at least (minus a debug info crash on Linux, but easy to check the current crashes). So would be good to run PR testing 🙏

Will do! Sorry for the mess!

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