Files
scylladb/utils/abi/eh_ia64.hh
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

53 lines
1.3 KiB
C++

/*
* Copyright (C) 2022-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#pragma once
#include <unwind.h>
#include <typeinfo>
#include <exception>
// This file defines structures/functions derived from the Itanium C++ ABI.
// Source: https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html
namespace utils {
namespace abi {
// __cxa_exception (exception object header), as defined in section 2.2.1
struct cxa_exception {
std::type_info* exceptionType;
void (*exceptionDestructor)(void*);
void (*unexpectedHandler)();
std::terminate_handler terminateHandler;
cxa_exception* nextException;
int handlerCount;
int handlerSwitchValue;
const char* actionRecord;
const char* languageSpecificData;
void* catchTemp;
void* adjustedPtr;
_Unwind_Exception unwindHeader;
};
// Given a pointer to the exception data, returns the pointer
// to the __cxa_exception header.
inline cxa_exception* get_cxa_exception(void* eptr) {
// From section 2.2.1:
// "By convention, a __cxa_exception pointer points at the C++ object
// representing the exception being thrown, immediately following
// the header. The header structure is accessed at a negative offset
// from the __cxa_exception pointer."
return reinterpret_cast<cxa_exception*>(eptr) - 1;
}
} // abi
} // utils