This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] gdb: xtensa: initialize isa in call0_ret
- From: Max Filippov <jcmvbkbc at gmail dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org, Maxim Grigoriev <maxim2405 at gmail dot com>, Woody LaRue <larue at cadence dot com>, Marc Gauthier <marc at cadence dot com>
- Date: Tue, 14 Feb 2017 01:46:14 -0800
- Subject: Re: [PATCH 1/3] gdb: xtensa: initialize isa in call0_ret
- Authentication-results: sourceware.org; auth=none
- References: <1484783438-13780-1-git-send-email-jcmvbkbc@gmail.com> <1484783438-13780-2-git-send-email-jcmvbkbc@gmail.com> <771fb557-5364-2844-43c5-cec009d75e53@codesourcery.com>
On Mon, Feb 13, 2017 at 10:32 AM, Luis Machado
<lgustavo@codesourcery.com> wrote:
> On 01/18/2017 05:50 PM, Max Filippov wrote:
>>
>> This fixes segfault in native gdb because isa is not initialized at the
>> point of call to xtensa_isa_maxlength.
>>
>> 2017-01-18 Max Filippov <jcmvbkbc@gmail.com>
>> gdb/
>
>
>
> Drop gdb/
>
>> diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
>> index 978b13a..797e728 100644
>> --- a/gdb/xtensa-tdep.c
>> +++ b/gdb/xtensa-tdep.c
>> @@ -2027,6 +2027,8 @@ call0_ret (CORE_ADDR start_pc, CORE_ADDR finish_pc)
>> const char *opcname;
>> int found_ret = 0;
>>
>> + if (!xtensa_default_isa)
>> + xtensa_default_isa = xtensa_isa_init (0, 0);
>> isa = xtensa_default_isa;
>> gdb_assert (XTENSA_ISA_BSZ >= xtensa_isa_maxlength (isa));
>> ins = xtensa_insnbuf_alloc (isa);
>>
>
> I see a couple other uses of this construct for checking if a default isa is
> set or not. How about moving this check to a function that takes care of
> setting the default isa and returns this information to assign to "isa"?
Ok, let me look at it.
--
Thanks.
-- Max