3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00

add exception handler for debugging #1925

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-11-10 10:07:42 -08:00
parent d7ecaa2ebb
commit 82e60ab17a

View file

@ -692,31 +692,35 @@ def mk_install_tactic_cpp_internal(h_files_full_path, path):
fout.write('#include "cmd_context/tactic_cmds.h"\n') fout.write('#include "cmd_context/tactic_cmds.h"\n')
fout.write('#include "cmd_context/cmd_context.h"\n') fout.write('#include "cmd_context/cmd_context.h"\n')
tactic_pat = re.compile('[ \t]*ADD_TACTIC\(.*\)') tactic_pat = re.compile('[ \t]*ADD_TACTIC\(.*\)')
probe_pat = re.compile('[ \t]*ADD_PROBE\(.*\)') probe_pat = re.compile('[ \t]*ADD_PROBE\(.*\)')
for h_file in sorted_headers_by_component(h_files_full_path): for h_file in sorted_headers_by_component(h_files_full_path):
added_include = False added_include = False
with open(h_file, 'r') as fin: try:
for line in fin: with open(h_file, 'r') as fin:
if tactic_pat.match(line): for line in fin:
if not added_include: if tactic_pat.match(line):
added_include = True if not added_include:
fout.write('#include "%s"\n' % path_after_src(h_file)) added_include = True
try: fout.write('#include "%s"\n' % path_after_src(h_file))
eval(line.strip('\n '), eval_globals, None) try:
except Exception as e: eval(line.strip('\n '), eval_globals, None)
_logger.error("Failed processing ADD_TACTIC command at '{}'\n{}".format( except Exception as e:
fullname, line)) _logger.error("Failed processing ADD_TACTIC command at '{}'\n{}".format(
raise e fullname, line))
if probe_pat.match(line): raise e
if not added_include: if probe_pat.match(line):
added_include = True if not added_include:
fout.write('#include "%s"\n' % path_after_src(h_file)) added_include = True
try: fout.write('#include "%s"\n' % path_after_src(h_file))
eval(line.strip('\n '), eval_globals, None) try:
except Exception as e: eval(line.strip('\n '), eval_globals, None)
_logger.error("Failed processing ADD_PROBE command at '{}'\n{}".format( except Exception as e:
fullname, line)) _logger.error("Failed processing ADD_PROBE command at '{}'\n{}".format(
raise e fullname, line))
raise e
except e:
_loggeer.error("Failed to read file {}\n".format(fullname))
raise e
# First pass will just generate the tactic factories # First pass will just generate the tactic factories
fout.write('#define ADD_TACTIC_CMD(NAME, DESCR, CODE) ctx.insert(alloc(tactic_cmd, symbol(NAME), DESCR, [](ast_manager &m, const params_ref &p) { return CODE; }))\n') fout.write('#define ADD_TACTIC_CMD(NAME, DESCR, CODE) ctx.insert(alloc(tactic_cmd, symbol(NAME), DESCR, [](ast_manager &m, const params_ref &p) { return CODE; }))\n')
fout.write('#define ADD_PROBE(NAME, DESCR, PROBE) ctx.insert(alloc(probe_info, symbol(NAME), DESCR, PROBE))\n') fout.write('#define ADD_PROBE(NAME, DESCR, PROBE) ctx.insert(alloc(probe_info, symbol(NAME), DESCR, PROBE))\n')