mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Backtracing][Linux] Add Linux crash handler to the runtime.
This also adds a function to demangle a symbol, and a way for the backtracing code to report warning messages to the same place as the main runtime. I'd like to rename the _swift_isThunkFunction() SPI also, but we can't do that until we've made the changes to the _Backtracing library, so we'll do that there instead. rdar://110261430
This commit is contained in:
@@ -17,10 +17,17 @@
|
||||
#ifndef SWIFT_RUNTIME_BACKTRACE_H
|
||||
#define SWIFT_RUNTIME_BACKTRACE_H
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <signal.h>
|
||||
#endif // defined(__linux__)
|
||||
|
||||
#include "swift/Runtime/Config.h"
|
||||
#include "swift/Runtime/CrashInfo.h"
|
||||
|
||||
#include "swift/shims/Visibility.h"
|
||||
#include "swift/shims/CrashInfo.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -50,7 +57,11 @@ typedef int ErrorCode;
|
||||
|
||||
SWIFT_RUNTIME_STDLIB_INTERNAL ErrorCode _swift_installCrashHandler();
|
||||
|
||||
#ifdef __linux__
|
||||
SWIFT_RUNTIME_STDLIB_INTERNAL bool _swift_spawnBacktracer(const ArgChar * const *argv, int memserver_fd);
|
||||
#else
|
||||
SWIFT_RUNTIME_STDLIB_INTERNAL bool _swift_spawnBacktracer(const ArgChar * const *argv);
|
||||
#endif
|
||||
|
||||
enum class UnwindAlgorithm {
|
||||
Auto = 0,
|
||||
@@ -125,6 +136,12 @@ SWIFT_RUNTIME_STDLIB_INTERNAL BacktraceSettings _swift_backtraceSettings;
|
||||
|
||||
SWIFT_RUNTIME_STDLIB_SPI SWIFT_CC(swift) bool _swift_isThunkFunction(const char *mangledName);
|
||||
|
||||
SWIFT_RUNTIME_STDLIB_SPI
|
||||
char *_swift_backtrace_demangle(const char *mangledName,
|
||||
size_t mangledNameLength,
|
||||
char *outputBuffer,
|
||||
size_t *outputBufferSize,
|
||||
int *status);
|
||||
#ifdef __cplusplus
|
||||
} // namespace backtrace
|
||||
} // namespace runtime
|
||||
|
||||
@@ -124,6 +124,9 @@ swift_dynamicCastFailure(const void *sourceType, const char *sourceName,
|
||||
SWIFT_RUNTIME_EXPORT
|
||||
void swift_reportError(uint32_t flags, const char *message);
|
||||
|
||||
SWIFT_RUNTIME_EXPORT
|
||||
void swift_reportWarning(uint32_t flags, const char *message);
|
||||
|
||||
// Halt due to an overflow in swift_retain().
|
||||
SWIFT_RUNTIME_ATTRIBUTE_NORETURN SWIFT_RUNTIME_ATTRIBUTE_NOINLINE
|
||||
void swift_abortRetainOverflow();
|
||||
|
||||
Reference in New Issue
Block a user