[Lldb-commits] [PATCH] D57552: Handle "." in target.source-map in PathMapListing::FindFiles

Ted Woodward via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 1 10:39:06 PST 2019


ted added a comment.

In D57552#1381046 <https://reviews.llvm.org/D57552#1381046>, @jingham wrote:

> In D57552#1380782 <https://reviews.llvm.org/D57552#1380782>, @ted wrote:
>
> > FYI, @jingham , this is also an issue with DYLD plugins, if the file in the link map starts with ".". "image search-paths add . /path/to/my/libraries" fails in this case, because "./library.so" gets changed to "library.so".
>
>
> This should fix that issue as well, since image search-paths are also PathMappingLists.  I don't see any tests for this, however.  Do you have something handy you could turn into a test?


I don't think this will fix it, because the problem happens in the initial FileSpec, before we get to search-paths.

>From source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp, DYLDRendezvous::ReadSOEntryFromMemory():

  std::string file_path = ReadStringFromMemory(entry.path_addr);
  entry.file_spec.SetFile(file_path, false, FileSpec::Style::native);

FileSpec::SetFile normalizes the path, which will remove a leading "./", so "image search-paths add . /path/to/my/lib", which would work with "./mylib.so", won't work with "mylib.so".

I think I can write a test that uses LD_LIBRARY_PATH and a subdirectory so the target can load "./mylib.so", but LLDB won't be able to see it without a search-path.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57552/new/

https://reviews.llvm.org/D57552





More information about the lldb-commits mailing list