public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Faust <david.faust@oracle.com>
To: Cupertino Miranda <cupertino.miranda@oracle.com>
Cc: gcc-patches@gcc.gnu.org, jose.marchesi@oracle.com,
	elena.zannoni@oracle.com, indu.bhagat@oracle.com
Subject: Re: [PATCH v2 2/5] btf: added KIND_FUNC traversal function.
Date: Tue, 27 Feb 2024 12:07:10 -0800	[thread overview]
Message-ID: <9457b342-0c00-4e6d-94c8-919543c4e2c7@oracle.com> (raw)
In-Reply-To: <20240227190435.35750-3-cupertino.miranda@oracle.com>

Hi Cupertino,

Similar to patch 1, please use present tense to match the style of
existing commits, in commit message and in ChangeLog.

On 2/27/24 11:04, Cupertino Miranda wrote:
> Added a traversal function to traverse all BTF_KIND_FUNC nodes with a
> callback function. Used for .BTF.ext section content creation.

Added -> Add

> 
> gcc/ChangeLog:
> 
> 	* btfout.cc (output_btf_func_types): Use FOR_EACH_VEC_ELT.
> 	(traverse_btf_func_types): Defined function.
> 	* ctfc.h (funcs_traverse_callback): Typedef for function
> 	prototype.
> 	(traverse_btf_func_types): Added prototype.

Mix of present and past tenses here, please stick to the present:
Defined -> Define
Added -> Add

The code changes LGTM, so OK with those nits fixed.
Thanks.

> ---
>  gcc/btfout.cc | 22 ++++++++++++++++++++--
>  gcc/ctfc.h    |  3 +++
>  2 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
> index 7e114e224449..7aabd99f3e7c 100644
> --- a/gcc/btfout.cc
> +++ b/gcc/btfout.cc
> @@ -1276,8 +1276,10 @@ output_btf_types (ctf_container_ref ctfc)
>  static void
>  output_btf_func_types (ctf_container_ref ctfc)
>  {
> -  for (size_t i = 0; i < vec_safe_length (funcs); i++)
> -    btf_asm_func_type (ctfc, (*funcs)[i], i);
> +  ctf_dtdef_ref ref;
> +  unsigned i;
> +  FOR_EACH_VEC_ELT (*funcs, i, ref)
> +    btf_asm_func_type (ctfc, ref, i);
>  }
>  
>  /* Output all BTF_KIND_DATASEC records.  */
> @@ -1452,4 +1454,20 @@ btf_finalize (void)
>    tu_ctfc = NULL;
>  }
>  
> +/* Traversal function for all BTF_KIND_FUNC type records.  */
> +
> +bool
> +traverse_btf_func_types (funcs_traverse_callback callback, void *data)
> +{
> +  ctf_dtdef_ref ref;
> +  unsigned i;
> +  FOR_EACH_VEC_ELT (*funcs, i, ref)
> +    {
> +      bool stop = callback (ref, data);
> +      if (stop == true)
> +	return true;
> +    }
> +  return false;
> +}
> +
>  #include "gt-btfout.h"
> diff --git a/gcc/ctfc.h b/gcc/ctfc.h
> index 7aac57edac55..fa188bf2f5a4 100644
> --- a/gcc/ctfc.h
> +++ b/gcc/ctfc.h
> @@ -441,6 +441,9 @@ extern int ctf_add_variable (ctf_container_ref, const char *, ctf_id_t,
>  extern ctf_id_t ctf_lookup_tree_type (ctf_container_ref, const tree);
>  extern ctf_id_t get_btf_id (ctf_id_t);
>  
> +typedef bool (*funcs_traverse_callback) (ctf_dtdef_ref, void *);
> +bool traverse_btf_func_types (funcs_traverse_callback, void *);
> +
>  /* CTF section does not emit location information; at this time, location
>     information is needed for BTF CO-RE use-cases.  */
>  

  reply	other threads:[~2024-02-27 20:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 19:04 bpf: PR target/113453 func_info .BTF.ext implementation Cupertino Miranda
2024-02-27 19:04 ` [PATCH v2 1/5] btf: fixed type id in BTF_KIND_FUNC struct data Cupertino Miranda
2024-02-27 20:00   ` David Faust
2024-02-28 19:24     ` Cupertino Miranda
2024-02-27 19:04 ` [PATCH v2 2/5] btf: added KIND_FUNC traversal function Cupertino Miranda
2024-02-27 20:07   ` David Faust [this message]
2024-02-28 19:25     ` Cupertino Miranda
2024-02-27 19:04 ` [PATCH v2 3/5] bpf: Always emit .BTF.ext section if generating BTF Cupertino Miranda
2024-02-27 20:16   ` David Faust
2024-02-28 19:25     ` Cupertino Miranda
2024-02-27 19:04 ` [PATCH v2 4/5] bpf: implementation of func_info in .BTF.ext Cupertino Miranda
2024-02-27 21:21   ` David Faust
2024-02-28 19:28     ` Cupertino Miranda
2024-02-27 19:04 ` [PATCH v2 5/5] bpf: renamed coreout.* files to btfext-out.* Cupertino Miranda
2024-02-27 20:28   ` David Faust
2024-02-28 19:29     ` Cupertino Miranda

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=9457b342-0c00-4e6d-94c8-919543c4e2c7@oracle.com \
    --to=david.faust@oracle.com \
    --cc=cupertino.miranda@oracle.com \
    --cc=elena.zannoni@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=indu.bhagat@oracle.com \
    --cc=jose.marchesi@oracle.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).