@@ -568,7 +568,8 @@ var MonoSupportLib = {
568568 } ,
569569 } ,
570570
571- mono_wasm_add_dbg_command_received : function ( res_ok , id , buffer , buffer_len ) {
571+ mono_wasm_add_dbg_command_received : function ( res_ok , id , buffer , buffer_len )
572+ {
572573 const assembly_data = new Uint8Array ( Module . HEAPU8 . buffer , buffer , buffer_len ) ;
573574 const base64String = MONO . _base64Converter . toBase64StringImpl ( assembly_data ) ;
574575 const buffer_obj = {
@@ -578,7 +579,9 @@ var MonoSupportLib = {
578579 value : base64String
579580 }
580581 }
581- MONO . commands_received = buffer_obj ;
582+ if ( MONO . commands_received . has ( id ) )
583+ console . warn ( "Addind an id that already exists in commands_received" ) ;
584+ MONO . commands_received . set ( id , buffer_obj ) ;
582585 } ,
583586
584587 mono_wasm_malloc_and_set_debug_buffer : function ( command_parameters )
@@ -594,11 +597,18 @@ var MonoSupportLib = {
594597 this . _debugger_heap_bytes . set ( this . _base64_to_uint8 ( command_parameters ) ) ;
595598 } ,
596599
600+ mono_get_and_delete_from_commands_received : function ( id )
601+ {
602+ const res = MONO . commands_received . get ( id ) ;
603+ MONO . commands_received . delete ( id ) ;
604+ return res ;
605+ } ,
606+
597607 mono_wasm_send_dbg_command_with_parms : function ( id , command_set , command , command_parameters , length , valtype , newvalue )
598608 {
599609 this . mono_wasm_malloc_and_set_debug_buffer ( command_parameters ) ;
600610 this . _c_fn_table . mono_wasm_send_dbg_command_with_parms_wrapper ( id , command_set , command , this . _debugger_buffer , length , valtype , newvalue . toString ( ) ) ;
601- let { res_ok, res } = MONO . commands_received ;
611+ let { res_ok, res } = this . mono_get_and_delete_from_commands_received ( id ) ;
602612 if ( ! res_ok )
603613 throw new Error ( `Failed on mono_wasm_invoke_method_debugger_agent_with_parms` ) ;
604614 return res ;
@@ -608,7 +618,7 @@ var MonoSupportLib = {
608618 {
609619 this . mono_wasm_malloc_and_set_debug_buffer ( command_parameters ) ;
610620 this . _c_fn_table . mono_wasm_send_dbg_command_wrapper ( id , command_set , command , this . _debugger_buffer , command_parameters . length ) ;
611- let { res_ok, res } = MONO . commands_received ;
621+ let { res_ok, res } = this . mono_get_and_delete_from_commands_received ( id ) ;
612622 if ( ! res_ok )
613623 throw new Error ( `Failed on mono_wasm_send_dbg_command` ) ;
614624 return res ;
@@ -617,7 +627,7 @@ var MonoSupportLib = {
617627
618628 mono_wasm_get_dbg_command_info : function ( )
619629 {
620- let { res_ok, res } = MONO . commands_received ;
630+ let { res_ok, res } = this . mono_get_and_delete_from_commands_received ( 0 ) ;
621631 if ( ! res_ok )
622632 throw new Error ( `Failed on mono_wasm_get_dbg_command_info` ) ;
623633 return res ;
@@ -712,14 +722,14 @@ var MonoSupportLib = {
712722 if ( prop . get !== undefined ) {
713723 Object . defineProperty ( proxy ,
714724 prop . name ,
715- { get ( ) { return MONO . mono_wasm_send_dbg_command ( - 1 , prop . get . commandSet , prop . get . command , prop . get . buffer , prop . get . length ) ; } ,
716- set : function ( newValue ) { MONO . mono_wasm_send_dbg_command_with_parms ( - 1 , prop . set . commandSet , prop . set . command , prop . set . buffer , prop . set . length , prop . set . valtype , newValue ) ; return MONO . commands_received . res_ok ; } }
725+ { get ( ) { return MONO . mono_wasm_send_dbg_command ( prop . get . id , prop . get . commandSet , prop . get . command , prop . get . buffer , prop . get . length ) ; } ,
726+ set : function ( newValue ) { MONO . mono_wasm_send_dbg_command_with_parms ( prop . set . id , prop . set . commandSet , prop . set . command , prop . set . buffer , prop . set . length , prop . set . valtype , newValue ) ; return true ; } }
717727 ) ;
718728 } else if ( prop . set !== undefined ) {
719729 Object . defineProperty ( proxy ,
720730 prop . name ,
721731 { get ( ) { return prop . value ; } ,
722- set : function ( newValue ) { MONO . mono_wasm_send_dbg_command_with_parms ( - 1 , prop . set . commandSet , prop . set . command , prop . set . buffer , prop . set . length , prop . set . valtype , newValue ) ; return MONO . commands_received . res_ok ; } }
732+ set : function ( newValue ) { MONO . mono_wasm_send_dbg_command_with_parms ( prop . set . id , prop . set . commandSet , prop . set . command , prop . set . buffer , prop . set . length , prop . set . valtype , newValue ) ; return true ; } }
723733 ) ;
724734 } else {
725735 proxy [ prop . name ] = prop . value ;
@@ -835,6 +845,7 @@ var MonoSupportLib = {
835845 } ,
836846
837847 mono_wasm_runtime_ready : function ( ) {
848+ MONO . commands_received = new Map ( ) ;
838849 this . mono_wasm_runtime_is_ready = true ;
839850 this . _clear_per_step_state ( ) ;
840851
0 commit comments