public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Tom Tromey <tom@tromey.com>, <gdb-patches@sourceware.org>
Subject: Re: [RFA 1/6] Unify new_symbol and new_symbol_full
Date: Sun, 07 Jan 2018 05:33:00 -0000	[thread overview]
Message-ID: <a1faf3ee-8608-67f5-35fe-566296eebfed@ericsson.com> (raw)
In-Reply-To: <20180106002621.21099-2-tom@tromey.com>

On 2018-01-05 07:26 PM, Tom Tromey wrote:
> This patch unifies new_symbol with new_symbol_full, replacing a
> wrapper function with a default parameter.
> 
> 2018-01-05  Tom Tromey  <tom@tromey.com>
> 
> 	* dwarf2read.c (dwarf2_compute_name): Update comment.
> 	(read_func_scope, read_variable): Update.
> 	(new_symbol): Remove.
> 	(new_symbol_full): Rename to new_symbol.
> ---
>  gdb/ChangeLog    |  7 +++++++
>  gdb/dwarf2read.c | 29 +++++++++--------------------
>  2 files changed, 16 insertions(+), 20 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 24ccfe6882..5ad43d963a 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,10 @@
> +2018-01-05  Tom Tromey  <tom@tromey.com>
> +
> +	* dwarf2read.c (dwarf2_compute_name): Update comment.
> +	(read_func_scope, read_variable): Update.
> +	(new_symbol): Remove.
> +	(new_symbol_full): Rename to new_symbol.
> +
>  2018-01-05  Pedro Alves  <palves@redhat.com>
>  
>  	PR gdb/18653
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index a3028e5c52..92c4903241 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -1862,10 +1862,7 @@ static struct compunit_symtab *dwarf2_start_symtab (struct dwarf2_cu *,
>  						    CORE_ADDR);
>  
>  static struct symbol *new_symbol (struct die_info *, struct type *,
> -				  struct dwarf2_cu *);
> -
> -static struct symbol *new_symbol_full (struct die_info *, struct type *,
> -				       struct dwarf2_cu *, struct symbol *);
> +				  struct dwarf2_cu *, struct symbol * = NULL);
>  
>  static void dwarf2_const_value (const struct attribute *, struct symbol *,
>  				struct dwarf2_cu *);
> @@ -10831,7 +10828,7 @@ dwarf2_compute_name (const char *name,
>       but otherwise compute it by typename_concat inside GDB.
>       FIXME: Actually this is not really true, or at least not always true.
>       It's all very confusing.  SYMBOL_SET_NAMES doesn't try to demangle
> -     Fortran names because there is no mangling standard.  So new_symbol_full
> +     Fortran names because there is no mangling standard.  So new_symbol
>       will set the demangled name to the result of dwarf2_full_name, and it is
>       the demangled name that GDB uses if it exists.  */
>    if (cu->language == language_ada
> @@ -11104,8 +11101,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
>  
>        if (cu->language == language_go)
>  	{
> -	  /* This is a lie, but we already lie to the caller new_symbol_full.
> -	     new_symbol_full assumes we return the mangled name.
> +	  /* This is a lie, but we already lie to the caller new_symbol.
> +	     new_symbol assumes we return the mangled name.
>  	     This just undoes that lie until things are cleaned up.  */
>  	}
>        else
> @@ -13731,8 +13728,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
>      }
>  
>    newobj = push_context (0, lowpc);
> -  newobj->name = new_symbol_full (die, read_type_die (die, cu), cu,
> -			       (struct symbol *) templ_func);
> +  newobj->name = new_symbol (die, read_type_die (die, cu), cu,
> +			     (struct symbol *) templ_func);
>  
>    /* If there is a location expression for DW_AT_frame_base, record
>       it.  */
> @@ -14287,7 +14284,7 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu)
>  	}
>      }
>  
> -  new_symbol_full (die, NULL, cu, storage);
> +  new_symbol (die, NULL, cu, storage);
>  }
>  
>  /* Call CALLBACK from DW_AT_ranges attribute value OFFSET
> @@ -21183,8 +21180,8 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
>     NULL, allocate a new symbol on the objfile's obstack.  */
>  
>  static struct symbol *
> -new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
> -		 struct symbol *space)
> +new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
> +	    struct symbol *space)
>  {
>    struct objfile *objfile = cu->objfile;
>    struct gdbarch *gdbarch = get_objfile_arch (objfile);
> @@ -21564,14 +21561,6 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
>    return (sym);
>  }
>  
> -/* A wrapper for new_symbol_full that always allocates a new symbol.  */
> -
> -static struct symbol *
> -new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
> -{
> -  return new_symbol_full (die, type, cu, NULL);
> -}
> -
>  /* Given an attr with a DW_FORM_dataN value in host byte order,
>     zero-extend it as appropriate for the symbol's type.  The DWARF
>     standard (v4) is not entirely clear about the meaning of using
> 

LGTM, this one can go in by itself I think.

Simon

      reply	other threads:[~2018-01-07  5:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-06  0:26 [RFA 0/6] Some DWARF reader polishing Tom Tromey
2018-01-06  0:26 ` [RFA 4/6] Change dwarf2_cu::method_info to be a std::vector Tom Tromey
2018-01-16 15:30   ` Simon Marchi
2018-01-17 17:15     ` Tom Tromey
2018-01-17 17:29       ` Simon Marchi
2018-01-06  0:26 ` [RFA 2/6] Allocate abbrev_table with new Tom Tromey
2018-01-07  5:29   ` Simon Marchi
2018-01-07 16:55     ` Simon Marchi
2018-01-09 18:56       ` Tom Tromey
2018-01-10 12:02         ` Yao Qi
2018-01-10 16:10           ` Tom Tromey
2018-01-10 12:45         ` Simon Marchi
2018-01-06  0:26 ` [RFA 6/6] Remove symbolp typedef Tom Tromey
2018-01-16 15:33   ` Simon Marchi
2018-01-06  0:26 ` [RFA 5/6] Remove objfile argument from add_dyn_prop Tom Tromey
2018-01-10 13:01   ` Yao Qi
2018-01-10 16:32     ` Tom Tromey
2018-01-16 16:00       ` Yao Qi
2018-01-16 15:33   ` Simon Marchi
2018-01-17 17:16     ` Tom Tromey
2018-01-06  0:26 ` [RFA 3/6] Allocate dwarf2_cu with new Tom Tromey
2018-01-10 12:17   ` Yao Qi
2018-01-10 16:14     ` Tom Tromey
2018-01-10 16:28       ` Tom Tromey
2018-01-16 15:04         ` Simon Marchi
2018-01-17 17:10           ` Tom Tromey
2018-01-06  0:26 ` [RFA 1/6] Unify new_symbol and new_symbol_full Tom Tromey
2018-01-07  5:33   ` Simon Marchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1faf3ee-8608-67f5-35fe-566296eebfed@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).