This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [1/4] RFC: skip DIEs which only declare an enum


On Fri, Jul 15, 2011 at 2:06 PM, Tom Tromey <tromey@redhat.com> wrote:
> With -gdwarf-4:
>
> -PASS: gdb.cp/classes.exp: print ('ClassWithEnum::PrivEnum') 42
> -PASS: gdb.cp/classes.exp: print (ClassWithEnum::PrivEnum) 42
> +FAIL: gdb.cp/classes.exp: print ('ClassWithEnum::PrivEnum') 42
> +FAIL: gdb.cp/classes.exp: print (ClassWithEnum::PrivEnum) 42
>
> What happens here is that gcc emits multiple .debug_type CUs. ?While
> reading one such CU, we see an empty declaration for PrivEnum. ?This
> gets turned into a symbol, and later we end up with an incomplete type.
>
> This patch fixes the problem by simply skipping declaration-only enums.
> This makes it so only the full definition is put into the symbol table,
> letting check_typedef work.
>
> This is one of the patches I am less sure about. ?Is it really safe? ?It
> also may change the error a user sees in some obscure case -- but to my
> mind there is not much practical difference between "type not found" and
> "type found but useless".

Generally speaking, I agree with your sentiment.  Can't you
forward-declare enums in the latest C++ draft, though?  If the
declaration is all we have, something like (enum X) 42 is more useful
than <unknown type> (both examples made up; I don't know what we
print.

We ought to be able to resolve the incomplete type if we have both.
But I know that doesn't always work right.

-- 
Thanks,
Daniel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]