From: Jiri Olsa <jolsa@redhat.com>
To: "Rémi Bernon" <rbernon@codeweavers.com>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Namhyung Kim <namhyung@kernel.org>,
Jacek Caban <jacek@codeweavers.com>
Subject: Re: [RFC PATCH 1/2] perf dso: Use libbfd to read build_id and .gnu_debuglink section
Date: Mon, 1 Jun 2020 19:48:26 +0200 [thread overview]
Message-ID: <20200601174826.GG1031432@krava> (raw)
In-Reply-To: <20200601111915.114974-2-rbernon@codeweavers.com>
On Mon, Jun 01, 2020 at 01:19:14PM +0200, Rémi Bernon wrote:
SNIP
> int sysfs__read_build_id(const char *filename, void *build_id, size_t size)
> @@ -611,6 +638,37 @@ int sysfs__read_build_id(const char *filename, void *build_id, size_t size)
> int filename__read_debuglink(const char *filename, char *debuglink,
> size_t size)
> {
> +#ifdef HAVE_LIBBFD_SUPPORT
> + int err = -1;
> + asection *section;
> + bfd *abfd;
> +
> + abfd = bfd_openr(filename, NULL);
> + if (!abfd)
> + return -1;
> +
> + if (!bfd_check_format(abfd, bfd_object)) {
> + pr_debug2("%s: cannot read %s bfd file.\n", __func__, filename);
> + goto out_close;
> + }
> +
> + section = bfd_get_section_by_name(abfd, ".gnu_debuglink");
> + if (!section)
> + goto out_close;
> +
> + if (section->size > size)
> + goto out_close;
> +
> + if (!bfd_get_section_contents(abfd, section, debuglink, 0,
> + section->size))
> + goto out_close;
> +
> + err = 0;
> +
> +out_close:
> + bfd_close(abfd);
> + return err;
> +#else
please define 2 filename__read_debuglink functions
for each ifdef leg
thanks,
jirka
> int fd, err = -1;
> Elf *elf;
> GElf_Ehdr ehdr;
> @@ -658,6 +716,7 @@ int filename__read_debuglink(const char *filename, char *debuglink,
> close(fd);
> out:
> return err;
> +#endif
> }
>
> static int dso__swap_init(struct dso *dso, unsigned char eidata)
> --
> 2.26.1
>
next prev parent reply other threads:[~2020-06-01 17:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 11:19 [RFC PATCH 0/2] Add basic support for PE binary format Rémi Bernon
2020-06-01 11:19 ` [RFC PATCH 1/2] perf dso: Use libbfd to read build_id and .gnu_debuglink section Rémi Bernon
2020-06-01 17:48 ` Jiri Olsa [this message]
2020-07-13 0:57 ` [perf dso] 7816ab73f2: perf-sanity-tests.Probe_SDT_events.fail kernel test robot
2020-06-01 11:19 ` [RFC PATCH 2/2] perf symbols: Try reading the symbol table with libbfd Rémi Bernon
2020-06-01 17:45 ` Jiri Olsa
2020-06-01 15:01 ` [RFC PATCH 0/2] Add basic support for PE binary format 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=20200601174826.GG1031432@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jacek@codeweavers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rbernon@codeweavers.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