From 46ee82bf019f0b010cc1da93e6186e669dcc575c Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Thu, 14 Mar 2013 14:48:25 -0400 Subject: [PATCH] nitdbg: Added module debugger Signed-off-by: Lucas BAJOLET --- src/debugger.nit | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/debugger.nit diff --git a/src/debugger.nit b/src/debugger.nit new file mode 100644 index 0000000..ca4acb0 --- /dev/null +++ b/src/debugger.nit @@ -0,0 +1,47 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Lucas Bajolet +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Debugging of a nit program using the NaiveInterpreter +module debugger + +intrude import naive_interpreter + +redef class ModelBuilder + # Execute the program from the entry point (Sys::main) of the `mainmodule' + # `arguments' are the command-line arguments in order + # REQUIRE that: + # 1. the AST is fully loaded. + # 2. the model is fully built. + # 3. the instructions are fully analysed. + fun run_debugger(mainmodule: MModule, arguments: Array[String]) + do + var time0 = get_time + self.toolcontext.info("*** START INTERPRETING ***", 1) + + var interpreter = new Debugger(self, mainmodule, arguments) + + init_naive_interpreter(interpreter, mainmodule) + + var time1 = get_time + self.toolcontext.info("*** END INTERPRETING: {time1-time0} ***", 2) + end +end + +# The class extending NaiveInterpreter by adding debugging methods +class Debugger + super NaiveInterpreter + +end -- 1.7.9.5