]> git.lizzy.rs Git - rust.git/commitdiff
miri: debug! print when we are leaving/entering a function
authorRalf Jung <post@ralfj.de>
Wed, 17 Oct 2018 10:46:20 +0000 (12:46 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 18 Oct 2018 10:09:00 +0000 (12:09 +0200)
With a hack to exclude the topmost function for now, because that triggers an ICE...

src/librustc_mir/interpret/eval_context.rs

index 102dda9f17e3bcd41d8820aa786e6aedf62e1d98..5fcd5307b8e24c37af2ecaa6c85bbe4954c21203 100644 (file)
@@ -438,6 +438,9 @@ pub fn push_stack_frame(
         return_place: Option<PlaceTy<'tcx, M::PointerTag>>,
         return_to_block: StackPopCleanup,
     ) -> EvalResult<'tcx> {
+        if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc...
+            debug!("PAUSING({}) {}", self.cur_frame(), self.frame().instance);
+        }
         ::log_settings::settings().indentation += 1;
 
         // first push a stack frame so we have access to the local substs
@@ -502,6 +505,10 @@ pub fn push_stack_frame(
             self.frame_mut().locals = locals;
         }
 
+        if self.stack.len() > 1 { // FIXME no check should be needed, but printing topmost frame crashes rustc...
+            debug!("ENTERING({}) {}", self.cur_frame(), self.frame().instance);
+        }
+
         if self.stack.len() > self.tcx.sess.const_eval_stack_frame_limit {
             err!(StackFrameLimitReached)
         } else {
@@ -510,6 +517,9 @@ pub fn push_stack_frame(
     }
 
     pub(super) fn pop_stack_frame(&mut self) -> EvalResult<'tcx> {
+        if self.stack.len() > 1 { // FIXME no check should be needed, but printing topmost frame crashes rustc...
+            debug!("LEAVING({}) {}", self.cur_frame(), self.frame().instance);
+        }
         ::log_settings::settings().indentation -= 1;
         let frame = self.stack.pop().expect(
             "tried to pop a stack frame, but there were none",
@@ -553,6 +563,10 @@ pub(super) fn pop_stack_frame(&mut self) -> EvalResult<'tcx> {
             return err!(Unreachable);
         }
 
+        if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc...
+            debug!("CONTINUING({}) {}", self.cur_frame(), self.frame().instance);
+        }
+
         Ok(())
     }