[PATCH] Refrain from asking debug stubs to read invalid memory
Kévin Le Gouguec
legouguec@adacore.com
Tue Sep 3 12:51:04 GMT 2024
Thiago Jung Bauermann <thiago.bauermann@linaro.org> writes:
>> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
>> index 599a696839e..917c997ad8c 100644
>> --- a/gdb/gdbtypes.c
>> +++ b/gdb/gdbtypes.c
>> @@ -2805,7 +2805,7 @@ resolve_dynamic_type_internal (struct type *type,
>> if (addr_stack->valaddr.data () != NULL)
>> pinfo.addr = extract_typed_address (addr_stack->valaddr.data (),
>> type);
>> - else
>> + else if (addr_stack->addr != 0)
>> pinfo.addr = read_memory_typed_address (addr_stack->addr, type);
>> pinfo.next = addr_stack;
>
> This can leave pinfo.addr uninitialised, so an additional branch is needed:
>
> else
> pinfo.addr = 0;
Quite right, thanks for catching this!
> The CI doesn't report any regression on this patch, so with the change
> above:
>
> Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
No surprises on my end with your suggested amendment; will send v2 to
the list momentarily.
More information about the Gdb-patches
mailing list