@@ -110,7 +110,7 @@ pub struct LiveDebuggerCallbacks {
110110#[ derive( Default ) ]
111111pub struct LiveDebuggerState {
112112 pub spans_map : HashMap < String , i64 > ,
113- pub active : HashMap < String , ( RemoteConfigParsed , MaybeShmLimiter ) > ,
113+ pub active : HashMap < String , Box < ( RemoteConfigParsed , MaybeShmLimiter ) > > , // Box<> for stable heap address!
114114 pub config_id : String ,
115115 pub allow_dfa : Option < Regex > ,
116116 pub deny_dfa : Option < Regex > ,
@@ -390,7 +390,7 @@ pub extern "C" fn ddog_process_remote_configs(remote_config: &mut RemoteConfigSt
390390 if let Some ( data) = value. data {
391391 match value. product {
392392 RemoteConfigProduct :: LiveDebugger => {
393- let val = ( data, MaybeShmLimiter :: open ( limiter_index) ) ;
393+ let val = Box :: new ( ( data, MaybeShmLimiter :: open ( limiter_index) ) ) ;
394394 let rc_ref: & mut RemoteConfigState = unsafe { mem:: transmute ( remote_config as * mut _ ) } ; // sigh, borrow checker
395395 let entry = remote_config. live_debugger . active . entry ( value. config_id ) ;
396396 let ( parsed, limiter) = match entry {
@@ -438,8 +438,8 @@ pub extern "C" fn ddog_process_remote_configs(remote_config: &mut RemoteConfigSt
438438 }
439439 RemoteConfigUpdate :: Remove ( path) => match path. product {
440440 RemoteConfigProduct :: LiveDebugger => {
441- if let Some ( ( parsed , _ ) ) = remote_config. live_debugger . active . remove ( & path. config_id ) {
442- if let Some ( debugger) = parsed . downcast :: < LiveDebuggingData > ( ) {
441+ if let Some ( boxed ) = remote_config. live_debugger . active . remove ( & path. config_id ) {
442+ if let Some ( debugger) = boxed . 0 . downcast :: < LiveDebuggingData > ( ) {
443443 remove_config ( remote_config, debugger) ;
444444 }
445445 }
@@ -552,8 +552,8 @@ fn remove_config(remote_config: &mut RemoteConfigState, debugger: &LiveDebugging
552552pub extern "C" fn ddog_remote_config_get_loaded_configs ( remote_config : & RemoteConfigState ) -> * mut c_char {
553553 let mut entries: Vec < ( String , String ) > = Vec :: new ( ) ;
554554
555- for ( config_id, ( parsed , _ ) ) in & remote_config. live_debugger . active {
556- if let Some ( debugger) = parsed . downcast :: < LiveDebuggingData > ( ) {
555+ for ( config_id, boxed ) in & remote_config. live_debugger . active {
556+ if let Some ( debugger) = boxed . 0 . downcast :: < LiveDebuggingData > ( ) {
557557 let value = match debugger {
558558 LiveDebuggingData :: Probe ( p) => format ! ( r#"{{"type":"probe","id":"{}"}}"# , p. id) ,
559559 LiveDebuggingData :: ServiceConfiguration ( sc) => format ! ( r#"{{"type":"service_config","id":"{}"}}"# , sc. id) ,
@@ -610,13 +610,13 @@ pub extern "C" fn ddog_type_can_be_instrumented(
610610
611611#[ no_mangle]
612612pub extern "C" fn ddog_global_log_probe_limiter_inc ( remote_config : & RemoteConfigState ) -> bool {
613- if let Some ( ( parsed , limiter ) ) = remote_config
613+ if let Some ( boxed ) = remote_config
614614 . live_debugger
615615 . active
616616 . get ( & remote_config. live_debugger . config_id )
617617 {
618- if let Some ( LiveDebuggingData :: ServiceConfiguration ( config) ) = parsed . downcast :: < LiveDebuggingData > ( ) {
619- limiter . inc ( config. sampling_snapshots_per_second )
618+ if let Some ( LiveDebuggingData :: ServiceConfiguration ( config) ) = boxed . 0 . downcast :: < LiveDebuggingData > ( ) {
619+ boxed . 1 . inc ( config. sampling_snapshots_per_second )
620620 } else {
621621 true
622622 }
@@ -720,9 +720,9 @@ pub extern "C" fn ddog_set_dynamic_instrumentation_enabled(
720720 }
721721 } else {
722722 // Reinstall all probes currently stored in `active`.
723- for ( probe_id, ( parsed , limiter ) ) in remote_config. live_debugger . active . iter ( ) {
724- if let Some ( LiveDebuggingData :: Probe ( probe) ) = parsed . downcast :: < LiveDebuggingData > ( ) {
725- let hook_id = ( callbacks. set_probe ) ( probe. into ( ) , limiter ) ;
723+ for ( probe_id, boxed ) in remote_config. live_debugger . active . iter ( ) {
724+ if let Some ( LiveDebuggingData :: Probe ( probe) ) = boxed . 0 . downcast :: < LiveDebuggingData > ( ) {
725+ let hook_id = ( callbacks. set_probe ) ( probe. into ( ) , & boxed . 1 ) ;
726726 if hook_id >= 0 {
727727 remote_config
728728 . live_debugger
0 commit comments