This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH PR gdb/22736] [aarch64] gdb crashes on a conditional breakpoint with cast return type
- From: Alan Hayward <Alan dot Hayward at arm dot com>
- To: Joel Brobecker <brobecker at adacore dot com>, Yao Qi <qiyaoltc at gmail dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Fri, 2 Mar 2018 12:09:47 +0000
- Subject: Re: [PATCH PR gdb/22736] [aarch64] gdb crashes on a conditional breakpoint with cast return type
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan dot Hayward at arm dot com;
- Nodisclaimer: True
- References: <F0AF0417-7A6F-48C6-B6E5-6999F9FEE3A7@arm.com> <20180302033204.v2wvjmquwy3dswyk@adacore.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
> 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.