6 DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".dbg.out"
7 OPT_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".dbg.opt.out"
8 LOG_FILE="Output/" + sys.argv[1] + ".log"
9 NATIVE_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".native.dbg.out"
10 NATIVE_OPT_DBG_OUTPUT_FILE="Output/" + sys.argv[1] + ".native.dbg.opt.out"
11 NATIVE_LOG_FILE="Output/" + sys.argv[1] + ".native.log"
12 REPORT_FILE="Output/" + sys.argv[1] + ".dbg.report.html"
15 def __init__(self, bp_name):
18 self.missing_args = []
19 self.matching_args = []
20 self.notmatching_args = []
21 self.missing_bp = False
24 self.missing_bp = True
26 def getArgCount(self):
27 return len(self.values)
29 def getMissingArgCount(self):
30 if self.missing_bp == True:
31 return len(self.values)
32 return len(self.missing_args)
34 def getMatchingArgCount(self):
35 if self.missing_bp == True:
37 return len(self.matching_args)
39 def getNotMatchingArgCount(self):
40 if self.missing_bp == True:
42 return len(self.notmatching_args)
44 def recordArgument(self, arg_name, value):
45 self.values[arg_name] = value
49 items = self.values.items()
50 for i in range(len(items)):
51 print items[i][0]," = ",items[i][1]
54 def compare_args(self, other, file):
55 myitems = self.values.items()
56 otheritems = other.values.items()
58 for i in range(len(myitems)):
59 if i >= len(otheritems):
61 self.missing_args.append(myitems[i][0])
62 elif cmp(myitems[i][1], otheritems[i][1]):
64 self.notmatching_args.append(myitems[i][0])
66 self.matching_args.append(myitems[i][0])
68 self.print_list(self.matching_args, " Matching arguments ", file)
69 self.print_list(self.notmatching_args, " Not Matching arguments ", file)
70 self.print_list(self.missing_args, " Missing arguments ", file)
73 def print_list(self, items, txt, pfile):
76 pfile.write(self.name)
83 def read_input(filename, dict):
84 f = open(filename, "r")
86 for l in range(len(lines)):
88 if c[0] == "#Breakpoint":
93 if c[0] == "#Argument":
98 bp.recordArgument(c[3], c[4])
102 read_input(DBG_OUTPUT_FILE, f1_breakpoints)
103 f1_items = f1_breakpoints.items()
106 read_input(OPT_DBG_OUTPUT_FILE, f2_breakpoints)
107 f2_items = f2_breakpoints.items()
109 f = open(LOG_FILE, "w")
110 f.write("Log output\n")
111 for f2bp in range(len(f2_items)):
112 id = f2_items[f2bp][0]
113 bp = f2_items[f2bp][1]
114 bp1 = f1_breakpoints.get(id)
118 bp1.compare_args(bp,f)
122 read_input(NATIVE_DBG_OUTPUT_FILE, nf1_breakpoints)
123 nf1_items = nf1_breakpoints.items()
126 read_input(NATIVE_OPT_DBG_OUTPUT_FILE, nf2_breakpoints)
127 nf2_items = nf2_breakpoints.items()
129 nfl = open(NATIVE_LOG_FILE, "w")
130 for nf2bp in range(len(nf2_items)):
131 id = nf2_items[nf2bp][0]
132 bp = nf2_items[nf2bp][1]
133 bp1 = nf1_breakpoints.get(id)
137 bp1.compare_args(bp,nfl)
141 f1_matching_arg_count = 0
142 f1_notmatching_arg_count = 0
143 f1_missing_arg_count = 0
144 for idx in range(len(f1_items)):
145 bp = f1_items[idx][1]
146 f1_arg_count = f1_arg_count + bp.getArgCount()
147 f1_matching_arg_count = f1_matching_arg_count + bp.getMatchingArgCount()
148 f1_notmatching_arg_count = f1_notmatching_arg_count + bp.getNotMatchingArgCount()
149 f1_missing_arg_count = f1_missing_arg_count + bp.getMissingArgCount()
152 nf1_matching_arg_count = 0
153 nf1_notmatching_arg_count = 0
154 nf1_missing_arg_count = 0
155 for idx in range(len(nf1_items)):
156 bp = nf1_items[idx][1]
157 nf1_arg_count = nf1_arg_count + bp.getArgCount()
158 nf1_matching_arg_count = nf1_matching_arg_count + bp.getMatchingArgCount()
159 nf1_notmatching_arg_count = nf1_notmatching_arg_count + bp.getNotMatchingArgCount()
160 nf1_missing_arg_count = nf1_missing_arg_count + bp.getMissingArgCount()
162 rf = open(REPORT_FILE, "w")
164 rf.write(str(sys.argv[1]))
165 rf.write("</td><td>|</td><td>")
166 rf.write(str(nf1_arg_count))
167 rf.write("</td><td><b>")
168 rf.write(str(nf1_matching_arg_count))
169 rf.write("</b></td><td>")
170 rf.write(str(nf1_notmatching_arg_count))
171 rf.write("</td><td>")
172 rf.write(str(nf1_missing_arg_count))
173 rf.write("</td><td>|</td><td>")
174 rf.write(str(f1_arg_count))
175 rf.write("</td><td><b>")
176 rf.write(str(f1_matching_arg_count))
177 rf.write("</b></td><td>")
178 rf.write(str(f1_notmatching_arg_count))
179 rf.write("</td><td>")
180 rf.write(str(f1_missing_arg_count))