From 4d7eec10e9a9b7e8cda11f9b0c867b73d3cbda6c Mon Sep 17 00:00:00 2001
From: losfair <zhy20000919@hotmail.com>
Date: Tue, 17 Dec 2019 00:32:26 +0800
Subject: [PATCH] fault, state: Cleanup and keep consistent with backend.

---
 lib/runtime-core/src/fault.rs | 7 +------
 lib/runtime-core/src/state.rs | 2 --
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/lib/runtime-core/src/fault.rs b/lib/runtime-core/src/fault.rs
index 89d5b800e..6aae53349 100644
--- a/lib/runtime-core/src/fault.rs
+++ b/lib/runtime-core/src/fault.rs
@@ -305,7 +305,6 @@ extern "C" fn signal_trap_handler(
                             std::slice::from_raw_parts(ip as *const u8, magic_size),
                         ) {
                             match ib.ty {
-                                InlineBreakpointType::Trace => {}
                                 InlineBreakpointType::Middleware => {
                                     let out: Option<Result<(), Box<dyn Any + Send>>> =
                                         with_breakpoint_map(|bkpt_map| {
@@ -321,7 +320,6 @@ extern "C" fn signal_trap_handler(
                                         unwind_result = e;
                                     }
                                 }
-                                _ => println!("Unknown breakpoint type: {:?}", ib.ty),
                             }
 
                             fault.ip.set(ip + magic_size);
@@ -464,10 +462,7 @@ pub struct FaultInfo {
 impl FaultInfo {
     /// Parses the stack and builds an execution state image.
     pub unsafe fn read_stack(&self, max_depth: Option<usize>) -> Option<ExecutionStateImage> {
-        let rsp = match self.known_registers[X64Register::GPR(GPR::RSP).to_index().0] {
-            Some(x) => x,
-            None => return None,
-        };
+        let rsp = self.known_registers[X64Register::GPR(GPR::RSP).to_index().0]?;
 
         Some(CURRENT_CODE_VERSIONS.with(|versions| {
             let versions = versions.borrow();
diff --git a/lib/runtime-core/src/state.rs b/lib/runtime-core/src/state.rs
index 7465f735e..fedbc745b 100644
--- a/lib/runtime-core/src/state.rs
+++ b/lib/runtime-core/src/state.rs
@@ -1063,7 +1063,6 @@ pub mod x64 {
             let mut is_baseline: Option<bool> = None;
 
             for version in versions() {
-                //println!("Lookup IP: {:x}", ret_addr);
                 match version
                     .msm
                     .lookup_call_ip(ret_addr as usize, version.base)
@@ -1251,7 +1250,6 @@ pub mod x64 {
                 stack: wasm_stack,
                 locals: wasm_locals,
             };
-            //println!("WFS = {:?}", wfs);
             results.push(wfs);
         }