* Use the frame's context (instead of just the target's) when evaluating, so that the language of the frame's CU can be used to select the compiler and/or compiler options to use when parsing the expression. This allows for modules built with mixed languages to be parsed in the context of their frame. * Add all C and C++ language variants when determining the language options to set. * Enable C++ language options when language is C or ObjC as a workaround since the expression parser uses features of C++ to capture values. * Enable ObjC language options when language is C++ as a workaround for ObjC requirements. * Disable C++11 language options when language is C++03. * Add test TestMixedLanguages.py to check that the language being used for evaluation is that of the frame. * Fix test TestExprOptions.py to check for C++11 instead of C++ since C++ has to be enabled for C, and remove redundant expr --language test for ObjC. * Fix TestPersistentPtrUpdate.py to not require C++11 in C. Reviewed by: clayborg, spyffe, jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11102 llvm-svn: 246829
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
"""
|
|
Test that we can have persistent pointer variables
|
|
"""
|
|
|
|
import unittest2
|
|
import lldb
|
|
import lldbutil
|
|
from lldbtest import *
|
|
|
|
class PersistentPtrUpdateTestCase(TestBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
def setUp(self):
|
|
# Call super's setUp().
|
|
TestBase.setUp(self)
|
|
|
|
@skipUnlessDarwin
|
|
@dsym_test
|
|
def test_with_dsym(self):
|
|
"""Test that we can have persistent pointer variables"""
|
|
self.buildDsym()
|
|
self.do_my_test()
|
|
|
|
@skipUnlessDarwin
|
|
@dwarf_test
|
|
def test_with_dwarf(self):
|
|
"""Test that we can have persistent pointer variables"""
|
|
self.buildDwarf()
|
|
self.do_my_test()
|
|
|
|
def do_my_test(self):
|
|
def cleanup():
|
|
pass
|
|
|
|
# Execute the cleanup function during test case tear down.
|
|
self.addTearDownHook(cleanup)
|
|
|
|
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
|
|
|
|
self.runCmd('break set -p here')
|
|
|
|
self.runCmd("run", RUN_SUCCEEDED)
|
|
|
|
self.runCmd("expr void* $foo = 0")
|
|
|
|
self.runCmd("continue")
|
|
|
|
self.expect("expr $foo", substrs=['$foo','0x0'])
|
|
|
|
if __name__ == '__main__':
|
|
import atexit
|
|
lldb.SBDebugger.Initialize()
|
|
atexit.register(lambda: lldb.SBDebugger.Terminate())
|
|
unittest2.main()
|