Skip to content

[lldb/Reproducers] Always collect the whole dSYM in the reproducer #1102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 22, 2020
Merged

[lldb/Reproducers] Always collect the whole dSYM in the reproducer #1102

merged 5 commits into from
Apr 22, 2020

Conversation

JDevlieghere
Copy link

No description provided.

The current implementation of the JSONWriter does not support writing
out directory entries. Earlier today I added a unit test to illustrate
the problem. When an entry is added to the YAMLVFSWriter and the path is
a directory, it will incorrectly emit the directory as a file, and any
files inside that directory will not be found by the VFS.

It's possible to partially work around the issue by only adding "leaf
nodes" (files) to the YAMLVFSWriter. However, this doesn't work for
representing empty directories. This is a problem for clients of the VFS
that want to iterate over a directory. The directory not being there is
not the same as the directory being empty.

This is not just a hypothetical problem. The FileCollector for example
does not differentiate between file and directory paths. I temporarily
worked around the issue for LLDB by ignoring directories, but I suspect
this will prove problematic sooner rather than later.

This patch fixes the issue by extending the JSONWriter to support
writing out directory entries. We store whether an entry should be
emitted as a file or directory.

Differential revision: https://reviews.llvm.org/D76670

(cherry picked from commit 3ef33e6)
… contents."

Extend the FileCollector's API with addDirectory which adds a directory
and its contents to the VFS mapping.

Differential revision: https://reviews.llvm.org/D76671

(cherry picked from commit 4151f2d)
The FileCollector in LLDB collects every files that's used during a
debug session when capture is enabled. This ensures that the reproducer
only contains the files necessary to reproduce. This approach is not a
good fit for the dSYM bundle, which is a directory on disk, but should
be treated as a single unit.

On macOS LLDB have automatically find the matching dSYM for a binary by
its UUID. Having a incomplete dSYM in a reproducer can break debugging
even when reproducers are disabled.

This patch adds a was to specify a directory of interest to the
reproducers. It is called from SymbolVendorMacOSX with the path of the
dSYMs used by LLDB.

Differential revision: https://reviews.llvm.org/D76672

(cherry picked from commit 38ddb49)
@JDevlieghere
Copy link
Author

@swift-ci please test macOS

1 similar comment
@JDevlieghere
Copy link
Author

@swift-ci please test macOS

Fix error: conditional expression is ambiguous; 'const std::string' (aka
'const basic_string<char, char_traits<char>, allocator<char> >') can be
converted to 'llvm::StringRef' and vice versa.
@JDevlieghere
Copy link
Author

@swift-ci please test macOS

@JDevlieghere JDevlieghere merged commit c1aa619 into swiftlang:apple/stable/20200108 Apr 22, 2020
@JDevlieghere JDevlieghere deleted the 🍒/20200108/1d9a5bea33c6b9b94bb1a930df1655e3dd4188e7 branch April 22, 2020 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant