Skip to content

Runtime: add a non-Darwin error message storage #72785

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
Apr 6, 2024

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Apr 2, 2024

This introduces a non-Darwin (non-CrashReporter) storage for error messages to allow extraction for crash reporting. This is initially meant to be used on Windows, though it is generic enough to be used on any platform.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves #NNNNN, fix apple/llvm-project#MMMMM.

@kubamracek
Copy link
Contributor

From the Embedded Swift perspective: This change LGTM -- it doesn't change anything around Embedded Swift, as Errors.cpp is not part of the Embedded Swift Runtime. I think it's fine to proceed as is, because (1) Embedded Swift shouldn't get any any non-essential runtime facilities, (2) in production builds, it already today has fatalErrors() not print the error message, and the error message string is not even present in the binaries (to minimize codesize), (3) the crash message should be recoverable from debuginfo (4) given the highly experimental state of Embedded Swift, we can always revisit and change the status quo later.

@compnerd
Copy link
Member Author

compnerd commented Apr 5, 2024

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Apr 5, 2024

@swift-ci please test Windows platform

@compnerd
Copy link
Member Author

compnerd commented Apr 5, 2024

@swift-ci please test

This introduces a non-Darwin (non-CrashReporter) storage for error
messages to allow extraction for crash reporting. This is initially
meant to be used on Windows, though it is generic enough to be used on
any platform.
@compnerd
Copy link
Member Author

compnerd commented Apr 5, 2024

@swift-ci please test

@compnerd compnerd enabled auto-merge April 6, 2024 00:14
@compnerd compnerd merged commit 2de6442 into swiftlang:main Apr 6, 2024
@compnerd compnerd deleted the error-storage branch April 6, 2024 03:03
@meg-gupta
Copy link
Contributor

meg-gupta commented Apr 6, 2024

@compnerd I am seeing a compilation error possibly due to this PR on ubuntu 18.04 :

https://ci.swift.org/job/oss-swift-RA-lsan-linux-ubuntu-18_04/10040/console

FAILED: stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o 
/home/build-user/build/buildbot_incremental_lsan/llvm-linux-x86_64/./bin/clang++ -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DSWIFT_BUILD_SWIFT_SYNTAX -DSWIFT_INLINE_NAMESPACE=__runtime -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_HARDENED_MODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/build/buildbot_incremental_lsan/swift-linux-x86_64/stdlib/public/runtime -I/home/build-user/swift/stdlib/public/runtime -I/home/build-user/swift/stdlib/include -I/home/build-user/swift/stdlib/public/SwiftShims -I/home/build-user/build/buildbot_incremental_lsan/swift-linux-x86_64/include -I/home/build-user/swift/include -I/home/build-user/build/buildbot_incremental_lsan/llvm-linux-x86_64/include -I/home/build-user/llvm-project/clang/include -I/home/build-user/build/buildbot_incremental_lsan/llvm-linux-x86_64/tools/clang/include -I/home/build-user/cmark/src/include -I/home/build-user/build/buildbot_incremental_lsan/cmark-linux-x86_64/src -I/home/build-user/swift-corelibs-libdispatch/src/BlocksRuntime -I/home/build-user/swift-corelibs-libdispatch -gline-tables-only -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -fsanitize=leak -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden  -fno-exceptions -funwind-tables -fno-rtti -Werror=gnu -Werror=c++98-compat-extra-semi -UNDEBUG -Werror=switch -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -Wno-nested-anon-types -fno-sanitize=all -Wall -Wformat-nonliteral -Werror=format-nonliteral -Wglobal-constructors -Werror=global-constructors -Wexit-time-destructors -Werror=exit-time-destructors -DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=1 -DswiftCore_EXPORTS -I/home/build-user/swift/stdlib/include/llvm/Support -I/home/build-user/swift/include -DSWIFT_TARGET_LIBRARY_NAME=swiftRuntime -DSWIFT_RUNTIME -DSWIFT_LIB_SUBDIR=\"linux\" -DSWIFT_ARCH=\"x86_64\" -target x86_64-unknown-linux-gnu -fno-omit-frame-pointer -O0 -g -mcx16 -DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -march=core2 -DSWIFT_OBJC_INTEROP=0 -DSWIFT_LIBRARY_EVOLUTION=1 -DSWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT -DSWIFT_ENABLE_REFLECTION -DSWIFT_STDLIB_HAS_DLADDR -DSWIFT_STDLIB_HAS_DLSYM=1 -DSWIFT_STDLIB_HAS_FILESYSTEM -DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC=1 -DSWIFT_STDLIB_HAS_STDIN -DSWIFT_STDLIB_HAS_ENVIRON -DSWIFT_STDLIB_HAS_LOCALE -DSWIFT_THREADING_LINUX -DSWIFT_RUNTIME_OS_VERSIONING -DSWIFT_STDLIB_SHORT_MANGLING_LOOKUPS -DSWIFT_STDLIB_ENABLE_VECTOR_TYPES -DSWIFT_STDLIB_HAS_TYPE_PRINTING -DSWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING -DSWIFT_STDLIB_ENABLE_UNICODE_DATA -DSWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE -std=c++17 -MD -MT stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o -MF stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o.d -o stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o -c /home/build-user/swift/stdlib/public/runtime/Errors.cpp
/home/build-user/swift/stdlib/public/runtime/Errors.cpp:315:13: error: no matching function for call to 'atomic_compare_exchange_strong_explicit'
  315 |   } while (!std::atomic_compare_exchange_strong_explicit(&kFatalErrorMessage,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/atomic:1121:5: note: candidate template ignored: deduced conflicting types for parameter '_ITp' ('const char *' vs. 'char *')
 1121 |     atomic_compare_exchange_strong_explicit(atomic<_ITp>* __a,
      |     ^
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/atomic:1129:5: note: candidate template ignored: deduced conflicting types for parameter '_ITp' ('const char *' vs. 'char *')
 1129 |     atomic_compare_exchange_strong_explicit(volatile atomic<_ITp>* __a,
      |     ^
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/bits/shared_ptr_atomic.h:220:5: note: candidate template ignored: could not match 'shared_ptr' against 'atomic'
  220 |     atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p,
      |     ^
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/bits/shared_ptr_atomic.h:272:5: note: candidate template ignored: could not match '__shared_ptr' against 'atomic'
  272 |     atomic_compare_exchange_strong_explicit(__shared_ptr<_Tp, _Lp>* __p,
      |     ^
1 error generated.

@compnerd
Copy link
Member Author

compnerd commented Apr 7, 2024

@meg-gupta interesting; seems like it is an overload mismatch? It might require an explicit cast? I'll see if I can get away with casting away the const-ness on all the platforms. Is there an easy way to trigger the runs on the 18.04 builder?

@meg-gupta
Copy link
Contributor

Mishal pointed me to https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#build-swift-toolchain. You can use - swift-ci Please Build Toolchain Ubuntu 18.04

@meg-gupta
Copy link
Contributor

@compnerd I created #72904 to track this with links to more logs where this issue happens.

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.

5 participants