From 80a55c1663ac600103e3d475c1f72b04e2e76f0f Mon Sep 17 00:00:00 2001 From: Kelebek1 Date: Fri, 13 Jan 2023 21:06:13 +0000 Subject: Add stacktrace symbol demangling --- src/core/arm/arm_interface.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/core') diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp index 2df7b0ee8..a34200539 100644 --- a/src/core/arm/arm_interface.cpp +++ b/src/core/arm/arm_interface.cpp @@ -7,8 +7,10 @@ #include #include + #include "common/bit_field.h" #include "common/common_types.h" +#include "common/demangle.h" #include "common/logging/log.h" #include "core/arm/arm_interface.h" #include "core/arm/symbols.h" @@ -71,20 +73,8 @@ void ARM_Interface::SymbolicateBacktrace(Core::System& system, std::vectorsecond, entry.offset); - if (symbol.has_value()) { -#ifdef _MSC_VER - // TODO(DarkLordZach): Add demangling of symbol names. - entry.name = *symbol; -#else - int status{-1}; - char* demangled{abi::__cxa_demangle(symbol->c_str(), nullptr, nullptr, &status)}; - if (status == 0 && demangled != nullptr) { - entry.name = demangled; - std::free(demangled); - } else { - entry.name = *symbol; - } -#endif + if (symbol) { + entry.name = Common::DemangleSymbol(*symbol); } } } -- cgit v1.2.3 From 42b16bb33ab0a0bb5b8e4032753fbe67bc85844f Mon Sep 17 00:00:00 2001 From: Kelebek1 Date: Sat, 14 Jan 2023 19:53:55 +0000 Subject: Be careful of mangled out of bounds read --- src/core/arm/arm_interface.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/core') diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp index a34200539..8aa7b9641 100644 --- a/src/core/arm/arm_interface.cpp +++ b/src/core/arm/arm_interface.cpp @@ -1,10 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#ifndef _MSC_VER -#include -#endif - #include #include -- cgit v1.2.3