ams: use R_DISCARD everywhere

This commit is contained in:
hexkyz committed 2026-09-23 20:42:15 +01:00
1 parent 2d0fc65fd8
commit 44d9649c6d
65 files changed
+185 -185

No files matched your search

@@ -29,7 +29,7 @@ namespace ams::dmnt {
for (size_t i = 0; (bp = static_cast<BreakPoint *>(this->GetBreakPoint(i))) != nullptr; ++i) {
if (bp->m_in_use && bp->m_is_step) {
AMS_DMNT2_GDB_LOG_DEBUG("BreakPointManager::ClearStep %p 0x%lx (idx=%zu)\n", bp, bp->m_address, i);
bp->Clear(m_debug_process);
R_DISCARD(bp->Clear(m_debug_process));
}
}
}
@@ -28,7 +28,7 @@ namespace ams::dmnt {
BreakPointBase *bp = nullptr;
for (size_t i = 0; (bp = static_cast<BreakPointBase *>(this->GetBreakPoint(i))) != nullptr; ++i) {
if (bp->m_in_use) {
bp->Clear(m_debug_process);
R_DISCARD(bp->Clear(m_debug_process));
}
}
}
@@ -44,7 +44,7 @@ namespace ams::dmnt {
/* Get our process id. */
u64 pid_value = 0;
svc::GetProcessId(std::addressof(pid_value), m_debug_handle);
R_DISCARD(svc::GetProcessId(std::addressof(pid_value), m_debug_handle));
m_process_id = { pid_value };
@@ -413,7 +413,7 @@ namespace ams::dmnt {
/* Get the instruction where we were. */
u32 insn = 0;
this->ReadMemory(std::addressof(insn), pc, sizeof(insn));
R_DISCARD(this->ReadMemory(std::addressof(insn), pc, sizeof(insn)));
/* Handle by architecture. */
bool is_call = false;
@@ -471,7 +471,7 @@ namespace ams::dmnt {
}
Result DebugProcess::ClearBreakPoint(uintptr_t address, size_t size) {
m_software_breakpoints.ClearBreakPoint(address, size);
R_DISCARD(m_software_breakpoints.ClearBreakPoint(address, size));
R_SUCCEED();
}
@@ -480,7 +480,7 @@ namespace ams::dmnt {
}
Result DebugProcess::ClearHardwareBreakPoint(uintptr_t address, size_t size) {
m_hardware_breakpoints.ClearBreakPoint(address, size);
R_DISCARD(m_hardware_breakpoints.ClearBreakPoint(address, size));
R_SUCCEED();
}
@@ -1030,7 +1030,7 @@ namespace ams::dmnt {
const auto reason = info.break_reason & ~svc::BreakReason_NotificationOnlyFlag;
if (reason == svc::BreakReason_PostLoadDll || reason == svc::BreakReason_PostUnloadDll) {
/* Re-collect the process's modules. */
m_debug_process.CollectModules();
R_DISCARD(m_debug_process.CollectModules());
}
if (m_debug_process.GetOverrideStatus().IsHbl() && reason == svc::BreakReason_PostLoadDll) {
@@ -1049,7 +1049,7 @@ namespace ams::dmnt {
}
/* This was just a notification, so we should continue. */
m_debug_process.Continue();
R_DISCARD(m_debug_process.Continue());
continue;
}
@@ -1064,7 +1064,7 @@ namespace ams::dmnt {
if (!is_svc_break) {
AMS_DMNT2_GDB_LOG_ERROR("UserBreak from non-SvcBreak (%08x)\n", insn);
m_debug_process.Continue();
R_DISCARD(m_debug_process.Continue());
continue;
}
}
@@ -1194,7 +1194,7 @@ namespace ams::dmnt {
AMS_DMNT2_GDB_LOG_DEBUG("CreateThread %lx\n", thread_id);
if (m_debug_process.IsValid()) {
m_debug_process.Continue();
R_DISCARD(m_debug_process.Continue());
} else {
AppendReplyFormat(reply_cur, reply_end, "W00");
}
@@ -1205,7 +1205,7 @@ namespace ams::dmnt {
AMS_DMNT2_GDB_LOG_DEBUG("ExitThread %lx\n", thread_id);
if (m_debug_process.IsValid()) {
m_debug_process.Continue();
R_DISCARD(m_debug_process.Continue());
} else {
AppendReplyFormat(reply_cur, reply_end, "W00");
}
@@ -1227,7 +1227,7 @@ namespace ams::dmnt {
break;
default:
AMS_DMNT2_GDB_LOG_DEBUG("Unhandled ProcessEvent %u %lx\n", static_cast<u32>(d.type), thread_id);
m_debug_process.Continue();
R_DISCARD(m_debug_process.Continue());
break;
}
@@ -1235,7 +1235,7 @@ namespace ams::dmnt {
bool do_break;
this->SendPacket(std::addressof(do_break), send_buffer);
if (do_break) {
m_debug_process.Break();
R_DISCARD(m_debug_process.Break());
}
}
}
@@ -1250,7 +1250,7 @@ namespace ams::dmnt {
/* Get the thread context. */
svc::ThreadContext thread_context = {};
m_debug_process.GetThreadContext(std::addressof(thread_context), thread_id, svc::ThreadContextFlag_General | svc::ThreadContextFlag_Control);
R_DISCARD(m_debug_process.GetThreadContext(std::addressof(thread_context), thread_id, svc::ThreadContextFlag_General | svc::ThreadContextFlag_Control));
/* Add important registers. */
/* TODO: aarch32 */
@@ -1280,7 +1280,7 @@ namespace ams::dmnt {
/* Add the thread core. */
{
u32 core = 0;
m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_id);
R_DISCARD(m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_id));
AppendReplyFormat(m_reply_cur, m_reply_end, ";core:%u;", core);
}
@@ -1305,7 +1305,7 @@ namespace ams::dmnt {
/* If we should, break the process. */
if (do_break) {
m_debug_process.Break();
R_DISCARD(m_debug_process.Break());
}
}
}
@@ -1721,7 +1721,7 @@ namespace ams::dmnt {
}
void GdbServerImpl::k() {
m_debug_process.Terminate();
R_DISCARD(m_debug_process.Terminate());
m_killed = true;
}
@@ -2369,7 +2369,7 @@ namespace ams::dmnt {
/* Get the thread core. */
u32 core = 0;
m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_ids[i]);
R_DISCARD(m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_ids[i]));
/* Get the thread name. */
char name[os::ThreadNameLengthMax + 1];
@@ -197,7 +197,7 @@ namespace ams::dmnt {
g_last_bp_ctx_register = g_last_bp_register;
for (int i = g_last_bp_ctx_register; i >= static_cast<int>(svc::HardwareBreakPointRegisterName_I0); --i) {
const Result result = svc::SetHardwareBreakPoint(static_cast<svc::HardwareBreakPointRegisterName>(i), dbgbcr, svc::PseudoHandle::CurrentProcess);
svc::SetHardwareBreakPoint(static_cast<svc::HardwareBreakPointRegisterName>(i), 0, 0);
R_DISCARD(svc::SetHardwareBreakPoint(static_cast<svc::HardwareBreakPointRegisterName>(i), 0, 0));
if (R_FAILED(result)) {
if (!svc::ResultInvalidHandle::Includes(result)) {