File tree 1 file changed +26
-3
lines changed
1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -227,9 +227,32 @@ void memory_snapshot_harness_generatort::get_memory_snapshot(
227
227
throw deserialization_exceptiont (" failed to read JSON memory snapshot" );
228
228
}
229
229
230
- // throws a deserialization_exceptiont or an incorrect_goto_program_exceptiont
231
- // on failure to read JSON symbol table
232
- symbol_table_from_json (json, snapshot);
230
+ if (json.is_array ())
231
+ {
232
+ // since memory-analyzer produces an array JSON we need to search it
233
+ // to find the first JSON object that is a symbol table
234
+ const auto &jarr = to_json_array (json);
235
+ for (auto const &arr_element : jarr)
236
+ {
237
+ if (!arr_element.is_object ())
238
+ continue ;
239
+ const auto &json_obj = to_json_object (arr_element);
240
+ const auto it = json_obj.find (" symbolTable" );
241
+ if (it != json_obj.end ())
242
+ {
243
+ symbol_table_from_json (json_obj, snapshot);
244
+ return ;
245
+ }
246
+ }
247
+ throw deserialization_exceptiont (
248
+ " JSON memory snapshot does not contain symbol table" );
249
+ }
250
+ else
251
+ {
252
+ // throws a deserialization_exceptiont or an incorrect_goto_program_exceptiont
253
+ // on failure to read JSON symbol table
254
+ symbol_table_from_json (json, snapshot);
255
+ }
233
256
}
234
257
235
258
void memory_snapshot_harness_generatort::generate (
You can’t perform that action at this time.
0 commit comments