diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities')
67 files changed, 914 insertions, 230 deletions
| diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py index c0c2267a8362..871363b7aed3 100644 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py @@ -45,14 +45,6 @@ class BreakpointOptionsTestCase(TestBase):              extra_options="-K 0",              num_expected_locations=1) -        # This should create a breakpoint 0 locations. -        lldbutil.run_break_set_by_file_and_line( -            self, -            "main.cpp", -            self.line, -            extra_options="-m 0", -            num_expected_locations=0) -          # Run the program.          self.runCmd("run", RUN_SUCCEEDED) @@ -68,8 +60,6 @@ class BreakpointOptionsTestCase(TestBase):                  "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %                  self.line,                  "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % -                self.line, -                "3: file = 'main.cpp', line = %d, exact_match = 1, locations = 0" %                  self.line])          # Continue the program, there should be another stop. diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp index 363b90003d76..b2e8f523c84d 100644 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp @@ -1,8 +1,4 @@ -// Set break point at this line. -  extern "C" int foo(void); -int -main (int argc, char **argv) -{  +int main (int argc, char **argv) { // Set break point at this line.    return foo();  } diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile new file mode 100644 index 000000000000..3665ae323e7b --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile @@ -0,0 +1,6 @@ +LEVEL = ../../../../make + +ENABLE_THREADS := YES +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py new file mode 100644 index 000000000000..21fe084d3dfb --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py @@ -0,0 +1,114 @@ +""" +Test hardware breakpoints for multiple threads. +""" + +from __future__ import print_function + + +import os +import time +import re +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +# Hardware breakpoints are supported only by platforms mentioned in oslist. +@skipUnlessPlatform(oslist=['linux']) +class HardwareBreakpointMultiThreadTestCase(TestBase): +    NO_DEBUG_INFO_TESTCASE = True + +    mydir = TestBase.compute_mydir(__file__) + +    # LLDB supports hardware breakpoints for arm and aarch64 architectures. +    @skipIf(archs=no_match(['arm', 'aarch64'])) +    @expectedFailureAndroid +    def test_hw_break_set_delete_multi_thread(self): +        self.build() +        self.setTearDownCleanup()  +        self.break_multi_thread('delete') + +    # LLDB supports hardware breakpoints for arm and aarch64 architectures. +    @skipIf(archs=no_match(['arm', 'aarch64'])) +    @expectedFailureAndroid +    def test_hw_break_set_disable_multi_thread(self): +        self.build() +        self.setTearDownCleanup()  +        self.break_multi_thread('disable') + +    def setUp(self): +        # Call super's setUp(). +        TestBase.setUp(self) +        # Our simple source filename. +        self.source = 'main.cpp' +        # Find the line number to break inside main(). +        self.first_stop = line_number( +            self.source, 'Starting thread creation with hardware breakpoint set') + +    def break_multi_thread(self, removal_type): +        """Test that lldb hardware breakpoints work for multiple threads.""" +        self.runCmd( +            "file %s" % +            os.path.join( +                os.getcwd(), +                'a.out'), +            CURRENT_EXECUTABLE_SET) + +        # Stop in main before creating any threads. +        lldbutil.run_break_set_by_file_and_line( +            self, None, self.first_stop, num_expected_locations=1) + +        # Run the program. +        self.runCmd("run", RUN_SUCCEEDED) + +        # We should be stopped again due to the breakpoint. +        # The stop reason of the thread should be breakpoint. +        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +                    substrs=['stopped', +                             'stop reason = breakpoint']) + +        # Now set a hardware breakpoint in thread function. +        self.expect("breakpoint set -b hw_break_function --hardware", +            substrs=[ +                'Breakpoint', +                'hw_break_function', +                'address = 0x']) + +        # We should stop in hw_break_function function for 4 threads. +        count = 0 + +        while count < 2 : +          +            self.runCmd("process continue") + +            # We should be stopped in hw_break_function +            # The stop reason of the thread should be breakpoint. +            self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +                substrs=[ +                    'stop reason = breakpoint', +                    'hw_break_function']) + +            # Continue the loop and test that we are stopped 4 times. +            count += 1 + +        if removal_type == 'delete': +            self.runCmd("settings set auto-confirm true") + +            # Now 'breakpoint delete' should just work fine without confirmation +            # prompt from the command interpreter. +            self.expect("breakpoint delete", +                        startstr="All breakpoints removed") + +            # Restore the original setting of auto-confirm. +            self.runCmd("settings clear auto-confirm") + +        elif removal_type == 'disable': +            self.expect("breakpoint disable", +                        startstr="All breakpoints disabled.") + +        # Continue. Program should exit without stopping anywhere. +        self.runCmd("process continue") + +        # Process should have stopped and exited with status = 0 +        self.expect("process status", PROCESS_STOPPED, +                    patterns=['Process .* exited with status = 0']) diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp new file mode 100644 index 000000000000..d13393095c61 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp @@ -0,0 +1,51 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +//                     The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <chrono> +#include <cstdio> +#include <mutex> +#include <random> +#include <thread> + +#define NUM_OF_THREADS 4 + +std::mutex hw_break_mutex; + +void +hw_break_function (uint32_t thread_index) { +  printf ("%s called by Thread #%u...\n", __FUNCTION__, thread_index); +} + + +void +thread_func (uint32_t thread_index) { +  printf ("%s (thread index = %u) starting...\n", __FUNCTION__, thread_index); + +  hw_break_mutex.lock(); +   +  hw_break_function(thread_index); // Call hw_break_function + +  hw_break_mutex.unlock(); +} + + +int main (int argc, char const *argv[]) +{ +  std::thread threads[NUM_OF_THREADS];  + +  printf ("Starting thread creation with hardware breakpoint set...\n"); + +  for (auto &thread : threads) +    thread = std::thread{thread_func, std::distance(threads, &thread)}; + +  for (auto &thread : threads) +    thread.join(); + +  return 0; +} diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile new file mode 100644 index 000000000000..e7a1cab7e195 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile @@ -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 diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py new file mode 100644 index 000000000000..26041c313e57 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py @@ -0,0 +1,63 @@ +from __future__ import print_function + + +import unittest2 +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil + + +class TestMoveNearest(TestBase): + +    mydir = TestBase.compute_mydir(__file__) +    NO_DEBUG_INFO_TESTCASE = True + +    def setUp(self): +        # Call super's setUp(). +        TestBase.setUp(self) +        # Find the line number to break inside main(). +        self.line1 = line_number('foo.h', '// !BR1') +        self.line2 = line_number('foo.h', '// !BR2') +        self.line_main = line_number('main.cpp', '// !BR_main') + +    def test(self): +        """Test target.move-to-nearest logic""" + +        self.build() +        target = self.dbg.CreateTarget("a.out") +        self.assertTrue(target, VALID_TARGET) + +        lldbutil.run_break_set_by_symbol(self, 'main', sym_exact=True) +        environment = self.registerSharedLibrariesWithTarget(target, ["foo"]) +        process = target.LaunchSimple(None, environment, self.get_process_working_directory()) +        self.assertEquals(process.GetState(), lldb.eStateStopped) + +        # Regardless of the -m value the breakpoint should have exactly one +        # location on the foo functions +        self.runCmd("settings set target.move-to-nearest-code true") +        lldbutil.run_break_set_by_file_and_line(self, 'foo.h', self.line1, +                loc_exact=True, extra_options="-m 1") +        lldbutil.run_break_set_by_file_and_line(self, 'foo.h', self.line2, +                loc_exact=True, extra_options="-m 1") + +        self.runCmd("settings set target.move-to-nearest-code false") +        lldbutil.run_break_set_by_file_and_line(self, 'foo.h', self.line1, +                loc_exact=True, extra_options="-m 0") +        lldbutil.run_break_set_by_file_and_line(self, 'foo.h', self.line2, +                loc_exact=True, extra_options="-m 0") + + +        # Make sure we set a breakpoint in main with -m 1 for various lines in +        # the function declaration +        # "int" +        lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', +                self.line_main-1, extra_options="-m 1") +        # "main()" +        lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', +                self.line_main, extra_options="-m 1") +        # "{" +        lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', +                self.line_main+1, extra_options="-m 1") +        # "return .." +        lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', +                self.line_main+2, extra_options="-m 1") diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp new file mode 100644 index 000000000000..8dad0a23f368 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp @@ -0,0 +1,3 @@ +#include "foo.h" + +int call_foo1() { return foo1(); } diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h new file mode 100644 index 000000000000..060b91f5a5ea --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h @@ -0,0 +1,6 @@ +LLDB_TEST_API inline int foo1() { return 1; } // !BR1 + +LLDB_TEST_API inline int foo2() { return 2; } // !BR2 + +LLDB_TEST_API extern int call_foo1(); +LLDB_TEST_API extern int call_foo2(); diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp new file mode 100644 index 000000000000..c9295a5c7d3c --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp @@ -0,0 +1,9 @@ +#include "foo.h" + +int call_foo2() { return foo2(); } + +int +main() // !BR_main +{ +  return call_foo1() + call_foo2(); +} diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile new file mode 100644 index 000000000000..f89b52a972e9 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +ifneq (,$(findstring icc,$(CC))) +    CXXFLAGS += -debug inline-debug-info +endif + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py new file mode 100644 index 000000000000..00ddc628607c --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py @@ -0,0 +1,120 @@ +""" +Test that breakpoints do not affect stepping. +Check for correct StopReason when stepping to the line with breakpoint  +which chould be eStopReasonBreakpoint in general, +and eStopReasonPlanComplete when breakpoint's condition fails.   +""" + +from __future__ import print_function + +import unittest2 +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class StepOverBreakpointsTestCase(TestBase): + +    mydir = TestBase.compute_mydir(__file__) + +    def setUp(self): +        TestBase.setUp(self) +        +        self.build() +        exe = os.path.join(os.getcwd(), "a.out") +        src = lldb.SBFileSpec("main.cpp") + +        # Create a target by the debugger. +        self.target = self.dbg.CreateTarget(exe) +        self.assertTrue(self.target, VALID_TARGET) + +        # Setup four breakpoints, two of them with false condition +        self.line1 = line_number('main.cpp', "breakpoint_1") +        self.line4 = line_number('main.cpp', "breakpoint_4") + +        self.breakpoint1 = self.target.BreakpointCreateByLocation(src, self.line1)         +        self.assertTrue( +            self.breakpoint1 and self.breakpoint1.GetNumLocations() == 1, +            VALID_BREAKPOINT) + +        self.breakpoint2 = self.target.BreakpointCreateBySourceRegex("breakpoint_2", src) +        self.breakpoint2.GetLocationAtIndex(0).SetCondition('false') + +        self.breakpoint3 = self.target.BreakpointCreateBySourceRegex("breakpoint_3", src) +        self.breakpoint3.GetLocationAtIndex(0).SetCondition('false') + +        self.breakpoint4 = self.target.BreakpointCreateByLocation(src, self.line4) + +        # Start debugging +        self.process = self.target.LaunchSimple( +            None, None, self.get_process_working_directory()) +        self.assertIsNotNone(self.process, PROCESS_IS_VALID) +        self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint1) +        self.assertIsNotNone(self.thread, "Didn't stop at breakpoint 1.") + +    def test_step_instruction(self):  +        # Count instructions between breakpoint_1 and breakpoint_4 +        contextList = self.target.FindFunctions('main', lldb.eFunctionNameTypeAuto) +        self.assertEquals(contextList.GetSize(), 1) +        symbolContext = contextList.GetContextAtIndex(0) +        function = symbolContext.GetFunction() +        self.assertTrue(function) +        instructions = function.GetInstructions(self.target) +        addr_1 = self.breakpoint1.GetLocationAtIndex(0).GetAddress() +        addr_4 = self.breakpoint4.GetLocationAtIndex(0).GetAddress() +        for i in range(instructions.GetSize()) : +            addr = instructions.GetInstructionAtIndex(i).GetAddress() +            if (addr == addr_1) : index_1 = i +            if (addr == addr_4) : index_4 = i  + +        steps_expected = index_4 - index_1 +        step_count = 0 +        # Step from breakpoint_1 to breakpoint_4 +        while True: +            self.thread.StepInstruction(True) +            step_count = step_count + 1 +            self.assertEquals(self.process.GetState(), lldb.eStateStopped) +            self.assertTrue(self.thread.GetStopReason() == lldb.eStopReasonPlanComplete or +                            self.thread.GetStopReason() == lldb.eStopReasonBreakpoint) +            if (self.thread.GetStopReason() == lldb.eStopReasonBreakpoint) : +                # we should not stop on breakpoint_2 and _3 because they have false condition +                self.assertEquals(self.thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.line4) +                # breakpoint_2 and _3 should not affect step count +                self.assertTrue(step_count >= steps_expected) +                break + +        # Run the process until termination +        self.process.Continue() +        self.assertEquals(self.process.GetState(), lldb.eStateExited) + +    @skipIf(bugnumber="llvm.org/pr31972", hostoslist=["windows"]) +    def test_step_over(self): +        #lldb.DBG.EnableLog("lldb", ["step","breakpoint"]) +         +        self.thread.StepOver() +        # We should be stopped at the breakpoint_2 line with stop plan complete reason +        self.assertEquals(self.process.GetState(), lldb.eStateStopped) +        self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete) + +        self.thread.StepOver() +        # We should be stopped at the breakpoint_3 line with stop plan complete reason +        self.assertEquals(self.process.GetState(), lldb.eStateStopped) +        self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete) + +        self.thread.StepOver() +        # We should be stopped at the breakpoint_4 +        self.assertEquals(self.process.GetState(), lldb.eStateStopped) +        self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonBreakpoint) +        thread1 = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint4) +        self.assertEquals(self.thread, thread1, "Didn't stop at breakpoint 4.") + +        # Check that stepping does not affect breakpoint's hit count +        self.assertEquals(self.breakpoint1.GetHitCount(), 1) +        self.assertEquals(self.breakpoint2.GetHitCount(), 0) +        self.assertEquals(self.breakpoint3.GetHitCount(), 0) +        self.assertEquals(self.breakpoint4.GetHitCount(), 1) + +        # Run the process until termination +        self.process.Continue() +        self.assertEquals(self.process.GetState(), lldb.eStateExited) + diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp new file mode 100644 index 000000000000..8cfd34b73b55 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp @@ -0,0 +1,12 @@ + +int func() { return 1; } + +int +main(int argc, char const *argv[]) +{ +    int a = 0;      // breakpoint_1 +    int b = func(); // breakpoint_2 +    a = b + func(); // breakpoint_3 +    return 0;       // breakpoint_4 +} + diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/.categories b/packages/Python/lldbsuite/test/functionalities/darwin_log/.categories new file mode 100644 index 000000000000..ea135483a483 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/.categories @@ -0,0 +1 @@ +darwin-log diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py index 85281a97c572..f65b1b89d35b 100644 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py +++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py @@ -22,6 +22,7 @@ class TestDarwinLogBasic(darwin_log.DarwinLogEventBasedTestBase):      @decorators.add_test_categories(['pyapi'])      @decorators.skipUnlessDarwin      @decorators.expectedFailureAll(archs=["i386"], bugnumber="rdar://28655626") +    @decorators.expectedFailureAll(bugnumber="rdar://30645203")      def test_SBStructuredData_gets_broadcasted(self):          """Exercise SBStructuredData API.""" diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py index 6a832e02990a..63eb5e087e14 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py @@ -23,8 +23,7 @@ class LibCxxFunctionTestCase(TestBase):          var.SetPreferSyntheticValue(True)          return var -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows yet +    @add_test_categories(["libc++"])      def test(self):          """Test that std::function as defined by libc++ is correctly printed by LLDB"""          self.build() @@ -36,9 +35,6 @@ class LibCxxFunctionTestCase(TestBase):          self.runCmd("run", RUN_SUCCEEDED) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          # The stop reason of the thread should be breakpoint.          self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,                      substrs=['stopped', diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py index 5d23fcef04ce..9b4308f54095 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py @@ -22,9 +22,10 @@ class LibcxxIteratorDataFormatterTestCase(TestBase):          TestBase.setUp(self)          # Find the line number to break at.          self.line = line_number('main.cpp', '// Set break point at this line.') +        ns = 'ndk' if lldbplatformutil.target_is_android() else '' +        self.namespace = 'std::__' + ns + '1' -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows yet +    @add_test_categories(["libc++"])      def test_with_run_command(self):          """Test that libc++ iterators format properly."""          self.build() @@ -35,9 +36,6 @@ class LibcxxIteratorDataFormatterTestCase(TestBase):          self.runCmd("run", RUN_SUCCEEDED) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          # The stop reason of the thread should be breakpoint.          self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,                      substrs=['stopped', @@ -57,8 +55,6 @@ class LibcxxIteratorDataFormatterTestCase(TestBase):          # Execute the cleanup function during test case tear down.          self.addTearDownHook(cleanup) -        self.expect('image list', substrs=self.getLibcPlusPlusLibs()) -          self.expect('frame variable ivI', substrs=['item = 3'])          self.expect('expr ivI', substrs=['item = 3']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py index e2e082c795f7..e1ebbd5c226d 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py @@ -19,9 +19,8 @@ class LibcxxListDataFormatterTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows yet -    @add_test_categories(["pyapi"]) +    @add_test_categories(["libc++"]) +    @expectedFailureAndroid(bugnumber="llvm.org/pr32592")      @skipIfDarwin  # rdar://25499635      def test_with_run_command(self):          self.build() @@ -40,8 +39,6 @@ class LibcxxListDataFormatterTestCase(TestBase):          # Run the program, it should stop at breakpoint 1.          process = target.LaunchSimple(              None, None, self.get_process_working_directory()) -        lldbutil.skip_if_library_missing( -            self, target, lldbutil.PrintableRegex("libc\+\+"))          self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)          self.assertEqual(              len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint1)), 1) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py index 7433a0b0da2c..fc4714ea94e2 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py @@ -17,8 +17,12 @@ class LibcxxMapDataFormatterTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows yet +    def setUp(self): +        TestBase.setUp(self) +        ns = 'ndk' if lldbplatformutil.target_is_android() else '' +        self.namespace = 'std::__' + ns + '1' + +    @add_test_categories(["libc++"])      def test_with_run_command(self):          """Test that that file and class static variables display correctly."""          self.build() @@ -30,9 +34,6 @@ class LibcxxMapDataFormatterTestCase(TestBase):          self.runCmd("run", RUN_SUCCEEDED) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          # The stop reason of the thread should be breakpoint.          self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,                      substrs=['stopped', @@ -52,16 +53,16 @@ class LibcxxMapDataFormatterTestCase(TestBase):          # Execute the cleanup function during test case tear down.          self.addTearDownHook(cleanup) -        self.expect('image list', substrs=self.getLibcPlusPlusLibs()) - +        ns = self.namespace          self.expect('frame variable ii', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, +                             'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ii', -                    substrs=['size=2', +                    substrs=['%s::map' % ns, 'size=2',                               '[0] = ',                               'first = 0',                               'second = 0', @@ -72,7 +73,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ii', -                    substrs=['size=4', +                    substrs=['%s::map' % ns, 'size=4',                               '[2] = ',                               'first = 2',                               'second = 0', @@ -83,7 +84,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable ii", -                    substrs=['size=8', +                    substrs=['%s::map' % ns, 'size=8',                               '[5] = ',                               'first = 5',                               'second = 0', @@ -92,7 +93,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):                               'second = 1'])          self.expect("p ii", -                    substrs=['size=8', +                    substrs=['%s::map' % ns, 'size=8',                               '[5] = ',                               'first = 5',                               'second = 0', @@ -124,17 +125,17 @@ class LibcxxMapDataFormatterTestCase(TestBase):          self.runCmd("continue")          self.expect('frame variable ii', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, 'size=0',                               '{}'])          self.expect('frame variable si', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, 'size=0',                               '{}'])          self.runCmd("continue")          self.expect('frame variable si', -                    substrs=['size=1', +                    substrs=['%s::map' % ns, 'size=1',                               '[0] = ',                               'first = \"zero\"',                               'second = 0']) @@ -142,7 +143,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable si", -                    substrs=['size=4', +                    substrs=['%s::map' % ns, 'size=4',                               '[0] = ',                               'first = \"zero\"',                               'second = 0', @@ -157,7 +158,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):                               'second = 3'])          self.expect("p si", -                    substrs=['size=4', +                    substrs=['%s::map' % ns, 'size=4',                               '[0] = ',                               'first = \"zero\"',                               'second = 0', @@ -192,19 +193,19 @@ class LibcxxMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable si', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable is', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable is", -                    substrs=['size=4', +                    substrs=['%s::map' % ns, 'size=4',                               '[0] = ',                               'second = \"goofy\"',                               'first = 85', @@ -219,7 +220,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):                               'first = 3'])          self.expect("p is", -                    substrs=['size=4', +                    substrs=['%s::map' % ns, 'size=4',                               '[0] = ',                               'second = \"goofy\"',                               'first = 85', @@ -254,19 +255,19 @@ class LibcxxMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable is', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ss', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable ss", -                    substrs=['size=3', +                    substrs=['%s::map' % ns, 'size=3',                               '[0] = ',                               'second = \"hello\"',                               'first = \"ciao\"', @@ -278,7 +279,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):                               'first = \"gatto\"'])          self.expect("p ss", -                    substrs=['size=3', +                    substrs=['%s::map' % ns, 'size=3',                               '[0] = ',                               'second = \"hello\"',                               'first = \"ciao\"', @@ -309,5 +310,5 @@ class LibcxxMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ss', -                    substrs=['size=0', +                    substrs=['%s::map' % ns, 'size=0',                               '{}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py index 66091e6e113f..b28a7e6bc31b 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py @@ -18,8 +18,12 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) -    @skipIfWindows  # libc++ not ported to Windows yet -    @skipIf(compiler="gcc") +    def setUp(self): +        TestBase.setUp(self) +        ns = 'ndk' if lldbplatformutil.target_is_android() else '' +        self.namespace = 'std::__' + ns + '1' + +    @add_test_categories(["libc++"])      def test_with_run_command(self):          """Test that that file and class static variables display correctly."""          self.build() @@ -31,9 +35,6 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          self.runCmd("run", RUN_SUCCEEDED) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          # The stop reason of the thread should be breakpoint.          self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,                      substrs=['stopped', @@ -53,16 +54,15 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          # Execute the cleanup function during test case tear down.          self.addTearDownHook(cleanup) -        self.expect('image list', substrs=self.getLibcPlusPlusLibs()) - +        multimap = self.namespace + "::multimap"          self.expect('frame variable ii', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ii', -                    substrs=['size=2', +                    substrs=[multimap, 'size=2',                               '[0] = ',                               'first = 0',                               'second = 0', @@ -73,7 +73,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ii', -                    substrs=['size=4', +                    substrs=[multimap, 'size=4',                               '[2] = ',                               'first = 2',                               'second = 0', @@ -84,7 +84,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable ii", -                    substrs=['size=8', +                    substrs=[multimap, 'size=8',                               '[5] = ',                               'first = 5',                               'second = 0', @@ -93,7 +93,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):                               'second = 1'])          self.expect("p ii", -                    substrs=['size=8', +                    substrs=[multimap, 'size=8',                               '[5] = ',                               'first = 5',                               'second = 0', @@ -125,17 +125,17 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ii', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}'])          self.expect('frame variable si', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable si', -                    substrs=['size=1', +                    substrs=[multimap, 'size=1',                               '[0] = ',                               'first = \"zero\"',                               'second = 0']) @@ -143,7 +143,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable si", -                    substrs=['size=4', +                    substrs=[multimap, 'size=4',                               '[0] = ',                               'first = \"zero\"',                               'second = 0', @@ -158,7 +158,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):                               'second = 3'])          self.expect("p si", -                    substrs=['size=4', +                    substrs=[multimap, 'size=4',                               '[0] = ',                               'first = \"zero\"',                               'second = 0', @@ -193,19 +193,19 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable si', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable is', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable is", -                    substrs=['size=4', +                    substrs=[multimap, 'size=4',                               '[0] = ',                               'second = \"goofy\"',                               'first = 85', @@ -220,7 +220,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):                               'first = 3'])          self.expect("p is", -                    substrs=['size=4', +                    substrs=[multimap, 'size=4',                               '[0] = ',                               'second = \"goofy\"',                               'first = 85', @@ -255,19 +255,19 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable is', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ss', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}'])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable ss", -                    substrs=['size=3', +                    substrs=[multimap, 'size=3',                               '[0] = ',                               'second = \"hello\"',                               'first = \"ciao\"', @@ -279,7 +279,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):                               'first = \"gatto\"'])          self.expect("p ss", -                    substrs=['size=3', +                    substrs=[multimap, 'size=3',                               '[0] = ',                               'second = \"hello\"',                               'first = \"ciao\"', @@ -310,5 +310,5 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect('frame variable ss', -                    substrs=['size=0', +                    substrs=[multimap, 'size=0',                               '{}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py index d40bce83e0af..2f448e8fd115 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py @@ -17,8 +17,17 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows yet +    def setUp(self): +        TestBase.setUp(self) +        ns = 'ndk' if lldbplatformutil.target_is_android() else '' +        self.namespace = 'std::__' + ns + '1' + +    def getVariableType(self, name): +        var = self.frame().FindVariable(name) +        self.assertTrue(var.IsValid()) +        return var.GetType().GetCanonicalType().GetName() + +    @add_test_categories(["libc++"])      def test_with_run_command(self):          """Test that that file and class static variables display correctly."""          self.build() @@ -30,9 +39,6 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase):          self.runCmd("run", RUN_SUCCEEDED) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          # The stop reason of the thread should be breakpoint.          self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,                      substrs=['stopped', @@ -52,7 +58,9 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase):          # Execute the cleanup function during test case tear down.          self.addTearDownHook(cleanup) -        self.expect('image list', substrs=self.getLibcPlusPlusLibs()) +        ii_type = self.getVariableType("ii") +        self.assertTrue(ii_type.startswith(self.namespace + "::multiset"), +                        "Type: " + ii_type)          self.expect("frame variable ii", substrs=["size=0", "{}"])          lldbutil.continue_to_breakpoint(self.process(), bkpt) @@ -86,6 +94,9 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase):          self.expect("frame variable ii", substrs=["size=0", "{}"])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect("frame variable ii", substrs=["size=0", "{}"]) +        ss_type = self.getVariableType("ss") +        self.assertTrue(ss_type.startswith(self.namespace + "::multiset"), +                        "Type: " + ss_type)          self.expect("frame variable ss", substrs=["size=0", "{}"])          lldbutil.continue_to_breakpoint(self.process(), bkpt)          self.expect( diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py index b0e84121dded..5b9b14d549e5 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py @@ -23,9 +23,10 @@ class LibcxxStringDataFormatterTestCase(TestBase):          TestBase.setUp(self)          # Find the line number to break at.          self.line = line_number('main.cpp', '// Set break point at this line.') +        ns = 'ndk' if lldbplatformutil.target_is_android() else '' +        self.namespace = 'std::__' + ns + '1' -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows yet +    @add_test_categories(["libc++"])      def test_with_run_command(self):          """Test that that file and class static variables display correctly."""          self.build() @@ -36,9 +37,6 @@ class LibcxxStringDataFormatterTestCase(TestBase):          self.runCmd("run", RUN_SUCCEEDED) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          # The stop reason of the thread should be breakpoint.          self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,                      substrs=['stopped', @@ -58,17 +56,18 @@ class LibcxxStringDataFormatterTestCase(TestBase):          # Execute the cleanup function during test case tear down.          self.addTearDownHook(cleanup) +        ns = self.namespace          self.expect(              "frame variable",              substrs=[ -                '(std::__1::wstring) s = L"hello world! מזל טוב!"', -                '(std::__1::wstring) S = L"!!!!"', +                '(%s::wstring) s = L"hello world! מזל טוב!"'%ns, +                '(%s::wstring) S = L"!!!!"'%ns,                  '(const wchar_t *) mazeltov = 0x',                  'L"מזל טוב"', -                '(std::__1::string) q = "hello world"', -                '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"', -                '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"', -                '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"']) +                '(%s::string) q = "hello world"'%ns, +                '(%s::string) Q = "quite a long std::strin with lots of info inside it"'%ns, +                '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns, +                '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns])          self.runCmd("n") @@ -91,11 +90,11 @@ class LibcxxStringDataFormatterTestCase(TestBase):          self.expect(              "frame variable",              substrs=[ -                '(std::__1::wstring) s = L"hello world! מזל טוב!"', -                '(std::__1::wstring) S = L"!!!!!"', +                '(%s::wstring) s = L"hello world! מזל טוב!"'%ns, +                '(%s::wstring) S = L"!!!!!"'%ns,                  '(const wchar_t *) mazeltov = 0x',                  'L"מזל טוב"', -                '(std::__1::string) q = "hello world"', -                '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"', -                '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"', -                '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"']) +                '(%s::string) q = "hello world"'%ns, +                '(%s::string) Q = "quite a long std::strin with lots of info inside it"'%ns, +                '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns, +                '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py index 8a08d38975cf..f61a715a4d3e 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py @@ -17,10 +17,13 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) -    @skipIfWindows  # libc++ not ported to Windows yet -    @skipIf(compiler="gcc") +    def setUp(self): +        TestBase.setUp(self) +        ns = 'ndk' if lldbplatformutil.target_is_android() else '' +        self.namespace = 'std::__' + ns + '1' + +    @add_test_categories(["libc++"])      def test_with_run_command(self): -        """Test that that file and class static variables display correctly."""          self.build()          self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) @@ -29,9 +32,6 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase):          self.runCmd("run", RUN_SUCCEEDED) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          # The stop reason of the thread should be breakpoint.          self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,                      substrs=['stopped', @@ -51,30 +51,30 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase):          # Execute the cleanup function during test case tear down.          self.addTearDownHook(cleanup) -        self.expect('image list', substrs=self.getLibcPlusPlusLibs()) - +        ns = self.namespace          self.look_for_content_and_continue( -            "map", ['size=5 {', 'hello', 'world', 'this', 'is', 'me']) +            "map", ['%s::unordered_map' % +                    ns, 'size=5 {', 'hello', 'world', 'this', 'is', 'me'])          self.look_for_content_and_continue( -            "mmap", ['size=6 {', 'first = 3', 'second = "this"', -                                 'first = 2', 'second = "hello"']) +            "mmap", ['%s::unordered_multimap' % ns, 'size=6 {', 'first = 3', 'second = "this"', +                     'first = 2', 'second = "hello"'])          self.look_for_content_and_continue( -            "iset", ['size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2']) +            "iset", ['%s::unordered_set' % +                     ns, 'size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2'])          self.look_for_content_and_continue( -            "sset", ['size=5 {', '\[\d\] = "is"', '\[\d\] = "world"', -                                 '\[\d\] = "hello"']) +            "sset", ['%s::unordered_set' % ns, 'size=5 {', '\[\d\] = "is"', '\[\d\] = "world"', +                     '\[\d\] = "hello"'])          self.look_for_content_and_continue( -            "imset", ['size=6 {', '(\[\d\] = 3(\\n|.)+){3}', -                                  '\[\d\] = 2', '\[\d\] = 1']) +            "imset", ['%s::unordered_multiset' % ns, 'size=6 {', '(\[\d\] = 3(\\n|.)+){3}', +                      '\[\d\] = 2', '\[\d\] = 1'])          self.look_for_content_and_continue( -            "smset", -            ['size=5 {', '(\[\d\] = "is"(\\n|.)+){2}', -                         '(\[\d\] = "world"(\\n|.)+){2}']) +            "smset", ['%s::unordered_multiset' % ns, 'size=5 {', '(\[\d\] = "is"(\\n|.)+){2}', +                      '(\[\d\] = "world"(\\n|.)+){2}'])      def look_for_content_and_continue(self, var_name, patterns):          self.expect(("frame variable %s" % var_name), patterns=patterns) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py index 43d5ad4f1033..a7a00068383f 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py @@ -23,16 +23,12 @@ class LibcxxVBoolDataFormatterTestCase(TestBase):          # Find the line number to break at.          self.line = line_number('main.cpp', '// Set break point at this line.') -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows. +    @add_test_categories(["libc++"])      def test_with_run_command(self):          """Test that that file and class static variables display correctly."""          self.build()          self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          lldbutil.run_break_set_by_file_and_line(              self, "main.cpp", self.line, num_expected_locations=-1) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp index 7b9956ed36ea..91fe509465e7 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp @@ -65,5 +65,6 @@ int main()      vBool.push_back(true);      vBool.push_back(true); -    return 0; // Set break point at this line. +    printf ("size: %d", (int) vBool.size()); // Set break point at this line. +    return 0;   } diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py index 719ed7300505..9e226a100a10 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py @@ -17,16 +17,12 @@ class LibcxxVectorDataFormatterTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) -    @skipIf(compiler="gcc") -    @skipIfWindows  # libc++ not ported to Windows yet +    @add_test_categories(["libc++"])      def test_with_run_command(self):          """Test that that file and class static variables display correctly."""          self.build()          self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) -        lldbutil.skip_if_library_missing( -            self, self.target(), lldbutil.PrintableRegex("libc\+\+")) -          bkpt = self.target().FindBreakpointByID(              lldbutil.run_break_set_by_source_regexp(                  self, "break here")) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py index 770d87178f50..37adb28d7d59 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py @@ -34,21 +34,25 @@ class StdUniquePtrDataFormatterTestCase(TestBase):          self.assertTrue(frame.IsValid())          self.expect("frame variable nup", substrs=['nup = nullptr']) -        self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123']) -        self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"']) +        self.expect("frame variable iup", substrs=['iup = 0x']) +        self.expect("frame variable sup", substrs=['sup = 0x'])          self.expect("frame variable ndp", substrs=['ndp = nullptr']) -        self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) -        self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) -         +        self.expect("frame variable idp", substrs=['idp = 0x', 'deleter = ', 'a = 1', 'b = 2']) +        self.expect("frame variable sdp", substrs=['sdp = 0x', 'deleter = ', 'a = 3', 'b = 4']) +          self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned()) +        self.assertEqual(123, frame.GetValueForVariablePath("*iup").GetValueAsUnsigned())          self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())          self.assertEqual('"foobar"', frame.GetValueForVariablePath("sup.object").GetSummary()) +        self.assertEqual('"foobar"', frame.GetValueForVariablePath("*sup").GetSummary())          self.assertFalse(frame.GetValueForVariablePath("sup.deleter").IsValid())          self.assertEqual(456, frame.GetValueForVariablePath("idp.object").GetValueAsUnsigned()) +        self.assertEqual(456, frame.GetValueForVariablePath("*idp").GetValueAsUnsigned())          self.assertEqual('"baz"', frame.GetValueForVariablePath("sdp.object").GetSummary()) +        self.assertEqual('"baz"', frame.GetValueForVariablePath("*sdp").GetSummary())          idp_deleter = frame.GetValueForVariablePath("idp.deleter")          self.assertTrue(idp_deleter.IsValid()) @@ -59,3 +63,34 @@ class StdUniquePtrDataFormatterTestCase(TestBase):          self.assertTrue(sdp_deleter.IsValid())          self.assertEqual(3, sdp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned())          self.assertEqual(4, sdp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned()) + +    @skipIfFreeBSD +    @skipIfWindows  # libstdcpp not ported to Windows +    @skipIfDarwin  # doesn't compile on Darwin +    def test_recursive_unique_ptr(self): +        # Tests that LLDB can handle when we have a loop in the unique_ptr +        # reference chain and that it correctly handles the different options +        # for the frame variable command in this case. +        self.build() +        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) + +        lldbutil.run_break_set_by_source_regexp( +            self, "Set break point at this line.") +        self.runCmd("run", RUN_SUCCEEDED) +        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +                    substrs=['stopped', 'stop reason = breakpoint']) + +        self.expect("frame variable f1->fp", +                    substrs=['fp = 0x']) +        self.expect("frame variable --ptr-depth=1 f1->fp", +                    substrs=['data = 2', 'fp = 0x']) +        self.expect("frame variable --ptr-depth=2 f1->fp", +                    substrs=['data = 2', 'fp = 0x', 'data = 1']) + +        frame = self.frame() +        self.assertTrue(frame.IsValid()) +        self.assertEqual(2, frame.GetValueForVariablePath("f1->fp.object.data").GetValueAsUnsigned()) +        self.assertEqual(2, frame.GetValueForVariablePath("f1->fp->data").GetValueAsUnsigned()) +        self.assertEqual(1, frame.GetValueForVariablePath("f1->fp.object.fp.object.data").GetValueAsUnsigned()) +        self.assertEqual(1, frame.GetValueForVariablePath("f1->fp->fp->data").GetValueAsUnsigned()) + diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp index 4a40309338c1..dd0072764d4e 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp @@ -8,6 +8,11 @@ struct Deleter {    int b;  }; +struct Foo { +  int data; +  std::unique_ptr<Foo> fp; +}; +  int main() {    std::unique_ptr<char> nup;    std::unique_ptr<int> iup(new int{123}); @@ -18,5 +23,13 @@ int main() {    std::unique_ptr<std::string, Deleter> sdp(new std::string("baz"),                                              Deleter{3, 4}); +  std::unique_ptr<Foo> fp(new Foo{3}); + +  // Set up a structure where we have a loop in the unique_ptr chain. +  Foo* f1 = new Foo{1}; +  Foo* f2 = new Foo{2}; +  f1->fp.reset(f2); +  f2->fp.reset(f1); +    return 0; // Set break point at this line.  } diff --git a/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py b/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py new file mode 100644 index 000000000000..47357cf4f71d --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py @@ -0,0 +1,68 @@ +""" +Test to ensure SBFrame::Disassemble produces SOME output +""" + +from __future__ import print_function + + +import os +import time +import re +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + + +class FrameDisassembleTestCase(TestBase): + +    mydir = TestBase.compute_mydir(__file__) + +    NO_DEBUG_INFO_TESTCASE = True + +    def test_frame_disassemble(self): +        """Sample test to ensure SBFrame::Disassemble produces SOME output.""" +        self.build() +        self.frame_disassemble_test() + +    def setUp(self): +        # Call super's setUp(). +        TestBase.setUp(self) + +    def frame_disassemble_test(self): +        """Sample test to ensure SBFrame::Disassemble produces SOME output""" +        exe = os.path.join(os.getcwd(), "a.out") + +        # Create a target by the debugger. +        target = self.dbg.CreateTarget(exe) +        self.assertTrue(target, VALID_TARGET) + +        # Now create a breakpoint in main.c at the source matching +        # "Set a breakpoint here" +        breakpoint = target.BreakpointCreateBySourceRegex( +            "Set a breakpoint here", lldb.SBFileSpec("main.cpp")) +        self.assertTrue(breakpoint and +                        breakpoint.GetNumLocations() >= 1, +                        VALID_BREAKPOINT) + +        error = lldb.SBError() +        # This is the launch info.  If you want to launch with arguments or +        # environment variables, add them using SetArguments or +        # SetEnvironmentEntries + +        launch_info = lldb.SBLaunchInfo(None) +        process = target.Launch(launch_info, error) +        self.assertTrue(process, PROCESS_IS_VALID) + +        # Did we hit our breakpoint? +        from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint +        threads = get_threads_stopped_at_breakpoint(process, breakpoint) +        self.assertTrue( +            len(threads) == 1, +            "There should be a thread stopped at our breakpoint") + +        # The hit count for the breakpoint should be 1. +        self.assertTrue(breakpoint.GetHitCount() == 1) + +        frame = threads[0].GetFrameAtIndex(0) +        disassembly = frame.Disassemble() +        self.assertTrue(len(disassembly) != 0, "Disassembly was empty.") diff --git a/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp b/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp index 8813647f6b72..93925829ec82 100644 --- a/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp @@ -20,7 +20,7 @@ main(int argc, char const *argv[])      int array[3]; -    array[0] = sum (1238, 78392); +    array[0] = sum (1238, 78392); // Set a breakpoint here      array[1] = sum (379265, 23674);      array[2] = sum (872934, 234); diff --git a/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile new file mode 100644 index 000000000000..089fc237b054 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile @@ -0,0 +1,12 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp other.cpp other-2.cpp +C_SOURCES := somefunc.c + +include $(LEVEL)/Makefile.rules + +other-2.o: other-2.cpp +	$(CXX) $(CFLAGS_NO_DEBUG) -c other-2.cpp + +somefunc.o: somefunc.c +	$(CC) $(CFLAGS) -std=c99 -c somefunc.c
\ No newline at end of file diff --git a/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py b/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py new file mode 100644 index 000000000000..178e165f3cbe --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py @@ -0,0 +1,87 @@ +""" +Test the SB API SBFrame::GuessLanguage. +""" + +from __future__ import print_function + + +import os +import time +import re +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + + +class TestFrameGuessLanguage(TestBase): + +    mydir = TestBase.compute_mydir(__file__) + +    # If your test case doesn't stress debug info, the  +    # set this to true.  That way it won't be run once for +    # each debug info format. +    NO_DEBUG_INFO_TESTCASE = True + +    def test_guess_language(self): +        """Test GuessLanguage for C and C++.""" +        self.build() +        self.do_test() + +    def setUp(self): +        # Call super's setUp(). +        TestBase.setUp(self) + +    def check_language(self, thread, frame_no, test_lang): +        frame = thread.frames[frame_no] +        self.assertTrue(frame.IsValid(), "Frame %d was not valid."%(frame_no)) +        lang = frame.GuessLanguage() +        self.assertEqual(lang, test_lang) + +    def do_test(self): +        """Test GuessLanguage for C & C++.""" +        exe = os.path.join(os.getcwd(), "a.out") + +        # Create a target by the debugger. +        target = self.dbg.CreateTarget(exe) +        self.assertTrue(target, VALID_TARGET) + +        # Now create a breakpoint in main.c at the source matching +        # "Set a breakpoint here" +        breakpoint = target.BreakpointCreateBySourceRegex( +            "Set breakpoint here", lldb.SBFileSpec("somefunc.c")) +        self.assertTrue(breakpoint and +                        breakpoint.GetNumLocations() >= 1, +                        VALID_BREAKPOINT) + +        error = lldb.SBError() +        # This is the launch info.  If you want to launch with arguments or +        # environment variables, add them using SetArguments or +        # SetEnvironmentEntries + +        launch_info = lldb.SBLaunchInfo(None) +        process = target.Launch(launch_info, error) +        self.assertTrue(process, PROCESS_IS_VALID) + +        # Did we hit our breakpoint? +        from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint +        threads = get_threads_stopped_at_breakpoint(process, breakpoint) +        self.assertTrue( +            len(threads) == 1, +            "There should be a thread stopped at our breakpoint") + +        # The hit count for the breakpoint should be 1. +        self.assertTrue(breakpoint.GetHitCount() == 1) + +        thread = threads[0] + +        c_frame_language = lldb.eLanguageTypeC99 +        # gcc emits DW_LANG_C89 even if -std=c99 was specified +        if "gcc" in self.getCompiler(): +            c_frame_language = lldb.eLanguageTypeC89 + +        self.check_language(thread, 0, c_frame_language) +        self.check_language(thread, 1, lldb.eLanguageTypeC_plus_plus) +        self.check_language(thread, 2, lldb.eLanguageTypeC_plus_plus) +         +         + diff --git a/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp new file mode 100644 index 000000000000..f5449f217908 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp @@ -0,0 +1,10 @@ +#include <stdio.h> +#include "other.h" + +int +main() +{ +  int test_var = 10; +  Other::DoSomethingElse(); +  return 0; +} diff --git a/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp b/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp new file mode 100644 index 000000000000..77632de3ceb0 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp @@ -0,0 +1,7 @@ +#include "other.h" + +void  +Other::DoSomethingElse() +{ +  DoSomething(); +} diff --git a/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp b/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp new file mode 100644 index 000000000000..41f4f26079ad --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp @@ -0,0 +1,10 @@ +#include "other.h" + +extern "C" void some_func(); + +void  +Other::DoSomething() +{ +  some_func(); +} + diff --git a/packages/Python/lldbsuite/test/functionalities/frame-language/other.h b/packages/Python/lldbsuite/test/functionalities/frame-language/other.h new file mode 100644 index 000000000000..0a2c125e6b42 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/frame-language/other.h @@ -0,0 +1,7 @@ +class Other +{ + public: +  static void DoSomething(); +  static void DoSomethingElse(); +}; + diff --git a/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c b/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c new file mode 100644 index 000000000000..a4b4f47f32ec --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void +some_func() +{ +  printf("Set breakpoint here."); +} diff --git a/packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py b/packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py deleted file mode 100644 index 85741f548f33..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Test lldb 'commands regex' command which allows the user to create a regular expression command. -""" - -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 TestHomeDirectory(TestBase): - -    mydir = TestBase.compute_mydir(__file__) - -    @expectedFailureAll( -        hostoslist=["windows"], -        bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") -    @no_debug_info_test -    def test_tilde_home_directory(self): -        """Test that we can resolve "~/" in paths correctly. -        When a path starts with "~/", we use llvm::sys::path::home_directory() to -        resolve the home directory. This currently relies on "HOME" being set in the -        environment. While this is usually set, we can't rely upon that. We might -        eventually get a fix into llvm::sys::path::home_directory() so it doesn't rely -        on having to have an environment variable set, but until then we have work around -        code in FileSpec::ResolveUsername (llvm::SmallVectorImpl<char> &path) to ensure -        this always works. This test tests that we get the correct answer for with and -        without "HOME" being set in the environment.""" -        import pexpect -        prompt = "(lldb) " - -        child = pexpect.spawn( -            '%s --no-use-colors %s' % -            (lldbtest_config.lldbExec, self.lldbOption)) -        # Turn on logging for what the child sends back. -        if self.TraceOn(): -            child.logfile_read = sys.stdout -        # So that the spawned lldb session gets shutdown durng teardown. -        self.child = child - -        # Resolve "~/." to the full path of our home directory + "/." -        if 'HOME' in os.environ: -            home_dir = os.environ['HOME'] -            if self.TraceOn(): -                print("home directory is: '%s'" % (home_dir)) -            if os.path.exists(home_dir): -                home_dir_slash_dot = home_dir + '/.' -                child.expect_exact(prompt) -                child.sendline('''script str(lldb.SBFileSpec("~/.", True))''') -                child.expect_exact(home_dir) -                child.expect_exact(prompt) -                child.sendline( -                    '''script import os; os.unsetenv('HOME'); str(lldb.SBFileSpec("~/", True))''') -                child.expect_exact(home_dir) -                child.expect_exact(prompt) -            elif self.TraceOn(): -                print( -                    '''home directory "%s" doesn't exist, skipping home directory test''' % -                    (home_dir)) -        elif self.TraceOn(): -            print('"HOME" not in environment, skipping home directory test') - -        child.sendline('quit') diff --git a/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py b/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py index 9d4e44c96bbc..91342fdaf1c3 100644 --- a/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py +++ b/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py @@ -118,3 +118,20 @@ class MemoryReadTestCase(TestBase):                  '16',                  '18',                  '20']) + +        # the gdb format specifier and the size in characters for +        # the returned values including the 0x prefix. +        variations = [['b', 4], ['h', 6], ['w', 10], ['g', 18]] +        for v in variations: +          formatter = v[0] +          expected_object_length = v[1] +          self.runCmd( +              "memory read --gdb-format 4%s &my_uint64s" % formatter) +          lines = self.res.GetOutput().splitlines() +          objects_read = [] +          for l in lines: +              objects_read.extend(l.split(':')[1].split()) +          # Check that we got back 4 0x0000 etc bytes +          for o in objects_read: +              self.assertTrue (len(o) == expected_object_length) +          self.assertTrue(len(objects_read) == 4) diff --git a/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp b/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp index cd367ff318ab..fdc7b8bdba18 100644 --- a/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp @@ -7,12 +7,14 @@  //  //===----------------------------------------------------------------------===//  #include <stdio.h> +#include <stdint.h>  int main (int argc, char const *argv[])  {      char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0};      double my_double = 1234.5678;      int my_ints[] = {2,4,6,8,10,12,14,16,18,20,22}; +    uint64_t my_uint64s[] = {0, 1, 2, 3, 4, 5, 6, 7};      printf("my_string=%s\n", my_string); // Set break point at this line.      printf("my_double=%g\n", my_double);      return 0; diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py index 7a987aeafb5b..38b55ef40c6b 100644 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -21,10 +21,14 @@ class LinuxCoreTestCase(TestBase):      _i386_pid = 32306      _x86_64_pid = 32259      _s390x_pid = 1045 +    _mips64_n64_pid = 25619 +    _mips64_n32_pid = 3670 +    _mips_o32_pid = 3532      _i386_regions = 4      _x86_64_regions = 5      _s390x_regions = 2 +    _mips_regions = 5      def setUp(self):          super(LinuxCoreTestCase, self).setUp() @@ -35,24 +39,40 @@ class LinuxCoreTestCase(TestBase):          super(LinuxCoreTestCase, self).tearDown()      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_i386(self):          """Test that lldb can read the process information from an i386 linux core file."""          self.do_test("linux-i386", self._i386_pid, self._i386_regions) +    def test_mips_o32(self): +        """Test that lldb can read the process information from an MIPS O32 linux core file.""" +        self.do_test("linux-mipsel-gnuabio32", self._mips_o32_pid, self._mips_regions) + +    def test_mips_n32(self): +        """Test that lldb can read the process information from an MIPS N32 linux core file """ +        self.do_test("linux-mips64el-gnuabin32", self._mips64_n32_pid, self._mips_regions) + +    def test_mips_n64(self): +        """Test that lldb can read the process information from an MIPS N64 linux core file """ +        self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid, self._mips_regions) +      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_x86_64(self):          """Test that lldb can read the process information from an x86_64 linux core file."""          self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions)      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_s390x(self):          """Test that lldb can read the process information from an s390x linux core file."""          self.do_test("linux-s390x", self._s390x_pid, self._s390x_regions)      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_same_pid_running(self):          """Test that we read the information from the core correctly even if we have a running @@ -82,6 +102,7 @@ class LinuxCoreTestCase(TestBase):              self.RemoveTempFile("linux-x86_64-pid.core")      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_two_cores_same_pid(self):          """Test that we handle the situation if we have two core files with the same PID @@ -111,6 +132,7 @@ class LinuxCoreTestCase(TestBase):          self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions)      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_FPR_SSE(self):          # check x86_64 core file diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py index 5a11a52e93a6..5b398c1ccf0c 100644 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py @@ -23,12 +23,14 @@ class GCoreTestCase(TestBase):      _x86_64_pid = 5669      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_i386(self):          """Test that lldb can read the process information from an i386 linux core file."""          self.do_test("linux-i386", self._i386_pid)      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_x86_64(self):          """Test that lldb can read the process information from an x86_64 linux core file.""" diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp index 9908faffb6eb..f53ce2f35924 100644 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp @@ -9,7 +9,7 @@  // This test verifies the correct handling of child thread exits. -#include <atomic> +#include "pseudo_barrier.h"  #include <thread>  #include <csignal> diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.coreBinary files differ new file mode 100644 index 000000000000..272c627cd244 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.outBinary files differ new file mode 100755 index 000000000000..a230aa4251ae --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.coreBinary files differ new file mode 100644 index 000000000000..19c8100bdb11 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.outBinary files differ new file mode 100755 index 000000000000..d1293a71a856 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.coreBinary files differ new file mode 100644 index 000000000000..2ad41395a2e0 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.outBinary files differ new file mode 100755 index 000000000000..dc809c8da482 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py index 7cc3c0775ced..4895c051d63e 100644 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py @@ -27,12 +27,14 @@ class LinuxCoreThreadsTestCase(TestBase):      _x86_64_tid = 5250      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_i386(self):          """Test that lldb can read the process information from an i386 linux core file."""          self.do_test("linux-i386", self._i386_pid, self._i386_tid)      @skipIf(oslist=['windows']) +    @skipIfDarwin # <rdar://problem/31380097>, fails started happening with r299199      @skipIf(triple='^mips')      def test_x86_64(self):          """Test that lldb can read the process information from an x86_64 linux core file.""" diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp index 826d9d3fa972..7e09662edb2d 100644 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp @@ -9,7 +9,7 @@  // This test verifies the correct handling of child thread exits. -#include <atomic> +#include "pseudo_barrier.h"  #include <thread>  #include <csignal> diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py index 44a42fdfe9d1..9becd8756318 100644 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -23,6 +23,14 @@ class MiniDumpNewTestCase(TestBase):      _linux_x86_64_not_crashed_pid = 29939      _linux_x86_64_not_crashed_pid_offset = 0xD967 +    def setUp(self): +        super(MiniDumpNewTestCase, self).setUp() +        self._initial_platform = lldb.DBG.GetSelectedPlatform() + +    def tearDown(self): +        lldb.DBG.SetSelectedPlatform(self._initial_platform) +        super(MiniDumpNewTestCase, self).tearDown() +      def test_process_info_in_minidump(self):          """Test that lldb can read the process information from the Minidump."""          # target create -c linux-x86_64.dmp diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile new file mode 100644 index 000000000000..c4855ca9b12d --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile @@ -0,0 +1,8 @@ +LEVEL = ../../make + +DYLIB_NAME := unlikely_name +DYLIB_CXX_SOURCES := foo.cpp +CXX_SOURCES := main.cpp +CFLAGS_EXTRAS += -fPIC + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py new file mode 100644 index 000000000000..258c3d3fbb9f --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py @@ -0,0 +1,38 @@ +from __future__ import print_function + +import unittest2 +import lldb +from lldbsuite.test.lldbtest import * +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.decorators import * + +class TestPreRunLibraries(TestBase): + +    mydir = TestBase.compute_mydir(__file__) +    NO_DEBUG_INFO_TESTCASE = True + +    def setUp(self): +        # Call super's setUp(). +        TestBase.setUp(self) + +    @skipIf(oslist=no_match(['darwin','macos'])) +    def test(self): +        """Test that we find directly linked dylib pre-run.""" + +        self.build() +        target = self.dbg.CreateTarget("a.out") +        self.assertTrue(target, VALID_TARGET) + +        # I don't know what the name of a shared library +        # extension is in general, so instead of using FindModule, +        # I'll iterate through the module and do a basename match. +        found_it = False +        for module in target.modules: +            file_name = module.GetFileSpec().GetFilename() +            if file_name.find("unlikely_name") != -1: +                found_it = True +                break + +        self.assertTrue(found_it, "Couldn't find unlikely_to_occur_name in loaded libraries.") + +             diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.cpp b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.cpp new file mode 100644 index 000000000000..8dad0a23f368 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.cpp @@ -0,0 +1,3 @@ +#include "foo.h" + +int call_foo1() { return foo1(); } diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.h b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.h new file mode 100644 index 000000000000..060b91f5a5ea --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.h @@ -0,0 +1,6 @@ +LLDB_TEST_API inline int foo1() { return 1; } // !BR1 + +LLDB_TEST_API inline int foo2() { return 2; } // !BR2 + +LLDB_TEST_API extern int call_foo1(); +LLDB_TEST_API extern int call_foo2(); diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/main.cpp b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/main.cpp new file mode 100644 index 000000000000..c9295a5c7d3c --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/main.cpp @@ -0,0 +1,9 @@ +#include "foo.h" + +int call_foo2() { return foo2(); } + +int +main() // !BR_main +{ +  return call_foo1() + call_foo2(); +} diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py index 6fcf29a2f58f..6dccaa55a103 100644 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py +++ b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py @@ -15,6 +15,7 @@ from lldbsuite.test import lldbutil  class TestYMMRegister(TestBase):      mydir = TestBase.compute_mydir(__file__) +    NO_DEBUG_INFO_TESTCASE = True      @skipIfFreeBSD      @skipIfiOSSimulator diff --git a/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py b/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py index 157a0a8bd982..cc1389ca6b01 100644 --- a/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py +++ b/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py @@ -18,6 +18,7 @@ from lldbsuite.test import lldbutil  class RegisterCommandsTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) +    NO_DEBUG_INFO_TESTCASE = True      def setUp(self):          TestBase.setUp(self) @@ -139,17 +140,10 @@ class RegisterCommandsTestCase(TestBase):          # This intentionally checks the host platform rather than the target          # platform as logging is host side.          self.platform = "" -        if sys.platform.startswith("darwin"): -            self.platform = ""  # TODO: add support for "log enable darwin registers" - -        if sys.platform.startswith("freebsd"): -            self.platform = "freebsd" - -        if sys.platform.startswith("linux"): -            self.platform = "linux" - -        if sys.platform.startswith("netbsd"): -            self.platform = "netbsd" +        if (sys.platform.startswith("freebsd") or +                sys.platform.startswith("linux") or +                sys.platform.startswith("netbsd")): +            self.platform = "posix"          if self.platform != "":              self.log_file = os.path.join(os.getcwd(), 'TestRegisters.log') diff --git a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/main.cpp index f9f33fda82bb..f06761936d12 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/main.cpp @@ -13,7 +13,7 @@  // breakpoint is hit.  The test case should be flexible enough to treat that  // as success. -#include <atomic> +#include "pseudo_barrier.h"  #include <chrono>  #include <thread> diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp index 10b55bff3ba4..540b5148aefa 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp @@ -13,7 +13,7 @@  // the main thread (before any worker threads are spawned) and modify variables  // which control the number of threads that are spawned for each action. -#include <atomic> +#include "pseudo_barrier.h"  #include <vector>  using namespace std; diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/main.cpp index 70681fd11603..f927e3d9d496 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/main.cpp @@ -10,7 +10,7 @@  // This test is intended to create a situation in which one thread will be  // created while the debugger is stepping in another thread. -#include <atomic> +#include "pseudo_barrier.h"  #include <thread>  #define do_nothing() diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp index a032da835ea6..e41fbebf380d 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp @@ -13,7 +13,7 @@  // breakpoint is hit.  The test case should be flexible enough to treat that  // as success. -#include <atomic> +#include "pseudo_barrier.h"  #include <chrono>  #include <thread> diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/main.cpp index 45adf28ce813..c7affd2a59ab 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/main.cpp @@ -10,6 +10,7 @@  // This test is intended to create a situation in which one thread will exit  // while the debugger is stepping in another thread. +#include "pseudo_barrier.h"  #include <thread>  #define do_nothing() diff --git a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/main.cpp index c3d695dbc745..d46038109fc2 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/main.cpp @@ -12,7 +12,7 @@  // the breakpoint in the second thread will be hit while the breakpoint handler  // in the first thread is trying to stop all threads. -#include <atomic> +#include "pseudo_barrier.h"  #include <thread>  pseudo_barrier_t g_barrier; diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp index 31f9a1576b92..ecc0571f2bd3 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp @@ -10,7 +10,7 @@  // This test is intended to create a situation in which two threads are stopped  // at a breakpoint and the debugger issues a step-out command. -#include <atomic> +#include "pseudo_barrier.h"  #include <thread>  pseudo_barrier_t g_barrier; diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp index c57db9f48527..f9508cf6ecca 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp @@ -9,7 +9,7 @@  // This test verifies the correct handling of child thread exits. -#include <atomic> +#include "pseudo_barrier.h"  #include <thread>  pseudo_barrier_t g_barrier1; | 
