debugger: Added help/bad_command functions
authorLucas Bajolet <r4pass@hotmail.com>
Thu, 9 Oct 2014 18:59:37 +0000 (14:59 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Wed, 15 Oct 2014 13:53:45 +0000 (09:53 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

src/interpreter/debugger.nit

index 8b52f5a..308eba6 100644 (file)
@@ -539,6 +539,42 @@ class Debugger
                return true
        end
 
+       # Produces help for the commands of the debugger
+       fun help do
+               print ""
+               print "Help :"
+               print "-----------------------------------"
+               print ""
+               print "Variables"
+               print " * Modification: var_name = value (Warning: var_name must be primitive)"
+               print " * Alias: var_name as alias"
+               print ""
+               print "Printing"
+               print " * Variables: p(rint) var_name (Use * to print all local variables)"
+               print " * Collections: p(rint) var_name '[' start_index (.. end_index) ']'"
+               print ""
+               print "Breakpoints"
+               print " * File/line: b(reak) file_name line_number"
+               print " * Remove: d(elete) id"
+               print ""
+               print "Tracepoints"
+               print " * Variable: trace var_name break/print"
+               print " * Untrace variable: untrace var_name"
+               print ""
+               print "Flow control"
+               print " * Next instruction (same-level): n"
+               print " * Next instruction: s"
+               print " * Finish current method: finish"
+               print " * Continue until next breakpoint or end: c"
+               print ""
+               print "General commands"
+               print " * quit: Quits the debugger"
+               print " * abort: Aborts the interpretation, prints the stack trace before leaving"
+               print " * nitx: Ask questions to the model about its entities (classes, methods, etc.)"
+               print " * nit: Inject dynamic code for interpretation"
+               print ""
+       end
+
        #######################################################################
        ##               Processing specific command functions               ##
        #######################################################################
@@ -581,6 +617,10 @@ class Debugger
                return false
        end
 
+       fun bad_command(cmd: String) do
+               print "Unrecognized command {cmd}. Use 'help' to show help."
+       end
+
        # Prints the demanded variable in the command
        #
        # The name of the variable in in position 1 of the array 'parts_of_command'