Skip to content

Commit 6b3e144

Browse files
committed
Security analyser drivers: cbmc -> jbmc
1 parent 427b98f commit 6b3e144

9 files changed

+33
-33
lines changed

benchmarks/TRAINING/diffblue/taint_traces_01_evaluator.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
"error_traces":
1919
{
20-
"cbmc":
20+
"jbmc":
2121
[
2222
"search_for_error_traces/error_trace_0.json"
2323
],

benchmarks/TRAINING/diffblue/taint_traces_04_evaluator.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[
1717
{
1818
"error_traces": {
19-
"cbmc": [
19+
"jbmc": [
2020
"search_for_error_traces/error_trace_0.json"
2121
],
2222
"symex": []
@@ -28,7 +28,7 @@
2828
},
2929
{
3030
"error_traces": {
31-
"cbmc": [
31+
"jbmc": [
3232
"search_for_error_traces/error_trace_1.json"
3333
],
3434
"symex": []
@@ -40,7 +40,7 @@
4040
},
4141
{
4242
"error_traces": {
43-
"cbmc": [
43+
"jbmc": [
4444
"search_for_error_traces/error_trace_2.json"
4545
],
4646
"symex": []

benchmarks/TRAINING/diffblue/taint_traces_05_evaluator.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[
1717
{
1818
"error_traces": {
19-
"cbmc": [
19+
"jbmc": [
2020
"search_for_error_traces/error_trace_0.json"
2121
],
2222
"symex": []

benchmarks/TRAINING/diffblue/taint_traces_06_evaluator.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[
1717
{
1818
"error_traces": {
19-
"cbmc": [
19+
"jbmc": [
2020
"search_for_error_traces/error_trace_0.json"
2121
],
2222
"symex": []
@@ -28,7 +28,7 @@
2828
},
2929
{
3030
"error_traces": {
31-
"cbmc": [
31+
"jbmc": [
3232
"search_for_error_traces/error_trace_1.json"
3333
],
3434
"symex": []

benchmarks/TRAINING/diffblue/taint_traces_07_evaluator.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[
1717
{
1818
"error_traces": {
19-
"cbmc": [
19+
"jbmc": [
2020
"search_for_error_traces/error_trace_0.json"
2121
],
2222
"symex": []

benchmarks/evaluator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __compare_computed_and_expected_results(error_traces, record):
119119
file_line = expected_loc_traces["file"] + "', line " + str(expected_loc_traces["line"])
120120
if not loc_traces:
121121
return "There are missing error traces for the sink location '" + file_line + "."
122-
if len(expected_loc_traces["error_traces"]["cbmc"]) != len(loc_traces["error_traces"]["cbmc"]):
122+
if len(expected_loc_traces["error_traces"]["jbmc"]) != len(loc_traces["error_traces"]["jbmc"]):
123123
return "Wrong number of CBMC generated error traces for the sink location '" + file_line + "."
124124
if len(expected_loc_traces["error_traces"]["symex"]) != len(loc_traces["error_traces"]["symex"]):
125125
return "Wrong number of SYMEX generated error traces for the sink location '" + file_line + "."
@@ -212,7 +212,7 @@ def __main():
212212
print("PASSED:\"" + benchmark["sources-dir"] + "\"")
213213
return 0 # success (for Travis)
214214
except Exception as e:
215-
print("ERROR: " + str(e))
215+
print("ERROR: " + repr(e))
216216
return 1 # failure (for Travis)
217217
except:
218218
print("ERROR: Unknown exception was raised.")

driver/analyser.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def get_goto_instrument_pathname():
3434
return os.path.abspath(os.path.join(_tools_binary_dir, "goto-instrument"))
3535

3636

37-
def get_cbmc_pathname():
38-
return os.path.abspath(os.path.join(_tools_binary_dir, "cbmc"))
37+
def get_jbmc_pathname():
38+
return os.path.abspath(os.path.join(_tools_binary_dir, "jbmc"))
3939

4040

4141
def get_symex_pathname():
@@ -167,7 +167,7 @@ def run_program_slicing(
167167
return prof
168168

169169

170-
def append_cbmc_error_trace_if_it_is_relevant(trace, trace_id, results_dir, cfg, traces_list):
170+
def append_jbmc_error_trace_if_it_is_relevant(trace, trace_id, results_dir, cfg, traces_list):
171171
"""A trace is relevant, if it ends at a sink."""
172172
was_trace_saved = False
173173
last_rec = trace[-1]
@@ -188,12 +188,12 @@ def append_cbmc_error_trace_if_it_is_relevant(trace, trace_id, results_dir, cfg,
188188
rec["function"] == sink["function"] and \
189189
rec["line"] == sink["line"] and \
190190
rec["goto_binary_file"] == cfg["goto_binary_file"]:
191-
rec["error_traces"]["cbmc"].append(trace_fname)
191+
rec["error_traces"]["jbmc"].append(trace_fname)
192192
found = True
193193
if found == False:
194194
rec = sink.copy()
195195
rec["goto_binary_file"] = cfg["goto_binary_file"]
196-
rec["error_traces"] = { "cbmc": [trace_fname], "symex": [] }
196+
rec["error_traces"] = { "jbmc": [trace_fname], "symex": [] }
197197
traces_list.append(rec)
198198
break
199199
return was_trace_saved
@@ -220,30 +220,30 @@ def run_search_for_error_traces(
220220
os.chdir(results_dir)
221221
# verbosity must be at least 4 for error traces to get printed!
222222
command = (
223-
get_cbmc_pathname() + " " +
223+
get_jbmc_pathname() + " " +
224224
cfg["goto_binary_file"] + " " +
225225
" --trace --lazy-methods --json-ui --unwind 10 " +
226226
"--verbosity " + str(max(verbosity, 4)) + " "
227-
"> \"cbmc_results.json\""
227+
"> \"jbmc_results.json\""
228228
)
229-
prof["calling_cbmc"] = {}
230-
prof_calling_cbmc_start_time = time.time()
231-
print("Invoking 'cbmc' ...")
229+
prof["calling_jbmc"] = {}
230+
prof_calling_jbmc_start_time = time.time()
231+
print("Invoking 'jbmc' ...")
232232
if verbosity >= 9:
233233
print("CWD: " + results_dir)
234234
print("CMD: " + command)
235235
os.system(command)
236-
prof["calling_cbmc"]["duration"] = time.time() - prof_calling_cbmc_start_time
236+
prof["calling_jbmc"]["duration"] = time.time() - prof_calling_jbmc_start_time
237237
os.chdir(old_cwd)
238238

239-
with open(os.path.join(results_dir,"cbmc_results.json")) as data_file:
240-
cbmc_results = json.load(data_file)
241-
for outer_element in cbmc_results:
239+
with open(os.path.join(results_dir,"jbmc_results.json")) as data_file:
240+
jbmc_results = json.load(data_file)
241+
for outer_element in jbmc_results:
242242
if "result" in outer_element:
243243
for inner_element in outer_element["result"]:
244244
if "trace" in inner_element and len(inner_element["trace"]) > 0:
245245
trace=inner_element["trace"]
246-
was_trace_saved = append_cbmc_error_trace_if_it_is_relevant(
246+
was_trace_saved = append_jbmc_error_trace_if_it_is_relevant(
247247
trace,
248248
trace_id,
249249
results_dir,

driver/presentation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,13 @@ def build_HTML_interface_to_error_traces(root_dir,sub_dir,ofile):
401401
ofile.write(" <tr>\n")
402402
ofile.write(" <td>" + traces_group["file"] + "</td>\n")
403403
ofile.write(" <td>" + str(traces_group["line"]) + "</td>\n")
404-
if len(traces_group["error_traces"]["cbmc"]) > 0:
405-
ofile.write(" <td align=\"center\"><a href=\"./" + sub_dir + "/error_traces_cbmc_" + str(group_idx) +
404+
if len(traces_group["error_traces"]["jbmc"]) > 0:
405+
ofile.write(" <td align=\"center\"><a href=\"./" + sub_dir + "/error_traces_jbmc_" + str(group_idx) +
406406
".html\">here</a></td>\n")
407-
with open(os.path.join(full_sub_dir,"error_traces_cbmc_" + str(group_idx) + ".html"),"w") as group_ofile:
407+
with open(os.path.join(full_sub_dir,"error_traces_jbmc_" + str(group_idx) + ".html"),"w") as group_ofile:
408408
build_HTML_interface_to_group_of_error_traces(
409409
traces_group["error_traces"],
410-
"cbmc",
410+
"jbmc",
411411
traces_group["file"],
412412
traces_group["line"],
413413
group_ofile)
@@ -707,7 +707,7 @@ def build_HTML_interface_to_results_and_statistics(
707707

708708

709709
ofile.write("<h3>Phase 5: Search for error-traces in sliced programs</h3>\n")
710-
ofile.write("<p>It is performed by tools 'cbmc' and 'symex'.</p>\n")
710+
ofile.write("<p>It is performed by tools 'jbmc' and 'symex'.</p>\n")
711711

712712
if num_slicing_tasks == 0:
713713
ofile.write("<p>There are no error traces, because there was no slicing task generated.</p>\n")

driver/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ def __main():
222222
analyser.get_goto_instrument_pathname() + "'. " +
223223
analyser.get_missing_binary_error_message())
224224
return
225-
if not os.path.exists(analyser.get_cbmc_pathname()):
226-
print("ERROR: Cannot find 'cbmc' executable file at '" +
227-
analyser.get_cbmc_pathname() + "'. " +
225+
if not os.path.exists(analyser.get_jbmc_pathname()):
226+
print("ERROR: Cannot find 'jbmc' executable file at '" +
227+
analyser.get_jbmc_pathname() + "'. " +
228228
analyser.get_missing_binary_error_message())
229229
return
230230

0 commit comments

Comments
 (0)