Skip to content

[lldb] Fix the last remaining tests not inheriting TCC permissions #1635

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 1 commit into from
Aug 11, 2020
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
Expand Up @@ -34,20 +34,21 @@ def run_weak_var_check (self, weak_varname, present):
correct_value = 10
else:
correct_value = 20

# Note, I'm adding the "; 10" at the end of the expression to work around
# the bug that expressions with no result currently return False for Success()...
expr = "if (&" + weak_varname + " != NULL) { present_weak_int = 10; } else { present_weak_int = 20;}; 10"
result = self.frame.EvaluateExpression(expr)
self.assertSuccess(result.GetError(), "absent_weak_int expr failed")
self.assertEqual(value.GetValueAsSigned(), correct_value, "Didn't change present_weak_int correctly.")

def do_test(self):
hidden_dir = os.path.join(self.getBuildDir(), "hidden")
hidden_dylib = os.path.join(hidden_dir, "libdylib.dylib")

launch_info = lldb.SBLaunchInfo(None)
launch_info.SetWorkingDirectory(self.getBuildDir())
launch_info.SetLaunchFlags(lldb.eLaunchFlagInheritTCCFromParent)
# We have to point to the hidden directory to pick up the
# version of the dylib without the weak symbols:
env_expr = self.platformContext.shlib_environment_var + "=" + hidden_dir
Expand All @@ -63,7 +64,7 @@ def do_test(self):
# search paths, and then run @import to introduce it into the expression
# context:
self.dbg.HandleCommand("settings set target.clang-module-search-paths " + self.getSourceDir())

self.frame = thread.frames[0]
self.assertTrue(self.frame.IsValid(), "Got a good frame")
options = lldb.SBExpressionOptions()
Expand All @@ -73,7 +74,7 @@ def do_test(self):
# Now run an expression that references an absent weak symbol:
self.run_weak_var_check("absent_weak_int", False)
self.run_weak_var_check("absent_weak_function", False)

# Make sure we can do the same thing with present weak symbols
self.run_weak_var_check("present_weak_int", True)
self.run_weak_var_check("present_weak_function", True)
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ def test_launch_notifications(self):
True

error = lldb.SBError()
flags = lldb.eLaunchFlagInheritTCCFromParent
process = target.Launch(listener,
None, # argv
None, # envp
None, # stdin_path
None, # stdout_path
None, # stderr_path
None, # working directory
0, # launch flags
flags, # launch flags
False, # Stop at entry
error) # error

Expand Down
1 change: 1 addition & 0 deletions lldb/test/API/lang/objc/exceptions/TestObjCExceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_objc_exceptions_at_throw(self):
self.assertTrue(target, VALID_TARGET)

launch_info = lldb.SBLaunchInfo(["a.out", "0"])
launch_info.SetLaunchFlags(lldb.eLaunchFlagInheritTCCFromParent)
lldbutil.run_to_name_breakpoint(self, "objc_exception_throw", launch_info=launch_info)

self.expect("thread list",
Expand Down
4 changes: 4 additions & 0 deletions lldb/test/API/types/AbstractBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ def generic_type_tester(
# This test uses a #include of "basic_type.cpp" so we need to enable
# always setting inlined breakpoints.
self.runCmd('settings set target.inline-breakpoint-strategy always')

# Inherit TCC permissions. We can leave this set.
self.runCmd('settings set target.inherit-tcc true')

# And add hooks to restore the settings during tearDown().
self.addTearDownHook(lambda: self.runCmd(
"settings set target.inline-breakpoint-strategy headers"))
Expand Down