summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-12-11 16:24:14 +0000
committerTamas Berghammer <tberghammer@google.com>2015-12-11 16:24:14 +0000
commite43482b626b5f8e8fe85aad0c91fd8e637f67cd4 (patch)
tree45a6102b113f507e6ffea6d03932b7ed30d46054 /lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
parent734a0b3f81e24d106e1e4b46d000a11f865a42e6 (diff)
downloadbcm5719-llvm-e43482b626b5f8e8fe85aad0c91fd8e637f67cd4.tar.gz
bcm5719-llvm-e43482b626b5f8e8fe85aad0c91fd8e637f67cd4.zip
Create test for llvm.org/pr25806
LLDB don't detect the loading of a shared object file linked against the main executable before the static initializers are executed for the given module. Because of this it is not possible to get breakpoint hits in these static initializers and to display proper debug info in case of a crash in these codes. llvm-svn: 255342
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py56
1 files changed, 50 insertions, 6 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
index b42bc456c4d..481e7c887bd 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
@@ -24,9 +24,9 @@ class LoadUnloadTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break for main.cpp.
- self.line = line_number('main.c',
+ self.line = line_number('main.cpp',
'// Set break point at this line for test_lldb_process_load_and_unload_commands().')
- self.line_d_function = line_number('d.c',
+ self.line_d_function = line_number('d.cpp',
'// Find this line number within d_dunction().')
if not self.platformIsDarwin():
if not lldb.remote_platform and "LD_LIBRARY_PATH" in os.environ:
@@ -164,7 +164,7 @@ class LoadUnloadTestCase(TestBase):
substrs = [os.path.basename(old_dylib)],
matching=True)
- lldbutil.run_break_set_by_file_and_line (self, "d.c", self.line_d_function, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line (self, "d.cpp", self.line_d_function, num_expected_locations=1)
# After run, make sure the non-hidden library is picked up.
self.expect("run", substrs=["return", "700"])
@@ -194,10 +194,10 @@ class LoadUnloadTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- # Break at main.c before the call to dlopen().
+ # Break at main.cpp before the call to dlopen().
# Use lldb's process load command to load the dylib, instead.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -296,7 +296,7 @@ class LoadUnloadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name a_function (not yet loaded).
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -311,3 +311,47 @@ class LoadUnloadTestCase(TestBase):
self.expect("thread list", "step over succeeded.",
substrs = ['stopped',
'stop reason = step over'])
+
+ @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+ @skipUnlessListedRemote(['android'])
+ @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
+ @unittest2.expectedFailure("llvm.org/pr25806")
+ def test_static_init_during_load (self):
+ """Test that we can set breakpoints correctly in static initializers"""
+
+ self.build()
+ self.copy_shlibs_to_remote()
+
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ a_init_bp_num = lldbutil.run_break_set_by_symbol(self, "a_init", num_expected_locations=0)
+ b_init_bp_num = lldbutil.run_break_set_by_symbol(self, "b_init", num_expected_locations=0)
+ d_init_bp_num = lldbutil.run_break_set_by_symbol(self, "d_init", num_expected_locations=1)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'd_init',
+ 'stop reason = breakpoint %d' % d_init_bp_num])
+
+ self.runCmd("continue")
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'a_init',
+ 'stop reason = breakpoint %d' % a_init_bp_num])
+ self.expect("thread backtrace",
+ substrs = ['a_init',
+ 'dlopen',
+ 'main'])
+
+ self.runCmd("continue")
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'b_init',
+ 'stop reason = breakpoint %d' % b_init_bp_num])
+ self.expect("thread backtrace",
+ substrs = ['b_init',
+ 'dlopen',
+ 'main'])
OpenPOWER on IntegriCloud