@@ -67,6 +67,10 @@ class goto_symext
6767
6868 typedef goto_symex_statet statet;
6969
70+ typedef
71+ std::function<const goto_functionst::goto_functiont &(const irep_idt &)>
72+ get_goto_functiont;
73+
7074 // / \brief symex entire program starting from entry point
7175 // /
7276 // / The state that goto_symext maintains has a large memory footprint.
@@ -76,6 +80,15 @@ class goto_symext
7680 virtual void symex_from_entry_point_of (
7781 const goto_functionst &goto_functions);
7882
83+ // / \brief symex entire program starting from entry point
84+ // /
85+ // / The state that goto_symext maintains has a large memory footprint.
86+ // / This method deallocates the state as soon as symbolic execution
87+ // / has completed, so use it if you don't care about having the state
88+ // / around afterwards.
89+ virtual void symex_from_entry_point_of (
90+ const get_goto_functiont &get_goto_function);
91+
7992 // // \brief symex entire program starting from entry point
8093 // /
8194 // / This method uses the `state` argument as the symbolic execution
@@ -88,6 +101,18 @@ class goto_symext
88101 const goto_functionst &,
89102 const goto_programt &);
90103
104+ // // \brief symex entire program starting from entry point
105+ // /
106+ // / This method uses the `state` argument as the symbolic execution
107+ // / state, which is useful for examining the state after this method
108+ // / returns. The state that goto_symext maintains has a large memory
109+ // / footprint, so if keeping the state around is not necessary,
110+ // / clients should instead call goto_symext::symex_from_entry_point_of().
111+ virtual void symex_with_state (
112+ statet &,
113+ const get_goto_functiont &,
114+ const goto_programt &);
115+
91116 // / Symexes from the first instruction and the given state, terminating as
92117 // / soon as the last instruction is reached. This is useful to explicitly
93118 // / symex certain ranges of a program, e.g. in an incremental decision
@@ -102,6 +127,20 @@ class goto_symext
102127 goto_programt::const_targett first,
103128 goto_programt::const_targett limit);
104129
130+ // / Symexes from the first instruction and the given state, terminating as
131+ // / soon as the last instruction is reached. This is useful to explicitly
132+ // / symex certain ranges of a program, e.g. in an incremental decision
133+ // / procedure.
134+ // / \param state Symex state to start with.
135+ // / \param get_goto_function retrieves a function body
136+ // / \param first Entry point in form of a first instruction.
137+ // / \param limit Final instruction, which itself will not be symexed.
138+ virtual void symex_instruction_range (
139+ statet &state,
140+ const get_goto_functiont &get_goto_function,
141+ goto_programt::const_targett first,
142+ goto_programt::const_targett limit);
143+
105144protected:
106145 // / Initialise the symbolic execution and the given state with <code>pc</code>
107146 // / as entry point.
@@ -111,21 +150,21 @@ class goto_symext
111150 // / \param limit final instruction, which itself will not
112151 // / be symexed.
113152 void initialize_entry_point (
114- statet &,
115- const goto_functionst & ,
153+ statet &state ,
154+ const get_goto_functiont &get_goto_function ,
116155 goto_programt::const_targett pc,
117156 goto_programt::const_targett limit);
118157
119158 // / Invokes symex_step and verifies whether additional threads can be
120159 // / executed.
121160 // / \param state Current GOTO symex step.
122- // / \param goto_functions GOTO model to symex.
161+ // / \param get_goto_function function that retrieves function bodies
123162 void symex_threaded_step (
124- statet &, const goto_functionst &);
163+ statet &, const get_goto_functiont &);
125164
126165 /* * execute just one step */
127166 virtual void symex_step (
128- const goto_functionst &,
167+ const get_goto_functiont &,
129168 statet &);
130169
131170public:
@@ -213,7 +252,7 @@ class goto_symext
213252 virtual void symex_decl (statet &);
214253 virtual void symex_decl (statet &, const symbol_exprt &expr);
215254 virtual void symex_dead (statet &);
216- virtual void symex_other (const goto_functionst &, statet &);
255+ virtual void symex_other (statet &);
217256
218257 virtual void vcc (
219258 const exprt &,
@@ -255,19 +294,19 @@ class goto_symext
255294 }
256295
257296 virtual void symex_function_call (
258- const goto_functionst &,
297+ const get_goto_functiont &,
259298 statet &,
260299 const code_function_callt &);
261300
262301 virtual void symex_end_of_function (statet &);
263302
264303 virtual void symex_function_call_symbol (
265- const goto_functionst &,
304+ const get_goto_functiont &,
266305 statet &,
267306 const code_function_callt &);
268307
269308 virtual void symex_function_call_code (
270- const goto_functionst &,
309+ const get_goto_functiont &,
271310 statet &,
272311 const code_function_callt &);
273312
0 commit comments