@@ -242,6 +242,28 @@ exprt gdb_value_extractort::get_pointer_to_member_value(
242
242
return *maybe_member_expr;
243
243
}
244
244
245
+ const auto it = values.find (memory_location);
246
+ // if the structure we are pointing to does not exists we need to build a
247
+ // temporary object for it: get the type from symbol table, query gdb for
248
+ // value, allocate new object for it and then store into assignments
249
+ if (it == values.end ())
250
+ {
251
+ const auto symbol_expr = struct_symbol->symbol_expr ();
252
+ const auto zero = zero_initializer (symbol_expr.type (), location, ns);
253
+ CHECK_RETURN (zero.has_value ());
254
+ const auto val = get_expr_value (symbol_expr, *zero, location);
255
+
256
+ symbol_exprt dummy (" tmp" , pointer_type (symbol_expr.type ()));
257
+ code_blockt assignments;
258
+
259
+ const symbol_exprt new_symbol =
260
+ to_symbol_expr (allocate_objects.allocate_automatic_local_object (
261
+ assignments, dummy, symbol_expr.type ()));
262
+
263
+ add_assignment (new_symbol, val);
264
+ values[memory_location] = val;
265
+ }
266
+
245
267
const auto maybe_member_expr = get_subexpression_at_offset (
246
268
struct_symbol->symbol_expr (), member_offset, expr.type ().subtype (), ns);
247
269
DATA_INVARIANT (
0 commit comments