Compare commits

...

3 commits

Author SHA1 Message Date
german77
615f8a3ef3 dmnt: Fix debug log for cheats 2024-02-14 10:28:16 -07:00
Liam
000e382c42 dmnt.gen2: avoid data abort when too many breakpoints are created 2024-02-14 10:27:45 -07:00
Liam
3627356d4b dmnt.gen2: enable gdbserver QStartNoAckMode 2024-02-14 10:27:36 -07:00
4 changed files with 19 additions and 6 deletions

View file

@ -45,7 +45,7 @@ namespace ams::dmnt {
} }
if (R_FAILED(result)) { if (R_FAILED(result)) {
AMS_DMNT2_GDB_LOG_DEBUG("BreakPointManager::SetBreakPoint %p 0x%lx !!! Fail 0x%08x !!!\n", bp, bp->m_address, result.GetValue()); AMS_DMNT2_GDB_LOG_DEBUG("BreakPointManager::SetBreakPoint %p 0x%lx !!! Fail 0x%08x !!!\n", bp, address, result.GetValue());
} }
R_RETURN(result); R_RETURN(result);

View file

@ -1538,13 +1538,18 @@ namespace ams::dmnt {
} }
void GdbServerImpl::Q() { void GdbServerImpl::Q() {
if (false) { if (ParsePrefix(m_receive_packet, "QStartNoAckMode")) {
/* TODO: QStartNoAckMode? */ this->QStartNoAckMode();
} else { } else {
AMS_DMNT2_GDB_LOG_DEBUG("Not Implemented Q: %s\n", m_receive_packet); AMS_DMNT2_GDB_LOG_DEBUG("Not Implemented Q: %s\n", m_receive_packet);
} }
} }
void GdbServerImpl::QStartNoAckMode() {
m_packet_io.SetNoAck();
AppendReplyOk(m_reply_cur, m_reply_end);
}
void GdbServerImpl::T() { void GdbServerImpl::T() {
if (const char *dot = std::strchr(m_receive_packet, '.'); dot != nullptr) { if (const char *dot = std::strchr(m_receive_packet, '.'); dot != nullptr) {
const u64 thread_id = DecodeHex(dot + 1); const u64 thread_id = DecodeHex(dot + 1);
@ -1919,6 +1924,7 @@ namespace ams::dmnt {
R_SUCCEED(); R_SUCCEED();
} }
void GdbServerImpl::q() { void GdbServerImpl::q() {
if (ParsePrefix(m_receive_packet, "qAttached:")) { if (ParsePrefix(m_receive_packet, "qAttached:")) {
this->qAttached(); this->qAttached();
@ -2145,6 +2151,7 @@ namespace ams::dmnt {
AppendReplyFormat(m_reply_cur, m_reply_end, ";swbreak+"); AppendReplyFormat(m_reply_cur, m_reply_end, ";swbreak+");
AppendReplyFormat(m_reply_cur, m_reply_end, ";hwbreak+"); AppendReplyFormat(m_reply_cur, m_reply_end, ";hwbreak+");
AppendReplyFormat(m_reply_cur, m_reply_end, ";vContSupported+"); AppendReplyFormat(m_reply_cur, m_reply_end, ";vContSupported+");
AppendReplyFormat(m_reply_cur, m_reply_end, ";QStartNoAckMode+");
} }
void GdbServerImpl::qXfer() { void GdbServerImpl::qXfer() {

View file

@ -77,6 +77,8 @@ namespace ams::dmnt {
void Q(); void Q();
void QStartNoAckMode();
void T(); void T();
void Z(); void Z();
@ -115,4 +117,4 @@ namespace ams::dmnt {
Result ParseVCont(char * const token, u64 *thread_ids, u8 *continue_modes, s32 num_threads, DebugProcess::ContinueMode &default_continue_mode); Result ParseVCont(char * const token, u64 *thread_ids, u8 *continue_modes, s32 num_threads, DebugProcess::ContinueMode &default_continue_mode);
}; };
} }

View file

@ -46,8 +46,11 @@ namespace ams::dmnt::cheat::impl {
void CheatVirtualMachine::OpenDebugLogFile() { void CheatVirtualMachine::OpenDebugLogFile() {
#ifdef DMNT_CHEAT_VM_DEBUG_LOG #ifdef DMNT_CHEAT_VM_DEBUG_LOG
CloseDebugLogFile(); CloseDebugLogFile();
R_ABORT_UNLESS(fs::OpenFile(std::addressof(m_debug_log_file), "sdmc:/atmosphere/cheat_vm_logs/debug_log.txt")); fs::EnsureDirectory("sdmc:/atmosphere/cheat_vm_logs");
fs::CreateFile("sdmc:/atmosphere/cheat_vm_logs/debug_log.txt", 0);
R_ABORT_UNLESS(fs::OpenFile(std::addressof(m_debug_log_file), "sdmc:/atmosphere/cheat_vm_logs/debug_log.txt", fs::OpenMode_Write | fs::OpenMode_AllowAppend));
m_debug_log_file_offset = 0; m_debug_log_file_offset = 0;
m_has_debug_log_file = true;
#endif #endif
} }
@ -80,7 +83,8 @@ namespace ams::dmnt::cheat::impl {
fmt_len += 1; fmt_len += 1;
} }
fs::WriteFile(m_debug_log_file, m_debug_log_offset, m_debug_log_format_buf, fmt_len, fs::WriteOption::Flush); fs::WriteFile(m_debug_log_file, m_debug_log_file_offset, m_debug_log_format_buf, fmt_len, fs::WriteOption::Flush);
m_debug_log_file_offset += fmt_len;
#else #else
AMS_UNUSED(format); AMS_UNUSED(format);
#endif #endif