-
Notifications
You must be signed in to change notification settings - Fork 342
[stable/20211026] Cherry-pick missing commits #3627
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
[stable/20211026] Cherry-pick missing commits #3627
Conversation
rdar://74106759
rdar://74106816
The patch also calls coro::salavageDebugInfo() on all dbg.declares in entry function. This is necessary for Swift because in the Swift calling convention the entry function can already have a coroutine context argument. I believe that the patch is neutral for C++ coroutines at -O0 (and mildly beneficial at -O), as it does rewrite dbg.declares to point into the freshly setup coroutine frame, as shown in the updated test. rdar://82037718
Honor some previously ignored diagnostic options like '-debug-diagnostic-names' and '-locale' by applying them to the diagnostic engine in the SwiftASTContext. https://bugs.swift.org/browse/SR-14845
This is being applied downstream as the section is not a standard section and this is Swift centric. The longer term solution here is to drop support for gold as a linker as we have done for the BFD linker. With the use of LLD, we can use a LLVM extension to inject linker options into ELF. This has a corresponding change to Swift to remove the previous ELF specific gadget to discard the metadata. rdar://82640394
hotfix for rdar://82037935
The only file in here is named `Find Results` which appears to be some text output of a search for a symbol. Probably checked in by mistake.
Turn off reproducer-capture-by default. See lldb-dev [0] for more context. [0] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html
Fix the python executable. The python interpreter is `Python3_EXECUTABLE` after the merge. We were relying on the shebang to get the python which could pick up the wrong version.
This addresses a small window of in-atomicity in the rename support for Windows. IF the ClangImporter is stressed sufficiently, it can run afoul of the small window of opportunity where the destination file will not exist. This causes the `LockFileManger` to improperly handle file locking for the module compilation resulting in spurious failures as the file is failed to be read after writing due to multiple processes overwriting the file and exposing that window constantly to the scheduled processes when building with a `-num-threads` > 1 for the Swift driver. The implementation of `llvm::sys::fs::rename` was changed in SVN r315079 (80e31f1) which even explicitly identifies the issue: ~~~ This implementation is still not fully POSIX. Specifically in the case where the destination file is open at the point when rename is called, there will be a short interval of time during which the destination file will not exist. It isn't clear whether it is possible to avoid this using the Windows API. ~~~ Special thanks to Ben Barham for the discussions and help with analyzing logging to track down this issue! While this should certainly be upstream'ed, this change is more intrusive than what would be comfortable to send upstream for immediate merging. This aligns the minimum SDK version on non-MinGW builds to the maximum version supported by the SDK. This can cause issues if built against an older SDK and potentially introduce use of APIs which are too new. However, this is required to get the updated definitions for the `FileRenameInfoEx` class which was introduced in Windows 10 RS1. Unfortunately, the minimum safe level for updating LLVM to is likely Windows 8 which is still not new enough for this functionality and there does not seem to be a good way to dynamically detect the Windows build number to identify if we are on a host that is running RS1 or newer. For the moment, this will allow increased stability on the Windows compiler for Swift, and we can look into upstreaming a variant of this subsequently.
It does not handle loops correctly i.e it moves the lifetime.start intrinsic into a loop rendering the stack object as not alive for part of the loop. ``` entry: %obj = alloca i8 lifetime.start(%obj) br loop loop: coro.suspend() escape(%obj) cond_br %cond, label %exit, label loop br loop exit: lifetime.end(%obj ``` After sinking: ``` entry: %obj = alloca i8 br loop loop: coro.suspend() lifetime.start(%obj) escape(%obj) cond_br %cond, label %exit, label loop br loop exit: lifetime.end(%obj ``` rdar://83411917 Differential Revision: https://reviews.llvm.org/D110953
…Retcon Infinite loops can lead to an IR representation where the lifetime.end intrinsice is missing. The code to do lifetime based optimization then fails to see that an address escapes (is life) accross a supspend. Eventually, we could detect such situations and disable it under more narrow circumstances. For now, do the correct thing. rdar://83635953 Differential Revision: https://reviews.llvm.org/D110949
This patch relands changes introduced in b7c987b and aligns it with llvm.org. This should also fix the test failure in `dwarf5-debug_line-file-index.s`. rdar://83444992 Signed-off-by: Med Ismail Bennani <[email protected]>
(cherry picked from commit 109798f)
…tions with the same name." This reverts commit 9454716. The patch being reverted results in swift-corelibs-foundation failing to build due to being unable to find `Glibc.pthread_mutex_t`. The declaration is defined in the module, but is also imported via CDispatch. This patch marks any complete redeclarations of a given declaration incomplete. Swift can't import incomplete declarations, so it is ignored in `ClangImporter::isVisibleFromModule`. We will need some mechanism of detecting redeclarations while not marking complete declarations as being incomplete.
…dling-of-recursive_mutex-lock-failures [lldb] Add work around handling of recursive_mutex lock failures (cherry picked from commit ae21717)
Don't try to get a class descriptor for a pointer that doesn't look like a tagged pointer. Also print addresses as fixed-width hex and update the test. (cherry picked from commit 10eb32f)
Somehow every pointer looks like it's tagged on GreenDragon. Removing the check to unblock the bot until we can get to the bottom of this. (cherry picked from commit d09a21a)
This implements DoLoadImage and UnloadImage in the Windows platform plugin modelled after the POSIX platform plugin. This was previously unimplemented and resulted in a difficult to decipher error without any logging. This implementation is intended to support enables the use of LLDB's Swift REPL on Windows. Paths which are added to the library search path are persistent and applied to all subsequent loads. This can be adjusted in the future by storing all the cookies and restoring the path prior to returning from the helper. However, the dynamic path count makes this a bit more challenging. Differential Revision: https://reviews.llvm.org/D77287
Use `0` instead of `ERROR_SUCCESS` as `ERROR_SUCCESS` requires building on Windows.
Don't set the OS when computing supported architectures in PlatformDarwin::ARMGetSupportedArchitectureAtIndex. Differential revision: https://reviews.llvm.org/D113159 (cherry picked from commit cd7a2bf)
This patch introduces a wrapper ReflectionContextInterface that encapsulates all traffic to ReflectionContext and abstracts the detail that ReflectionContext is a template that needs to be specialized for a specific pointer width. This fixes various TypeSystemSwiftTypeRef issues when debugging on an arm64_32 Apple Watch. rdar://83959667
(cherry picked from commit a5c2622)
When debugging a Simulator process on macOS (e.g. the iPhone simulator), the process will have both a dyld, and a dyld_sim present. The dyld_sim is an iOS Simulator binary. The dyld is a macOS binary. Both are MH_DYLINKER filetypes. lldb needs to identify & set a breakpoint in dyld, so it has to distinguish between these two. Previously lldb was checking if the inferior target was x86 (indicating macOS) and the OS of the MH_DYLINKER binary was iOS/watchOS/etc -- if so, then this is dyld_sim and we should ignore it. Now with arm64 macOS systems, this check was invalid, and we would set our breakpoint for new binaries being loaded in dyld_sim, causing binary loading to be missed by lldb. This patch uses the Target's ArchSpec triple environment, to see if this process is a simulator process. If this is a Simulator process, then we only recognize a MH_DYLINKER binary with OS type macOS as being dyld. This patch also removes some code that handled pre-2016 era debugservers which didn't give us the OS type for each binary. This was only being used on macOS, where we don't need to handle the presence of very old debugservers. Differential Revision: https://reviews.llvm.org/D115001 rdar://85907839 (cherry picked from commit fddafa1)
@aschwaighofer please confirm whether the following two are needed: I've included them at the moment since it seems like they will be, but note that the corresponding upstream PR isn't merged yet. |
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that @JDevlieghere explicitly signs off here - I'm not sure about the changes to the python bindings generated swig file.
We'll just generate them again :-) |
Two test failures on MacOS: racy_async_let_fibonacci.swift should have been fixed by #3596 so I'll have to look into that one again. async-args.swift is new. Linux failed to build a LLDB unittest but it's not caused by this PR and should be failing on MacOS too 🤔. In any case I'll fix in a follow up PR. Can also regenerate the bindings in a followup. Going to go ahead and merge. |
Just a guess, but maybe we need to cherry-pick commit fb8981d for the async args test? |
Thanks Adrian! I'll do another follow-up PR with some more fixes. |
Fixed async-args on the Swift side, see comments in swiftlang/swift#40447. Re-generated bindings and fixed |
There are a whole bunch of commits on stable/20210726 and next that are not on stable/20211026 due to only being cherry-picked to next after the branch point.
Furthermore all current work is going into stable/20210726 and next (or done upstream and only cherry-picked to stable/20210726) so there's that too.
I did my best here to check that the commits should actually go into stable/20211026 but given the number it's quite possible I got some wrong. Below is a list of all commits I went though, with some reasoning added for skipped commits. These were generated from a script that first does a
git cherry
and then attempted to find the same commit in the branch-to-cherry-to, logging if it couldn't be found.425c6b5 X86 swifttailcc remove invalid check
Skipped - merge fix for 20210726
22a54d0 [lldb] Only warn about 'auto' types in the log instead of stderr
Skipped - says not to add to newer branches
07058aa Revert "[SimplifyLibCalls][NFC] Clean up LibCallSimplifier from 'memset + malloc into calloc' transformation"
Skipped - not needed
a9c4190 Revert "[DSE] Transform memset + malloc --> calloc (PR25892)"
Skipped - not needed
48a091a A random collection of little fixes needed to get this branch building.
Skipped - compilation fixes not needed in 20211026
a334b4c Relax test to account for differences in swift-llvm
Skipped - committed separately to next (before 20211026 branch)
0b6bbe9 Revert "[llvm][sve] Lowering for VLS truncating stores"
Skipped - not needed
d825321 Update copy of code in UpdateValue from DoUpdateChildrenAddressType
Skipped - copy should not have existed and was removed
ec6318a [lldb] Include TargetConditionals.h
Skipped - no longer necessary
e34145f [lldb] Re-enable TestBitfields.py
5d9789d [lldb] Re-enable TestDataFormatterObjCNSError.py
7fb9da5 Revert "Reland "[Clang] Propagate guaranteed alignment for malloc and others""
Skipped - not needed
c74e627 Update test to allow for Swift.String instead of just String
703a0ea Revert "[Coverage] Store compilation dir separately in coverage mapping"
Skipped - only intended for 20210726
ff06f2f Temporarily mark swiftasync unavailable for x86_64 Windows.
Skipped - avoid conflicts (reverted and added back)
d7f78e9 Run coro::salavageDebugInfo on dbg.declares in entry function
de8c4e4 [lldb] Support diagnostic options in Swift REPL
aeeda41 Default to swift-async-fp=always
Skipped - seems to have been a partial commit of a773db7
e46dc39 Experimentally make clang default to SwiftAsyncFramePointerKind::Always too
Skipped - f670c5a already defaults to Always
d0f00c4 Target: explicitly handle
.swift1_autolink_entries
1242ce6 [lldb] Name UnsafePointer's single child 'pointee'
e4386fa Disable assertion
2319e3e [lldb] Temporarily disable the reproducer tests
f3e93f3 [lldb] XFAIL SwiftREPL/Resilient{Dict,Array}.test
Skipped - no longer XFAILed
f1f077c [lldb] Remove unused folder source/Plugins/Process/Darwin
15fdd40 [lldb] Allow for getting the current/inherited environment separately
Skipped - partial cherry-pick from next, have the full in stable/20211026 already
742fc62 [lldb] Skip failing tests on Linux
b7b84d9 [lldb] Toggle the reproducer default in the driver
d013556 Update CMakeLists.txt
3598797 [lldb] Add missing serialization status strings
Skipped - already updated
cc13fd5 update RevisionIncompatible string
Skipped - already updated
8a22207 refine RevisionIncompatible string
Skipped - already updated
09bdb99 Support: unlock Windows API support, switch to Windows 10 RS1+ APIs
5c40704 Disable lifetime.start sinking for ABI::Async and ABI::Retcon
9edc5ee Don't use lifetime.start based alloca localization for ABI.Async/ABI.Retcon
813a25a Reland "[lldb] Use CompileUnit::ResolveSymbolContext in SymbolFileDWARF"
cbaccb0 [lldb] Pass extra clang args by const-ref (NFC)
109798f Unxfail test.
Picked e2e6bee instead as the file was renamed
0113c2e Merge pull request #3316 from apple/fixfornewsig
Skipped - already updated
f6faf0c [lldb] Add new Swift log channel
97740ea [lldb] Log SwiftASTContext configuration to Swift health
8b4225d [lldb] Remove superfluous SDKTypeMinVersion type (NFC)
4fee9a7 wrap in LLDB_ENABLE_SWIFT
48fe48a reuse LOG_PRINTF_IMPL
43e3983 missed a LLDB_ENABLE_SWIFT
082d1eb [lldb] Modify call to ASTContext::get as per new signature
Skipped - already updated
07bbf6c Revert "[modules] Fix miscompilation when using two RecordDecl definitions with the same name."
73ec670 Revert "Work around outdated system header files on Amazon Linux"
Skipped - picked 89f633a and then bbd22f4 instead
2db66e8 [lldb] Auto-enable swift health logging to memory buffer
dcfe81e [lldb] Add basic healthcheck command
0379089 wrap in LLDB_ENABLE_SWIFT
30515a1 Merge pull request #2646 from apple/lldb-Add-work-around-handling-of-recursive_mutex-lock-failures
9bc7ba6 Revert "[profile] Add binary id into profiles"
Skipped - only for 20210726
87f3da5 Revert "Work around outdated system header files on Amazon Linux"
Skipped - see previous revert
41c3c52 [lldb] Add call to registerClangImporterRequestFunctions in SwiftASTContext
cc706bf [lldb] Rename 'healthcheck' to 'swift-healthcheck'
1ae2552 Revert "Work around outdated system header files on Amazon Linux"
Skipped - see previous revert
9394255 [lldb] Duplicate SwiftASTContext::CreateInstance errors to swift health log
79e9860 Revert "Work around outdated system header files on Amazon Linux"
Skipped - see previous revert
2d5f691 Revert "Work around outdated system header files on Amazon Linux"
Skipped - see previous revert
110fe51 disable test on linux
13ac86a [lldb] Remove swiftc -enable-experimental-concurrency from tests
a0e1c60 [lldb/test] Remove XFAIL on TestSwiftStepping.py
de14972 [lldb] Skip tests for target var without a proc on both arm64 & arm64e
0aca635 [lldb] Move reference related functions to TypeSystemSwift
92251f5 [lldb] Implement GetPointeeType
d4afbfc [lldb] Disable swift-create-module-contexts-in-parallel for a few tests
Skipped - since reverted
860affe [lldb] Add message to functions not worth implementing in tss-typeref
c81320b add comment and radar link
Skipped - since reverted
3c6d4b1 [lldb] Move DumpSummary implementation to TypeSystemSwift
c8c963c [lldb] Fixup code addresses in the Objective-C language runtime
dc39a8a Fix Stable lldb Release Builds
e57ab30 [lldb] The os and version are not separate components in the triple
668722c build: optionalize some clang resource headers
5ae95ea [debugserver] Fix typo in DNBArchImplARM64
Skipped - already fixed by e4235bd
83a8378 [lldb] Use reflection metadata to find the value type of an existential
4301f82 [lldb] Use std::string instead of llvm::Twine in GDBRemoteCommunicationClient
1e21555 [lldb] Remove nested switches from ARMGetSupportedArchitectureAtIndex (NFC)
f4451aa [lldb] Remove 'result' variable which is set but not used (NFC)
1512c8f [lldb] Fix C2360: initialization of 'identifier' is skipped by 'case' label
3a153b6 Support looking up absolute symbols
9afd5a0 Add a requires line to test.
f71c162 Use yaml2obj instead of relying on invoking the Darwin system assembler.
f55350d headers: optionalise some generated resource headers
Skipped - picked the correpsonding next commit c17d9b4 and d96161a instead
b987701 test: mark more ARM64 tests are requiring the ARM backend
Skipped - not on next
a160e45 [AArch64] Add missing tests for i8 vector to half conversions.
Skipped - already fixed by 9583d5f
74973c3 [lldb] Fix that the embedded Python REPL crashes if it receives SIGINT
55a9501 reland: [VFS] Use original path when falling back to external FS
3a083b5 [lldb] Fix Scripted ProcessLaunchInfo Argument nullptr deref
fd6b58b [lldb/bindings] Change ScriptedThread initializer parameters
11ab69d [lldb/test] Update TestScriptedProcess to use skinny corefiles
ff790af [lldb/test] Skip TestScriptedProcess when using system's debugserver (NFC)
c7b4936 [lldb/Plugins] Refactor ScriptedThread register context creation
4c10566 [lldb] Fix ScriptedThread build failure (NFC)
Skipped - have upstream 214054f
a7c4c5f [lldb/bindings] Update python static bindings (NFC)
Skipped - already regenerated bindings
03844d1 [lldb] Improve error reporting in
lang objc tagged-pointer info
3a3a862 [lldb] Update tagged pointer command output and test.
68b08e5 [lldb] Improve 'lang objc tagged-pointer info' command
52a7a8d [lldb] Remove failures case from TestTaggedPointerCmd
13a2b20 Windows: support
DoLoadImage
Skipped - picked the corresponding next commit fbf9b76 instead
7a77da8 [lldb] Remove unused GetAllocationStrategy function
716bb2c Update PlatformWindows.cpp
Skipped - picked the corresponding next commit 01f8e3d instead
627f7d3 [lldb] Don't set the OS for ARMGetSupportedArchitectureAtIndex
248daba [lldb] Consider bound types when deciding if the overall type is dynamic
b26f763 Add support for 32-bit reflection contexts.
c0b76ea [lldb] Desugar unlimited levels when calculating type name
1f2c20f [lldb] Fix desugaring of dicts on TypeSystemSwiftTypeRef
f7e500c [lldb] Implement TypeSystemSwiftTypeRef::GetFullyUnqualifiedType
a5c2622 [lldb] Implement GetFormat in terms of GetTypeInfo
Skipped - picked the corresponding next commit bd51db5 instead
5efa8c0 [lldb] Use Desugar function in GetCanonicalNode and remove duped code
15da5c8 Add missing default specifier
5897a27 Simplify logic to identify dyld_sim in Simulator debugging on macos