File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ pub trait Operations {
4040 type Buffer : Buffer ;
4141
4242 /// Called when RTKit crashes.
43- fn crashed ( _data : <Self :: Data as ForeignOwnable >:: Borrowed < ' _ > ) { }
43+ fn crashed ( _data : <Self :: Data as ForeignOwnable >:: Borrowed < ' _ > , _crashlog : Option < & [ u8 ] > ) { }
4444
4545 /// Called when a message was received on a non-system endpoint. Called in non-IRQ context.
4646 fn recv_message (
@@ -92,9 +92,19 @@ pub struct RtKit<T: Operations> {
9292 _p : PhantomData < T > ,
9393}
9494
95- unsafe extern "C" fn crashed_callback < T : Operations > ( cookie : * mut core:: ffi:: c_void ) {
95+ unsafe extern "C" fn crashed_callback < T : Operations > (
96+ cookie : * mut core:: ffi:: c_void ,
97+ crashlog : * const core:: ffi:: c_void ,
98+ crashlog_size : usize ,
99+ ) {
100+ let crashlog = if !crashlog. is_null ( ) && crashlog_size > 0 {
101+ // SAFETY: The crashlog is either missing or a byte buffer of the specified size
102+ Some ( unsafe { core:: slice:: from_raw_parts ( crashlog as * const u8 , crashlog_size) } )
103+ } else {
104+ None
105+ } ;
96106 // SAFETY: cookie is always a T::Data in this API
97- T :: crashed ( unsafe { T :: Data :: borrow ( cookie) } ) ;
107+ T :: crashed ( unsafe { T :: Data :: borrow ( cookie) } , crashlog ) ;
98108}
99109
100110unsafe extern "C" fn recv_message_callback < T : Operations > (
You can’t perform that action at this time.
0 commit comments