-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcspdb
More file actions
121 lines (86 loc) · 3.55 KB
/
Copy pathcspdb
File metadata and controls
121 lines (86 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/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 <http://www.gnu.org/licenses/>.
"""
__author__ = 'Sarah Mount <s.mount@wlv.ac.uk>'
__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)