This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 0/2] Aarch64: Fix segfault when casting dummy calls
On 10/09/2018 06:50 PM, Alan Hayward wrote:
>
>
>> On 9 Oct 2018, at 17:10, Pedro Alves <palves@redhat.com> wrote:
>>
>> On 10/01/2018 04:52 PM, Alan Hayward wrote:
>>> This is a reworking of a patch I posted in March.
>>> V1 had a long discussion which was then paused to wait for
>>> Pedro's IFUNC rewrite.
>>>
>>>
>>> Prevent the int cast in the following causing a segfault on aarch64:
>>> (gdb) b foo if (int)strcmp(name,"abc") == 0
>>> (gdb) run
>>>
>>>
>>> This is because to aarch64_push_dummy_call determines the return type
>>> of the function and then does not check for null pointer.
>>>
>>> A null pointer for the return type means either 1) the call has a
>>> cast or 2) an error has occured.
>>
>> I'd think that "1) the call has a cast" is not accurate.
>> If the called function has debug info, then GDB will know
>> it's return type. The issue is that the called function may
>> not have debug information, and then GDB does not know
>> its return type (so its NULL), and then the only way to
>> call the function is to add the cast. Right?
>>
>
> That makes sense. I’d add that in the above example I’m able to do the
> break without a cast and gdb does not segfault - the return type
> of the function comes back as an int.
Please double check whether the proposed testcase crashes GDB without
the fix. I suspect not, due to the library being compiled with
debug info. If it does crash, then I think I'm missing something.
Thanks,
Pedro Alves