@@ -63,10 +63,23 @@ void memory_snapshot_harness_generatort::handle_option(
63
63
{
64
64
variables_to_havoc.insert (values.begin (), values.end ());
65
65
}
66
- else if (option == " initial-line" )
66
+ else if (option == " initial-file- line" )
67
67
{
68
- const std::string initial_line = require_exactly_one_value (option, values);
69
- line_number = optionalt<unsigned >(safe_string2unsigned (initial_line));
68
+ const std::string initial_file_line =
69
+ require_exactly_one_value (option, values);
70
+
71
+ std::vector<std::string> start;
72
+ split_string (initial_file_line, ' :' , start, true );
73
+
74
+ if (start.size () != 2 || start.front ().empty () || start.back ().empty ())
75
+ {
76
+ throw invalid_command_line_argument_exceptiont (
77
+ " invalid initial location specification" , " --initial-file-line" );
78
+ }
79
+
80
+ initial_file_name = start.front ();
81
+ initial_line_number =
82
+ optionalt<unsigned >(safe_string2unsigned (start.back ()));
70
83
}
71
84
else
72
85
{
@@ -81,7 +94,7 @@ memory_snapshot_harness_generatort::get_start_instruction(
81
94
const goto_modelt &goto_model)
82
95
{
83
96
const auto &goto_functions = goto_model.goto_functions ;
84
- if (line_number .has_value ())
97
+ if (initial_line_number .has_value ())
85
98
{
86
99
// by line: iterate over all instructions until source location match
87
100
for (const auto &entry : goto_functions.function_map )
@@ -96,8 +109,10 @@ memory_snapshot_harness_generatort::get_start_instruction(
96
109
goto_program.instructions .begin (),
97
110
goto_program.instructions .end (),
98
111
[this ](const goto_programt::instructiont &instruction) {
99
- return safe_string2unsigned (id2string (
100
- instruction.source_location .get_line ())) >= *line_number;
112
+ return instruction.source_location .get_file () == initial_file_name &&
113
+ safe_string2unsigned (
114
+ id2string (instruction.source_location .get_line ())) >=
115
+ *initial_line_number;
101
116
});
102
117
103
118
if (it != goto_program.instructions .end ())
0 commit comments