debugger: Removed module Breakpoint, moved Breakpoint class to debugger module
authorLucas Bajolet <r4pass@hotmail.com>
Thu, 9 Oct 2014 18:14:05 +0000 (14:14 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Tue, 14 Oct 2014 19:04:48 +0000 (15:04 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

src/interpreter/breakpoint.nit [deleted file]
src/interpreter/debugger.nit

diff --git a/src/interpreter/breakpoint.nit b/src/interpreter/breakpoint.nit
deleted file mode 100644 (file)
index ef04a3b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2013 Lucas Bajolet <lucas.bajolet@gmail.com>
-#
-# 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.
-
-# Classes and methods relative to the management of Breakpoints for the Debugger
-module breakpoint
-
-# Contains all the informations of a Breakpoint for the Debugger
-class Breakpoint
-
-       # Line to break on
-       var line: Int
-
-       # File concerned by the breakpoint
-       var file: String
-
-       # Maximum times to break on self
-       var max_breaks: Int
-
-       init(line: Int, file: String)
-       do
-               self.line = line
-               self.file = file
-               self.max_breaks = -1
-       end
-
-       fun set_max_breaks(breaks: Int)
-       do
-               self.max_breaks = breaks
-       end
-
-       # When the breakpoint is encountered, the check-in function should be called
-       fun check_in
-       do
-               if self.max_breaks > 0 then self.max_breaks -= 1
-       end
-
-       # Checks if the breakpoint is still valid (that is, if it has a remaining breaks number > 0 or == -1)
-       fun is_valid: Bool
-       do
-               if max_breaks == 0 then
-                       return false
-               else
-                       return true
-               end
-       end
-
-end
index 586c04c..8b52f5a 100644 (file)
@@ -17,7 +17,6 @@
 # Debugging of a nit program using the NaiveInterpreter
 module debugger
 
-import breakpoint
 intrude import naive_interpreter
 import nitx
 intrude import semantize::local_var_init
@@ -167,6 +166,20 @@ redef class ModelBuilder
        end
 end
 
+# Contains all the informations of a Breakpoint for the Debugger
+class Breakpoint
+
+       # Line to break on
+       var line: Int
+
+       # File concerned by the breakpoint
+       var file: String
+
+       redef init do
+               if not file.has_suffix(".nit") then file += ".nit"
+       end
+end
+
 # The class extending `NaiveInterpreter` by adding debugging methods
 class Debugger
        super NaiveInterpreter
@@ -379,14 +392,6 @@ class Debugger
                var breakpoint = find_breakpoint(curr_file, n.location.line_start)
 
                if breakpoints.keys.has(curr_file) and breakpoint != null then
-
-                       breakpoint.check_in
-
-                       if not breakpoint.is_valid
-                       then
-                               remove_breakpoint(curr_file, n.location.line_start)
-                       end
-
                        n.debug("Execute stmt {n.to_s}")
                        while read_cmd do end
                end
@@ -511,10 +516,6 @@ class Debugger
                        else if parts_of_command[0] == "break" or parts_of_command[0] == "b"
                        then
                                process_place_break_fun(parts_of_command)
-                       # Places a temporary breakpoint on line x of file y
-                       else if parts_of_command[0] == "tbreak" and (parts_of_command.length == 2 or parts_of_command.length == 3)
-                       then
-                               process_place_tbreak_fun(parts_of_command)
                        # Removes a breakpoint on line x of file y
                        else if parts_of_command[0] == "d" or parts_of_command[0] == "delete" then
                                process_remove_break_fun(parts_of_command)
@@ -1215,17 +1216,6 @@ class Debugger
                end
        end
 
-       #Places a breakpoint that will trigger once and be destroyed afterwards
-       fun process_place_tbreak_fun(parts_of_command: Array[String])
-       do
-               var bp = get_breakpoint_from_command(parts_of_command)
-               if bp != null
-               then
-                       bp.set_max_breaks(1)
-                       place_breakpoint(bp)
-               end
-       end
-
        #######################################################################
        ##                  Breakpoint removing functions                    ##
        #######################################################################