[PATCH] Fix partial symbols

Andrew Burgess andrew.burgess@embecosm.com
Sun Nov 29 19:43:48 GMT 2020


* Bernd Edlinger <bernd.edlinger@hotmail.de> [2020-11-28 19:01:10 +0100]:

> Hi,
> 
> this fixes a regression in partial symbols.


Is there a particular test that regressed and is fixed with this
patch?  It is probably worth mentioning in the commit message.

If this is a regression in some functionality that is not tested in
tree then it would be great to see a test added.


> 
> The bug was introduced with this patch:
> 
> commit 529908cbd0afc2524044b7df3626c09d0bdae12d
> Author: Tom Tromey <tom@tromey.com>
> Date:   Tue Sep 29 18:49:08 2020 -0600
> 
>     Remove DW_UNSND
>     
>     This removes DW_UNSND, replacing uses with either as_unsigned or
>     constant_value, depending primarily on whether or not the form is
>     already known to be appropriate.
>     
>     gdb/ChangeLog
>     2020-09-29  Tom Tromey  <tom@tromey.com>
>     
>         * dwarf2/read.c (lookup_dwo_id, get_type_unit_group)
>         (read_file_scope, dwarf2_get_pc_bounds)
>         (dwarf2_record_block_ranges, dwarf2_add_field, get_alignment)
>         (read_structure_type, handle_struct_member_die)
>         (read_enumeration_type, read_array_type, read_set_type)
>         (read_tag_pointer_type, read_tag_reference_type)
>         (read_subroutine_type, read_base_type, read_subrange_type)
>         (read_full_die_1, partial_die_info::read)
>         (partial_die_info::read, by, new_symbol)
>         (dwarf2_const_value_data, dwarf2_const_value_attr)
>         (dump_die_shallow, dwarf2_fetch_constant_bytes)
>         (prepare_one_comp_unit): Update.
>         * dwarf2/attribute.h (DW_UNSND): Remove.
> 
> Due to the broken handling of DW_AT_ranges
> in partial_die_info::read only a subset of the
> complete locations is found when I set a breakpoint
> on an inline function.

This commit message is very cryptic, it assumes the reader will have
knowledge of what the "broken handling of DW_AT_ranges in
partial_die_info::read" is, and why this change works around this
issue.

A better commit message would explain what the problem is, why the
current code causes issues when combined with this problem, and why
the change you propose works around this issue.

Maybe someone else will have more context and be able to review this
change, but the clearer your commit messages the easier it is for
people to review your work.

Thanks,
Andrew

> 
> Is it OK for trunk?
> 
> 
> Thanks
> Bernd.

> From a2db347c00b4dac744f49a7e0d4b9689a861dc66 Mon Sep 17 00:00:00 2001
> From: Bernd Edlinger <bernd.edlinger@hotmail.de>
> Date: Sat, 28 Nov 2020 17:29:18 +0100
> Subject: [PATCH] Fix partial symbols
> 
> attr.constant_value does not work for DW_FORM_rnglistx at least.
> 
> Fixes: 529908cbd0a ("Remove DW_UNSND")
> 
> 2020-11-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
> 
> 	* dwarf2/read.c (partial_die_info::read): Fix DW_AT_ranges.
> ---
>  gdb/dwarf2/read.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index 601a571..28244e5 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -19660,7 +19660,7 @@ struct type *
>  	    /* It would be nice to reuse dwarf2_get_pc_bounds here,
>  	       but that requires a full DIE, so instead we just
>  	       reimplement it.  */
> -	    unsigned int ranges_offset = (attr.constant_value (0)
> +	    unsigned int ranges_offset = (attr.as_unsigned ()
>  					  + (need_ranges_base
>  					     ? cu->ranges_base
>  					     : 0));
> -- 
> 1.9.1
> 



More information about the Gdb-patches mailing list