@@ -50,11 +50,6 @@ int goto_harness_parse_optionst::doit()
5050
5151 auto factory_options = collect_generate_factory_options ();
5252
53- // Initialise harness generator
54- auto harness_generator =
55- factory.factory (got_harness_config.harness_type , factory_options);
56- CHECK_RETURN (harness_generator != nullptr );
57-
5853 // This just sets up the defaults (and would interpret options such as --32).
5954 config.set (cmdline);
6055
@@ -67,8 +62,28 @@ int goto_harness_parse_optionst::doit()
6762 got_harness_config.in_file + " '" };
6863 }
6964 auto goto_model = std::move (read_goto_binary_result.value ());
65+
66+ // This has to be called after the defaults are set up (as per the
67+ // config.set(cmdline) above) otherwise, e.g. the architecture specification
68+ // will be unknown.
7069 config.set_from_symbol_table (goto_model.symbol_table );
7170
71+ if (goto_model.symbol_table .has_symbol (
72+ got_harness_config.harness_function_name ))
73+ {
74+ throw invalid_command_line_argument_exceptiont (
75+ " harness function `" +
76+ id2string (got_harness_config.harness_function_name ) +
77+ " ` already in "
78+ " the symbol table" ,
79+ " --" GOTO_HARNESS_GENERATOR_HARNESS_FUNCTION_NAME_OPT);
80+ }
81+
82+ // Initialise harness generator
83+ auto harness_generator = factory.factory (
84+ got_harness_config.harness_type , factory_options, goto_model);
85+ CHECK_RETURN (harness_generator != nullptr );
86+
7287 harness_generator->generate (
7388 goto_model, got_harness_config.harness_function_name );
7489
0 commit comments