[Lldb-commits] [lldb] r319443 - Add a test case for open bug 35480
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 30 07:39:57 PST 2017
Author: labath
Date: Thu Nov 30 07:39:57 2017
New Revision: 319443
URL: http://llvm.org/viewvc/llvm-project?rev=319443&view=rev
Log:
Add a test case for open bug 35480
The test is about failing to hit breakpoints in global constructors in
shared libraries.
Added:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile?rev=319443&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile Thu Nov 30 07:39:57 2017
@@ -0,0 +1,8 @@
+LEVEL = ../../../make
+
+DYLIB_NAME := foo
+DYLIB_CXX_SOURCES := foo.cpp
+CXX_SOURCES := main.cpp
+CFLAGS_EXTRAS := -fPIC
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py?rev=319443&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py Thu Nov 30 07:39:57 2017
@@ -0,0 +1,46 @@
+"""
+Test that we can hit breakpoints in global constructors
+"""
+
+from __future__ import print_function
+
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestBreakpointInGlobalConstructors(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.line_foo = line_number('foo.cpp', '// !BR_foo')
+ self.line_main = line_number('main.cpp', '// !BR_main')
+
+ @expectedFailureAll(bugnumber="llvm.org/pr35480", oslist=["linux"])
+ def test(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file %s" % exe)
+
+ bp_main = lldbutil.run_break_set_by_file_and_line(
+ self, 'main.cpp', self.line_main)
+ bp_foo = lldbutil.run_break_set_by_file_and_line(
+ self, 'foo.cpp', self.line_foo)
+
+ self.runCmd("run")
+
+ self.assertIsNotNone(
+ lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ self.process(), bp_foo))
+
+ self.runCmd("continue")
+
+ self.assertIsNotNone(
+ lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ self.process(), bp_main))
Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp?rev=319443&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp Thu Nov 30 07:39:57 2017
@@ -0,0 +1,5 @@
+#include "foo.h"
+
+Foo::Foo() : x(42) {} // !BR_foo
+
+Foo FooObj;
Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h?rev=319443&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h Thu Nov 30 07:39:57 2017
@@ -0,0 +1,11 @@
+#ifndef FOO_H
+#define FOO_H
+
+struct LLDB_TEST_API Foo {
+ Foo();
+ int x;
+};
+
+extern LLDB_TEST_API Foo FooObj;
+
+#endif
Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp?rev=319443&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp Thu Nov 30 07:39:57 2017
@@ -0,0 +1,12 @@
+#include "foo.h"
+
+struct Main {
+ Main();
+ int x;
+};
+
+Main::Main() : x(47) {} // !BR_main
+
+Main MainObj;
+
+int main() { return MainObj.x + FooObj.x; }
More information about the lldb-commits
mailing list