mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	Add stacktrace symbol demangling
This commit is contained in:
		@@ -7,8 +7,10 @@
 | 
			
		||||
 | 
			
		||||
#include <map>
 | 
			
		||||
#include <optional>
 | 
			
		||||
 | 
			
		||||
#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::vector<Backt
 | 
			
		||||
        const auto symbol_set = symbols.find(entry.module);
 | 
			
		||||
        if (symbol_set != symbols.end()) {
 | 
			
		||||
            const auto symbol = Symbols::GetSymbolName(symbol_set->second, 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);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user