This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb: Remove cleanup from dw2_do_instantiate_symtab
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Tue, 06 Feb 2018 16:39:55 +0000
- Subject: Re: [PATCH] gdb: Remove cleanup from dw2_do_instantiate_symtab
- Authentication-results: sourceware.org; auth=none
- References: <20180202235354.6468-1-andrew.burgess@embecosm.com> <CAH=s-PPjUmouEjg+bLZ+cwycrDY-XC+BzTRspKYJZ+gzgWTM1g@mail.gmail.com> <20180205193450.GC2778@embecosm.com>
Andrew Burgess <andrew.burgess@embecosm.com> writes:
> I ran a few experiments using GCC 7.2, with -gdwarf-4 and
> -fdebug-type-sections added to the compiler flags (I believe
> IS_TYPE_UNIT_GROUP is related to -fdebug-type-sections) but I was
> unable to cause the IS_TYPE_UNIT_GROUP check to trigger, which would
> explain why my change didn't break anything.
>
Thanks for dig it deeper...
> So, assuming that the IS_TYPE_UNIT_GROUP can trigger in some cases,
> I've simply moved the creation of the dwarf2_queue_guard down the
> function until after the early return.
Yes, that looks right to me. Local object is initialized when it is
declared. Patch is good to me.
>
> I don't know if this violates the coding-standard. I know it used to
> be the case that variables had to be declared at the start of the
> block, but there are a few examples in this same file where this rule
> is not followed.
No, it doesn't. In C++, we can declare the variable when we'll use it.
--
Yao (齐尧)