Skip to content

Commit 1b8dc35

Browse files
committed
goldenrun.py: fix exception for configs without start address
1 parent 8839c34 commit 1b8dc35

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

goldenrun.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,11 @@ def run_goldenrun(
5353
if "memorydump" in config_qemu:
5454
goldenrun_config["memorydump"] = config_qemu["memorydump"]
5555

56-
experiments = []
57-
if "start" in config_qemu:
58-
pre_goldenrun = {"type": "pre_goldenrun", "index": -2, "data": {}}
59-
experiments.append(pre_goldenrun)
60-
goldenrun = {"type": "goldenrun", "index": -1, "data": {}}
61-
experiments.append(goldenrun)
62-
63-
for experiment in experiments:
64-
if experiment["type"] == "pre_goldenrun":
65-
goldenrun_config["end"] = [config_qemu["start"]]
66-
# Set max_insn_count to ridiculous high number to never reach it
67-
goldenrun_config["max_instruction_count"] = 10000000000000
68-
69-
elif experiment["type"] == "goldenrun":
70-
if "start" in config_qemu:
71-
goldenrun_config["start"] = config_qemu["start"]
72-
if "end" in config_qemu:
73-
goldenrun_config["end"] = config_qemu["end"]
74-
if "start" in config_qemu and "end" in config_qemu:
75-
# Set max_insn_count to ridiculous high number to never reach it
76-
goldenrun_config["max_instruction_count"] = 10000000000000
77-
56+
def run_experiment(experiment, config, faultconfig):
7857
logger.info(f"{experiment['type']} started...")
7958
python_worker(
8059
dummyfaultlist,
81-
goldenrun_config,
60+
config,
8261
experiment["index"],
8362
queue_output,
8463
qemu_output,
@@ -103,7 +82,7 @@ def run_goldenrun(
10382
data_queue.put(experiment["data"])
10483

10584
if experiment["type"] != "goldenrun":
106-
continue
85+
return experiment["data"]
10786

10887
tbexec = pd.DataFrame(experiment["data"]["tbexec"])
10988
tbinfo = pd.DataFrame(experiment["data"]["tbinfo"])
@@ -121,10 +100,31 @@ def run_goldenrun(
121100
)
122101
)
123102

103+
return experiment["data"]
104+
105+
pregoldenrun_data = None
106+
if "start" in config_qemu:
107+
pre_goldenrun = {"type": "pre_goldenrun", "index": -2, "data": {}}
108+
goldenrun_config["end"] = [config_qemu["start"]]
109+
# Set max_insn_count to ridiculous high number to never reach it
110+
goldenrun_config["max_instruction_count"] = 10000000000000
111+
pregoldenrun_data = run_experiment(pre_goldenrun, goldenrun_config, faultconfig)
112+
113+
goldenrun = {"type": "goldenrun", "index": -1, "data": {}}
114+
if "start" in config_qemu:
115+
goldenrun_config["start"] = config_qemu["start"]
116+
if "end" in config_qemu:
117+
goldenrun_config["end"] = config_qemu["end"]
118+
if "start" in config_qemu and "end" in config_qemu:
119+
# Set max_insn_count to ridiculous high number to never reach it
120+
goldenrun_config["max_instruction_count"] = 10000000000000
121+
122+
goldenrun_data = run_experiment(goldenrun, goldenrun_config, faultconfig)
123+
124124
return [
125125
config_qemu["max_instruction_count"],
126-
experiments[0]["data"],
127-
experiments[1]["data"],
126+
pregoldenrun_data,
127+
goldenrun_data,
128128
faultconfig,
129129
]
130130

0 commit comments

Comments
 (0)