[PATCH PR gdb/22736] [aarch64] gdb crashes on a conditional breakpoint with cast return type

Alan Hayward Alan.Hayward@arm.com
Fri Mar 2 12:09:00 GMT 2018



> On 2 Mar 2018, at 03:32, Joel Brobecker <brobecker@adacore.com> wrote:
> 
> On Thu, Mar 01, 2018 at 05:03:44PM +0000, Alan Hayward wrote:
>> On aarch64, the (int) casting in the following causes a gdb segfault:
>> $ ./gdb ./gdb
>> (gdb) b dwarf2_physname if (int)strcmp (name, "another_thread_local") == 0
>> (gdb) run a.out         // use any a.out
>> 
>> This is due to getting a null pointer from TYPE_TARGET_TYPE, and then
>> using it for language_pass_by_reference().
>> 
>> Fixed by adding a null check, similar to other occurrences in gdb.
>> 
>> Tested on aarch64 with make check using unix, native_gdbserver.
>> 
>> Alan.
>> 
>> 
>> 2018-03-01  Alan Hayward  <alan.hayward@arm.com>
>> 
>> 	* aarch64-tdep.c (aarch64_push_dummy_call): Check for null
>> 	return_type.
> 
> The patch looks good to me, but do you think you could add a test
> for it? Intuitively, I think this should be fairly easily doable,
> but can you confirm?

Agreed, should be easy enough.
I’ve not added anything to the .exp files yet, so this is a good excuse for me to
look into them a bit more :)

Thanks for the review.


> On 2 Mar 2018, at 10:07, Yao Qi <qiyaoltc@gmail.com> wrote:
> 
> On Thu, Mar 1, 2018 at 5:03 PM, Alan Hayward <Alan.Hayward@arm.com> wrote:
>> 2018-03-01  Alan Hayward  <alan.hayward@arm.com>
>> 
>>        * aarch64-tdep.c (aarch64_push_dummy_call): Check for null
>>        return_type.
> 
> Add "PR gdb/22736" in ChangeLog entry.
> 

Will add.

> Any idea on why TYPE_TARGET_TYPE (func_type) is NULL? (because
> there is no strcmp debug info?)
> 

The cast to (int) is causing this - remove the cast and it finds the type.
I’m assuming that’s causing it to drop the debug info.


Also, thanks for the review.


Alan.





More information about the Gdb-patches mailing list