Skip to content

[lldb] Detect when full DWARF debugging should be enabled #8318

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 1 commit into from
Mar 15, 2024

Conversation

augusto2112
Copy link

Automatically turn on full DWARF debugging if reflection metadata isn't available.

rdar://122711892

@augusto2112
Copy link
Author

@swift-ci test

@@ -32,21 +32,21 @@ struct DescriptorFinderForwarder : public swift::reflection::DescriptorFinder {

std::unique_ptr<swift::reflection::BuiltinTypeDescriptorBase>
getBuiltinTypeDescriptor(const swift::reflection::TypeRef *TR) override {
if (m_descriptor_finder)
if (m_descriptor_finder && shouldConsultDescriptorFinder())

Choose a reason for hiding this comment

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

This pattern looks like it could be factored out into a template or a function that takes a std::function?

Copy link
Author

Choose a reason for hiding this comment

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

Maybe there's a better way to do this, but I think the "obvious" template solution is more trouble than it's worth. We'd need a templated function like:

  template <typename T>
  std::unique_ptr<T>
  getDescriptor(std::function<std::unique_ptr<T>()> descriptor_func) {
    if (m_descriptor_finder && shouldConsultDescriptorFinder())
      return descriptor_func();
    return nullptr;
  }

And then on the call side we'd need something like:

  std::unique_ptr<swift::reflection::BuiltinTypeDescriptorBase>
  getBuiltinTypeDescriptor(const swift::reflection::TypeRef *TR) override {
    std::function<
        std::unique_ptr<swift::reflection::BuiltinTypeDescriptorBase>()>
        lambda =
            [&]() { return m_descriptor_finder->getBuiltinTypeDescriptor(TR); };
    return getDescriptor(lambda);
  }

We need to spell out the lambda's type because the compiler is not able to deduce them.

Automatically turn on full DWARF debugging if reflection metadata isn't available.

rdar://122711892
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112
Copy link
Author

@swift-ci test Windows

@augusto2112
Copy link
Author

@swift-ci test windows

@augusto2112 augusto2112 merged commit c468fa3 into swiftlang:stable/20230725 Mar 15, 2024
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.

2 participants