Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/tools/compiletest/src/runtest/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,35 @@ impl TestCx<'_> {
// We don't want to hang when calling `quit` while the process is still running
let mut script_str = String::from("settings set auto-confirm true\n");

// macOS has a system for restricting access to files and peripherals
// called Transparency, Consent, and Control (TCC), which can be
// configured using the "Security & Privacy" tab in your settings.
//
// This system is provenance-based: if Terminal.app is given access to
// your Desktop, and you launch a binary within Terminal.app, the new
// binary also has access to the files on your Desktop.
//
// By default though, LLDB launches binaries in very isolated
// contexts. This includes resetting any TCC grants that might
// otherwise have been inherited.
//
// In effect, this means that if the developer has placed the rust
// repository under one of the system-protected folders, they will get
// a pop-up _for each binary_ asking for permissions to access the
// folder - quite annoying.
//
// To avoid this, we tell LLDB to spawn processes with TCC grants
// inherited from the parent process.
//
// Setting this also avoids unnecessary overhead from XprotectService
// when running with the Developer Tool grant.
//
// TIP: If you want to allow launching `lldb ~/Desktop/my_binary`
// without being prompted, you can put this in your `~/.lldbinit` too.
if self.config.host.contains("darwin") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great comment!

script_str.push_str("settings set target.inherit-tcc true\n");
}

// Make LLDB emit its version, so we have it documented in the test output
script_str.push_str("version\n");

Expand Down
Loading