diff options
author | Tamas Berghammer <tberghammer@google.com> | 2016-09-15 08:53:33 +0000 |
---|---|---|
committer | Tamas Berghammer <tberghammer@google.com> | 2016-09-15 08:53:33 +0000 |
commit | 2540a553e5ab66c2fa15b52edc0c22669ef53f15 (patch) | |
tree | 56d29b515178796099abd77ec992aaa86ba506e5 /lldb/packages/Python/lldbsuite/test/python_api | |
parent | 2cc4e3e04e2201d9404eae3e4e8c877c4e38ba13 (diff) | |
download | bcm5719-llvm-2540a553e5ab66c2fa15b52edc0c22669ef53f15.tar.gz bcm5719-llvm-2540a553e5ab66c2fa15b52edc0c22669ef53f15.zip |
Add support for DW_AT_ranges_base attribute
It is a new attribute emitted by clang as a GNU extension and will
be part of Dwarf5. The purpose of the attribute is to specify a compile
unit level base value for all DW_AT_ranges to reduce the number of
relocations have to be done by the linker.
Fixes (at least partially): https://llvm.org/pr28826
Differential revision: https://reviews.llvm.org/D24514
llvm-svn: 281595
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api')
4 files changed, 71 insertions, 19 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py index b6a26fb3186..7220601fe96 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py @@ -38,3 +38,46 @@ class SymbolContextTwoFilesTestCase(TestBase): symbol_address, lldb.eSymbolContextFunction) self.assertEqual(symbol_name, sc_by_address.GetFunction().GetName()) + + @add_test_categories(['pyapi']) + def test_ranges_in_multiple_compile_unit(self): + """This test verifies that we correctly handle the case when multiple + compile unit contains DW_AT_ranges and DW_AT_ranges_base attributes.""" + self.build() + exe = os.path.join(os.getcwd(), "a.out") + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + source1 = "file1.cpp" + line1 = line_number(source1, '// Break1') + breakpoint1 = target.BreakpointCreateByLocation(source1, line1) + self.assertIsNotNone(breakpoint1) + self.assertTrue(breakpoint1.IsValid()) + + source2 = "file2.cpp" + line2 = line_number(source2, '// Break2') + breakpoint2 = target.BreakpointCreateByLocation(source2, line2) + self.assertIsNotNone(breakpoint2) + self.assertTrue(breakpoint2.IsValid()) + + process = target.LaunchSimple(None, None, os.getcwd()) + self.assertIsNotNone(process, PROCESS_IS_VALID) + + threads = lldbutil.get_threads_stopped_at_breakpoint( + process, breakpoint2) + self.assertEqual(len(threads), 1) + frame = threads[0].GetFrameAtIndex(0) + value = frame.FindVariable("x") + self.assertTrue(value.IsValid()) + + process.Continue() + + threads = lldbutil.get_threads_stopped_at_breakpoint( + process, breakpoint1) + self.assertEqual(len(threads), 1) + frame = threads[0].GetFrameAtIndex(0) + value = frame.FindVariable("x") + self.assertTrue(value.IsValid()) + + process.Continue() diff --git a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h index 0cb685622cd..7c804584206 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h +++ b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h @@ -1,11 +1,11 @@ -struct struct1 -{ - static void - f(); +struct struct1 { + ~struct1(); + static void f(); }; -struct struct2 -{ - static void - f(); +struct struct2 { + ~struct2(); + static void f(); }; + +int g(); diff --git a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp index 16c8ce7d948..327d0fb7718 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp +++ b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp @@ -1,13 +1,21 @@ #include "decls.h" -void -struct1::f() -{ +int g() { + return 1; } -int main() -{ - struct1::f(); - struct2::f(); - return 0; +struct1::~struct1() { + int x = g(); // Break1 +} + +void struct1::f() {} + +int main() { + struct1::f(); + struct2::f(); + + struct1 s1; + struct2 s2; + + return 0; } diff --git a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp index 3bd1aaf95a7..109e01572ed 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp +++ b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp @@ -1,6 +1,7 @@ #include "decls.h" -void -struct2::f() -{ +struct2::~struct2() { + int x = g(); // Break2 } + +void struct2::f() {} |