See More

#!/usr/bin/env python """ Debugger for the pyyhon-csp library. Copyright (C) Sarah Mount, 2010. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have rceeived a copy of the GNU General Public License along with this program. If not, see . """ __author__ = 'Sarah Mount ' __date__ = 'May 2010' import sys import csp.tracer.tracer as tracer from optparse import OptionParser parser = OptionParser() parser.add_option('-p', '--prog', dest='program', action='store', help='Program to be debugged') parser.add_option('-a', '--all', dest='all', action='store_true', help='Provide all available debugging information') parser.add_option('-m', '--model', dest='model', action='store_true', help='Provide a CSP_M model of PROGRAM, suitable for use with the FDR2 model checker') parser.add_option('-g', '--graph', dest='graph', action='store_true', help='Provide (as a PNG) a graph of the processes and guards created by PROGRAM') parser.add_option('-t', '--trace', dest='trace', action='store_true', help='Provide a Hoare-style CSP trace of PROGRAM') parser.add_option('-v', '--vcr', dest='vcr', action='store_true', help='Provide a view-centric reasoning trace of PROGRAM') parser.add_option('-s', '--struct', dest='struct', action='store_true', help='Provide a structural trace of PROGRAM') def create_icode(): """Create an ICODE model of the given program. """ raise NotImplementedError('ICODE models not yet implemented') def create_model(icode): """Create a CSP_M model of the given program """ raise NotImplementedError('CSP_M models not yet implemented') def create_graph(icode): """Create a process graph of the given program """ raise NotImplementedError('Process graphs not yet implemented') def create_trace(icode): """Create an CSP trace of the given program. """ raise NotImplementedError('CSP traces not yet implemented') def create_vcr(icode): """Create an VCR trace of the given program. """ raise NotImplementedError('VCR traces not yet implemented') def create_struct(icode): """Create a structural trace of the given program. """ raise NotImplementedError('ICODE models not yet implemented') if __name__ == '__main__': (options, args) = parser.parse_args() if options.program: with tracer.csptrace(): exec(compile(open(options.program).read(), options.program, 'exec')) else: parser.print_help() if options.all: icode = create_icode() create_model(icode) create_graph(icode) create_trace(icode) create_vcr(icode) create_struct(icode) sys.exit() if options.model: create_model(icode) if options.graph: create_graph(icode) if options.trace: create_trace(icode) if options.vcr: create_vcr(icode) if options.struct: create_struct(icode)