dolphin/Source/Core/Core/PowerPC/PPCSymbolDB.h
JosJuice 7cecb28bdf DolphinQt: Properly lock CPU before accessing emulated memory
This fixes a problem I was having where using frame advance with the
debugger open would frequently cause panic alerts about invalid addresses
due to the CPU thread changing MSR.DR while the host thread was trying
to access memory.

To aid in tracking down all the places where we weren't properly locking
the CPU, I've created a new type (in Core.h) that you have to pass as a
reference or pointer to functions that require running as the CPU thread.
2023-02-12 11:27:50 +01:00

51 lines
1.3 KiB
C++

// Copyright 2009 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <map>
#include <string>
#include <vector>
#include "Common/CommonTypes.h"
#include "Common/SymbolDB.h"
#include "Core/Debugger/PPCDebugInterface.h"
namespace Core
{
class CPUThreadGuard;
}
// This has functionality overlapping Debugger_Symbolmap. Should merge that stuff in here later.
class PPCSymbolDB : public Common::SymbolDB
{
public:
PPCSymbolDB();
~PPCSymbolDB() override;
Common::Symbol* AddFunction(const Core::CPUThreadGuard& guard, u32 start_addr) override;
void AddKnownSymbol(const Core::CPUThreadGuard& guard, u32 startAddr, u32 size,
const std::string& name,
Common::Symbol::Type type = Common::Symbol::Type::Function);
Common::Symbol* GetSymbolFromAddr(u32 addr) override;
std::string GetDescription(u32 addr);
void FillInCallers();
bool LoadMap(const Core::CPUThreadGuard& guard, const std::string& filename, bool bad = false);
bool SaveSymbolMap(const std::string& filename) const;
bool SaveCodeMap(const Core::CPUThreadGuard& guard, const std::string& filename) const;
void PrintCalls(u32 funcAddr) const;
void PrintCallers(u32 funcAddr) const;
void LogFunctionCall(u32 addr);
private:
Common::DebugInterface* debugger;
};
extern PPCSymbolDB g_symbolDB;