Summary: When we get an error back from IRForTarget we directly print that error to the debugger output stream instead of putting it in the result object. The result object only gets a vague "The expression could not be prepared to run in the target" error message that doesn't actually tell the user what went wrong. This patch just puts the IRForTarget errors into the status object that is returned to the caller instead of directly printing it to the debugger. Also updates one test that now can actually check for the error message it is supposed to check for (instead of the default error which is all we had before). Reviewers: JDevlieghere Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D81654
27 lines
1006 B
Python
27 lines
1006 B
Python
"""
|
|
Tests that importing ObjC modules in a non-ObjC target doesn't crash LLDB.
|
|
"""
|
|
|
|
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
|
|
class TestCase(TestBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
@skipUnlessDarwin
|
|
def test(self):
|
|
self.build()
|
|
lldbutil.run_to_source_breakpoint(self,"// break here", lldb.SBFileSpec("main.c"))
|
|
|
|
# Import foundation to get some ObjC types.
|
|
self.expect("expr --lang objc -- @import Foundation")
|
|
# Do something with NSString (which requires special handling when
|
|
# preparing to run in the target). The expression most likely can't
|
|
# be prepared to run in the target but it should at least not crash LLDB.
|
|
self.expect('expr --lang objc -- [NSString stringWithFormat:@"%d", 1];',
|
|
error=True,
|
|
substrs=["Rewriting an Objective-C constant string requires CFStringCreateWithBytes"])
|