DebugInterface: Make GetRawMemoryString return a std::string

This commit is contained in:
Lioncash 2016-10-07 09:56:02 -04:00
commit ee71d70738
6 changed files with 30 additions and 44 deletions

View file

@ -2,16 +2,15 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Core/Debugger/PPCDebugInterface.h"
#include <string>
#include "Common/GekkoDisassembler.h"
#include "Common/StringUtil.h"
#include "Core/Core.h"
#include "Core/Debugger/Debugger_SymbolMap.h"
#include "Core/Debugger/PPCDebugInterface.h"
#include "Core/HW/DSP.h"
#include "Core/HW/Memmap.h"
#include "Core/Host.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
@ -48,24 +47,19 @@ std::string PPCDebugInterface::Disassemble(unsigned int address)
}
}
void PPCDebugInterface::GetRawMemoryString(int memory, unsigned int address, char* dest,
int max_size)
std::string PPCDebugInterface::GetRawMemoryString(int memory, unsigned int address)
{
if (IsAlive())
{
if (memory || PowerPC::HostIsRAMAddress(address))
{
snprintf(dest, max_size, "%08X%s", ReadExtraMemory(memory, address), memory ? " (ARAM)" : "");
}
else
{
strcpy(dest, memory ? "--ARAM--" : "--------");
}
}
else
{
strcpy(dest, "<unknwn>"); // bad spelling - 8 chars
const bool is_aram = memory != 0;
if (is_aram || PowerPC::HostIsRAMAddress(address))
return StringFromFormat("%08X%s", ReadExtraMemory(memory, address), is_aram ? " (ARAM)" : "");
return is_aram ? "--ARAM--" : "--------";
}
return "<unknwn>"; // bad spelling - 8 chars
}
unsigned int PPCDebugInterface::ReadMemory(unsigned int address)

View file

@ -15,7 +15,7 @@ class PPCDebugInterface final : public DebugInterface
public:
PPCDebugInterface() {}
std::string Disassemble(unsigned int address) override;
void GetRawMemoryString(int memory, unsigned int address, char* dest, int max_size) override;
std::string GetRawMemoryString(int memory, unsigned int address) override;
int GetInstructionSize(int /*instruction*/) override { return 4; }
bool IsAlive() override;
bool IsBreakpoint(unsigned int address) override;