Skip to content

IRGen: New way of bypassing resilience for LLDB #16000

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

Conversation

slavapestov
Copy link
Contributor

When running Swift from within LLDB, we bypass resilience since LLDB does
not support resilience yet. However, the bypass was done too early, disabling
resilience altogether.

We still want resilience at the SIL level so that function types lower the
same with debugger support turned on and off. Only IRGen needs to bypass
resilience, so that LLDB can calculate fragile layouts of types.

Fixes rdar://problem/38719739 and rdar://problem/38483762.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov requested a review from jrose-apple April 17, 2018 22:58
Copy link
Contributor

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

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

Thanks! Could you do a full test instead of a smoke test, so it also runs the LLDB tests?

FirstProtocol(invalidProtocolInfo()) {}
FirstProtocol(invalidProtocolInfo()) {
// In LLDB, everything is completely fragile, so that IRGen can query
// the size of resilient types. Of course this is not the right long term
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe spell this out even more explicitly:

FIXME: This won't work once the swiftmodule ...

@slavapestov
Copy link
Contributor Author

@swift-ci Please test


// CHECK-LLDB: ![[V1]] = !DILocalVariable(name: "s1", {{.*}}type: ![[TY:[0-9]+]])
// CHECK-LLDB: ![[TY]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Size",
// CHECK-LLDB: =
Copy link
Contributor

Choose a reason for hiding this comment

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

What's up with this check line, and the one above for non-LLDB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know, I'll remove it unless @adrian-prantl objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

The CHECK: = line ensures that whatever CHECK comes next doesn't match the same line. If there is no (longer a) CHECK following that one then it can safely be removed.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e173005fc1830cff9bd3f22ded3578e13d5ec16b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e173005fc1830cff9bd3f22ded3578e13d5ec16b

@slavapestov slavapestov force-pushed the fix-resilience-debugger-support branch 2 times, most recently from 21eb82f to 617b0cf Compare April 18, 2018 07:15
@slavapestov
Copy link
Contributor Author

apple/swift-lldb#540
@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e173005fc1830cff9bd3f22ded3578e13d5ec16b

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e173005fc1830cff9bd3f22ded3578e13d5ec16b

@slavapestov slavapestov force-pushed the fix-resilience-debugger-support branch from 617b0cf to b0a7e62 Compare April 18, 2018 21:28
@slavapestov slavapestov changed the title IRGen: Move -debugger-support flag check from SerializedModuleLoader to IRGen IRGen: New way of bypassing resilience for LLDB Apr 18, 2018
@slavapestov
Copy link
Contributor Author

apple/swift-lldb#542
@swift-ci Please test

@slavapestov
Copy link
Contributor Author

apple/swift-lldb#542
@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b0a7e62

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b0a7e62

When running Swift from within LLDB, we need to bypass resilience since LLDB
does not support resilience yet. However, the bypass was done too early as
part of the module loader, which had the effect of disabling resilience
altogether.

We still want resilience at the SIL level so that function types lower the
same with debugger support turned on and off. Only IRGen needs to bypass
resilience, so that LLDB can calculate fragile layouts of types. Also, the
DebuggerSupport flag is not always set in the ASTContexts created by LLDB.

So replace it with a new flag that only controls this behavior and nothing
else, and make it part of IRGenOptions to make it totally clear that it only
impacts IRGen.

Together with the paired LLDB change, fixes <rdar://problem/38719739>
and <rdar://problem/38483762>.
@slavapestov
Copy link
Contributor Author

apple/swift-lldb#542
@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b0a7e62

@slavapestov slavapestov force-pushed the fix-resilience-debugger-support branch from b0a7e62 to 55633e8 Compare April 19, 2018 05:59
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b0a7e62

@slavapestov
Copy link
Contributor Author

apple/swift-lldb#542
@swift-ci Please smoke test

@slavapestov slavapestov merged commit 78ca835 into swiftlang:master Apr 19, 2018
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.

4 participants