public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA v2 06/17] Record minimal symbols directly in reader.
Date: Thu, 13 Oct 2016 22:34:00 -0000	[thread overview]
Message-ID: <d8702eec-9a96-26b0-52db-47cc2d3ee9d4@redhat.com> (raw)
In-Reply-To: <1476393012-29987-7-git-send-email-tom@tromey.com>

On 10/13/2016 10:10 PM, Tom Tromey wrote:
> This patch changes minimal symbol creation in two ways.  First, it
> removes global variables in favor of members of minimal_symbol_reader.
> Second, it changes functions like prim_record_minimal_symbol to be
> member functions of minimal_symbol_reader.
> 

Awesome, thanks.

>  struct minimal_symbol *
> -prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
> -				 CORE_ADDR address,
> -				 enum minimal_symbol_type ms_type,
> -				 int section,
> -				 struct objfile *objfile)
> +minimal_symbol_reader::record_full (const char *name, int name_len,
> +					   int copy_name,

Can you make this bool while at it?

> +					   CORE_ADDR address,
> +					   enum minimal_symbol_type ms_type,
> +					   int section)



>    explicit minimal_symbol_reader (struct objfile *);
>  
> @@ -73,6 +74,56 @@ class minimal_symbol_reader
>  
>    void install ();
>  
> +  /* Record a new minimal symbol.  This is the "full" entry point;
> +     simpler convenience entry points are also provided below.
> +   
> +     This returns a new minimal symbol.  It is ok to modify the returned
> +     minimal symbol (though generally not necessary).  It is not ok,
> +     though, to stash the pointer anywhere; as minimal symbols may be
> +     moved after creation.  The memory for the returned minimal symbol
> +     is still owned by the minsyms.c code, and should not be freed.
> +   
> +     Arguments are:
> +
> +     NAME - the symbol's name
> +     NAME_LEN - the length of the name
> +     COPY_NAME - if true, the minsym code must make a copy of NAME.  If
> +     false, then NAME must be NUL-terminated, and must have a lifetime
> +     that is at least as long as OBJFILE's lifetime.
> +     ADDRESS - the address of the symbol
> +     MS_TYPE - the type of the symbol
> +     SECTION - the symbol's section
> +     appropriate obj_section for the minimal symbol.  This can be NULL.

Hmm, preexisting, but, this parameter's type is actually int.
Not sure that comment makes sense as is.

> +     OBJFILE - the objfile associated with the minimal symbol.  */

ENOSUCHPARAMETER.

> +
> +  struct minimal_symbol *record_full (const char *name,
> +				      int name_len,
> +				      int copy_name,

Use "bool" for copy_name ?

> +				      CORE_ADDR address,
> +				      enum minimal_symbol_type ms_type,
> +				      int section);
> +
> +  /* Like record_full, but:
> +     - uses strlen to compute NAME_LEN,
> +     - passes COPY_NAME = 1,

"= true".

> +     - and passes a default SECTION, depending on the type
> +
> +     This variant does not return the new symbol.  */
> +
> +  void record (const char *, CORE_ADDR, enum minimal_symbol_type);

I think it may be a good idea to give names to the parameters.

> +
> +  /* Like record_full, but:
> +     - uses strlen to compute NAME_LEN,
> +     - passes COPY_NAME = 1.  */

= true.

> +
> +  struct minimal_symbol *record_with_info (const char *name,
> +					   CORE_ADDR address,
> +					   enum minimal_symbol_type ms_type,
> +					   int section)
> +  {
> +    return record_full (name, strlen (name), 1, address, ms_type, section);

s/1/true/.

LGTM with those changes.

Thanks,
Pedro Alves

  reply	other threads:[~2016-10-13 22:34 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13 21:11 [RFA v2 00/17] more C++ Tom Tromey
2016-10-13 21:11 ` [RFA v2 12/17] Remove make_cleanup_restore_current_uiout Tom Tromey
2016-10-13 22:49   ` Pedro Alves
2016-10-14 21:30     ` Tom Tromey
2016-10-20 21:46       ` Tom Tromey
2016-10-20 21:57         ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 15/17] Convert DWARF expr functions to methods Tom Tromey
2016-10-13 23:01   ` Pedro Alves
2016-10-20 21:47     ` Tom Tromey
2016-10-20 22:01       ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 08/17] Remove some cleanups in MI Tom Tromey
2016-10-13 22:38   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 04/17] Introduce minimal_symbol_reader Tom Tromey
2016-10-13 22:20   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 02/17] Use scoped_restore for ui_file Tom Tromey
2016-10-13 22:07   ` Pedro Alves
2016-10-14 21:33     ` Tom Tromey
2016-10-13 21:11 ` [RFA v2 03/17] Use scoped_restore for current_ui Tom Tromey
2016-10-13 22:16   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 10/17] Replace two xmallocs with unique_ptr Tom Tromey
2016-10-13 22:44   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 05/17] Change minimal_symbol_reader to store objfile Tom Tromey
2016-10-13 22:21   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 01/17] Use RAII to save and restore scalars Tom Tromey
2016-10-13 22:03   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 11/17] Use gdb::unique_ptr in elf_read_minimal_symbols Tom Tromey
2016-10-13 22:44   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 07/17] Remove make_cleanup_restore_current_ui Tom Tromey
2016-10-13 22:37   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 14/17] Initial conversion of dwarf_expr_ctx Tom Tromey
2016-10-13 22:54   ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 06/17] Record minimal symbols directly in reader Tom Tromey
2016-10-13 22:34   ` Pedro Alves [this message]
2016-10-14 21:22     ` Tom Tromey
2016-10-20 21:47       ` Tom Tromey
2016-10-20 22:13         ` Pedro Alves
2016-10-13 21:11 ` [RFA v2 16/17] Convert dwarf_expr_context_funcs to methods Tom Tromey
2016-10-13 23:05   ` Pedro Alves
2016-10-18  2:50     ` Tom Tromey
2016-10-18 10:51       ` Pedro Alves
2016-10-18 14:55         ` Tom Tromey
2016-10-18 17:38           ` Pedro Alves
2016-10-19 22:29             ` Tom Tromey
2016-10-20 21:48       ` Tom Tromey
2016-10-20 21:56         ` Pedro Alves
2016-10-28 13:36         ` Pedro Alves
2016-10-31  2:48           ` Tom Tromey
2016-11-01 22:07             ` Tom Tromey
2016-11-02 16:12             ` Pedro Alves
2016-10-13 21:13 ` [RFA v2 13/17] Some cleanup removal in dwarf2loc.c Tom Tromey
2016-10-13 22:52   ` Pedro Alves
2016-10-13 21:14 ` [RFA v2 09/17] Change command stats reporting to use class Tom Tromey
2016-10-13 22:43   ` Pedro Alves
2016-10-13 21:18 ` [RFA v2 17/17] Remove last cleanup from captured_main_1 Tom Tromey
2016-10-13 23:13   ` Pedro Alves
2016-10-13 21:39 ` [RFA v2 00/17] more C++ Pedro Alves
2016-10-14 16:26   ` Pedro Alves
2016-10-20 21:49 ` Tom Tromey
2016-10-20 22:27   ` Pedro Alves

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=d8702eec-9a96-26b0-52db-47cc2d3ee9d4@redhat.com \
    --to=palves@redhat.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).