@@ -998,12 +998,18 @@ bool CLR_DBG_Debugger::Monitor_WriteMemory(WP_Message *msg)
998998{
999999 NATIVE_PROFILE_CLR_DEBUGGER ();
10001000
1001- auto *cmd = (CLR_DBG_Commands_Monitor_WriteMemory *)msg->m_payload ;
1002- CLR_DBG_Commands_Monitor_WriteMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
1001+ CLR_DBG_Commands_Monitor_WriteMemory *cmd = (CLR_DBG_Commands_Monitor_WriteMemory *)msg->m_payload ;
1002+ CLR_DBG_Commands_Monitor_WriteMemory_Reply cmdReply;
1003+ uint32_t errorCode;
10031004
1005+ // command reply is to be loaded with the error code and sent back to the caller
10041006 g_CLR_DBG_Debugger->AccessMemory (cmd->address , cmd->length , cmd->data , AccessMemory_Write, &errorCode);
10051007
1006- WP_ReplyToCommand (msg, true , false , &errorCode, sizeof (errorCode));
1008+ // copy over the error code to the command reply
1009+ cmdReply = errorCode;
1010+
1011+ // the execution of this command is always successful, and the reply carries the error code
1012+ WP_ReplyToCommand (msg, true , false , &cmdReply, sizeof (cmdReply));
10071013
10081014 return true ;
10091015}
@@ -1012,13 +1018,17 @@ bool CLR_DBG_Debugger::Monitor_CheckMemory(WP_Message *msg)
10121018{
10131019 NATIVE_PROFILE_CLR_DEBUGGER ();
10141020
1015- auto *cmd = (CLR_DBG_Commands_Monitor_CheckMemory *)msg->m_payload ;
1016- CLR_DBG_Commands_Monitor_CheckMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
1021+ CLR_DBG_Commands_Monitor_CheckMemory *cmd = (CLR_DBG_Commands_Monitor_CheckMemory *)msg->m_payload ;
1022+ CLR_DBG_Commands_Monitor_CheckMemory_Reply cmdReply;
1023+ uint32_t errorCode;
10171024
1025+ // access memory execution will load the command reply with the error code
10181026 g_CLR_DBG_Debugger
1019- ->AccessMemory (cmd->address , cmd->length , (unsigned char *)&errorCode , AccessMemory_Check, &errorCode);
1027+ ->AccessMemory (cmd->address , cmd->length , (unsigned char *)&cmdReply , AccessMemory_Check, &errorCode);
10201028
1021- WP_ReplyToCommand (msg, errorCode == AccessMemoryErrorCode_NoError, false , &errorCode, sizeof (errorCode));
1029+ // the execution of this command will fail if there is an error code, never the less, the error code is returned to
1030+ // the caller
1031+ WP_ReplyToCommand (msg, errorCode == AccessMemoryErrorCode_NoError, false , &cmdReply, sizeof (cmdReply));
10221032
10231033 return true ;
10241034}
@@ -1027,12 +1037,18 @@ bool CLR_DBG_Debugger::Monitor_EraseMemory(WP_Message *msg)
10271037{
10281038 NATIVE_PROFILE_CLR_DEBUGGER ();
10291039
1030- auto *cmd = (CLR_DBG_Commands_Monitor_EraseMemory *)msg->m_payload ;
1031- CLR_DBG_Commands_Monitor_EraseMemory_Reply errorCode = AccessMemoryErrorCode_NoError;
1040+ CLR_DBG_Commands_Monitor_EraseMemory *cmd = (CLR_DBG_Commands_Monitor_EraseMemory *)msg->m_payload ;
1041+ CLR_DBG_Commands_Monitor_EraseMemory_Reply cmdReply;
1042+ uint32_t errorCode;
10321043
1044+ // command reply is to be loaded with the error code and sent back to the caller
10331045 g_CLR_DBG_Debugger->AccessMemory (cmd->address , cmd->length , NULL , AccessMemory_Erase, &errorCode);
10341046
1035- WP_ReplyToCommand (msg, true , false , &errorCode, sizeof (errorCode));
1047+ // copy over the error code to the command reply
1048+ cmdReply = errorCode;
1049+
1050+ // the execution of this command is always successful, and the reply carries the error code
1051+ WP_ReplyToCommand (msg, true , false , &cmdReply, sizeof (cmdReply));
10361052
10371053 return true ;
10381054}
0 commit comments