mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-28 09:30:58 +01:00
use cxxabi for demangling on linux/windows
This commit is contained in:
parent
ee5f99fdb4
commit
49cddd68e4
@ -82,7 +82,7 @@ export LIBS := -lstratosphere -lnx
|
|||||||
else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
|
else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
|
||||||
export LIBS := -lstratosphere -lwinmm -lws2_32 -lbcrypt -lbfd -liberty -lintl -lz
|
export LIBS := -lstratosphere -lwinmm -lws2_32 -lbcrypt -lbfd -liberty -lintl -lz
|
||||||
else ifeq ($(ATMOSPHERE_BOARD),generic_linux)
|
else ifeq ($(ATMOSPHERE_BOARD),generic_linux)
|
||||||
export LIBS := -lstratosphere -pthread -lbfd -liberty -ldl
|
export LIBS := -lstratosphere -pthread -lbfd
|
||||||
else ifeq ($(ATMOSPHERE_BOARD),generic_macos)
|
else ifeq ($(ATMOSPHERE_BOARD),generic_macos)
|
||||||
export LIBS := -lstratosphere -pthread
|
export LIBS := -lstratosphere -pthread
|
||||||
else
|
else
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
#include "impl/diag_get_all_backtrace.hpp"
|
||||||
#include "impl/diag_invoke_abort.hpp"
|
#include "impl/diag_invoke_abort.hpp"
|
||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
@ -179,6 +180,9 @@ namespace ams::diag {
|
|||||||
|
|
||||||
std::scoped_lock lk(g_abort_mutex);
|
std::scoped_lock lk(g_abort_mutex);
|
||||||
|
|
||||||
|
/* Set the abort impl return address. */
|
||||||
|
impl::SetAbortImplReturnAddress(reinterpret_cast<uintptr_t>(__builtin_return_address(0)));
|
||||||
|
|
||||||
/* Create abort info. */
|
/* Create abort info. */
|
||||||
std::va_list cvl;
|
std::va_list cvl;
|
||||||
va_copy(cvl, vl);
|
va_copy(cvl, vl);
|
||||||
|
@ -23,6 +23,10 @@ namespace ams::diag::impl {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetAbortImplReturnAddress(uintptr_t address) {
|
||||||
|
g_abort_impl_return_address = address;
|
||||||
|
}
|
||||||
|
|
||||||
size_t GetAllBacktrace(uintptr_t *out, size_t out_size, ::ams::diag::Backtrace &bt) {
|
size_t GetAllBacktrace(uintptr_t *out, size_t out_size, ::ams::diag::Backtrace &bt) {
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
do {
|
do {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace ams::diag::impl {
|
namespace ams::diag::impl {
|
||||||
|
|
||||||
void SetAbortImplAddress(uintptr_t address);
|
void SetAbortImplReturnAddress(uintptr_t address);
|
||||||
|
|
||||||
size_t GetAllBacktrace(uintptr_t *out, size_t out_size, ::ams::diag::Backtrace &bt);
|
size_t GetAllBacktrace(uintptr_t *out, size_t out_size, ::ams::diag::Backtrace &bt);
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@
|
|||||||
extern "C" char __init_array_start;
|
extern "C" char __init_array_start;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAVE_DECL_BASENAME 1
|
#include <cxxabi.h>
|
||||||
#include <libiberty/demangle.h>
|
|
||||||
|
|
||||||
namespace ams::diag::impl {
|
namespace ams::diag::impl {
|
||||||
|
|
||||||
@ -219,7 +218,10 @@ namespace ams::diag::impl {
|
|||||||
|
|
||||||
/* Print the symbol. */
|
/* Print the symbol. */
|
||||||
const char *name = bfd_asymbol_name(*symbol);
|
const char *name = bfd_asymbol_name(*symbol);
|
||||||
if (auto *demangled = bfd_demangle(m_handle, name, DMGL_ANSI | DMGL_PARAMS); demangled != nullptr) {
|
|
||||||
|
int cpp_name_status = 0;
|
||||||
|
if (char *demangled = abi::__cxa_demangle(name, nullptr, 0, std::addressof(cpp_name_status)); cpp_name_status == 0) {
|
||||||
|
AMS_ASSERT(demangled != nullptr);
|
||||||
util::TSNPrintf(dst, dst_size, "%s", demangled);
|
util::TSNPrintf(dst, dst_size, "%s", demangled);
|
||||||
std::free(demangled);
|
std::free(demangled);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user