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 7/7] Move read_partial_die to partial_die_info::read


On 2018-01-25 04:38 AM, Yao Qi wrote:
> gdb:
> 
> 2018-01-11  Yao Qi  <yao.qi@linaro.org>
> 
> 	* dwarf2read.c (struct partial_die_info) <read>: New method.
> 	(read_partial_die): Remove the declaration.
> 	(load_partial_dies): Update.
> 	(partial_die_info::partial_die_info):
> 	(read_partial_die): Change it to partial_die_info::read.
> ---
>  gdb/dwarf2read.c | 108 +++++++++++++++++++++++++++++--------------------------
>  1 file changed, 57 insertions(+), 51 deletions(-)
> 
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 9b6f2ec..02e4431 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -1415,6 +1415,12 @@ struct partial_die_info
>         name.  */
>      void fixup (struct dwarf2_cu *cu);
>  
> +    /* Read a minimal amount of information into the minimal die
> +       structure.  */
> +    const gdb_byte *read (const struct die_reader_specs *reader,
> +			  struct abbrev_info *abbrev,
> +			  const gdb_byte *info_ptr);
> +
>      /* Offset of this DIE.  */
>      const sect_offset sect_off;
>  
> @@ -1481,8 +1487,8 @@ struct partial_die_info
>  
>      /* Pointer into the info_buffer (or types_buffer) pointing at the target of
>         DW_AT_sibling, if any.  */
> -    /* NOTE: This member isn't strictly necessary, read_partial_die could
> -       return DW_AT_sibling values to its caller load_partial_dies.  */
> +    /* NOTE: This member isn't strictly necessary, partial_die_info::read
> +       could return DW_AT_sibling values to its caller load_partial_dies.  */
>      const gdb_byte *sibling = nullptr;
>  
>      /* If HAS_SPECIFICATION, the offset of the DIE referred to by
> @@ -1836,11 +1842,6 @@ static unsigned int peek_abbrev_code (bfd *, const gdb_byte *);
>  static struct partial_die_info *load_partial_dies
>    (const struct die_reader_specs *, const gdb_byte *, int);
>  
> -static const gdb_byte *read_partial_die (const struct die_reader_specs *,
> -					 struct partial_die_info *,
> -					 struct abbrev_info *,
> -					 const gdb_byte *);
> -
>  static struct partial_die_info *find_partial_die (sect_offset, int,
>  						  struct dwarf2_cu *);
>  
> @@ -14804,7 +14805,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
>  	return PC_BOUNDS_NOT_PRESENT;
>      }
>  
> -  /* read_partial_die has also the strict LOW < HIGH requirement.  */
> +  /* partial_die_info::read has also the strict LOW < HIGH requirement.  */
>    if (high <= low)
>      return PC_BOUNDS_INVALID;
>  
> @@ -18316,8 +18317,8 @@ load_partial_dies (const struct die_reader_specs *reader,
>        struct partial_die_info pdi ((sect_offset) (info_ptr - reader->buffer),
>  				   abbrev);
>  
> -      info_ptr = read_partial_die (reader, &pdi, abbrev,
> -				   (const gdb_byte *) info_ptr + bytes_read);
> +      info_ptr = pdi.read (reader, abbrev,
> +				 (const gdb_byte *) info_ptr + bytes_read);

Nit: can you remove the unnecessary cast while at it?

Otherwise the patch LGTM (the patches I didn't comment on also LGTM).

Simon


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