Fix windows support
This commit is contained in:
parent
8dfeb82bc9
commit
8fb0a0673e
@ -34,6 +34,8 @@
|
|||||||
* @copyright 2012 Samsung R&D Institute Russia, 2016 Moscow Institute of Physics and Technology
|
* @copyright 2012 Samsung R&D Institute Russia, 2016 Moscow Institute of Physics and Technology
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
|
||||||
#include "death_handler.h"
|
#include "death_handler.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
@ -556,18 +558,22 @@ void DeathHandler::HandleSignal(int sig, void * /* info */, void *secret) {
|
|||||||
|
|
||||||
// Overwrite sigaction with caller's address
|
// Overwrite sigaction with caller's address
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#if defined(__arm__)
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
trace[1] = reinterpret_cast<void *>(uc->uc_mcontext.arm_pc);
|
#if defined(__aarch64__)
|
||||||
#else
|
trace[1] = reinterpret_cast<void *>(uc->uc_mcontext.arm_pc);
|
||||||
#if !defined(__i386__) && !defined(__x86_64__)
|
#else
|
||||||
#error Only ARM, x86 and x86-64 are supported
|
trace[1] = reinterpret_cast<void *>(uc->uc_mcontext.arm_pc);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__x86_64__)
|
#else
|
||||||
trace[1] = reinterpret_cast<void *>(uc->uc_mcontext.gregs[REG_RIP]);
|
#if !defined(__i386__) && !defined(__x86_64__)
|
||||||
#else
|
#error Only ARM, AARCH64, x86 and x86-64 are supported
|
||||||
trace[1] = reinterpret_cast<void *>(uc->uc_mcontext.gregs[REG_EIP]);
|
#endif
|
||||||
#endif
|
#if defined(__x86_64__)
|
||||||
#endif
|
trace[1] = reinterpret_cast<void *>(uc->uc_mcontext.gregs[REG_RIP]);
|
||||||
|
#else
|
||||||
|
trace[1] = reinterpret_cast<void *>(uc->uc_mcontext.gregs[REG_EIP]);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
const int path_max_length = 2048;
|
const int path_max_length = 2048;
|
||||||
char* name_buf = memory;
|
char* name_buf = memory;
|
||||||
@ -727,3 +733,5 @@ void DeathHandler::HandleSignal(int sig, void * /* info */, void *secret) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace Debug
|
} // namespace Debug
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
* Underlying code style is very similar to [Google C++ Style Guide](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml). It is checked with cpplint.py.
|
* Underlying code style is very similar to [Google C++ Style Guide](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml). It is checked with cpplint.py.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
|
||||||
#ifndef DEATH_HANDLER_H_
|
#ifndef DEATH_HANDLER_H_
|
||||||
#define DEATH_HANDLER_H_
|
#define DEATH_HANDLER_H_
|
||||||
|
|
||||||
@ -258,3 +260,5 @@ class DeathHandler {
|
|||||||
|
|
||||||
} // namespace Debug
|
} // namespace Debug
|
||||||
#endif // DEATH_HANDLER_H_
|
#endif // DEATH_HANDLER_H_
|
||||||
|
|
||||||
|
#endif
|
@ -12,7 +12,9 @@
|
|||||||
#include "td/utils/Slice.h"
|
#include "td/utils/Slice.h"
|
||||||
#include "td/utils/Time.h"
|
#include "td/utils/Time.h"
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include "td/utils/death_handler.h"
|
#include "td/utils/death_handler.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -278,11 +280,15 @@ void process_fatal_error(CSlice message) {
|
|||||||
if (callback) {
|
if (callback) {
|
||||||
callback(message);
|
callback(message);
|
||||||
}
|
}
|
||||||
#if TD_THREAD_UNSUPPORTED || TD_EVENTFD_UNSUPPORTED
|
#ifndef _WIN32
|
||||||
std::abort();
|
#if TD_THREAD_UNSUPPORTED || TD_EVENTFD_UNSUPPORTED
|
||||||
|
std::abort();
|
||||||
|
#else
|
||||||
|
struct sigaction sa{};
|
||||||
|
Debug::DeathHandler::HandleSignal(SIGABRT, &sa, nullptr);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
struct sigaction sa{};
|
std::abort();
|
||||||
Debug::DeathHandler::HandleSignal(SIGABRT, &sa, nullptr);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user