This is an archive of the discontinued LLVM Phabricator instance.

Prefer executable files from sysroot over files from local filesystem
ClosedPublic

Authored by yuri on Apr 6 2020, 12:56 AM.

Details

Summary

In D49685 sysroot behaviour was partially fixed. But files from local filesystem with same path still has priority over files from sysroot.

This patch fixes it by removing fallback to local filesystem from RemoteAwarePlatform::GetModuleSpec(). It is not actually required because higher level code do such fallback itself. See, for example, resolver in Platform::GetSharedModule().

Diff Detail

Event Timeline

yuri created this revision.Apr 6 2020, 12:56 AM
yuri updated this revision to Diff 255260.Apr 6 2020, 2:30 AM
yuri added a comment.Apr 6 2020, 3:26 AM

Build failure is a bug of tidy script and is not caused by the patch itself.

/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/lldb/source/Target/RemoteAwarePlatform.cpp:9:10: error: 'lldb/Target/RemoteAwarePlatform.h' file not found [clang-diagnostic-error]
#include "lldb/Target/RemoteAwarePlatform.h"
         ^
labath added a comment.Apr 6 2020, 3:35 AM

Thanks for doing this. There are so many levels at which the search for modules is retried and I am glad that we can solve this problem by getting rid of one of them. Unfortunately, all of that complexity also means it's hard to guarantee that this won't break anything, but this patch is so simple, I think it's worth giving it a shot...

I just have a question about the test case inline...

lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
221

Would it be possible to make this test not depend on the existence of /bin/sh? Maybe if you place the "wrong" file in $BUILD/a.out, and the "right" file at $BUILD/sysroot/$BUILD/a.out and then check that the "right" file was selected?

I guess that will require creating a new core file with a sufficiently long path so that it can be replaced by the right runtime value.

yuri marked an inline comment as done.Apr 6 2020, 4:05 AM
yuri added inline comments.
lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
221

Yes, it's possible.
Can you suggest how to upload binary file into review? Looks like git diff with --binary flag is not supported.

yuri updated this revision to Diff 255588.EditedApr 6 2020, 10:21 PM

Do not depend on existance of /bin/sh anymore

yuri marked an inline comment as done.Apr 6 2020, 10:30 PM
yuri added a comment.Apr 16 2020, 1:53 AM

@labath, please take a look

labath accepted this revision.Apr 16 2020, 2:33 AM

Sorry, this got burried in my inbox. I think this looks good. I don't believe this test will pass on windows, because of the different path styles. I don't think it's possible to meaningfully test this on windows, as it requires the path in the core file to match a host path. So, I think you can just slap @skipIfWindows on the test.

Do you have commit access?

This revision is now accepted and ready to land.Apr 16 2020, 2:33 AM
yuri updated this revision to Diff 258034.Apr 16 2020, 6:16 AM

Added @skipIfWindows

yuri added a comment.Apr 16 2020, 6:20 AM

I don't believe this test will pass on windows, because of the different path styles. I don't think it's possible to meaningfully test this on windows, as it requires the path in the core file to match a host path. So, I think you can just slap @skipIfWindows on the test.

Added

Do you have commit access?

No, I don't. Please commit this change

This revision was automatically updated to reflect the committed changes.