Skip to content

Commit 10de8a7

Browse files
authored
Merge pull request #127 from nevillegrech/feat/tac_gen_cli_arg
Add optional CLI argument for tac gen config file path
2 parents c3fceb5 + 74a0aa7 commit 10de8a7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

gigahorse.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
import json
77
import logging
88
import shutil
9-
import re
109
import sys
1110
import time
1211
from collections import defaultdict
1312
from multiprocessing import Process, SimpleQueue, Manager, Event, cpu_count
14-
from typing import List, Tuple, Type, Any, Dict, DefaultDict
13+
from typing import List, Tuple, Any, Dict, DefaultDict
1514
from os.path import join, getsize
1615
import os
1716

@@ -21,7 +20,7 @@
2120

2221
## Constants
2322

24-
TAC_GEN_CONFIG_FILE = 'tac_gen_config.json'
23+
DEFAULT_TAC_GEN_CONFIG_FILE = join(GIGAHORSE_DIR, 'tac_gen_config.json')
2524

2625
DEFAULT_RESULTS_FILE = 'results.json'
2726
"""File to write results to by default."""
@@ -192,6 +191,13 @@
192191
default=False,
193192
help="Run souffle in interpreted mode.")
194193

194+
parser.add_argument(
195+
"--tac_gen_config",
196+
nargs="?",
197+
default=DEFAULT_TAC_GEN_CONFIG_FILE,
198+
metavar="TAC_GEN_CONFIG",
199+
help="the location of the TAC generation configuration file",
200+
)
195201

196202
def get_working_dir(contract_name: str) -> str:
197203
return join(os.path.abspath(args.working_dir), os.path.split(contract_name)[1].split('.')[0])
@@ -589,7 +595,7 @@ def run_gigahorse(args, fact_generator: AbstractFactGenerator) -> None:
589595

590596
args = parser.parse_args()
591597

592-
tac_gen_config_json = os.path.join(os.path.dirname(os.path.abspath(__file__)),TAC_GEN_CONFIG_FILE)
598+
tac_gen_config_json = args.tac_gen_config
593599
with open(tac_gen_config_json, 'r') as config:
594600
tac_gen_config = json.loads(config.read())
595601
if len(tac_gen_config["handlers"]) == 0: #if no handlers defined, default to classic decompilation

0 commit comments

Comments
 (0)