about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-10-17 12:46:20 +0200
committerRalf Jung <post@ralfj.de>2018-10-18 12:09:00 +0200
commit24724efe1c590893f8d50280acb236c4b998c3d6 (patch)
treecb543432dbba12d592e90f6aaeda112a442b98c5
parentabf6f4781f906a50c800f38db6e95a693d804865 (diff)
downloadrust-24724efe1c590893f8d50280acb236c4b998c3d6.tar.gz
rust-24724efe1c590893f8d50280acb236c4b998c3d6.zip
miri: debug! print when we are leaving/entering a function
With a hack to exclude the topmost function for now, because that triggers an ICE...
-rw-r--r--src/librustc_mir/interpret/eval_context.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 102dda9f17e..5fcd5307b8e 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -438,6 +438,9 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
         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 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
             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 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
     }
 
     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 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
             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(())
     }