Skip to content
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

CMake: SwiftCore: Add back SWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING #78497

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

etcwilde
Copy link
Contributor

@etcwilde etcwilde commented Jan 8, 2025

So, despite the name, this is not the same as enabling backtracing.... Somehow. Anyway, this was a macro from the old build that we want in the new build.

@mikeash and @al45tair, is there some way that we can merge these concepts or at least have a better description of how they differ.

rdar://142440689

So, despite the name, this is not the same as enabling backtracing....
Somehow. Anyway, this was a macro from the old build that we want in the
new build.

rdar://142440689
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

This is not confusing at all 🤦‍♂️

@al45tair
Copy link
Contributor

al45tair commented Jan 9, 2025

This setting controls the backtrace that you get from fatalError(), which ends up calling reportNow() in Errors.cpp; there are a few other things that use this path also, mostly where the runtime is directly emitting diagnostics. Having the backtracer take over these backtraces is on my list of things to do (rdar://113562509).

@@ -100,6 +101,7 @@ defaulted_option(SwiftCore_ENABLE_STDLIB_TRACING "Enable tracing in the runtime.
option(SwiftCore_ENABLE_UNICODE_DATA "Include unicode data in Swift runtimes" ON)
option(SwiftCore_ENABLE_SHORT_MANGLING_LOOKUPS "Build with fast-path context descriptor lookups based on well-known short manglings." ON)
option(SwiftCore_ENABLE_FILESYSTEM_SUPPORT "Build for systems that have a filesystem" ON)
option(SwiftCore_ENABLE_BACKTRACE_REPORTING "Build with backtrace reporting support" ${SwiftCore_HAS_BACKTRACE})
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be enabled on Windows (which doesn't have backtrace()) and on ELF platforms where we use the unwinder instead of backtrace()… is that going to be handled in cache files rather than by logic here?

@etcwilde
Copy link
Contributor Author

etcwilde commented Jan 9, 2025

This setting controls the backtrace that you get from fatalError(), which ends up calling reportNow() in Errors.cpp; there are a few other things that use this path also, mostly where the runtime is directly emitting diagnostics.

Okay, I can give this a better description then.

@@ -99,7 +99,8 @@ target_compile_definitions(swiftRuntime
$<$<BOOL:${SwiftCore_HAS_DLSYM}>:-DSWIFT_STDLIB_HAS_DLSYM>
$<$<BOOL:${SwiftCore_ENABLE_FILESYSTEM_SUPPORT}>:-DSWIFT_STDLIB_HAS_FILESYSTEM>
$<$<AND:$<BOOL:${SwiftCore_ENABLE_FILESYSTEM_SUPPORT}>,$<COMPILE_LANGUAGE:C,CXX>>:-DSWIFT_ARCH="${SwiftCore_ARCH_SUBDIR}">
$<$<AND:$<BOOL:${SwiftCore_ENABLE_FILESYSTEM_SUPPORT}>,$<COMPILE_LANGUAGE:C,CXX>>:-DSWIFT_LIB_SUBDIR="${SwiftCore_PLATFORM_SUBDIR}">)
$<$<AND:$<BOOL:${SwiftCore_ENABLE_FILESYSTEM_SUPPORT}>,$<COMPILE_LANGUAGE:C,CXX>>:-DSWIFT_LIB_SUBDIR="${SwiftCore_PLATFORM_SUBDIR}">
$<$<BOOL:${SwiftCore_ENABLE_BACKTRACE_REPORTING}>:-DSWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING>)
Copy link
Contributor

Choose a reason for hiding this comment

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

(Optional) we may consider moving the closing parenthesis on a new line, so to make subsequent diffs more straightforward in their intent, e.g.

Suggested change
$<$<BOOL:${SwiftCore_ENABLE_BACKTRACE_REPORTING}>:-DSWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING>)
$<$<BOOL:${SwiftCore_ENABLE_BACKTRACE_REPORTING}>:-DSWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING>
)

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