@@ -998,12 +998,18 @@ bool CLR_DBG_Debugger::Monitor_WriteMemory(WP_Message *msg)
998
998
{
999
999
NATIVE_PROFILE_CLR_DEBUGGER ();
1000
1000
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;
1003
1004
1005
+ // command reply is to be loaded with the error code and sent back to the caller
1004
1006
g_CLR_DBG_Debugger->AccessMemory (cmd->address , cmd->length , cmd->data , AccessMemory_Write, &errorCode);
1005
1007
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));
1007
1013
1008
1014
return true ;
1009
1015
}
@@ -1012,13 +1018,17 @@ bool CLR_DBG_Debugger::Monitor_CheckMemory(WP_Message *msg)
1012
1018
{
1013
1019
NATIVE_PROFILE_CLR_DEBUGGER ();
1014
1020
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;
1017
1024
1025
+ // access memory execution will load the command reply with the error code
1018
1026
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);
1020
1028
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));
1022
1032
1023
1033
return true ;
1024
1034
}
@@ -1027,12 +1037,18 @@ bool CLR_DBG_Debugger::Monitor_EraseMemory(WP_Message *msg)
1027
1037
{
1028
1038
NATIVE_PROFILE_CLR_DEBUGGER ();
1029
1039
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;
1032
1043
1044
+ // command reply is to be loaded with the error code and sent back to the caller
1033
1045
g_CLR_DBG_Debugger->AccessMemory (cmd->address , cmd->length , NULL , AccessMemory_Erase, &errorCode);
1034
1046
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));
1036
1052
1037
1053
return true ;
1038
1054
}
0 commit comments