@@ -1454,13 +1454,17 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
1454
1454
if ecx. machine . borrow_tracker . is_some ( ) {
1455
1455
ecx. on_stack_pop ( frame) ?;
1456
1456
}
1457
+ // tracing-tree can autoamtically annotate scope changes, but it gets very confused by our
1458
+ // concurrency and what it prints is just plain wrong. So we print our own information
1459
+ // instead. (Cc https://github.com/rust-lang/miri/issues/2266)
1460
+ info ! ( "Leaving {}" , ecx. frame( ) . instance) ;
1457
1461
Ok ( ( ) )
1458
1462
}
1459
1463
1460
1464
#[ inline( always) ]
1461
1465
fn after_stack_pop (
1462
1466
ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
1463
- mut frame : Frame < ' mir , ' tcx , Provenance , FrameExtra < ' tcx > > ,
1467
+ frame : Frame < ' mir , ' tcx , Provenance , FrameExtra < ' tcx > > ,
1464
1468
unwinding : bool ,
1465
1469
) -> InterpResult < ' tcx , StackPopJump > {
1466
1470
if frame. extra . is_user_relevant {
@@ -1470,10 +1474,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
1470
1474
// user-relevant frame and restore that here.)
1471
1475
ecx. active_thread_mut ( ) . recompute_top_user_relevant_frame ( ) ;
1472
1476
}
1473
- let timing = frame. extra . timing . take ( ) ;
1474
- let res = ecx. handle_stack_pop_unwind ( frame. extra , unwinding) ;
1475
- if let Some ( profiler) = ecx. machine . profiler . as_ref ( ) {
1476
- profiler. finish_recording_interval_event ( timing. unwrap ( ) ) ;
1477
+ let res = {
1478
+ // Move `frame`` into a sub-scope so we control when it will be dropped.
1479
+ let mut frame = frame;
1480
+ let timing = frame. extra . timing . take ( ) ;
1481
+ let res = ecx. handle_stack_pop_unwind ( frame. extra , unwinding) ;
1482
+ if let Some ( profiler) = ecx. machine . profiler . as_ref ( ) {
1483
+ profiler. finish_recording_interval_event ( timing. unwrap ( ) ) ;
1484
+ }
1485
+ res
1486
+ } ;
1487
+ // Needs to be done after dropping frame to show up on the right nesting level.
1488
+ // (Cc https://github.com/rust-lang/miri/issues/2266)
1489
+ if !ecx. active_thread_stack ( ) . is_empty ( ) {
1490
+ info ! ( "Continuing in {}" , ecx. frame( ) . instance) ;
1477
1491
}
1478
1492
res
1479
1493
}
0 commit comments