BPF List
 help / color / mirror / Atom feed
From: Ihor Solodrai <ihor.solodrai@pm.me>
To: dwarves@vger.kernel.org
Cc: bpf@vger.kernel.org, acme@kernel.org, alan.maguire@oracle.com,
	eddyz87@gmail.com, andrii@kernel.org, mykolal@fb.com,
	olsajiri@gmail.com
Subject: [PATCH dwarves v4 07/10] dwarf_loader: introduce cu->id
Date: Tue, 07 Jan 2025 19:09:37 +0000	[thread overview]
Message-ID: <20250107190855.2312210-8-ihor.solodrai@pm.me> (raw)
In-Reply-To: <20250107190855.2312210-1-ihor.solodrai@pm.me>

Add an id member to the struct cu.

An id is an index of a CU, in order they are created in dwarf_loader.c
This allows for an easy identification of a CU, particularly when they
need to be processed in order.

Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
---
 dwarf_loader.c | 5 +++++
 dwarves.h      | 1 +
 2 files changed, 6 insertions(+)

diff --git a/dwarf_loader.c b/dwarf_loader.c
index 34376b2..39e4cba 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -3440,6 +3440,7 @@ struct dwarf_cus {
 	int		    build_id_len;
 	int		    error;
 	struct dwarf_cu	    *type_dcu;
+	uint32_t	nr_cus_created;
 };
 
 struct dwarf_thread {
@@ -3472,6 +3473,9 @@ static struct dwarf_cu *dwarf_cus__create_cu(struct dwarf_cus *dcus, Dwarf_Die *
 	cu->priv = dcu;
 	cu->dfops = &dwarf__ops;
 
+	cu->id = dcus->nr_cus_created;
+	dcus->nr_cus_created++;
+
 	return dcu;
 }
 
@@ -3783,6 +3787,7 @@ static int cus__load_module(struct cus *cus, struct conf_load *conf,
 			.type_dcu = type_cu ? &type_dcu : NULL,
 			.build_id = build_id,
 			.build_id_len = build_id_len,
+			.nr_cus_created = 0,
 		};
 		res = dwarf_cus__process_cus(&dcus);
 	}
diff --git a/dwarves.h b/dwarves.h
index 0a4d5a2..b28a66e 100644
--- a/dwarves.h
+++ b/dwarves.h
@@ -290,6 +290,7 @@ struct cu {
 	struct ptr_table functions_table;
 	struct ptr_table tags_table;
 	struct rb_root	 functions;
+	uint32_t	 id;
 	const char	 *name;
 	char		 *filename;
 	void 		 *priv;
-- 
2.47.1



  parent reply	other threads:[~2025-01-07 19:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 19:08 [PATCH dwarves v4 00/10] pahole: faster reproducible BTF encoding Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 01/10] btf_encoder: simplify function encoding Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 02/10] btf_encoder: free encoder->secinfo in btf_encoder__delete Ihor Solodrai
2025-01-09 16:54   ` Alan Maguire
2025-01-09 21:36     ` Arnaldo Carvalho de Melo
2025-01-07 19:09 ` [PATCH dwarves v4 03/10] btf_encoder: separate elf function, saved function representations Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 04/10] btf_encoder: introduce elf_functions struct type Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 05/10] btf_encoder: introduce elf_functions_list Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 06/10] btf_encoder: remove skip_encoding_inconsistent_proto Ihor Solodrai
2025-01-07 19:09 ` Ihor Solodrai [this message]
2025-01-07 19:09 ` [PATCH dwarves v4] dwarf_loader: multithreading with a job/worker model Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 09/10] btf_encoder: clean up global encoders list Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4] btf_encoder: switch func_states from a list to an array Ihor Solodrai
2025-01-07 20:35 ` [PATCH dwarves v4 00/10] pahole: faster reproducible BTF encoding Ihor Solodrai
2025-01-09 18:32 ` Arnaldo Carvalho de Melo
2025-01-09 18:38   ` Ihor Solodrai
2025-01-09 21:21     ` Arnaldo Carvalho de Melo

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=20250107190855.2312210-8-ihor.solodrai@pm.me \
    --to=ihor.solodrai@pm.me \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=mykolal@fb.com \
    --cc=olsajiri@gmail.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