This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix regressions caused by early debug (DW_OP_GNU_variable_value extension 161109.2; PR debug/77589)
- From: Jason Merrill <jason at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches List <gcc-patches at gcc dot gnu dot org>, Pedro Alves <palves at redhat dot com>, Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Fri, 24 Feb 2017 13:40:37 -0800
- Subject: Re: [PATCH] Fix regressions caused by early debug (DW_OP_GNU_variable_value extension 161109.2; PR debug/77589)
- Authentication-results: sourceware.org; auth=none
- References: <20170224115859.GL1849@tucnak>
On Fri, Feb 24, 2017 at 3:58 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> + copy = ggc_alloc<dw_loc_descr_node> ();
> + memcpy (copy, ref, sizeof (dw_loc_descr_node));
> + list->expr = copy;
> + while (copy->dw_loc_next != ref_end)
> + {
> + dw_loc_descr_ref new_copy = ggc_alloc<dw_loc_descr_node> ();
> + memcpy (new_copy, copy->dw_loc_next, sizeof (dw_loc_descr_node));
> + copy->dw_loc_next = new_copy;
> + copy = new_copy;
> + }
This seems like it could use a copy_loc_descr function, shared with
add_loc_descr_to_each.
> + && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (loc)))
> + <= DWARF2_ADDR_SIZE))
Is this condition necessary, given that DWARF 5 supports typed
expressions that are not restricted to the size of the generic type?
> @@ -27532,6 +27538,18 @@ prune_unused_types_walk_loc_descr (dw_lo
> if (loc->dw_loc_oprnd1.val_class == dw_val_class_die_ref)
> prune_unused_types_mark (loc->dw_loc_oprnd1.v.val_die_ref.die, 1);
> break;
> + case DW_OP_GNU_variable_value:
> + if (loc->dw_loc_oprnd1.val_class == dw_val_class_decl_ref)
> + {
> + dw_die_ref ref
> + = lookup_decl_die (loc->dw_loc_oprnd1.v.val_decl_ref);
> + if (ref == NULL)
> + break;
> + loc->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
> + loc->dw_loc_oprnd1.v.val_die_ref.die = ref;
> + loc->dw_loc_oprnd1.v.val_die_ref.external = 0;
> + }
Doing this adjustment in prune_unused_types is surprising. Why is it
needed here as well as in the other places you do it? What if the
user specifies -fno-eliminate-unused-debug-types?
Jason