Skip to content

Commit

Permalink
Revert "Switch SDK overlays to use the public SDK"
Browse files Browse the repository at this point in the history
This reverts commit r31245, it broke buildbots.

Swift SVN r31246
  • Loading branch information
gribozavr committed Aug 14, 2015
1 parent b9ef882 commit f2fce43
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 43 deletions.
25 changes: 22 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ option(SWIFT_EMBED_BITCODE_SECTION
FALSE)

option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
"Whether to enable CrashReporter integration"
"Whether CrashReporterClient library should be a required dependency (build will fail if it is not found)"
FALSE)

#
Expand Down Expand Up @@ -394,7 +394,7 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
if(${SWIFT_ENABLE_TARGET_TVOS})
is_sdk_requested(TVOS swift_build_tvos)
if(swift_build_tvos AND ${swift_can_crosscompile_stdlib})
configure_sdk_darwin(TVOS "tvOS" "9.0" appletvos tvos tvos "arm64" FALSE)
configure_sdk_darwin(TVOS "tvOS" "9.0" appletvos tvos tvos "arm64" TRUE)
configure_target_variant(TVOS-DA "tvOS Debug+Asserts" TVOS DA "Debug+Asserts")
configure_target_variant(TVOS-RA "tvOS Release+Asserts" TVOS RA "Release+Asserts")
configure_target_variant(TVOS-R "tvOS Release" TVOS R "Release")
Expand All @@ -414,7 +414,7 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")

is_sdk_requested(WATCHOS swift_build_watchos)
if(swift_build_watchos AND ${swift_can_crosscompile_stdlib})
configure_sdk_darwin(WATCHOS "watchOS" "2.0" watchos watchos watchos "armv7k" FALSE)
configure_sdk_darwin(WATCHOS "watchOS" "2.0" watchos watchos watchos "armv7k" TRUE)
configure_target_variant(WATCHOS-DA "watchOS Debug+Asserts" WATCHOS DA "Debug+Asserts")
configure_target_variant(WATCHOS-RA "watchOS Release+Asserts" WATCHOS RA "Release+Asserts")
configure_target_variant(WATCHOS-R "watchOS Release" WATCHOS R "Release")
Expand Down Expand Up @@ -503,6 +503,25 @@ if(LIBXML2_FOUND)
set(SWIFT_HAVE_LIBXML 1)
endif()

# Find CrashReporterClient.
if(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT)
foreach(SDK ${SWIFT_SDKS})
foreach(ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES})
set(VARIANT_SUFFIX "-${SWIFT_SDK_${SDK}_LIB_SUBDIR}-${ARCH}")
unset(SWIFT_HAVE_CRASH_REPORTER_CLIENT)
unset(SWIFT_HAVE_CRASH_REPORTER_CLIENT CACHE)
find_library(SWIFT_HAVE_CRASH_REPORTER_CLIENT
NAMES CrashReporterClient
PATHS "${SWIFT_SDK_${SDK}_PATH}/usr/local/lib"
NO_DEFAULT_PATH)
if(NOT SWIFT_HAVE_CRASH_REPORTER_CLIENT)
message(FATAL_ERROR
"CrashReporterClient library is required, but it was not found")
endif()
endforeach()
endforeach()
endif()

#
# Set up global CMake variables for API notes.
#
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS)
"-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=1")
endif()

if(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT)
if(SWIFT_HAVE_CRASH_REPORTER_CLIENT)
list(APPEND swift_runtime_compile_flags
"-DSWIFT_HAVE_CRASHREPORTERCLIENT=1")
endif()
Expand Down
41 changes: 4 additions & 37 deletions stdlib/public/runtime/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,12 @@
#define _SWIFT_RUNTIME_DEBUG_HELPERS_

#include <llvm/Support/Compiler.h>
#include <stdio.h>

#ifdef SWIFT_HAVE_CRASHREPORTERCLIENT
#include <stdint.h>

#define CRASH_REPORTER_CLIENT_HIDDEN __attribute__((visibility("hidden")))
#define CRASHREPORTER_ANNOTATIONS_VERSION 5
#define CRASHREPORTER_ANNOTATIONS_SECTION "__crash_info"

struct crashreporter_annotations_t {
uint64_t version; // unsigned long
uint64_t message; // char *
uint64_t signature_string; // char *
uint64_t backtrace; // char *
uint64_t message2; // char *
uint64_t thread; // uint64_t
uint64_t dialog_mode; // unsigned int
uint64_t abort_cause; // unsigned int
};

extern "C" {
CRASH_REPORTER_CLIENT_HIDDEN
extern struct crashreporter_annotations_t gCRAnnotations;
}

LLVM_ATTRIBUTE_ALWAYS_INLINE
static void CRSetCrashLogMessage(const char *message) {
gCRAnnotations.message = reinterpret_cast<uint64_t>(message);
}

LLVM_ATTRIBUTE_ALWAYS_INLINE
static const char *CRGetCrashLogMessage() {
return reinterpret_cast<const char *>(gCRAnnotations.message);
}

#if SWIFT_HAVE_CRASHREPORTERCLIENT
#include <CrashReporterClient.h>
#else

LLVM_ATTRIBUTE_ALWAYS_INLINE
static void CRSetCrashLogMessage(const char *) {}

#define CRSetCrashLogMessage(_m_) fprintf(stderr, "%s\n", (_m_))
#endif

namespace swift {
Expand Down
6 changes: 4 additions & 2 deletions stdlib/public/runtime/Errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#include <asl.h>
#endif

#ifdef SWIFT_HAVE_CRASHREPORTERCLIENT
#if SWIFT_HAVE_CRASHREPORTERCLIENT

#include <CrashReporterClient.h>
#include <malloc/malloc.h>

// Instead of linking to CrashReporterClient.a (because it complicates the
Expand All @@ -39,7 +41,7 @@ extern "C" {
CRASH_REPORTER_CLIENT_HIDDEN
struct crashreporter_annotations_t gCRAnnotations
__attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = {
CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0, 0};
CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0};
}

// Report a message to any forthcoming crash log.
Expand Down

0 comments on commit f2fce43

Please sign in to comment.