Skip to content
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

Avoid adding any framework paths in /System/Library in process_one_mo… #46

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
LEVEL = ../../../make

SWIFT_SOURCES := main.swift

SWIFT_FLAGS_EXTRAS := -framwork CoreGraphics

include $(LEVEL)/Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbtest as lldbtest
import lldbsuite.test.lldbutil as lldbutil
import os
import unittest2


class TestSwiftAnyType(lldbtest.TestBase):

mydir = lldbtest.TestBase.compute_mydir(__file__)

@swiftTest
def test_system_framework(self):
"""Make sure no framework paths into /System/Library are added"""
self.build()
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, 'break here', lldb.SBFileSpec('main.swift'))

log = self.getBuildArtifact("types.log")
self.runCmd('log enable lldb types -f "%s"' % log)
self.expect("settings set target.use-all-compiler-flags true")
self.expect("expression -- 0")
pos = 0
neg = 0
with open(log, "r") as logfile:
for line in logfile:
if "process_one_module rejecting framework path" in line:
pos += 1
elif "/System/Library/Frameworks" in line:
neg += 1

self.assertGreater(pos, 0, "sanity check failed")
self.assertEqual(neg, 0, "found /System/Library/Frameworks in log")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import ApplicationServices

func stop() {}

let a = ATSFSSpec()
stop() // break here
5 changes: 4 additions & 1 deletion lldb/source/Symbol/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,10 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(lldb::LanguageType language,
std::string parent_path =
module_path.substr(0, framework_offset);

if (!StringRef(parent_path).equals("/System/Library") &&
// Never add framework paths pointing into the
// system. These modules must be imported from the
// SDK instead.
if (!StringRef(parent_path).startswith("/System/Library") &&
!IsDeviceSupport(parent_path.c_str()))
framework_search_paths.push_back(
{std::move(parent_path), /*system*/ false});
Expand Down