This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA]dwarf reader: Avoid complaint on const type
- From: Doug Evans <dje at google dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: Pedro Alves <pedro at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Mon, 28 Jun 2010 13:27:19 -0700
- Subject: Re: [RFA]dwarf reader: Avoid complaint on const type
- References: <41597.7287375883$1274454923@news.gmane.org> <m3aart18ls.fsf@fleche.redhat.com> <201006161708.41089.pedro@codesourcery.com> <3752333521215815628@unknownmsgid>
On Sun, Jun 20, 2010 at 3:39 PM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
> 2010-06-21 ?Pierre Muller ?<muller@ics.u-strasbg.fr>
>
> ? ? ? ?* dwarf2read.c (process_die): Do not call new_symbol
> ? ? ? ?for DW_TAG_volatile_type and DW_TAG_const_type.
> ? ? ? ?(new_symbol): Do not add the name of DW_TAG_volatile_type
> ? ? ? ?and DW_TAG_const_type to the symbol list.
>
>
>
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.400
> diff -u -p -r1.400 dwarf2read.c
> --- dwarf2read.c ? ? ? ?17 Jun 2010 22:36:41 -0000 ? ? ?1.400
> +++ dwarf2read.c ? ? ? ?20 Jun 2010 21:57:23 -0000
> @@ -3210,12 +3210,14 @@ process_die (struct die_info *die, struc
> ? ? case DW_TAG_base_type:
> ? ? case DW_TAG_subrange_type:
> ? ? case DW_TAG_typedef:
> - ? ?case DW_TAG_const_type:
> - ? ?case DW_TAG_volatile_type:
> ? ? ? /* Add a typedef symbol for the type definition, if it has a
> ? ? ? ? ?DW_AT_name. ?*/
> ? ? ? new_symbol (die, read_type_die (die, cu), cu);
> ? ? ? break;
> + ? ?case DW_TAG_const_type:
> + ? ?case DW_TAG_volatile_type:
> + ? ? ?read_type_die (die, cu);
> + ? ? ?break;
> ? ? case DW_TAG_common_block:
> ? ? ? read_common_block (die, cu);
> ? ? ? break;
> @@ -8912,12 +8914,16 @@ new_symbol (struct die_info *die, struct
> ? ? ? ? ?break;
> ? ? ? ?case DW_TAG_base_type:
> ? ? ? ? case DW_TAG_subrange_type:
> - ? ? ? ?case DW_TAG_const_type:
> - ? ? ? ?case DW_TAG_volatile_type:
> ? ? ? ? ?SYMBOL_CLASS (sym) = LOC_TYPEDEF;
> ? ? ? ? ?SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
> ? ? ? ? ?add_symbol_to_list (sym, cu->list_in_scope);
> ? ? ? ? ?break;
> + ? ? ? ?case DW_TAG_const_type:
> + ? ? ? ?case DW_TAG_volatile_type:
> + ? ? ? ? /* The name of the type given in the dwarf name atribute is the
> + ? ? ? ? ? ?name of the `normal' type and not a new type name, so
> + ? ? ? ? ? ?do not register this as a new type name. ?*/
> + ? ? ? ? break;
> ? ? ? ?case DW_TAG_enumerator:
> ? ? ? ? ?attr = dwarf2_attr (die, DW_AT_const_value, cu);
> ? ? ? ? ?if (attr)
>
>
Hi. I'd like to reach closure on this and get rid of this testsuite failure.
I *think* the patch to process_die is ok.
I'm not sure about the patch to new_symbol though.
AFAICT, new_symbol will never be called for
DW_TAG_volatile_type/const_type (*including* via bad debug info - IOW
the code itself would never call new_symbol for these tags).
*If* that is true, I wouldn't mind calling gdb_assert (0) for those
tags - make it clearer to the caller what the API is.
One may want to just leave it alone and let the default case flag a complaint.