File tree 1 file changed +6
-5
lines changed 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -344,12 +344,13 @@ exprt gdb_value_extractort::get_non_char_pointer_value(
344
344
// expected positions. Since the allocated size is over-approximation we may
345
345
// end up querying pass the allocated bounds and building larger array with
346
346
// meaningless values.
347
- size_t allocated_size =
348
- gdb_api.query_malloc_size (c_converter.convert (expr));
347
+ const auto c_name = c_converter.convert (expr);
348
+ const auto maybe_allocated_size = get_malloc_size (c_name);
349
+ mp_integer allocated_size = maybe_allocated_size.has_value ()
350
+ ? *maybe_allocated_size
351
+ : gdb_api.query_malloc_size (c_name);
349
352
// get the sizeof(target_type) and thus the number of elements
350
- const auto target_size_bits = pointer_offset_bits (target_type, ns);
351
- CHECK_RETURN (target_size_bits.has_value ());
352
- const auto number_of_elements = allocated_size / (*target_size_bits / 8 );
353
+ const auto number_of_elements = allocated_size / get_type_size (target_type);
353
354
if (number_of_elements > 1 )
354
355
{
355
356
array_exprt::operandst elements;
You can’t perform that action at this time.
0 commit comments