[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1525866228-30321-13-git-send-email-adrian.hunter@intel.com>
Date: Wed, 9 May 2018 14:43:41 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <ak@...ux.intel.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>, Jiri Olsa <jolsa@...hat.com>,
linux-kernel@...r.kernel.org, x86@...nel.org
Subject: [PATCH RFC 12/19] perf buildid-cache: kcore_copy: Keep phdr data in a list
In preparation to add more program headers, keep phdr data in a list.
Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
---
tools/perf/util/symbol-elf.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 48943b834f11..7faca21141a2 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1388,6 +1388,7 @@ struct phdr_data {
off_t offset;
u64 addr;
u64 len;
+ struct list_head list;
};
struct kcore_copy_info {
@@ -1399,6 +1400,7 @@ struct kcore_copy_info {
u64 last_module_symbol;
struct phdr_data kernel_map;
struct phdr_data modules_map;
+ struct list_head phdrs;
};
static int kcore_copy__process_kallsyms(void *arg, const char *name, char type,
@@ -1510,6 +1512,11 @@ static int kcore_copy__read_maps(struct kcore_copy_info *kci, Elf *elf)
if (elf_read_maps(elf, true, kcore_copy__read_map, kci) < 0)
return -1;
+ if (kci->kernel_map.len)
+ list_add_tail(&kci->kernel_map.list, &kci->phdrs);
+ if (kci->modules_map.len)
+ list_add_tail(&kci->modules_map.list, &kci->phdrs);
+
return 0;
}
@@ -1678,6 +1685,8 @@ int kcore_copy(const char *from_dir, const char *to_dir)
char kcore_filename[PATH_MAX];
char extract_filename[PATH_MAX];
+ INIT_LIST_HEAD(&kci.phdrs);
+
if (kcore_copy__copy_file(from_dir, to_dir, "kallsyms"))
return -1;
--
1.9.1
Powered by blists - more mailing lists