diff options
author | Enrico Granata <egranata@apple.com> | 2015-05-16 01:27:00 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-05-16 01:27:00 +0000 |
commit | bb642e54564a605c71f4ee9a57e9ed430ac8f68f (patch) | |
tree | 2c98954ad427d7988bee045d0bb3290f8c83b6bd /lldb/test/expression_command/persistent_ptr_update | |
parent | 15a31f67f7b08650b7e7bb0f4262f3530baa4374 (diff) | |
download | bcm5719-llvm-bb642e54564a605c71f4ee9a57e9ed430ac8f68f.tar.gz bcm5719-llvm-bb642e54564a605c71f4ee9a57e9ed430ac8f68f.zip |
Constant result ValueObjects are - well - constant
And they also do not have a thread/frame attached to them
That makes dynamic and synthetic values attached to them impossible to update - which, among other things, makes it impossible to properly display persistent variables of types that could have such dynamic/persistent values
Fix this by making it so that a ValueObject can control its constantness (hint: dynamic and synthetic values cannot be constant) and whether it wants to let itself be updated when an invalid thread is around
llvm-svn: 237504
Diffstat (limited to 'lldb/test/expression_command/persistent_ptr_update')
3 files changed, 73 insertions, 0 deletions
diff --git a/lldb/test/expression_command/persistent_ptr_update/Makefile b/lldb/test/expression_command/persistent_ptr_update/Makefile new file mode 100644 index 00000000000..db5f575866d --- /dev/null +++ b/lldb/test/expression_command/persistent_ptr_update/Makefile @@ -0,0 +1,7 @@ +LEVEL = ../../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules + + diff --git a/lldb/test/expression_command/persistent_ptr_update/TestPersistentPtrUpdate.py b/lldb/test/expression_command/persistent_ptr_update/TestPersistentPtrUpdate.py new file mode 100644 index 00000000000..9c291219529 --- /dev/null +++ b/lldb/test/expression_command/persistent_ptr_update/TestPersistentPtrUpdate.py @@ -0,0 +1,55 @@ +""" +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 = nullptr") + + 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() diff --git a/lldb/test/expression_command/persistent_ptr_update/main.c b/lldb/test/expression_command/persistent_ptr_update/main.c new file mode 100644 index 00000000000..73346969ecc --- /dev/null +++ b/lldb/test/expression_command/persistent_ptr_update/main.c @@ -0,0 +1,11 @@ +void* foo(void *p) +{ + return p; // break here +} + +int main() { + while (1) { + foo(0); + } + return 0; +} |