All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Ihor Solodrai <ihor.solodrai@pm.me>, dwarves@vger.kernel.org
Cc: acme@kernel.org, andrii@kernel.org, eddyz87@gmail.com
Subject: Re: [PATCH v3 dwarves 1/5] dwarf_loader: introduce pre_load_module hook to conf_load
Date: Thu, 17 Oct 2024 11:44:00 +0100	[thread overview]
Message-ID: <5c26452e-a550-4b4f-8be2-3f1556052d94@oracle.com> (raw)
In-Reply-To: <20241016001025.857970-2-ihor.solodrai@pm.me>

On 16/10/2024 01:10, Ihor Solodrai wrote:
> Add a function pointer to conf_load, which is called immediately after
> Elf is extracted from Dwfl_Module in cus__proces_dwflmod.
> 
> This is a preparation for making elf_functions table shared between
> encoders. Shared table can be built as soon as the relevant Elf is
> available.
> 
> Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>

looks good to me

Reviewed-by: Alan Maguire <alan.maguire@oracle.com>

> ---
>  dwarf_loader.c | 14 +++++++-------
>  dwarves.h      | 11 +++++++++--
>  2 files changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/dwarf_loader.c b/dwarf_loader.c
> index e54a16c..83a7f54 100644
> --- a/dwarf_loader.c
> +++ b/dwarf_loader.c
> @@ -3723,13 +3723,6 @@ static int cus__load_module(struct cus *cus, struct conf_load *conf,
>  	return DWARF_CB_OK;
>  }
>  
> -struct process_dwflmod_parms {
> -	struct cus	 *cus;
> -	struct conf_load *conf;
> -	const char	 *filename;
> -	uint32_t	 nr_dwarf_sections_found;
> -};
> -
>  static int cus__process_dwflmod(Dwfl_Module *dwflmod,
>  				void **userdata __maybe_unused,
>  				const char *name __maybe_unused,
> @@ -3753,11 +3746,18 @@ static int cus__process_dwflmod(Dwfl_Module *dwflmod,
>  	Dwarf *dw = dwfl_module_getdwarf(dwflmod, &dwbias);
>  
>  	int err = DWARF_CB_OK;
> +	if (parms->conf->pre_load_module) {
> +		err = parms->conf->pre_load_module(dwflmod, elf);
> +		if (err)
> +			return DWARF_CB_ABORT;
> +	}
> +
>  	if (dw != NULL) {
>  		++parms->nr_dwarf_sections_found;
>  		err = cus__load_module(cus, parms->conf, dwflmod, dw, elf,
>  				       parms->filename);
>  	}
> +
>  	/*
>  	 * XXX We will fall back to try finding other debugging
>  	 * formats (CTF), so no point in telling this to the user
> diff --git a/dwarves.h b/dwarves.h
> index f147b2b..eb3be6e 100644
> --- a/dwarves.h
> +++ b/dwarves.h
> @@ -36,6 +36,7 @@
>  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>  
>  struct cu;
> +struct cus;
>  
>  enum load_steal_kind {
>  	LSK__KEEPIT,
> @@ -58,6 +59,13 @@ typedef uint32_t type_id_t;
>  struct btf;
>  struct conf_fprintf;
>  
> +struct process_dwflmod_parms {
> +	struct cus	 *cus;
> +	struct conf_load *conf;
> +	const char	 *filename;
> +	uint32_t	 nr_dwarf_sections_found;
> +};
> +
>  /** struct conf_load - load configuration
>   * @thread_exit - called at the end of a thread, 1st user: BTF encoder dedup
>   * @extra_dbg_info - keep original debugging format extra info
> @@ -106,6 +114,7 @@ struct conf_load {
>  	struct conf_fprintf	*conf_fprintf;
>  	int			(*threads_prepare)(struct conf_load *conf, int nr_threads, void **thr_data);
>  	int			(*threads_collect)(struct conf_load *conf, int nr_threads, void **thr_data, int error);
> +	int			(*pre_load_module)(Dwfl_Module *mod, Elf *elf);
>  };
>  
>  /** struct conf_fprintf - hints to the __fprintf routines
> @@ -167,8 +176,6 @@ struct conf_fprintf {
>  	uint8_t    skip_emitting_modifier:1;
>  };
>  
> -struct cus;
> -
>  struct cus *cus__new(void);
>  void cus__delete(struct cus *cus);
>  


  reply	other threads:[~2024-10-17 10:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  0:10 [PATCH v3 dwarves 0/5] btf_encoder: implement shared elf_functions table Ihor Solodrai
2024-10-16  0:10 ` [PATCH v3 dwarves 1/5] dwarf_loader: introduce pre_load_module hook to conf_load Ihor Solodrai
2024-10-17 10:44   ` Alan Maguire [this message]
2024-10-16  0:10 ` [PATCH v3 dwarves 2/5] btf_encoder: introduce elf_functions struct type Ihor Solodrai
2024-10-17 10:29   ` Alan Maguire
2024-10-16  0:10 ` [PATCH v3 dwarves 3/5] btf_encoder: collect elf_functions in btf_encoder__pre_load_module Ihor Solodrai
2024-10-17 10:56   ` Alan Maguire
2024-10-17 20:13     ` Arnaldo Carvalho de Melo
2024-10-18 20:17       ` Ihor Solodrai
2024-10-16  0:10 ` [PATCH v3 dwarves 4/5] btf_encoder: store a list of elf_function per function name Ihor Solodrai
2024-10-21 17:51   ` Alan Maguire
2024-10-31  0:14     ` Ihor Solodrai
2024-11-06 23:28       ` Ihor Solodrai
2024-11-07 15:45         ` Alan Maguire
2024-10-16  0:10 ` [PATCH v3 dwarves 5/5] btf_encoder: switch to shared elf_functions table Ihor Solodrai

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=5c26452e-a550-4b4f-8be2-3f1556052d94@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=acme@kernel.org \
    --cc=andrii@kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@pm.me \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.