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