Skip to content

IRGen: Add another lldb resilience hack [4.2] #17726

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jul 4, 2018

  • Description: Global variables with a resiliently-sized type cannot have statically-allocated storage, because their size is not known at compile time. Instead, IRGen dynamically allocates space, using a small buffer optimization if the runtime size of the global is less than three words. lldb is currently not smart enough to figure this out. We added a workaround for globals defined in compiled code, but REPL globals do not consult DWARF debug info so another workaround is needed. Add a global bit to VarDecl which gets set by LLDB, and if the bit is set, avoid this indirection.

  • Scope of the issue: Affects anyone defining new globals containing Foundation types in the REPL and trying to manipulate them with LLDB commands.

  • Origination: Introduced when we started building the standard library resiliently

  • Risk: Very low risk for the Swift change -- it's just adding this new bit.

  • Reviewed by: @adrian-prantl (in person)

  • Radar: rdar://problem/39722386

When accessing global variables defined in the REPL, lldb does not consult
debug info, so it does not see that the DW_OP_deref was emitted.

So instead, set a special bit on globals defined in the REPL which bypasses
resilience for them altogether.

Part of the fix <rdar://problem/39722386>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

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.

1 participant