mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-12-01 18:15:41 +00:00
Host: Purge ReportFormattedDebuggerMessage()
This commit is contained in:
parent
aa94b07f30
commit
567b86ce79
|
@ -2013,10 +2013,12 @@ ALWAYS_INLINE CPU::BreakpointList& CPU::GetBreakpointList(BreakpointType type)
|
||||||
|
|
||||||
const char* CPU::GetBreakpointTypeName(BreakpointType type)
|
const char* CPU::GetBreakpointTypeName(BreakpointType type)
|
||||||
{
|
{
|
||||||
static constexpr std::array<const char*, static_cast<u32>(BreakpointType::Count)> names = {
|
static constexpr std::array<const char*, static_cast<u32>(BreakpointType::Count)> names = {{
|
||||||
{TRANSLATE_NOOP("DebuggerWindow", "Execute"), TRANSLATE_NOOP("DebuggerWindow", "Read"),
|
"Execute",
|
||||||
TRANSLATE_NOOP("DebuggerWindow", "Write")}};
|
"Read",
|
||||||
return Host::TranslateToCString("DebuggerWindow", names[static_cast<size_t>(type)]);
|
"Write",
|
||||||
|
}};
|
||||||
|
return names[static_cast<size_t>(type)];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPU::HasBreakpointAtAddress(BreakpointType type, VirtualMemoryAddress address)
|
bool CPU::HasBreakpointAtAddress(BreakpointType type, VirtualMemoryAddress address)
|
||||||
|
@ -2070,9 +2072,7 @@ bool CPU::AddBreakpoint(BreakpointType type, VirtualMemoryAddress address, bool
|
||||||
System::InterruptExecution();
|
System::InterruptExecution();
|
||||||
|
|
||||||
if (!auto_clear)
|
if (!auto_clear)
|
||||||
{
|
Host::ReportDebuggerMessage(fmt::format("Added breakpoint at 0x{:08X}.", address));
|
||||||
Host::ReportFormattedDebuggerMessage(TRANSLATE("DebuggerWindow", "Added breakpoint at 0x%08X."), address);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2099,8 +2099,7 @@ bool CPU::RemoveBreakpoint(BreakpointType type, VirtualMemoryAddress address)
|
||||||
if (it == bplist.end())
|
if (it == bplist.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Host::ReportFormattedDebuggerMessage(TRANSLATE("DebuggerWindow", "Removed %s breakpoint at 0x%08X."),
|
Host::ReportDebuggerMessage(fmt::format("Removed {} breakpoint at 0x{:08X}.", GetBreakpointTypeName(type), address));
|
||||||
GetBreakpointTypeName(type), address);
|
|
||||||
|
|
||||||
bplist.erase(it);
|
bplist.erase(it);
|
||||||
if (UpdateDebugDispatcherFlag())
|
if (UpdateDebugDispatcherFlag())
|
||||||
|
@ -2134,7 +2133,7 @@ bool CPU::AddStepOverBreakpoint()
|
||||||
|
|
||||||
if (!IsCallInstruction(inst))
|
if (!IsCallInstruction(inst))
|
||||||
{
|
{
|
||||||
Host::ReportFormattedDebuggerMessage(TRANSLATE("DebuggerWindow", "0x%08X is not a call instruction."), g_state.pc);
|
Host::ReportDebuggerMessage(fmt::format("0x{:08X} is not a call instruction.", g_state.pc));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2143,15 +2142,14 @@ bool CPU::AddStepOverBreakpoint()
|
||||||
|
|
||||||
if (IsBranchInstruction(inst))
|
if (IsBranchInstruction(inst))
|
||||||
{
|
{
|
||||||
Host::ReportFormattedDebuggerMessage(TRANSLATE("DebuggerWindow", "Can't step over double branch at 0x%08X"),
|
Host::ReportDebuggerMessage(fmt::format("Can't step over double branch at 0x{:08X}", g_state.pc));
|
||||||
g_state.pc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip the delay slot
|
// skip the delay slot
|
||||||
bp_pc += sizeof(Instruction);
|
bp_pc += sizeof(Instruction);
|
||||||
|
|
||||||
Host::ReportFormattedDebuggerMessage(TRANSLATE("DebuggerWindow", "Stepping over to 0x%08X."), bp_pc);
|
Host::ReportDebuggerMessage(fmt::format("Stepping over to 0x{:08X}.", bp_pc));
|
||||||
|
|
||||||
return AddBreakpoint(BreakpointType::Execute, bp_pc, true);
|
return AddBreakpoint(BreakpointType::Execute, bp_pc, true);
|
||||||
}
|
}
|
||||||
|
@ -2167,22 +2165,20 @@ bool CPU::AddStepOutBreakpoint(u32 max_instructions_to_search)
|
||||||
Instruction inst;
|
Instruction inst;
|
||||||
if (!SafeReadInstruction(ret_pc, &inst.bits))
|
if (!SafeReadInstruction(ret_pc, &inst.bits))
|
||||||
{
|
{
|
||||||
Host::ReportFormattedDebuggerMessage(
|
Host::ReportDebuggerMessage(
|
||||||
TRANSLATE("DebuggerWindow", "Instruction read failed at %08X while searching for function end."), ret_pc);
|
fmt::format("Instruction read failed at {:08X} while searching for function end.", ret_pc));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsReturnInstruction(inst))
|
if (IsReturnInstruction(inst))
|
||||||
{
|
{
|
||||||
Host::ReportFormattedDebuggerMessage(TRANSLATE("DebuggerWindow", "Stepping out to 0x%08X."), ret_pc);
|
Host::ReportDebuggerMessage(fmt::format("Stepping out to 0x{:08X}.", ret_pc));
|
||||||
|
|
||||||
return AddBreakpoint(BreakpointType::Execute, ret_pc, true);
|
return AddBreakpoint(BreakpointType::Execute, ret_pc, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Host::ReportFormattedDebuggerMessage(
|
Host::ReportDebuggerMessage(fmt::format("No return instruction found after {} instructions for step-out at {:08X}.",
|
||||||
TRANSLATE("DebuggerWindow", "No return instruction found after %u instructions for step-out at %08X."),
|
max_instructions_to_search, g_state.pc));
|
||||||
max_instructions_to_search, g_state.pc);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2227,15 +2223,15 @@ ALWAYS_INLINE_RELEASE bool CPU::CheckBreakpointList(BreakpointType type, Virtual
|
||||||
|
|
||||||
if (bp.auto_clear)
|
if (bp.auto_clear)
|
||||||
{
|
{
|
||||||
Host::ReportFormattedDebuggerMessage("Stopped execution at 0x%08X.", pc);
|
Host::ReportDebuggerMessage(fmt::format("Stopped execution at 0x{:08X}.", pc));
|
||||||
bplist.erase(bplist.begin() + i);
|
bplist.erase(bplist.begin() + i);
|
||||||
count--;
|
count--;
|
||||||
UpdateDebugDispatcherFlag();
|
UpdateDebugDispatcherFlag();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Host::ReportFormattedDebuggerMessage("Hit %s breakpoint %u at 0x%08X.", GetBreakpointTypeName(type), bp.number,
|
Host::ReportDebuggerMessage(
|
||||||
address);
|
fmt::format("Hit {} breakpoint {} at 0x{:08X}.", GetBreakpointTypeName(type), bp.number, address));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2253,7 +2249,7 @@ ALWAYS_INLINE_RELEASE void CPU::ExecutionBreakpointCheck()
|
||||||
// single step ignores breakpoints, since it stops anyway
|
// single step ignores breakpoints, since it stops anyway
|
||||||
s_single_step = false;
|
s_single_step = false;
|
||||||
s_break_after_instruction = true;
|
s_break_after_instruction = true;
|
||||||
Host::ReportFormattedDebuggerMessage("Stepped to 0x%08X.", g_state.npc);
|
Host::ReportDebuggerMessage(fmt::format("Stepped to 0x{:08X}.", g_state.npc));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,16 +250,6 @@ std::string Host::GetHTTPUserAgent()
|
||||||
return fmt::format("DuckStation for {} ({}) {}", TARGET_OS_STR, CPU_ARCH_STR, g_scm_tag_str);
|
return fmt::format("DuckStation for {} ({}) {}", TARGET_OS_STR, CPU_ARCH_STR, g_scm_tag_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::ReportFormattedDebuggerMessage(const char* format, ...)
|
|
||||||
{
|
|
||||||
std::va_list ap;
|
|
||||||
va_start(ap, format);
|
|
||||||
std::string message = StringUtil::StdStringFromFormatV(format, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
ReportDebuggerMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Host::CreateGPUDevice(RenderAPI api, Error* error)
|
bool Host::CreateGPUDevice(RenderAPI api, Error* error)
|
||||||
{
|
{
|
||||||
DebugAssert(!g_gpu_device);
|
DebugAssert(!g_gpu_device);
|
||||||
|
|
|
@ -72,7 +72,6 @@ SettingsInterface* GetSettingsInterface();
|
||||||
|
|
||||||
/// Debugger feedback.
|
/// Debugger feedback.
|
||||||
void ReportDebuggerMessage(std::string_view message);
|
void ReportDebuggerMessage(std::string_view message);
|
||||||
void ReportFormattedDebuggerMessage(const char* format, ...);
|
|
||||||
|
|
||||||
/// Returns a list of supported languages and codes (suffixes for translation files).
|
/// Returns a list of supported languages and codes (suffixes for translation files).
|
||||||
std::span<const std::pair<const char*, const char*>> GetAvailableLanguageList();
|
std::span<const std::pair<const char*, const char*>> GetAvailableLanguageList();
|
||||||
|
|
Loading…
Reference in a new issue