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: [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum


On 05/29/2016 03:10 PM, Jan Kratochvil wrote:

> 
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -1606,9 +1606,24 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
>  static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
>  			       struct dwarf2_cu *, struct partial_symtab *);
>  
> -static int dwarf2_get_pc_bounds (struct die_info *,
> -				 CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
> -				 struct partial_symtab *);
> +/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
> +   values.  */
> +enum pc_bounds_kind
> +{
> +  /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
> +     was found.  */
> +  pc_bounds_not_present,
> +
> +  /* Discontiguous range was found - that is DW_AT_ranges was found.  */
> +  pc_bounds_ranges,
> +
> +  /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found.  */
> +  pc_bounds_high_low,

I think it's much more common in GDB to uppercase enum values.

> +};

Add empty line here.

> +static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
> +						 CORE_ADDR *, CORE_ADDR *,
> +						 struct dwarf2_cu *,
> +						 struct partial_symtab *);
>  


> -  int has_pc_info;
> +  enum pc_bounds_kind has_pc_info;

Shouldn't we rename the variable name too?

Otherwise LGTM.

Thanks,
Pedro Alves


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