From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Luke Diamand <ldiamand@roku.com>
Cc: elfutils-devel@sourceware.org, Mark Wielaard <mark@klomp.org>
Subject: Re: [PATCHv1 1/2] libdwfl: specify optional sysroot to search for shared libraries
Date: Sun, 20 Jan 2019 22:08:00 -0000 [thread overview]
Message-ID: <20190120220838.GA1869@altlinux.org> (raw)
In-Reply-To: <20190120150028.21580-2-ldiamand@roku.com>
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
On Sun, Jan 20, 2019 at 03:00:45PM +0000, Luke Diamand wrote:
> When searching the list of modules in a core file, if the core was
> generated on a different system to the current one, we need to look
> in a sysroot for the various shared objects.
>
> For example, we might be looking at a core file from an ARM system
> using elfutils running on an x86 host.
>
> This change adds a new function, dwfl_set_sysroot(), which then
> gets used when searching for libraries.
[...]
> --- a/libdwfl/link_map.c
> +++ b/libdwfl/link_map.c
> @@ -388,8 +388,21 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
> if (name != NULL)
> {
> /* This code is mostly inlined dwfl_report_elf. */
> - // XXX hook for sysroot
> - int fd = open (name, O_RDONLY);
> + char *path_name;
> + const char *sysroot = dwfl->sysroot;
> + int rc;
> +
> + /* don't look in the sysroot if the path is already inside the sysroot */
> + bool name_in_sysroot = strncmp(name, sysroot, strlen(sysroot)) == 0;
Is sysroot guaranteed to be non-NULL at this point?
If yes, is sysroot guaranteed to end with "/"?
--
ldv
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2019-01-20 22:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-20 15:01 [PATCHv1 0/2] specify a sysroot to search when examining a core file Luke Diamand
2019-01-20 15:01 ` [PATCHv1 2/2] eu-stack: add support for sysroot option Luke Diamand
2019-01-20 15:01 ` [PATCHv1 1/2] libdwfl: specify optional sysroot to search for shared libraries Luke Diamand
2019-01-20 22:08 ` Dmitry V. Levin [this message]
2019-01-29 13:47 ` [PATCHv1 0/2] specify a sysroot to search when examining a core file Mark Wielaard
[not found] ` <BN7PR01MB3953544F2EDA1FB7BF6E9470B0970@BN7PR01MB3953.prod.exchangelabs.com>
2019-01-31 15:22 ` Mark Wielaard
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=20190120220838.GA1869@altlinux.org \
--to=ldv@altlinux.org \
--cc=elfutils-devel@sourceware.org \
--cc=ldiamand@roku.com \
--cc=mark@klomp.org \
/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).