forked from OSchip/llvm-project
[lldb] Add test for importing ObjC modules in a non-ObjC target
This was previously crashing due to a missing nullptr check (see
e2d8aa6bf7
). This just adds a test that should
make sure this doesn't crash in case a user ends up in this strange setup.
This commit is contained in:
parent
0947296902
commit
f5e0f8b10a
|
@ -0,0 +1,3 @@
|
|||
C_SOURCES := main.c
|
||||
|
||||
include Makefile.rules
|
|
@ -0,0 +1,26 @@
|
|||
"""
|
||||
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=["error: The expression could not be prepared to run in the target"])
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 0; // break here
|
||||
}
|
Loading…
Reference in New Issue