IRGen: Add another lldb resilience hack [4.2] #17726
Merged
+35
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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