diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities')
316 files changed, 0 insertions, 12945 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/apropos/TestApropos.py b/lldb/packages/Python/lldbsuite/test/functionalities/apropos/TestApropos.py deleted file mode 100644 index c4337c7301f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/apropos/TestApropos.py +++ /dev/null @@ -1,29 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * - -class AproposTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - @no_debug_info_test - def test_apropos(self): - self.expect("apropos", error=True, - substrs=[' must be called with exactly one argument']) - self.expect("apropos a b", error=True, - substrs=[' must be called with exactly one argument']) - self.expect("apropos ''", error=True, - substrs=['\'\' is not a valid search word']) - - @no_debug_info_test - def test_apropos_variable(self): - """Test that 'apropos variable' prints the fully qualified command name""" - self.expect( - 'apropos variable', - substrs=[ - 'frame variable', - 'target variable', - 'watchpoint set variable']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/Makefile deleted file mode 100644 index 8a7102e347a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py b/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py deleted file mode 100644 index 1e146d9f62e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py +++ /dev/null @@ -1,43 +0,0 @@ -""" -Test that apropos env doesn't crash trying to touch the process plugin command -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class AproposWithProcessTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.cpp', '// break here') - - def test_apropos_with_process(self): - """Test that apropos env doesn't crash trying to touch the process plugin command.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break in main() after the variables are assigned values. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - self.runCmd('apropos env') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/main.cpp deleted file mode 100644 index d18c86512bf..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/apropos_with_process/main.cpp +++ /dev/null @@ -1,14 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -int main (int argc, char const *argv[]) -{ - return 0; // break here -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/Makefile deleted file mode 100644 index 13d40a13b3e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -EXE := AttachResume - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py b/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py deleted file mode 100644 index 2c402e6a31a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py +++ /dev/null @@ -1,93 +0,0 @@ -""" -Test process attach/resume. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -exe_name = "AttachResume" # Must match Makefile - - -class AttachResumeTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfRemote - @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr19310') - @expectedFailureNetBSD - @skipIfWindows # llvm.org/pr24778, llvm.org/pr21753 - def test_attach_continue_interrupt_detach(self): - """Test attach/continue/interrupt/detach""" - self.build() - self.process_attach_continue_interrupt_detach() - - def process_attach_continue_interrupt_detach(self): - """Test attach/continue/interrupt/detach""" - - exe = self.getBuildArtifact(exe_name) - - popen = self.spawnSubprocess(exe) - self.addTearDownHook(self.cleanupSubprocesses) - - self.runCmd("process attach -p " + str(popen.pid)) - - self.setAsync(True) - listener = self.dbg.GetListener() - process = self.dbg.GetSelectedTarget().GetProcess() - - self.runCmd("c") - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateRunning]) - - self.runCmd("process interrupt") - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateStopped]) - - # be sure to continue/interrupt/continue (r204504) - self.runCmd("c") - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateRunning]) - - self.runCmd("process interrupt") - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateStopped]) - - # Second interrupt should have no effect. - self.expect( - "process interrupt", - patterns=["Process is not running"], - error=True) - - # check that this breakpoint is auto-cleared on detach (r204752) - self.runCmd("br set -f main.cpp -l %u" % - (line_number('main.cpp', '// Set breakpoint here'))) - - self.runCmd("c") - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateRunning, lldb.eStateStopped]) - self.expect('br list', 'Breakpoint not hit', - substrs=['hit count = 1']) - - # Make sure the breakpoint is not hit again. - self.expect("expr debugger_flag = false", substrs=[" = false"]) - - self.runCmd("c") - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateRunning]) - - # make sure to detach while in running state (r204759) - self.runCmd("detach") - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateDetached]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/main.cpp deleted file mode 100644 index 82aad70eed5..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include <stdio.h> -#include <fcntl.h> - -#include <chrono> -#include <thread> - -volatile bool debugger_flag = true; // The debugger will flip this to false - -void *start(void *data) -{ - int i; - size_t idx = (size_t)data; - for (i=0; i<30; i++) - { - if ( idx == 0 && debugger_flag) - std::this_thread::sleep_for(std::chrono::microseconds(1)); // Set breakpoint here - std::this_thread::sleep_for(std::chrono::seconds(1)); - } - return 0; -} - -int main(int argc, char const *argv[]) -{ - lldb_enable_attach(); - - static const size_t nthreads = 16; - std::thread threads[nthreads]; - size_t i; - - for (i=0; i<nthreads; i++) - threads[i] = std::move(std::thread(start, (void*)i)); - - for (i=0; i<nthreads; i++) - threads[i].join(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile deleted file mode 100644 index 6067ee45e98..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -std=c99 - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py deleted file mode 100644 index f4d54111fd5..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Test address breakpoints set with shared library of SBAddress work correctly. -""" - -from __future__ import print_function - - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class AddressBreakpointTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def test_address_breakpoints(self): - """Test address breakpoints set with shared library of SBAddress work correctly.""" - self.build() - self.address_breakpoints() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def address_breakpoints(self): - """Test address breakpoints set with shared library of SBAddress work correctly.""" - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now create a breakpoint on main.c by name 'c'. - breakpoint = target.BreakpointCreateBySourceRegex( - "Set a breakpoint here", lldb.SBFileSpec("main.c")) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() >= 1, - VALID_BREAKPOINT) - - # Get the breakpoint location from breakpoint after we verified that, - # indeed, it has one location. - location = breakpoint.GetLocationAtIndex(0) - self.assertTrue(location and - location.IsEnabled(), - VALID_BREAKPOINT_LOCATION) - - # Next get the address from the location, and create an address breakpoint using - # that address: - - address = location.GetAddress() - target.BreakpointDelete(breakpoint.GetID()) - - breakpoint = target.BreakpointCreateBySBAddress(address) - - # Disable ASLR. This will allow us to actually test (on platforms that support this flag) - # that the breakpoint was able to track the module. - - launch_info = lldb.SBLaunchInfo(None) - flags = launch_info.GetLaunchFlags() - flags &= ~lldb.eLaunchFlagDisableASLR - launch_info.SetLaunchFlags(flags) - - error = lldb.SBError() - - 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) - - process.Kill() - - # Now re-launch and see that we hit the breakpoint again: - launch_info.Clear() - launch_info.SetLaunchFlags(flags) - - process = target.Launch(launch_info, error) - self.assertTrue(process, PROCESS_IS_VALID) - - thread = 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 now be 2. - self.assertTrue(breakpoint.GetHitCount() == 2) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py deleted file mode 100644 index 2dcce03a583..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Test that breakpoints set on a bad address say they are bad. -""" - -from __future__ import print_function - - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class BadAddressBreakpointTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def test_bad_address_breakpoints(self): - """Test that breakpoints set on a bad address say they are bad.""" - self.build() - self.address_breakpoints() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def address_breakpoints(self): - """Test that breakpoints set on a bad address say they are bad.""" - target, process, thread, bkpt = \ - lldbutil.run_to_source_breakpoint(self, - "Set a breakpoint here", - lldb.SBFileSpec("main.c")) - - # Now see if we can read from 0. If I can't do that, I don't - # have a good way to know what an illegal address is... - error = lldb.SBError() - - ptr = process.ReadPointerFromMemory(0x0, error) - - if not error.Success(): - bkpt = target.BreakpointCreateByAddress(0x0) - for bp_loc in bkpt: - self.assertTrue(bp_loc.IsResolved() == False) - else: - self.fail( - "Could not find an illegal address at which to set a bad breakpoint.") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/main.c deleted file mode 100644 index 6b779296e18..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/main.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <stdio.h> - -int -main() -{ - printf ("Set a breakpoint here.\n"); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile deleted file mode 100644 index 6067ee45e98..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -std=c99 - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py deleted file mode 100644 index 411e0cfc907..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py +++ /dev/null @@ -1,101 +0,0 @@ -""" -Test that the breakpoint auto-continue flag works correctly. -""" - -from __future__ import print_function - - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class BreakpointAutoContinue(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def test_breakpoint_auto_continue(self): - """Make sure the auto continue continues with no other complications""" - self.build() - self.simple_auto_continue() - - def test_auto_continue_with_command(self): - """Add a command, make sure the command gets run""" - self.build() - self.auto_continue_with_command() - - def test_auto_continue_on_location(self): - """Set auto-continue on a location and make sure only that location continues""" - self.build() - self.auto_continue_location() - - def make_target_and_bkpt(self, additional_options=None, num_expected_loc=1, - pattern="Set a breakpoint here"): - exe = self.getBuildArtifact("a.out") - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target.IsValid(), "Target is not valid") - - extra_options_txt = "--auto-continue 1 " - if additional_options: - extra_options_txt += additional_options - bpno = lldbutil.run_break_set_by_source_regexp(self, pattern, - extra_options = extra_options_txt, - num_expected_locations = num_expected_loc) - return bpno - - def launch_it (self, expected_state): - error = lldb.SBError() - launch_info = lldb.SBLaunchInfo(None) - launch_info.SetWorkingDirectory(self.get_process_working_directory()) - - process = self.target.Launch(launch_info, error) - self.assertTrue(error.Success(), "Launch failed.") - - state = process.GetState() - self.assertEqual(state, expected_state, "Didn't get expected state") - - return process - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def simple_auto_continue(self): - bpno = self.make_target_and_bkpt() - process = self.launch_it(lldb.eStateExited) - - bkpt = self.target.FindBreakpointByID(bpno) - self.assertEqual(bkpt.GetHitCount(), 2, "Should have run through the breakpoint twice") - - def auto_continue_with_command(self): - bpno = self.make_target_and_bkpt("-N BKPT -C 'break modify --auto-continue 0 BKPT'") - process = self.launch_it(lldb.eStateStopped) - state = process.GetState() - self.assertEqual(state, lldb.eStateStopped, "Process should be stopped") - bkpt = self.target.FindBreakpointByID(bpno) - threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt) - self.assertEqual(len(threads), 1, "There was a thread stopped at our breakpoint") - self.assertEqual(bkpt.GetHitCount(), 2, "Should have hit the breakpoint twice") - - def auto_continue_location(self): - bpno = self.make_target_and_bkpt(pattern="Set a[^ ]* breakpoint here", num_expected_loc=2) - bkpt = self.target.FindBreakpointByID(bpno) - bkpt.SetAutoContinue(False) - - loc = lldb.SBBreakpointLocation() - for i in range(0,2): - func_name = bkpt.location[i].GetAddress().function.name - if func_name == "main": - loc = bkpt.location[i] - - self.assertTrue(loc.IsValid(), "Didn't find a location in main") - loc.SetAutoContinue(True) - - process = self.launch_it(lldb.eStateStopped) - - threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt) - self.assertEqual(len(threads), 1, "Didn't get one thread stopped at our breakpoint") - func_name = threads[0].frame[0].function.name - self.assertEqual(func_name, "call_me") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c deleted file mode 100644 index a37f05e0290..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <stdio.h> - -void -call_me() -{ - printf("Set another breakpoint here.\n"); -} - -int -main() -{ - int change_me = 0; - for (int i = 0; i < 2; i++) - { - printf ("Set a breakpoint here: %d with: %d.\n", i, change_me); - } - call_me(); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile deleted file mode 100644 index 6c22351dc3b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -std=c99 -gcolumn-info - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py deleted file mode 100644 index 61794697b31..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Test setting a breakpoint by line and column. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointByLineAndColumnTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - ## Skip gcc version less 7.1 since it doesn't support -gcolumn-info - @skipIf(compiler="gcc", compiler_version=['<', '7.1']) - def testBreakpointByLineAndColumn(self): - self.build() - main_c = lldb.SBFileSpec("main.c") - _, _, _, breakpoint = lldbutil.run_to_line_breakpoint(self, - main_c, 19, 50) - self.expect("fr v did_call", substrs='1') - in_then = False - for i in range(breakpoint.GetNumLocations()): - b_loc = breakpoint.GetLocationAtIndex(i).GetAddress().GetLineEntry() - self.assertEqual(b_loc.GetLine(), 19) - in_then |= b_loc.GetColumn() == 50 - self.assertTrue(in_then) - - ## Skip gcc version less 7.1 since it doesn't support -gcolumn-info - @skipIf(compiler="gcc", compiler_version=['<', '7.1']) - def testBreakpointByLine(self): - self.build() - main_c = lldb.SBFileSpec("main.c") - _, _, _, breakpoint = lldbutil.run_to_line_breakpoint(self, main_c, 19) - self.expect("fr v did_call", substrs='0') - in_condition = False - for i in range(breakpoint.GetNumLocations()): - b_loc = breakpoint.GetLocationAtIndex(i).GetAddress().GetLineEntry() - self.assertEqual(b_loc.GetLine(), 19) - in_condition |= b_loc.GetColumn() < 30 - self.assertTrue(in_condition) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/main.c deleted file mode 100644 index f9adad30575..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/main.c +++ /dev/null @@ -1,22 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int square(int x) -{ - return x * x; -} - -int main (int argc, char const *argv[]) -{ - int did_call = 0; - - // Line 20. v Column 50. - if(square(argc+1) != 0) { did_call = 1; return square(argc); } - // ^ - return square(0); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/Makefile deleted file mode 100644 index a6376f9b165..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c a.c b.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py deleted file mode 100644 index b75a6db6e80..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py +++ /dev/null @@ -1,285 +0,0 @@ -""" -Test lldb breakpoint command add/list/delete. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil -import side_effect - - -class BreakpointCommandTestCase(TestBase): - - NO_DEBUG_INFO_TESTCASE = True - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") - def test_breakpoint_command_sequence(self): - """Test a sequence of breakpoint command add, list, and delete.""" - self.build() - self.breakpoint_command_sequence() - - def test_script_parameters(self): - """Test a sequence of breakpoint command add, list, and delete.""" - self.build() - self.breakpoint_command_script_parameters() - - def test_commands_on_creation(self): - self.build() - self.breakpoint_commands_on_creation() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.c', '// Set break point at this line.') - # disable "There is a running process, kill it and restart?" prompt - self.runCmd("settings set auto-confirm true") - self.addTearDownHook( - lambda: self.runCmd("settings clear auto-confirm")) - - def test_delete_all_breakpoints(self): - """Test that deleting all breakpoints works.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_symbol(self, "main") - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - self.runCmd("breakpoint delete") - self.runCmd("process continue") - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* exited with status = 0']) - - - def breakpoint_command_sequence(self): - """Test a sequence of breakpoint command add, list, and delete.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add three breakpoints on the same line. The first time we don't specify the file, - # since the default file is the one containing main: - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, num_expected_locations=1, loc_exact=True) - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=1, loc_exact=True) - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=1, loc_exact=True) - # Breakpoint 4 - set at the same location as breakpoint 1 to test - # setting breakpoint commands on two breakpoints at a time - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, num_expected_locations=1, loc_exact=True) - # Make sure relative path source breakpoints work as expected. We test - # with partial paths with and without "./" prefixes. - lldbutil.run_break_set_by_file_and_line( - self, "./main.c", self.line, - num_expected_locations=1, loc_exact=True) - lldbutil.run_break_set_by_file_and_line( - self, "breakpoint_command/main.c", self.line, - num_expected_locations=1, loc_exact=True) - lldbutil.run_break_set_by_file_and_line( - self, "./breakpoint_command/main.c", self.line, - num_expected_locations=1, loc_exact=True) - lldbutil.run_break_set_by_file_and_line( - self, "breakpoint/breakpoint_command/main.c", self.line, - num_expected_locations=1, loc_exact=True) - lldbutil.run_break_set_by_file_and_line( - self, "./breakpoint/breakpoint_command/main.c", self.line, - num_expected_locations=1, loc_exact=True) - # Test relative breakpoints with incorrect paths and make sure we get - # no breakpoint locations - lldbutil.run_break_set_by_file_and_line( - self, "invalid/main.c", self.line, - num_expected_locations=0, loc_exact=True) - lldbutil.run_break_set_by_file_and_line( - self, "./invalid/main.c", self.line, - num_expected_locations=0, loc_exact=True) - # Now add callbacks for the breakpoints just created. - self.runCmd( - "breakpoint command add -s command -o 'frame variable --show-types --scope' 1 4") - self.runCmd( - "breakpoint command add -s python -o 'import side_effect; side_effect.one_liner = \"one liner was here\"' 2") - self.runCmd( - "breakpoint command add --python-function bktptcmd.function 3") - - # Check that the breakpoint commands are correctly set. - - # The breakpoint list now only contains breakpoint 1. - self.expect( - "breakpoint list", "Breakpoints 1 & 2 created", substrs=[ - "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % - self.line], patterns=[ - "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % - self.line]) - - self.expect( - "breakpoint list -f", - "Breakpoints 1 & 2 created", - substrs=[ - "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % - self.line], - patterns=[ - "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % - self.line, - "1.1: .+at main.c:%d:?[0-9]*, .+unresolved, hit count = 0" % - self.line, - "2.1: .+at main.c:%d:?[0-9]*, .+unresolved, hit count = 0" % - self.line]) - - self.expect("breakpoint command list 1", "Breakpoint 1 command ok", - substrs=["Breakpoint commands:", - "frame variable --show-types --scope"]) - self.expect("breakpoint command list 2", "Breakpoint 2 command ok", - substrs=["Breakpoint commands (Python):", - "import side_effect", - "side_effect.one_liner"]) - self.expect("breakpoint command list 3", "Breakpoint 3 command ok", - substrs=["Breakpoint commands (Python):", - "bktptcmd.function(frame, bp_loc, internal_dict)"]) - - self.expect("breakpoint command list 4", "Breakpoint 4 command ok", - substrs=["Breakpoint commands:", - "frame variable --show-types --scope"]) - - self.runCmd("breakpoint delete 4") - - self.runCmd("command script import --allow-reload ./bktptcmd.py") - - # Next lets try some other breakpoint kinds. First break with a regular expression - # and then specify only one file. The first time we should get two locations, - # the second time only one: - - lldbutil.run_break_set_by_regexp( - self, r"._MyFunction", num_expected_locations=2) - - lldbutil.run_break_set_by_regexp( - self, - r"._MyFunction", - extra_options="-f a.c", - num_expected_locations=1) - - lldbutil.run_break_set_by_regexp( - self, - r"._MyFunction", - extra_options="-f a.c -f b.c", - num_expected_locations=2) - - # Now try a source regex breakpoint: - lldbutil.run_break_set_by_source_regexp( - self, - r"is about to return [12]0", - extra_options="-f a.c -f b.c", - num_expected_locations=2) - - lldbutil.run_break_set_by_source_regexp( - self, - r"is about to return [12]0", - extra_options="-f a.c", - num_expected_locations=1) - - # Reset our canary variables and run the program. - side_effect.one_liner = None - side_effect.bktptcmd = None - self.runCmd("run", RUN_SUCCEEDED) - - # Check the value of canary variables. - self.assertEquals("one liner was here", side_effect.one_liner) - self.assertEquals("function was here", side_effect.bktptcmd) - - # Finish the program. - self.runCmd("process continue") - - # Remove the breakpoint command associated with breakpoint 1. - self.runCmd("breakpoint command delete 1") - - # Remove breakpoint 2. - self.runCmd("breakpoint delete 2") - - self.expect( - "breakpoint command list 1", - startstr="Breakpoint 1 does not have an associated command.") - self.expect( - "breakpoint command list 2", - error=True, - startstr="error: '2' is not a currently valid breakpoint ID.") - - # The breakpoint list now only contains breakpoint 1. - self.expect( - "breakpoint list -f", - "Breakpoint 1 exists", - patterns=[ - "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" % - self.line, - "hit count = 1"]) - - # Not breakpoint 2. - self.expect( - "breakpoint list -f", - "No more breakpoint 2", - matching=False, - substrs=[ - "2: file = 'main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" % - self.line]) - - # Run the program again, with breakpoint 1 remaining. - self.runCmd("run", RUN_SUCCEEDED) - - # We should be stopped again due to breakpoint 1. - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # The breakpoint should have a hit count of 2. - self.expect("breakpoint list -f", BREAKPOINT_HIT_TWICE, - substrs=['resolved, hit count = 2']) - - def breakpoint_command_script_parameters(self): - """Test that the frame and breakpoint location are being properly passed to the script breakpoint command function.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=1, loc_exact=True) - - # Now add callbacks for the breakpoints just created. - self.runCmd("breakpoint command add -s python -o 'import side_effect; side_effect.frame = str(frame); side_effect.bp_loc = str(bp_loc)' 1") - - # Reset canary variables and run. - side_effect.frame = None - side_effect.bp_loc = None - self.runCmd("run", RUN_SUCCEEDED) - - self.expect(side_effect.frame, exe=False, startstr="frame #0:") - self.expect(side_effect.bp_loc, exe=False, - patterns=["1.* where = .*main .* resolved, hit count = 1"]) - - def breakpoint_commands_on_creation(self): - """Test that setting breakpoint commands when creating the breakpoint works""" - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target.IsValid(), "Created an invalid target.") - - # Add a breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=1, loc_exact=True, - extra_options='-C bt -C "thread list" -C continue') - - bkpt = target.FindBreakpointByID(1) - self.assertTrue(bkpt.IsValid(), "Couldn't find breakpoint 1") - com_list = lldb.SBStringList() - bkpt.GetCommandLineCommands(com_list) - self.assertEqual(com_list.GetSize(), 3, "Got the wrong number of commands") - self.assertEqual(com_list.GetStringAtIndex(0), "bt", "First bt") - self.assertEqual(com_list.GetStringAtIndex(1), "thread list", "Next thread list") - self.assertEqual(com_list.GetStringAtIndex(2), "continue", "Last continue") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py deleted file mode 100644 index 962728a324e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py +++ /dev/null @@ -1,99 +0,0 @@ -""" -Test that you can set breakpoint commands successfully with the Python API's: -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil -import side_effect - - -class PythonBreakpointCommandSettingTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @add_test_categories(['pyapi']) - def test_step_out_python(self): - """Test stepping out using avoid-no-debug with dsyms.""" - self.build() - self.do_set_python_command_from_python() - - def setUp(self): - TestBase.setUp(self) - self.main_source = "main.c" - self.main_source_spec = lldb.SBFileSpec(self.main_source) - - def do_set_python_command_from_python(self): - exe = self.getBuildArtifact("a.out") - error = lldb.SBError() - - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - body_bkpt = self.target.BreakpointCreateBySourceRegex( - "Set break point at this line.", self.main_source_spec) - self.assertTrue(body_bkpt, VALID_BREAKPOINT) - - func_bkpt = self.target.BreakpointCreateBySourceRegex( - "Set break point at this line.", self.main_source_spec) - self.assertTrue(func_bkpt, VALID_BREAKPOINT) - - # Also test that setting a source regex breakpoint with an empty file - # spec list sets it on all files: - no_files_bkpt = self.target.BreakpointCreateBySourceRegex( - "Set a breakpoint here", lldb.SBFileSpecList(), lldb.SBFileSpecList()) - self.assertTrue(no_files_bkpt, VALID_BREAKPOINT) - num_locations = no_files_bkpt.GetNumLocations() - self.assertTrue( - num_locations >= 2, - "Got at least two breakpoint locations") - got_one_in_A = False - got_one_in_B = False - for idx in range(0, num_locations): - comp_unit = no_files_bkpt.GetLocationAtIndex(idx).GetAddress().GetSymbolContext( - lldb.eSymbolContextCompUnit).GetCompileUnit().GetFileSpec() - print("Got comp unit: ", comp_unit.GetFilename()) - if comp_unit.GetFilename() == "a.c": - got_one_in_A = True - elif comp_unit.GetFilename() == "b.c": - got_one_in_B = True - - self.assertTrue(got_one_in_A, "Failed to match the pattern in A") - self.assertTrue(got_one_in_B, "Failed to match the pattern in B") - self.target.BreakpointDelete(no_files_bkpt.GetID()) - - error = lldb.SBError() - error = body_bkpt.SetScriptCallbackBody( - "import side_effect; side_effect.callback = 'callback was here'") - self.assertTrue( - error.Success(), - "Failed to set the script callback body: %s." % - (error.GetCString())) - - self.dbg.HandleCommand( - "command script import --allow-reload ./bktptcmd.py") - func_bkpt.SetScriptCallbackFunction("bktptcmd.function") - - # Clear out canary variables - side_effect.bktptcmd = None - side_effect.callback = None - - # Now launch the process, and do not stop at entry point. - self.process = self.target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(self.process, PROCESS_IS_VALID) - - # Now finish, and make sure the return value is correct. - threads = lldbutil.get_threads_stopped_at_breakpoint( - self.process, body_bkpt) - self.assertTrue(len(threads) == 1, "Stopped at inner breakpoint.") - self.thread = threads[0] - - self.assertEquals("callback was here", side_effect.callback) - self.assertEquals("function was here", side_effect.bktptcmd) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py deleted file mode 100644 index 8774d3763a6..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -Test _regexp-break command which uses regular expression matching to dispatch to other built in breakpoint commands. -""" - -from __future__ import print_function - - -import os -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class RegexpBreakCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - """Test _regexp-break command.""" - self.build() - self.regexp_break_command() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.source = 'main.c' - self.line = line_number( - self.source, '// Set break point at this line.') - - def regexp_break_command(self): - """Test the super consie "b" command, which is analias for _regexp-break.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - break_results = lldbutil.run_break_set_command( - self, "b %d" % - self.line) - lldbutil.check_breakpoint_result( - self, - break_results, - file_name='main.c', - line_number=self.line, - num_locations=1) - - break_results = lldbutil.run_break_set_command( - self, "b %s:%d" % (self.source, self.line)) - lldbutil.check_breakpoint_result( - self, - break_results, - file_name='main.c', - line_number=self.line, - num_locations=1) - - # Check breakpoint with full file path. - full_path = os.path.join(self.getSourceDir(), self.source) - break_results = lldbutil.run_break_set_command( - self, "b %s:%d" % (full_path, self.line)) - lldbutil.check_breakpoint_result( - self, - break_results, - file_name='main.c', - line_number=self.line, - num_locations=1) - - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/a.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/a.c deleted file mode 100644 index 870e4a6ab16..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/a.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdio.h> - -int -a_MyFunction () -{ - // Set a breakpoint here. - printf ("a is about to return 10.\n"); - return 10; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/b.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/b.c deleted file mode 100644 index 02b78e7bd85..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/b.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdio.h> - -int -b_MyFunction () -{ - // Set a breakpoint here. - printf ("b is about to return 20.\n"); - return 20; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py deleted file mode 100644 index ac0f753ccd8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import print_function -import side_effect - -def function(frame, bp_loc, dict): - side_effect.bktptcmd = "function was here" diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c deleted file mode 100644 index 8bebb9455a6..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int main (int argc, char const *argv[]) -{ - // Add a body to the function, so we can set more than one - // breakpoint in it. - static volatile int var = 0; - var++; - return 0; // Set break point at this line. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/side_effect.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/side_effect.py deleted file mode 100644 index ef4ab2b159c..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/side_effect.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -A dummy module for testing the execution of various breakpoint commands. A -command will modify a global variable in this module and test will check its -value. -""" diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile deleted file mode 100644 index 6067ee45e98..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -std=c99 - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py deleted file mode 100644 index 96ed32a9efe..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py +++ /dev/null @@ -1,226 +0,0 @@ -""" -Test breakpoint conditions with 'breakpoint modify -c <expr> id'. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointConditionsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_breakpoint_condition_and_run_command(self): - """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'.""" - self.build() - self.breakpoint_conditions() - - def test_breakpoint_condition_inline_and_run_command(self): - """Exercise breakpoint condition inline with 'breakpoint set'.""" - self.build() - self.breakpoint_conditions(inline=True) - - @add_test_categories(['pyapi']) - def test_breakpoint_condition_and_python_api(self): - """Use Python APIs to set breakpoint conditions.""" - self.build() - self.breakpoint_conditions_python() - - @add_test_categories(['pyapi']) - def test_breakpoint_invalid_condition_and_python_api(self): - """Use Python APIs to set breakpoint conditions.""" - self.build() - self.breakpoint_invalid_conditions_python() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to of function 'c'. - self.line1 = line_number( - 'main.c', '// Find the line number of function "c" here.') - self.line2 = line_number( - 'main.c', "// Find the line number of c's parent call here.") - - def breakpoint_conditions(self, inline=False): - """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - if inline: - # Create a breakpoint by function name 'c' and set the condition. - lldbutil.run_break_set_by_symbol( - self, - "c", - extra_options="-c 'val == 3'", - num_expected_locations=1, - sym_exact=True) - else: - # Create a breakpoint by function name 'c'. - lldbutil.run_break_set_by_symbol( - self, "c", num_expected_locations=1, sym_exact=True) - - # And set a condition on the breakpoint to stop on when 'val == 3'. - self.runCmd("breakpoint modify -c 'val == 3' 1") - - # Now run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # The process should be stopped at this point. - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* stopped']) - - # 'frame variable --show-types val' should return 3 due to breakpoint condition. - self.expect( - "frame variable --show-types val", - VARIABLES_DISPLAYED_CORRECTLY, - startstr='(int) val = 3') - - # Also check the hit count, which should be 3, by design. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=["resolved = 1", - "Condition: val == 3", - "hit count = 1"]) - - # The frame #0 should correspond to main.c:36, the executable statement - # in function name 'c'. And the parent frame should point to - # main.c:24. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_CONDITION, - #substrs = ["stop reason = breakpoint"], - patterns=["frame #0.*main.c:%d" % self.line1, - "frame #1.*main.c:%d" % self.line2]) - - # Test that "breakpoint modify -c ''" clears the condition for the last - # created breakpoint, so that when the breakpoint hits, val == 1. - self.runCmd("process kill") - self.runCmd("breakpoint modify -c ''") - self.expect( - "breakpoint list -f", - BREAKPOINT_STATE_CORRECT, - matching=False, - substrs=["Condition:"]) - - # Now run the program again. - self.runCmd("run", RUN_SUCCEEDED) - - # The process should be stopped at this point. - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* stopped']) - - # 'frame variable --show-types val' should return 1 since it is the first breakpoint hit. - self.expect( - "frame variable --show-types val", - VARIABLES_DISPLAYED_CORRECTLY, - startstr='(int) val = 1') - - self.runCmd("process kill") - - def breakpoint_conditions_python(self): - """Use Python APIs to set breakpoint conditions.""" - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now create a breakpoint on main.c by name 'c'. - breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print("breakpoint:", breakpoint) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # We didn't associate a thread index with the breakpoint, so it should - # be invalid. - self.assertTrue(breakpoint.GetThreadIndex() == lldb.UINT32_MAX, - "The thread index should be invalid") - # The thread name should be invalid, too. - self.assertTrue(breakpoint.GetThreadName() is None, - "The thread name should be invalid") - - # Let's set the thread index for this breakpoint and verify that it is, - # indeed, being set correctly. - # There's only one thread for the process. - breakpoint.SetThreadIndex(1) - self.assertTrue(breakpoint.GetThreadIndex() == 1, - "The thread index has been set correctly") - - # Get the breakpoint location from breakpoint after we verified that, - # indeed, it has one location. - location = breakpoint.GetLocationAtIndex(0) - self.assertTrue(location and - location.IsEnabled(), - VALID_BREAKPOINT_LOCATION) - - # Set the condition on the breakpoint location. - location.SetCondition('val == 3') - self.expect(location.GetCondition(), exe=False, - startstr='val == 3') - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # Frame #0 should be on self.line1 and the break condition should hold. - from lldbsuite.test.lldbutil import get_stopped_thread - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint condition") - frame0 = thread.GetFrameAtIndex(0) - var = frame0.FindValue('val', lldb.eValueTypeVariableArgument) - self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and - var.GetValue() == '3') - - # The hit count for the breakpoint should be 1. - self.assertTrue(breakpoint.GetHitCount() == 1) - - # Test that the condition expression didn't create a result variable: - options = lldb.SBExpressionOptions() - value = frame0.EvaluateExpression("$0", options) - self.assertTrue(value.GetError().Fail(), - "Conditions should not make result variables.") - process.Continue() - - def breakpoint_invalid_conditions_python(self): - """Use Python APIs to set breakpoint conditions.""" - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now create a breakpoint on main.c by name 'c'. - breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print("breakpoint:", breakpoint) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Set the condition on the breakpoint. - breakpoint.SetCondition('no_such_variable == not_this_one_either') - self.expect(breakpoint.GetCondition(), exe=False, - startstr='no_such_variable == not_this_one_either') - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # Frame #0 should be on self.line1 and the break condition should hold. - from lldbsuite.test.lldbutil import get_stopped_thread - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint condition") - frame0 = thread.GetFrameAtIndex(0) - var = frame0.FindValue('val', lldb.eValueTypeVariableArgument) - self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1) - - # The hit count for the breakpoint should be 1. - self.assertTrue(breakpoint.GetHitCount() == 1) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/main.c deleted file mode 100644 index c830b17a3ce..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/main.c +++ /dev/null @@ -1,53 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -// This simple program is to demonstrate the capability of the lldb command -// "breakpoint modify -c 'val == 3' breakpt-id" to break within c(int val) only -// when the value of the arg is 3. - -int a(int); -int b(int); -int c(int); - -int a(int val) -{ - if (val <= 1) - return b(val); - else if (val >= 3) - return c(val); // Find the line number of c's parent call here. - - return val; -} - -int b(int val) -{ - return c(val); -} - -int c(int val) -{ - return val + 3; // Find the line number of function "c" here. -} - -int main (int argc, char const *argv[]) -{ - int A1 = a(1); // a(1) -> b(1) -> c(1) - printf("a(1) returns %d\n", A1); - - int B2 = b(2); // b(2) -> c(2) - printf("b(2) returns %d\n", B2); - - int A3 = a(3); // a(3) -> c(3) - printf("a(3) returns %d\n", A3); - - for (int i = 0; i < 2; ++i) - printf("Loop\n"); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py deleted file mode 100644 index 6f696be8324..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py +++ /dev/null @@ -1,134 +0,0 @@ -""" -Test breakpoint hit count features. -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointHitCountTestCase(TestBase): - - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - def test_breakpoint_location_hit_count(self): - """Use Python APIs to check breakpoint hit count.""" - self.build() - self.do_test_breakpoint_location_hit_count() - - def test_breakpoint_one_shot(self): - """Check that one-shot breakpoints trigger only once.""" - self.build() - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - self.runCmd("tb a") - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - from lldbsuite.test.lldbutil import get_stopped_thread - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint") - - frame0 = thread.GetFrameAtIndex(0) - self.assertTrue(frame0.GetFunctionName() == "a(int)" or frame0.GetFunctionName() == "int a(int)"); - - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateExited) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.a_int_body_line_no = line_number( - 'main.cpp', '// Breakpoint Location 1') - self.a_float_body_line_no = line_number( - 'main.cpp', '// Breakpoint Location 2') - - def do_test_breakpoint_location_hit_count(self): - """Use Python APIs to check breakpoint hit count.""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Create a breakpoint in main.cpp by name 'a', - # there should be two locations. - breakpoint = target.BreakpointCreateByName('a', 'a.out') - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 2, - VALID_BREAKPOINT) - - # Verify all breakpoint locations are enabled. - location1 = breakpoint.GetLocationAtIndex(0) - self.assertTrue(location1 and - location1.IsEnabled(), - VALID_BREAKPOINT_LOCATION) - - location2 = breakpoint.GetLocationAtIndex(1) - self.assertTrue(location2 and - location2.IsEnabled(), - VALID_BREAKPOINT_LOCATION) - - # Launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # Verify 1st breakpoint location is hit. - from lldbsuite.test.lldbutil import get_stopped_thread - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint") - - frame0 = thread.GetFrameAtIndex(0) - location1 = breakpoint.FindLocationByAddress(frame0.GetPC()) - self.assertTrue( - frame0.GetLineEntry().GetLine() == self.a_int_body_line_no, - "Stopped in int a(int)") - self.assertTrue(location1) - self.assertEqual(location1.GetHitCount(), 1) - self.assertEqual(breakpoint.GetHitCount(), 1) - - process.Continue() - - # Verify 2nd breakpoint location is hit. - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint") - - frame0 = thread.GetFrameAtIndex(0) - location2 = breakpoint.FindLocationByAddress(frame0.GetPC()) - self.assertTrue( - frame0.GetLineEntry().GetLine() == self.a_float_body_line_no, - "Stopped in float a(float)") - self.assertTrue(location2) - self.assertEqual(location2.GetHitCount(), 1) - self.assertEqual(location1.GetHitCount(), 1) - self.assertEqual(breakpoint.GetHitCount(), 2) - - process.Continue() - - # Verify 2nd breakpoint location is hit again. - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint") - - self.assertEqual(location2.GetHitCount(), 2) - self.assertEqual(location1.GetHitCount(), 1) - self.assertEqual(breakpoint.GetHitCount(), 3) - - process.Continue() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp deleted file mode 100644 index 9fc133f2400..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int a(int val) -{ - return val; // Breakpoint Location 1 -} - -float a(float val) -{ - return val; // Breakpoint Location 2 -} - -int main (int argc, char const *argv[]) -{ - int A1 = a(1); - float A2 = a(2.0f); - float A3 = a(3.0f); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile deleted file mode 100644 index f89b52a972e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -ifneq (,$(findstring icc,$(CC))) - CXXFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py deleted file mode 100644 index 8386ea17267..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -Test lldb breakpoint ids. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class BreakpointIDTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - self.build() - - exe = self.getBuildArtifact("a.out") - self.expect("file " + exe, - patterns=["Current executable set to .*a.out"]) - - bpno = lldbutil.run_break_set_by_symbol( - self, 'product', num_expected_locations=-1, sym_exact=False) - self.assertTrue(bpno == 1, "First breakpoint number is 1.") - - bpno = lldbutil.run_break_set_by_symbol( - self, 'sum', num_expected_locations=-1, sym_exact=False) - self.assertTrue(bpno == 2, "Second breakpoint number is 2.") - - bpno = lldbutil.run_break_set_by_symbol( - self, 'junk', num_expected_locations=0, sym_exact=False) - self.assertTrue(bpno == 3, "Third breakpoint number is 3.") - - self.expect( - "breakpoint disable 1.1 - 2.2 ", - COMMAND_FAILED_AS_EXPECTED, - error=True, - startstr="error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.") - - self.expect( - "breakpoint disable 2 - 2.2", - COMMAND_FAILED_AS_EXPECTED, - error=True, - startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.") - - self.expect( - "breakpoint disable 2.1 - 2", - COMMAND_FAILED_AS_EXPECTED, - error=True, - startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.") - - self.expect("breakpoint disable 2.1 - 2.2", - startstr="2 breakpoints disabled.") - - self.expect("breakpoint enable 2.*", - patterns=[".* breakpoints enabled."]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/main.cpp deleted file mode 100644 index 3c98e147f22..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/main.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include <cstdlib> -#include <string> -#include <fstream> -#include <iostream> - - -#define INLINE inline __attribute__((always_inline)) - -INLINE int -product (int x, int y) -{ - int result = x * y; - return result; -} - -INLINE int -sum (int a, int b) -{ - int result = a + b; - return result; -} - -int -strange_max (int m, int n) -{ - if (m > n) - return m; - else if (n > m) - return n; - else - return 0; -} - -int -foo (int i, int j) -{ - if (strange_max (i, j) == i) - return product (i, j); - else if (strange_max (i, j) == j) - return sum (i, j); - else - return product (sum (i, i), sum (j, j)); -} - -int -main(int argc, char const *argv[]) -{ - - int array[3]; - - array[0] = foo (1238, 78392); - array[1] = foo (379265, 23674); - array[2] = foo (872934, 234); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py deleted file mode 100644 index 12c8068b419..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py +++ /dev/null @@ -1,151 +0,0 @@ -""" -Test breakpoint ignore count features. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointIgnoreCountTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfWindows # This test will hang on windows llvm.org/pr21753 - def test_with_run_command(self): - """Exercise breakpoint ignore count with 'breakpoint set -i <count>'.""" - self.build() - self.breakpoint_ignore_count() - - @add_test_categories(['pyapi']) - @skipIfWindows # This test will hang on windows llvm.org/pr21753 - def test_with_python_api(self): - """Use Python APIs to set breakpoint ignore count.""" - self.build() - self.breakpoint_ignore_count_python() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to of function 'c'. - self.line1 = line_number( - 'main.c', '// Find the line number of function "c" here.') - self.line2 = line_number( - 'main.c', '// b(2) -> c(2) Find the call site of b(2).') - self.line3 = line_number( - 'main.c', '// a(3) -> c(3) Find the call site of c(3).') - self.line4 = line_number( - 'main.c', '// a(3) -> c(3) Find the call site of a(3).') - self.line5 = line_number( - 'main.c', '// Find the call site of c in main.') - - def breakpoint_ignore_count(self): - """Exercise breakpoint ignore count with 'breakpoint set -i <count>'.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Create a breakpoint in main.c at line1. - lldbutil.run_break_set_by_file_and_line( - self, - 'main.c', - self.line1, - extra_options='-i 1', - num_expected_locations=1, - loc_exact=True) - - # Now run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # The process should be stopped at this point. - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* stopped']) - - # Also check the hit count, which should be 2, due to ignore count of - # 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE, - substrs=["resolved = 1", - "hit count = 2"]) - - # The frame #0 should correspond to main.c:37, the executable statement - # in function name 'c'. And frame #2 should point to main.c:45. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT, - #substrs = ["stop reason = breakpoint"], - patterns=["frame #0.*main.c:%d" % self.line1, - "frame #2.*main.c:%d" % self.line2]) - - # continue -i 1 is the same as setting the ignore count to 1 again, try that: - # Now run the program. - self.runCmd("process continue -i 1", RUN_SUCCEEDED) - - # The process should be stopped at this point. - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* stopped']) - - # Also check the hit count, which should be 2, due to ignore count of - # 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE, - substrs=["resolved = 1", - "hit count = 4"]) - - # The frame #0 should correspond to main.c:37, the executable statement - # in function name 'c'. And frame #2 should point to main.c:45. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT, - #substrs = ["stop reason = breakpoint"], - patterns=["frame #0.*main.c:%d" % self.line1, - "frame #1.*main.c:%d" % self.line5]) - - def breakpoint_ignore_count_python(self): - """Use Python APIs to set breakpoint ignore count.""" - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now create a breakpoint on main.c by name 'c'. - breakpoint = target.BreakpointCreateByName('c', 'a.out') - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Get the breakpoint location from breakpoint after we verified that, - # indeed, it has one location. - location = breakpoint.GetLocationAtIndex(0) - self.assertTrue(location and - location.IsEnabled(), - VALID_BREAKPOINT_LOCATION) - - # Set the ignore count on the breakpoint location. - location.SetIgnoreCount(2) - self.assertTrue(location.GetIgnoreCount() == 2, - "SetIgnoreCount() works correctly") - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and - # frame#2 should be on main.c:48. - # lldbutil.print_stacktraces(process) - from lldbsuite.test.lldbutil import get_stopped_thread - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint") - frame0 = thread.GetFrameAtIndex(0) - frame1 = thread.GetFrameAtIndex(1) - frame2 = thread.GetFrameAtIndex(2) - self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and - frame1.GetLineEntry().GetLine() == self.line3 and - frame2.GetLineEntry().GetLine() == self.line4, - STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT) - - # The hit count for the breakpoint should be 3. - self.assertTrue(breakpoint.GetHitCount() == 3) - - process.Continue() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/main.c deleted file mode 100644 index b1ed4465c1d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/main.c +++ /dev/null @@ -1,53 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -// This simple program is to demonstrate the capability of the lldb command -// "breakpoint modify -i <count> breakpt-id" to set the number of times a -// breakpoint is skipped before stopping. Ignore count can also be set upon -// breakpoint creation by 'breakpoint set ... -i <count>'. - -int a(int); -int b(int); -int c(int); - -int a(int val) -{ - if (val <= 1) - return b(val); - else if (val >= 3) - return c(val); // a(3) -> c(3) Find the call site of c(3). - - return val; -} - -int b(int val) -{ - return c(val); -} - -int c(int val) -{ - return val + 3; // Find the line number of function "c" here. -} - -int main (int argc, char const *argv[]) -{ - int A1 = a(1); // a(1) -> b(1) -> c(1) - printf("a(1) returns %d\n", A1); - - int B2 = b(2); // b(2) -> c(2) Find the call site of b(2). - printf("b(2) returns %d\n", B2); - - int A3 = a(3); // a(3) -> c(3) Find the call site of a(3). - printf("a(3) returns %d\n", A3); - - int C1 = c(5); // Find the call site of c in main. - printf ("c(5) returns %d\n", C1); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile deleted file mode 100644 index 77aa24afc0f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py deleted file mode 100644 index ff087159f61..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -Test specific to MIPS -""" - -from __future__ import print_function - -import re -import unittest2 -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class AvoidBreakpointInDelaySlotAPITestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIf(archs=no_match(re.compile('mips*'))) - def test(self): - self.build() - exe = self.getBuildArtifact("a.out") - self.expect("file " + exe, - patterns=["Current executable set to .*a.out.*"]) - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - breakpoint = target.BreakpointCreateByName('main', 'a.out') - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto) - self.assertTrue(list.GetSize() == 1) - sc = list.GetContextAtIndex(0) - self.assertTrue(sc.GetSymbol().GetName() == "foo") - function = sc.GetFunction() - self.assertTrue(function) - self.function(function, target) - - def function(self, function, target): - """Iterate over instructions in function and place a breakpoint on delay slot instruction""" - # Get the list of all instructions in the function - insts = function.GetInstructions(target) - print(insts) - i = 0 - for inst in insts: - if (inst.HasDelaySlot()): - # Remember the address of branch instruction. - branchinstaddress = inst.GetAddress().GetLoadAddress(target) - - # Get next instruction i.e delay slot instruction. - delayinst = insts.GetInstructionAtIndex(i + 1) - delayinstaddr = delayinst.GetAddress().GetLoadAddress(target) - - # Set breakpoint on delay slot instruction - breakpoint = target.BreakpointCreateByAddress(delayinstaddr) - - # Verify the breakpoint. - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - # Get the location from breakpoint - location = breakpoint.GetLocationAtIndex(0) - - # Get the address where breakpoint is actually set. - bpaddr = location.GetLoadAddress() - - # Breakpoint address should be adjusted to the address of - # branch instruction. - self.assertTrue(branchinstaddress == bpaddr) - i += 1 - else: - i += 1 - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c deleted file mode 100644 index bc3eceea769..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <stdio.h> - -foo (int a, int b) -{ - int c; - if (a<=b) - c=b-a; - else - c=b+a; - return c; -} - -int main() -{ - int a=7, b=8, c; - - c = foo(a, b); - -return 0; -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/Makefile deleted file mode 100644 index 4f6b058fa32..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := a.c -CXX_SOURCES := main.cpp b.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py deleted file mode 100644 index c22d22fe282..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py +++ /dev/null @@ -1,133 +0,0 @@ -""" -Test that the language option for breakpoints works correctly -parser. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class TestBreakpointLanguage(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - - def check_location_file(self, bp, loc, test_name): - bp_loc = bp.GetLocationAtIndex(loc) - addr = bp_loc.GetAddress() - comp_unit = addr.GetCompileUnit() - comp_name = comp_unit.GetFileSpec().GetFilename() - return comp_name == test_name - - def test_regex_breakpoint_language(self): - """Test that the name regex breakpoint commands obey the language filter.""" - - self.build() - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - error = lldb.SBError() - # Don't read in dependencies so we don't come across false matches that - # add unwanted breakpoint hits. - self.target = self.dbg.CreateTarget(exe, None, None, False, error) - self.assertTrue(self.target, VALID_TARGET) - - cpp_bp = self.target.BreakpointCreateByRegex( - "func_from", - lldb.eLanguageTypeC_plus_plus, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - cpp_bp.GetNumLocations() == 1, - "Only one C++ symbol matches") - self.assertTrue(self.check_location_file(cpp_bp, 0, "b.cpp")) - - c_bp = self.target.BreakpointCreateByRegex( - "func_from", - lldb.eLanguageTypeC, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - c_bp.GetNumLocations() == 1, - "Only one C symbol matches") - self.assertTrue(self.check_location_file(c_bp, 0, "a.c")) - - objc_bp = self.target.BreakpointCreateByRegex( - "func_from", - lldb.eLanguageTypeObjC, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - objc_bp.GetNumLocations() == 0, - "No ObjC symbol matches") - - def test_by_name_breakpoint_language(self): - """Test that the name regex breakpoint commands obey the language filter.""" - - self.build() - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - error = lldb.SBError() - # Don't read in dependencies so we don't come across false matches that - # add unwanted breakpoint hits. - self.target = self.dbg.CreateTarget(exe, None, None, False, error) - self.assertTrue(self.target, VALID_TARGET) - - cpp_bp = self.target.BreakpointCreateByName( - "func_from_cpp", - lldb.eFunctionNameTypeAuto, - lldb.eLanguageTypeC_plus_plus, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - cpp_bp.GetNumLocations() == 1, - "Only one C++ symbol matches") - self.assertTrue(self.check_location_file(cpp_bp, 0, "b.cpp")) - - no_cpp_bp = self.target.BreakpointCreateByName( - "func_from_c", - lldb.eFunctionNameTypeAuto, - lldb.eLanguageTypeC_plus_plus, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - no_cpp_bp.GetNumLocations() == 0, - "And the C one doesn't match") - - c_bp = self.target.BreakpointCreateByName( - "func_from_c", - lldb.eFunctionNameTypeAuto, - lldb.eLanguageTypeC, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - c_bp.GetNumLocations() == 1, - "Only one C symbol matches") - self.assertTrue(self.check_location_file(c_bp, 0, "a.c")) - - no_c_bp = self.target.BreakpointCreateByName( - "func_from_cpp", - lldb.eFunctionNameTypeAuto, - lldb.eLanguageTypeC, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - no_c_bp.GetNumLocations() == 0, - "And the C++ one doesn't match") - - objc_bp = self.target.BreakpointCreateByName( - "func_from_cpp", - lldb.eFunctionNameTypeAuto, - lldb.eLanguageTypeObjC, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - objc_bp.GetNumLocations() == 0, - "No ObjC symbol matches") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/a.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/a.c deleted file mode 100644 index b90e2bdcca5..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/a.c +++ /dev/null @@ -1,5 +0,0 @@ -int -func_from_c () -{ - return 5; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/b.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/b.cpp deleted file mode 100644 index 89373445b9a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/b.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int -func_from_cpp() -{ - return 10; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/main.cpp deleted file mode 100644 index b7d00a60202..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include <stdio.h> -extern "C" int func_from_c(); -extern int func_from_cpp(); - -int -main() -{ - func_from_c(); - func_from_cpp(); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile deleted file mode 100644 index 7934cd5db42..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -ifneq (,$(findstring icc,$(CC))) - CFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py deleted file mode 100644 index 052b125143f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py +++ /dev/null @@ -1,198 +0,0 @@ -""" -Test breakpoint commands for a breakpoint ID with multiple locations. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointLocationsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") - def test_enable(self): - """Test breakpoint enable/disable for a breakpoint ID with multiple locations.""" - self.build() - self.breakpoint_locations_test() - - def test_shadowed_cond_options(self): - """Test that options set on the breakpoint and location behave correctly.""" - self.build() - self.shadowed_bkpt_cond_test() - - - def test_shadowed_command_options(self): - """Test that options set on the breakpoint and location behave correctly.""" - self.build() - self.shadowed_bkpt_command_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.c', '// Set break point at this line.') - - def set_breakpoint (self): - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, "Target %s is not valid"%(exe)) - - # This should create a breakpoint with 3 locations. - - bkpt = target.BreakpointCreateByLocation("main.c", self.line) - - # The breakpoint list should show 3 locations. - self.assertEqual(bkpt.GetNumLocations(), 3, "Wrong number of locations") - - self.expect( - "breakpoint list -f", - "Breakpoint locations shown correctly", - substrs=[ - "1: file = 'main.c', line = %d, exact_match = 0, locations = 3" % - self.line], - patterns=[ - "where = a.out`func_inlined .+unresolved, hit count = 0", - "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"]) - - return bkpt - - def shadowed_bkpt_cond_test(self): - """Test that options set on the breakpoint and location behave correctly.""" - # Breakpoint option propagation from bkpt to loc used to be done the first time - # a breakpoint location option was specifically set. After that the other options - # on that location would stop tracking the breakpoint. That got fixed, and this test - # makes sure only the option touched is affected. - - bkpt = self.set_breakpoint() - bkpt_cond = "1 == 0" - bkpt.SetCondition(bkpt_cond) - self.assertEqual(bkpt.GetCondition(), bkpt_cond,"Successfully set condition") - self.assertTrue(bkpt.location[0].GetCondition() == bkpt.GetCondition(), "Conditions are the same") - - # Now set a condition on the locations, make sure that this doesn't effect the bkpt: - bkpt_loc_1_cond = "1 == 1" - bkpt.location[0].SetCondition(bkpt_loc_1_cond) - self.assertEqual(bkpt.location[0].GetCondition(), bkpt_loc_1_cond, "Successfully changed location condition") - self.assertNotEqual(bkpt.GetCondition(), bkpt_loc_1_cond, "Changed location changed Breakpoint condition") - self.assertEqual(bkpt.location[1].GetCondition(), bkpt_cond, "Changed another location's condition") - - # Now make sure that setting one options doesn't fix the value of another: - bkpt.SetIgnoreCount(10) - self.assertEqual(bkpt.GetIgnoreCount(), 10, "Set the ignore count successfully") - self.assertEqual(bkpt.location[0].GetIgnoreCount(), 10, "Location doesn't track top-level bkpt.") - - # Now make sure resetting the condition to "" resets the tracking: - bkpt.location[0].SetCondition("") - bkpt_new_cond = "1 == 3" - bkpt.SetCondition(bkpt_new_cond) - self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, "Didn't go back to tracking condition") - - def shadowed_bkpt_command_test(self): - """Test that options set on the breakpoint and location behave correctly.""" - # Breakpoint option propagation from bkpt to loc used to be done the first time - # a breakpoint location option was specifically set. After that the other options - # on that location would stop tracking the breakpoint. That got fixed, and this test - # makes sure only the option touched is affected. - - bkpt = self.set_breakpoint() - commands = ["AAAAAA", "BBBBBB", "CCCCCC"] - str_list = lldb.SBStringList() - str_list.AppendList(commands, len(commands)) - - bkpt.SetCommandLineCommands(str_list) - cmd_list = lldb.SBStringList() - bkpt.GetCommandLineCommands(cmd_list) - list_size = str_list.GetSize() - self.assertEqual(cmd_list.GetSize() , list_size, "Added the right number of commands") - for i in range(0,list_size): - self.assertEqual(str_list.GetStringAtIndex(i), cmd_list.GetStringAtIndex(i), "Mismatched commands.") - - commands = ["DDDDDD", "EEEEEE", "FFFFFF", "GGGGGG"] - loc_list = lldb.SBStringList() - loc_list.AppendList(commands, len(commands)) - bkpt.location[1].SetCommandLineCommands(loc_list) - loc_cmd_list = lldb.SBStringList() - bkpt.location[1].GetCommandLineCommands(loc_cmd_list) - - loc_list_size = loc_list.GetSize() - - # Check that the location has the right commands: - self.assertEqual(loc_cmd_list.GetSize() , loc_list_size, "Added the right number of commands to location") - for i in range(0,loc_list_size): - self.assertEqual(loc_list.GetStringAtIndex(i), loc_cmd_list.GetStringAtIndex(i), "Mismatched commands.") - - # Check that we didn't mess up the breakpoint level commands: - self.assertEqual(cmd_list.GetSize() , list_size, "Added the right number of commands") - for i in range(0,list_size): - self.assertEqual(str_list.GetStringAtIndex(i), cmd_list.GetStringAtIndex(i), "Mismatched commands.") - - # And check we didn't mess up another location: - untouched_loc_cmds = lldb.SBStringList() - bkpt.location[0].GetCommandLineCommands(untouched_loc_cmds) - self.assertEqual(untouched_loc_cmds.GetSize() , 0, "Changed the wrong location") - - def breakpoint_locations_test(self): - """Test breakpoint enable/disable for a breakpoint ID with multiple locations.""" - self.set_breakpoint() - - # The 'breakpoint disable 3.*' command should fail gracefully. - self.expect("breakpoint disable 3.*", - "Disabling an invalid breakpoint should fail gracefully", - error=True, - startstr="error: '3' is not a valid breakpoint ID.") - - # The 'breakpoint disable 1.*' command should disable all 3 locations. - self.expect( - "breakpoint disable 1.*", - "All 3 breakpoint locatons disabled correctly", - startstr="3 breakpoints disabled.") - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # We should not stopped on any breakpoint at all. - self.expect("process status", "No stopping on any disabled breakpoint", - patterns=["^Process [0-9]+ exited with status = 0"]) - - # The 'breakpoint enable 1.*' command should enable all 3 breakpoints. - self.expect( - "breakpoint enable 1.*", - "All 3 breakpoint locatons enabled correctly", - startstr="3 breakpoints enabled.") - - # The 'breakpoint disable 1.1' command should disable 1 location. - self.expect( - "breakpoint disable 1.1", - "1 breakpoint locatons disabled correctly", - startstr="1 breakpoints disabled.") - - # Run the program again. We should stop on the two breakpoint - # locations. - self.runCmd("run", RUN_SUCCEEDED) - - # Stopped once. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - # Continue the program, there should be another stop. - self.runCmd("process continue") - - # Stopped again. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - # At this point, 1.1 has a hit count of 0 and the other a hit count of - # 1". - self.expect( - "breakpoint list -f", - "The breakpoints should report correct hit counts", - patterns=[ - "1\.1: .+ unresolved, hit count = 0 +Options: disabled", - "1\.2: .+ resolved, hit count = 1", - "1\.3: .+ resolved, hit count = 1"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/main.c deleted file mode 100644 index 7ec3ded67b7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/main.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <stdio.h> - -#define INLINE inline __attribute__((always_inline)) - -int -func_not_inlined (void) -{ - printf ("Called func_not_inlined.\n"); - return 0; -} - -INLINE int -func_inlined (void) -{ - static int func_inline_call_count = 0; - printf ("Called func_inlined.\n"); - ++func_inline_call_count; - printf ("Returning func_inlined call count: %d.\n", func_inline_call_count); - return func_inline_call_count; // Set break point at this line. -} - -extern int func_inlined (void); - -int -main (int argc, char **argv) -{ - printf ("Starting...\n"); - - int (*func_ptr) (void); - func_ptr = func_inlined; - - int a = func_inlined(); - printf("First call to func_inlined() returns: %d.\n", a); - - func_not_inlined (); - - func_ptr (); - - printf("Last call to func_inlined() returns: %d.\n", func_inlined ()); - return 0; -} - - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py deleted file mode 100644 index 4a5ed87e330..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py +++ /dev/null @@ -1,365 +0,0 @@ -""" -Test breakpoint names. -""" - -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 BreakpointNames(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @add_test_categories(['pyapi']) - def test_setting_names(self): - """Use Python APIs to test that we can set breakpoint names.""" - self.build() - self.setup_target() - self.do_check_names() - - def test_illegal_names(self): - """Use Python APIs to test that we don't allow illegal names.""" - self.build() - self.setup_target() - self.do_check_illegal_names() - - def test_using_names(self): - """Use Python APIs to test that operations on names works correctly.""" - self.build() - self.setup_target() - self.do_check_using_names() - - def test_configuring_names(self): - """Use Python APIs to test that configuring options on breakpoint names works correctly.""" - self.build() - self.make_a_dummy_name() - self.setup_target() - self.do_check_configuring_names() - - def test_configuring_permissions_sb(self): - """Use Python APIs to test that configuring permissions on names works correctly.""" - self.build() - self.setup_target() - self.do_check_configuring_permissions_sb() - - def test_configuring_permissions_cli(self): - """Use Python APIs to test that configuring permissions on names works correctly.""" - self.build() - self.setup_target() - self.do_check_configuring_permissions_cli() - - def setup_target(self): - exe = self.getBuildArtifact("a.out") - - # Create a targets we are making breakpoint in and copying to: - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - self.main_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "main.c")) - - def check_name_in_target(self, bkpt_name): - name_list = lldb.SBStringList() - self.target.GetBreakpointNames(name_list) - found_it = False - for name in name_list: - if name == bkpt_name: - found_it = True - break - self.assertTrue(found_it, "Didn't find the name %s in the target's name list:"%(bkpt_name)) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - # These are the settings we're going to be putting into names & breakpoints: - self.bp_name_string = "ABreakpoint" - self.is_one_shot = True - self.ignore_count = 1000 - self.condition = "1 == 2" - self.auto_continue = True - self.tid = 0xaaaa - self.tidx = 10 - self.thread_name = "Fooey" - self.queue_name = "Blooey" - self.cmd_list = lldb.SBStringList() - self.cmd_list.AppendString("frame var") - self.cmd_list.AppendString("bt") - self.help_string = "I do something interesting" - - - def do_check_names(self): - """Use Python APIs to check that we can set & retrieve breakpoint names""" - bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10) - bkpt_name = "ABreakpoint" - other_bkpt_name = "_AnotherBreakpoint" - - # Add a name and make sure we match it: - success = bkpt.AddName(bkpt_name) - self.assertTrue(success, "We couldn't add a legal name to a breakpoint.") - - matches = bkpt.MatchesName(bkpt_name) - self.assertTrue(matches, "We didn't match the name we just set") - - # Make sure we don't match irrelevant names: - matches = bkpt.MatchesName("NotABreakpoint") - self.assertTrue(not matches, "We matched a name we didn't set.") - - # Make sure the name is also in the target: - self.check_name_in_target(bkpt_name) - - # Add another name, make sure that works too: - bkpt.AddName(other_bkpt_name) - - matches = bkpt.MatchesName(bkpt_name) - self.assertTrue(matches, "Adding a name means we didn't match the name we just set") - self.check_name_in_target(other_bkpt_name) - - # Remove the name and make sure we no longer match it: - bkpt.RemoveName(bkpt_name) - matches = bkpt.MatchesName(bkpt_name) - self.assertTrue(not matches,"We still match a name after removing it.") - - # Make sure the name list has the remaining name: - name_list = lldb.SBStringList() - bkpt.GetNames(name_list) - num_names = name_list.GetSize() - self.assertTrue(num_names == 1, "Name list has %d items, expected 1."%(num_names)) - - name = name_list.GetStringAtIndex(0) - self.assertTrue(name == other_bkpt_name, "Remaining name was: %s expected %s."%(name, other_bkpt_name)) - - def do_check_illegal_names(self): - """Use Python APIs to check that we reject illegal names.""" - bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10) - bad_names = ["-CantStartWithADash", - "1CantStartWithANumber", - "^CantStartWithNonAlpha", - "CantHave-ADash", - "Cant Have Spaces"] - for bad_name in bad_names: - success = bkpt.AddName(bad_name) - self.assertTrue(not success,"We allowed an illegal name: %s"%(bad_name)) - bp_name = lldb.SBBreakpointName(self.target, bad_name) - self.assertFalse(bp_name.IsValid(), "We made a breakpoint name with an illegal name: %s"%(bad_name)); - - retval =lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand("break set -n whatever -N '%s'"%(bad_name), retval) - self.assertTrue(not retval.Succeeded(), "break set succeeded with: illegal name: %s"%(bad_name)) - - def do_check_using_names(self): - """Use Python APIs to check names work in place of breakpoint ID's.""" - - bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10) - bkpt_name = "ABreakpoint" - other_bkpt_name= "_AnotherBreakpoint" - - # Add a name and make sure we match it: - success = bkpt.AddName(bkpt_name) - self.assertTrue(success, "We couldn't add a legal name to a breakpoint.") - - bkpts = lldb.SBBreakpointList(self.target) - self.target.FindBreakpointsByName(bkpt_name, bkpts) - - self.assertTrue(bkpts.GetSize() == 1, "One breakpoint matched.") - found_bkpt = bkpts.GetBreakpointAtIndex(0) - self.assertTrue(bkpt.GetID() == found_bkpt.GetID(),"The right breakpoint.") - - retval = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand("break disable %s"%(bkpt_name), retval) - self.assertTrue(retval.Succeeded(), "break disable failed with: %s."%(retval.GetError())) - self.assertTrue(not bkpt.IsEnabled(), "We didn't disable the breakpoint.") - - # Also make sure we don't apply commands to non-matching names: - self.dbg.GetCommandInterpreter().HandleCommand("break modify --one-shot 1 %s"%(other_bkpt_name), retval) - self.assertTrue(retval.Succeeded(), "break modify failed with: %s."%(retval.GetError())) - self.assertTrue(not bkpt.IsOneShot(), "We applied one-shot to the wrong breakpoint.") - - def check_option_values(self, bp_object): - self.assertEqual(bp_object.IsOneShot(), self.is_one_shot, "IsOneShot") - self.assertEqual(bp_object.GetIgnoreCount(), self.ignore_count, "IgnoreCount") - self.assertEqual(bp_object.GetCondition(), self.condition, "Condition") - self.assertEqual(bp_object.GetAutoContinue(), self.auto_continue, "AutoContinue") - self.assertEqual(bp_object.GetThreadID(), self.tid, "Thread ID") - self.assertEqual(bp_object.GetThreadIndex(), self.tidx, "Thread Index") - self.assertEqual(bp_object.GetThreadName(), self.thread_name, "Thread Name") - self.assertEqual(bp_object.GetQueueName(), self.queue_name, "Queue Name") - set_cmds = lldb.SBStringList() - bp_object.GetCommandLineCommands(set_cmds) - self.assertEqual(set_cmds.GetSize(), self.cmd_list.GetSize(), "Size of command line commands") - for idx in range(0, set_cmds.GetSize()): - self.assertEqual(self.cmd_list.GetStringAtIndex(idx), set_cmds.GetStringAtIndex(idx), "Command %d"%(idx)) - - def make_a_dummy_name(self): - "This makes a breakpoint name in the dummy target to make sure it gets copied over" - - dummy_target = self.dbg.GetDummyTarget() - self.assertTrue(dummy_target.IsValid(), "Dummy target was not valid.") - - def cleanup (): - self.dbg.GetDummyTarget().DeleteBreakpointName(self.bp_name_string) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Now find it in the dummy target, and make sure these settings took: - bp_name = lldb.SBBreakpointName(dummy_target, self.bp_name_string) - # Make sure the name is right: - self.assertTrue (bp_name.GetName() == self.bp_name_string, "Wrong bp_name: %s"%(bp_name.GetName())) - bp_name.SetOneShot(self.is_one_shot) - bp_name.SetIgnoreCount(self.ignore_count) - bp_name.SetCondition(self.condition) - bp_name.SetAutoContinue(self.auto_continue) - bp_name.SetThreadID(self.tid) - bp_name.SetThreadIndex(self.tidx) - bp_name.SetThreadName(self.thread_name) - bp_name.SetQueueName(self.queue_name) - bp_name.SetCommandLineCommands(self.cmd_list) - - # Now look it up again, and make sure it got set correctly. - bp_name = lldb.SBBreakpointName(dummy_target, self.bp_name_string) - self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name.") - self.check_option_values(bp_name) - - def do_check_configuring_names(self): - """Use Python APIs to check that configuring breakpoint names works correctly.""" - other_bp_name_string = "AnotherBreakpointName" - cl_bp_name_string = "CLBreakpointName" - - # Now find the version copied in from the dummy target, and make sure these settings took: - bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string) - self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name.") - self.check_option_values(bp_name) - - # Now add this name to a breakpoint, and make sure it gets configured properly - bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10) - success = bkpt.AddName(self.bp_name_string) - self.assertTrue(success, "Couldn't add this name to the breakpoint") - self.check_option_values(bkpt) - - # Now make a name from this breakpoint, and make sure the new name is properly configured: - new_name = lldb.SBBreakpointName(bkpt, other_bp_name_string) - self.assertTrue(new_name.IsValid(), "Couldn't make a valid bp_name from a breakpoint.") - self.check_option_values(bkpt) - - # Now change the name's option and make sure it gets propagated to - # the breakpoint: - new_auto_continue = not self.auto_continue - bp_name.SetAutoContinue(new_auto_continue) - self.assertEqual(bp_name.GetAutoContinue(), new_auto_continue, "Couldn't change auto-continue on the name") - self.assertEqual(bkpt.GetAutoContinue(), new_auto_continue, "Option didn't propagate to the breakpoint.") - - # Now make this same breakpoint name - but from the command line - cmd_str = "breakpoint name configure %s -o %d -i %d -c '%s' -G %d -t %d -x %d -T '%s' -q '%s' -H '%s'"%(cl_bp_name_string, - self.is_one_shot, - self.ignore_count, - self.condition, - self.auto_continue, - self.tid, - self.tidx, - self.thread_name, - self.queue_name, - self.help_string) - for cmd in self.cmd_list: - cmd_str += " -C '%s'"%(cmd) - - self.runCmd(cmd_str, check=True) - # Now look up this name again and check its options: - cl_name = lldb.SBBreakpointName(self.target, cl_bp_name_string) - self.check_option_values(cl_name) - # Also check the help string: - self.assertEqual(self.help_string, cl_name.GetHelpString(), "Help string didn't match") - # Change the name and make sure that works: - new_help = "I do something even more interesting" - cl_name.SetHelpString(new_help) - self.assertEqual(new_help, cl_name.GetHelpString(), "SetHelpString didn't") - - # We should have three names now, make sure the target can list them: - name_list = lldb.SBStringList() - self.target.GetBreakpointNames(name_list) - for name_string in [self.bp_name_string, other_bp_name_string, cl_bp_name_string]: - self.assertTrue(name_string in name_list, "Didn't find %s in names"%(name_string)) - - # Delete the name from the current target. Make sure that works and deletes the - # name from the breakpoint as well: - self.target.DeleteBreakpointName(self.bp_name_string) - name_list.Clear() - self.target.GetBreakpointNames(name_list) - self.assertTrue(self.bp_name_string not in name_list, "Didn't delete %s from a real target"%(self.bp_name_string)) - # Also make sure the name got removed from breakpoints holding it: - self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoint.") - - # Test that deleting the name we injected into the dummy target works (there's also a - # cleanup that will do this, but that won't test the result... - dummy_target = self.dbg.GetDummyTarget() - dummy_target.DeleteBreakpointName(self.bp_name_string) - name_list.Clear() - dummy_target.GetBreakpointNames(name_list) - self.assertTrue(self.bp_name_string not in name_list, "Didn't delete %s from the dummy target"%(self.bp_name_string)) - # Also make sure the name got removed from breakpoints holding it: - self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoint.") - - def check_permission_results(self, bp_name): - self.assertEqual(bp_name.GetAllowDelete(), False, "Didn't set allow delete.") - protected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10) - protected_id = protected_bkpt.GetID() - - unprotected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10) - unprotected_id = unprotected_bkpt.GetID() - - success = protected_bkpt.AddName(self.bp_name_string) - self.assertTrue(success, "Couldn't add this name to the breakpoint") - - self.target.DisableAllBreakpoints() - self.assertEqual(protected_bkpt.IsEnabled(), True, "Didnt' keep breakpoint from being disabled") - self.assertEqual(unprotected_bkpt.IsEnabled(), False, "Protected too many breakpoints from disabling.") - - # Try from the command line too: - unprotected_bkpt.SetEnabled(True) - result = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand("break disable", result) - self.assertTrue(result.Succeeded()) - self.assertEqual(protected_bkpt.IsEnabled(), True, "Didnt' keep breakpoint from being disabled") - self.assertEqual(unprotected_bkpt.IsEnabled(), False, "Protected too many breakpoints from disabling.") - - self.target.DeleteAllBreakpoints() - bkpt = self.target.FindBreakpointByID(protected_id) - self.assertTrue(bkpt.IsValid(), "Didn't keep the breakpoint from being deleted.") - bkpt = self.target.FindBreakpointByID(unprotected_id) - self.assertFalse(bkpt.IsValid(), "Protected too many breakpoints from deletion.") - - # Remake the unprotected breakpoint and try again from the command line: - unprotected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10) - unprotected_id = unprotected_bkpt.GetID() - - self.dbg.GetCommandInterpreter().HandleCommand("break delete -f", result) - self.assertTrue(result.Succeeded()) - bkpt = self.target.FindBreakpointByID(protected_id) - self.assertTrue(bkpt.IsValid(), "Didn't keep the breakpoint from being deleted.") - bkpt = self.target.FindBreakpointByID(unprotected_id) - self.assertFalse(bkpt.IsValid(), "Protected too many breakpoints from deletion.") - - def do_check_configuring_permissions_sb(self): - bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string) - - # Make a breakpoint name with delete disallowed: - bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string) - self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name for valid name.") - - bp_name.SetAllowDelete(False) - bp_name.SetAllowDisable(False) - bp_name.SetAllowList(False) - self.check_permission_results(bp_name) - - def do_check_configuring_permissions_cli(self): - # Make the name with the right options using the command line: - self.runCmd("breakpoint name configure -L 0 -D 0 -A 0 %s"%(self.bp_name_string), check=True) - # Now look up the breakpoint we made, and check that it works. - bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string) - self.assertTrue(bp_name.IsValid(), "Didn't make a breakpoint name we could find.") - self.check_permission_results(bp_name) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c deleted file mode 100644 index b1ed4465c1d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c +++ /dev/null @@ -1,53 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -// This simple program is to demonstrate the capability of the lldb command -// "breakpoint modify -i <count> breakpt-id" to set the number of times a -// breakpoint is skipped before stopping. Ignore count can also be set upon -// breakpoint creation by 'breakpoint set ... -i <count>'. - -int a(int); -int b(int); -int c(int); - -int a(int val) -{ - if (val <= 1) - return b(val); - else if (val >= 3) - return c(val); // a(3) -> c(3) Find the call site of c(3). - - return val; -} - -int b(int val) -{ - return c(val); -} - -int c(int val) -{ - return val + 3; // Find the line number of function "c" here. -} - -int main (int argc, char const *argv[]) -{ - int A1 = a(1); // a(1) -> b(1) -> c(1) - printf("a(1) returns %d\n", A1); - - int B2 = b(2); // b(2) -> c(2) Find the call site of b(2). - printf("b(2) returns %d\n", B2); - - int A3 = a(3); // a(3) -> c(3) Find the call site of a(3). - printf("a(3) returns %d\n", A3); - - int C1 = c(5); // Find the call site of c in main. - printf ("c(5) returns %d\n", C1); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/Makefile deleted file mode 100644 index 457c4972f2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp foo.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py deleted file mode 100644 index 66ec1161d77..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -Test breakpoint command for different options. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class BreakpointOptionsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - """Test breakpoint command for different options.""" - self.build() - self.breakpoint_options_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.cpp', '// Set break point at this line.') - - def breakpoint_options_test(self): - """Test breakpoint command for different options.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint with 1 locations. - lldbutil.run_break_set_by_file_and_line( - self, - "main.cpp", - self.line, - extra_options="-K 1", - num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line( - self, - "main.cpp", - self.line, - extra_options="-K 0", - num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Stopped once. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 2."]) - - # Check the list of breakpoint. - self.expect( - "breakpoint list -f", - "Breakpoint locations shown correctly", - substrs=[ - "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]) - - # Continue the program, there should be another stop. - self.runCmd("process continue") - - # Stopped again. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - # Continue the program, we should exit. - self.runCmd("process continue") - - # We should exit. - self.expect("process status", "Process exited successfully", - patterns=["^Process [0-9]+ exited with status = 0"]) - - def breakpoint_options_language_test(self): - """Test breakpoint command for language option.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint with 1 locations. - lldbutil.run_break_set_by_symbol( - self, - 'ns::func', - sym_exact=False, - extra_options="-L c++", - num_expected_locations=1) - - # This should create a breakpoint with 0 locations. - lldbutil.run_break_set_by_symbol( - self, - 'ns::func', - sym_exact=False, - extra_options="-L c", - num_expected_locations=0) - self.runCmd("settings set target.language c") - lldbutil.run_break_set_by_symbol( - self, 'ns::func', sym_exact=False, num_expected_locations=0) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Stopped once. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - # Continue the program, we should exit. - self.runCmd("process continue") - - # We should exit. - self.expect("process status", "Process exited successfully", - patterns=["^Process [0-9]+ exited with status = 0"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/foo.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/foo.cpp deleted file mode 100644 index e5d0e09803e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/foo.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -namespace ns { - int func(void) - { - return 0; - } -} - -extern "C" int foo(void) -{ - return ns::func(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp deleted file mode 100644 index b2e8f523c84..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp +++ /dev/null @@ -1,4 +0,0 @@ -extern "C" int foo(void); -int main (int argc, char **argv) { // Set break point at this line. - return foo(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py deleted file mode 100644 index 40a20a04b76..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -Test inferior restart when breakpoint is set on running target. -""" - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * - - -class BreakpointSetRestart(TestBase): - - mydir = TestBase.compute_mydir(__file__) - BREAKPOINT_TEXT = 'Set a breakpoint here' - - @skipIfNetBSD - def test_breakpoint_set_restart(self): - self.build() - - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - self.dbg.SetAsync(True) - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - event = lldb.SBEvent() - # Wait for inferior to transition to running state - while self.dbg.GetListener().WaitForEvent(2, event): - if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning: - break - - bp = target.BreakpointCreateBySourceRegex( - self.BREAKPOINT_TEXT, lldb.SBFileSpec('main.cpp')) - self.assertTrue( - bp.IsValid() and bp.GetNumLocations() == 1, - VALID_BREAKPOINT) - - while self.dbg.GetListener().WaitForEvent(2, event): - if lldb.SBProcess.GetStateFromEvent( - event) == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event): - continue - if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning: - continue - self.fail( - "Setting a breakpoint generated an unexpected event: %s" % - lldb.SBDebugger.StateAsCString( - lldb.SBProcess.GetStateFromEvent(event))) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp deleted file mode 100644 index 46682ec264d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <stdio.h> -#include <thread> - - -int main(int argc, char const *argv[]) -{ - static bool done = false; - while (!done) - { - std::this_thread::sleep_for(std::chrono::milliseconds{100}); - } - printf("Set a breakpoint here.\n"); - return 0; -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile deleted file mode 100644 index 2d7f20f43fe..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := relative.cpp - -EXE := CompDirSymLink - -include $(LEVEL)/Makefile.rules - -# Force relative filenames by copying it into the build directory. -relative.cpp: main.cpp - cp -f $< $@ - -clean:: - rm -rf relative.cpp diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py deleted file mode 100644 index 5b2c35fe5f7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py +++ /dev/null @@ -1,79 +0,0 @@ -""" -Test breakpoint command with AT_comp_dir set to symbolic link. -""" -from __future__ import print_function - - -import os -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -_EXE_NAME = 'CompDirSymLink' # Must match Makefile -_SRC_FILE = 'relative.cpp' -_COMP_DIR_SYM_LINK_PROP = 'plugin.symbol-file.dwarf.comp-dir-symlink-paths' - - -class CompDirSymLinkTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number( - os.path.join(self.getSourceDir(), "main.cpp"), - '// Set break point at this line.') - - @skipIf(hostoslist=["windows"]) - def test_symlink_paths_set(self): - pwd_symlink = self.create_src_symlink() - self.doBuild(pwd_symlink) - self.runCmd( - "settings set %s %s" % - (_COMP_DIR_SYM_LINK_PROP, pwd_symlink)) - src_path = self.getBuildArtifact(_SRC_FILE) - lldbutil.run_break_set_by_file_and_line(self, src_path, self.line) - - @skipIf(hostoslist=no_match(["linux"])) - def test_symlink_paths_set_procselfcwd(self): - os.chdir(self.getBuildDir()) - pwd_symlink = '/proc/self/cwd' - self.doBuild(pwd_symlink) - self.runCmd( - "settings set %s %s" % - (_COMP_DIR_SYM_LINK_PROP, pwd_symlink)) - src_path = self.getBuildArtifact(_SRC_FILE) - # /proc/self/cwd points to a realpath form of current directory. - src_path = os.path.realpath(src_path) - lldbutil.run_break_set_by_file_and_line(self, src_path, self.line) - - @skipIf(hostoslist=["windows"]) - def test_symlink_paths_unset(self): - pwd_symlink = self.create_src_symlink() - self.doBuild(pwd_symlink) - self.runCmd('settings clear ' + _COMP_DIR_SYM_LINK_PROP) - src_path = self.getBuildArtifact(_SRC_FILE) - self.assertRaises( - AssertionError, - lldbutil.run_break_set_by_file_and_line, - self, - src_path, - self.line) - - def create_src_symlink(self): - pwd_symlink = self.getBuildArtifact('pwd_symlink') - if os.path.exists(pwd_symlink): - os.unlink(pwd_symlink) - os.symlink(self.getBuildDir(), pwd_symlink) - self.addTearDownHook(lambda: os.remove(pwd_symlink)) - return pwd_symlink - - def doBuild(self, pwd_symlink): - self.build(None, None, {'PWD': pwd_symlink}) - - exe = self.getBuildArtifact(_EXE_NAME) - self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/main.cpp deleted file mode 100644 index 13e5e3e891f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int main (int argc, char const *argv[]) -{ - return 0; // Set break point at this line. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile deleted file mode 100644 index f89b52a972e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -ifneq (,$(findstring icc,$(CC))) - CXXFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py deleted file mode 100644 index 6afde150d8d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -Test that we handle breakpoints on consecutive instructions correctly. -""" - -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 ConsecutiveBreakpointsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def prepare_test(self): - self.build() - - (self.target, self.process, self.thread, bkpt) = lldbutil.run_to_source_breakpoint( - self, "Set breakpoint here", lldb.SBFileSpec("main.cpp")) - - # Set breakpoint to the next instruction - frame = self.thread.GetFrameAtIndex(0) - - address = frame.GetPCAddress() - instructions = self.target.ReadInstructions(address, 2) - self.assertTrue(len(instructions) == 2) - self.bkpt_address = instructions[1].GetAddress() - self.breakpoint2 = self.target.BreakpointCreateByAddress( - self.bkpt_address.GetLoadAddress(self.target)) - self.assertTrue( - self.breakpoint2 and self.breakpoint2.GetNumLocations() == 1, - VALID_BREAKPOINT) - - def finish_test(self): - # Run the process until termination - self.process.Continue() - self.assertEquals(self.process.GetState(), lldb.eStateExited) - - @no_debug_info_test - def test_continue(self): - """Test that continue stops at the second breakpoint.""" - self.prepare_test() - - self.process.Continue() - self.assertEquals(self.process.GetState(), lldb.eStateStopped) - # We should be stopped at the second breakpoint - self.thread = lldbutil.get_one_thread_stopped_at_breakpoint( - self.process, self.breakpoint2) - self.assertIsNotNone( - self.thread, - "Expected one thread to be stopped at breakpoint 2") - - self.finish_test() - - @no_debug_info_test - def test_single_step(self): - """Test that single step stops at the second breakpoint.""" - self.prepare_test() - - step_over = False - self.thread.StepInstruction(step_over) - - self.assertEquals(self.process.GetState(), lldb.eStateStopped) - self.assertEquals( - self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress( - self.target), self.bkpt_address.GetLoadAddress( - self.target)) - self.thread = lldbutil.get_one_thread_stopped_at_breakpoint( - self.process, self.breakpoint2) - self.assertIsNotNone( - self.thread, - "Expected one thread to be stopped at breakpoint 2") - - self.finish_test() - - @no_debug_info_test - def test_single_step_thread_specific(self): - """Test that single step stops, even though the second breakpoint is not valid.""" - self.prepare_test() - - # Choose a thread other than the current one. A non-existing thread is - # fine. - thread_index = self.process.GetNumThreads() + 1 - self.assertFalse(self.process.GetThreadAtIndex(thread_index).IsValid()) - self.breakpoint2.SetThreadIndex(thread_index) - - step_over = False - self.thread.StepInstruction(step_over) - - self.assertEquals(self.process.GetState(), lldb.eStateStopped) - self.assertEquals( - self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress( - self.target), self.bkpt_address.GetLoadAddress( - self.target)) - self.assertEquals( - self.thread.GetStopReason(), - lldb.eStopReasonPlanComplete, - "Stop reason should be 'plan complete'") - - self.finish_test() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/main.cpp deleted file mode 100644 index 94d0a0415d7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/main.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int -main(int argc, char const *argv[]) -{ - int a = 0; - int b = 1; - a = b + 1; // Set breakpoint here - b = a + 1; - return 0; -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile deleted file mode 100644 index f89b52a972e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -ifneq (,$(findstring icc,$(CC))) - CXXFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py deleted file mode 100644 index be21c6eea13..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py +++ /dev/null @@ -1,112 +0,0 @@ -""" -Test lldb breakpoint ids. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestCPPBreakpointLocations(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764") - def test(self): - self.build() - self.breakpoint_id_tests() - - def verify_breakpoint_locations(self, target, bp_dict): - - name = bp_dict['name'] - names = bp_dict['loc_names'] - bp = target.BreakpointCreateByName(name) - self.assertEquals( - bp.GetNumLocations(), - len(names), - "Make sure we find the right number of breakpoint locations") - - bp_loc_names = list() - for bp_loc in bp: - bp_loc_names.append(bp_loc.GetAddress().GetFunction().GetName()) - - for name in names: - found = name in bp_loc_names - if not found: - print("Didn't find '%s' in: %s" % (name, bp_loc_names)) - self.assertTrue(found, "Make sure we find all required locations") - - def breakpoint_id_tests(self): - - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - bp_dicts = [ - {'name': 'func1', 'loc_names': ['a::c::func1()', 'b::c::func1()']}, - {'name': 'func2', 'loc_names': ['a::c::func2()', 'c::d::func2()']}, - {'name': 'func3', 'loc_names': ['a::c::func3()', 'b::c::func3()', 'c::d::func3()']}, - {'name': 'c::func1', 'loc_names': ['a::c::func1()', 'b::c::func1()']}, - {'name': 'c::func2', 'loc_names': ['a::c::func2()']}, - {'name': 'c::func3', 'loc_names': ['a::c::func3()', 'b::c::func3()']}, - {'name': 'a::c::func1', 'loc_names': ['a::c::func1()']}, - {'name': 'b::c::func1', 'loc_names': ['b::c::func1()']}, - {'name': 'c::d::func2', 'loc_names': ['c::d::func2()']}, - {'name': 'a::c::func1()', 'loc_names': ['a::c::func1()']}, - {'name': 'b::c::func1()', 'loc_names': ['b::c::func1()']}, - {'name': 'c::d::func2()', 'loc_names': ['c::d::func2()']}, - ] - - for bp_dict in bp_dicts: - self.verify_breakpoint_locations(target, bp_dict) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764") - def test_destructors(self): - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - - # Don't skip prologue, so we can check the breakpoint address more - # easily - self.runCmd("settings set target.skip-prologue false") - try: - names = ['~c', 'c::~c', 'c::~c()'] - loc_names = {'a::c::~c()', 'b::c::~c()'} - # TODO: For windows targets we should put windows mangled names - # here - symbols = [ - '_ZN1a1cD1Ev', - '_ZN1a1cD2Ev', - '_ZN1b1cD1Ev', - '_ZN1b1cD2Ev'] - - for name in names: - bp = target.BreakpointCreateByName(name) - - bp_loc_names = {bp_loc.GetAddress().GetFunction().GetName() - for bp_loc in bp} - self.assertEquals( - bp_loc_names, - loc_names, - "Breakpoint set on the correct symbol") - - bp_addresses = {bp_loc.GetLoadAddress() for bp_loc in bp} - symbol_addresses = set() - for symbol in symbols: - sc_list = target.FindSymbols(symbol, lldb.eSymbolTypeCode) - self.assertEquals( - sc_list.GetSize(), 1, "Found symbol " + symbol) - symbol = sc_list.GetContextAtIndex(0).GetSymbol() - symbol_addresses.add( - symbol.GetStartAddress().GetLoadAddress(target)) - - self.assertEquals( - symbol_addresses, - bp_addresses, - "Breakpoint set on correct address") - finally: - self.runCmd("settings clear target.skip-prologue") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/main.cpp deleted file mode 100644 index 4afabcbd36e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/main.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -namespace a { - class c { - public: - c(); - ~c(); - void func1() - { - puts (__PRETTY_FUNCTION__); - } - void func2() - { - puts (__PRETTY_FUNCTION__); - } - void func3() - { - puts (__PRETTY_FUNCTION__); - } - }; - - c::c() {} - c::~c() {} -} - -namespace b { - class c { - public: - c(); - ~c(); - void func1() - { - puts (__PRETTY_FUNCTION__); - } - void func3() - { - puts (__PRETTY_FUNCTION__); - } - }; - - c::c() {} - c::~c() {} -} - -namespace c { - class d { - public: - d () {} - ~d() {} - void func2() - { - puts (__PRETTY_FUNCTION__); - } - void func3() - { - puts (__PRETTY_FUNCTION__); - } - }; -} - -int main (int argc, char const *argv[]) -{ - a::c ac; - b::c bc; - c::d cd; - ac.func1(); - ac.func2(); - ac.func3(); - bc.func1(); - bc.func3(); - cd.func2(); - cd.func3(); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py deleted file mode 100644 index e8a1b81a839..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Test that you can set breakpoint and hit the C++ language exception breakpoint -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestCPPExceptionBreakpoint (TestBase): - - mydir = TestBase.compute_mydir(__file__) - my_var = 10 - - @add_test_categories(['pyapi']) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24538") - @expectedFailureNetBSD - def test_cpp_exception_breakpoint(self): - """Test setting and hitting the C++ exception breakpoint.""" - self.build() - self.do_cpp_exception_bkpt() - - def setUp(self): - TestBase.setUp(self) - self.main_source = "main.c" - self.main_source_spec = lldb.SBFileSpec(self.main_source) - - def do_cpp_exception_bkpt(self): - exe = self.getBuildArtifact("a.out") - error = lldb.SBError() - - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - exception_bkpt = self.target.BreakpointCreateForException( - lldb.eLanguageTypeC_plus_plus, False, True) - self.assertTrue( - exception_bkpt.IsValid(), - "Created exception breakpoint.") - - process = self.target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - thread_list = lldbutil.get_threads_stopped_at_breakpoint( - process, exception_bkpt) - self.assertTrue(len(thread_list) == 1, - "One thread stopped at the exception breakpoint.") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp deleted file mode 100644 index 76cb22735a7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include <exception> - -void -throws_int () -{ - throw 5; -} - -int -main () -{ - throws_int(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py deleted file mode 100644 index f8d5704d990..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -Test embedded breakpoints, like `asm int 3;` in x86 or or `__debugbreak` on Windows. -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DebugBreakTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIf(archs=no_match(["i386", "i686", "x86_64"])) - @no_debug_info_test - def test_asm_int_3(self): - """Test that intrinsics like `__debugbreak();` and `asm {"int3"}` are treated like breakpoints.""" - self.build() - exe = self.getBuildArtifact("a.out") - - # Run the program. - target = self.dbg.CreateTarget(exe) - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - # We've hit the first stop, so grab the frame. - self.assertEqual(process.GetState(), lldb.eStateStopped) - stop_reason = lldb.eStopReasonException if (lldbplatformutil.getPlatform( - ) == "windows" or lldbplatformutil.getPlatform() == "macosx") else lldb.eStopReasonSignal - thread = lldbutil.get_stopped_thread(process, stop_reason) - self.assertIsNotNone( - thread, "Unable to find thread stopped at the __debugbreak()") - frame = thread.GetFrameAtIndex(0) - - # We should be in funciton 'bar'. - self.assertTrue(frame.IsValid()) - function_name = frame.GetFunctionName() - self.assertTrue('bar' in function_name, - "Unexpected function name {}".format(function_name)) - - # We should be able to evaluate the parameter foo. - value = frame.EvaluateExpression('*foo') - self.assertEqual(value.GetValueAsSigned(), 42) - - # The counter should be 1 at the first stop and increase by 2 for each - # subsequent stop. - counter = 1 - while counter < 20: - value = frame.EvaluateExpression('count') - self.assertEqual(value.GetValueAsSigned(), counter) - counter += 2 - process.Continue() - - # The inferior should exit after the last iteration. - self.assertEqual(process.GetState(), lldb.eStateExited) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/main.c deleted file mode 100644 index 5f936327e4e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/main.c +++ /dev/null @@ -1,29 +0,0 @@ -#ifdef _MSC_VER -#include <intrin.h> -#define BREAKPOINT_INTRINSIC() __debugbreak() -#else -#define BREAKPOINT_INTRINSIC() __asm__ __volatile__ ("int3") -#endif - -int -bar(int const *foo) -{ - int count = 0, i = 0; - for (; i < 10; ++i) - { - count += 1; - BREAKPOINT_INTRINSIC(); - count += 1; - } - return *foo; -} - -int -main(int argc, char **argv) -{ - int foo = 42; - bar(&foo); - return 0; -} - - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile deleted file mode 100644 index 7934cd5db42..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -ifneq (,$(findstring icc,$(CC))) - CFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py deleted file mode 100644 index f1c8abab167..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py +++ /dev/null @@ -1,72 +0,0 @@ -""" -Test breakpoint commands set before we have a target -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class BreakpointInDummyTarget (TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - """Test breakpoint set before we have a target. """ - self.build() - self.dummy_breakpoint_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.c', 'Set a breakpoint on this line.') - self.line2 = line_number('main.c', 'Set another on this line.') - - def dummy_breakpoint_test(self): - """Test breakpoint set before we have a target. """ - - # This should create a breakpoint with 3 locations. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=0) - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line2, num_expected_locations=0) - - # This is the function to remove breakpoints from the dummy target - # to get a clean slate for the next test case. - def cleanup(): - self.runCmd('breakpoint delete -D -f', check=False) - self.runCmd('breakpoint list', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # The breakpoint list should show 3 locations. - self.expect( - "breakpoint list -f", - "Breakpoint locations shown correctly", - substrs=[ - "1: file = 'main.c', line = %d, exact_match = 0, locations = 1" % - self.line, - "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % - self.line2]) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Stopped once. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - # Continue the program, there should be another stop. - self.runCmd("process continue") - - # Stopped again. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 2."]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/main.c deleted file mode 100644 index e1f03237cd1..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <stdio.h> - -int -main (int argc, char **argv) -{ - printf ("Set a breakpoint on this line.\n"); - - return 0; // Set another on this line. -} - - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile deleted file mode 100644 index 06ef85cf908..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -DYLIB_NAME := foo -DYLIB_CXX_SOURCES := foo.cpp -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py deleted file mode 100644 index 9ca44a95ad2..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Test that we can hit breakpoints in global constructors -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestBreakpointInGlobalConstructors(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @expectedFailureNetBSD - def test(self): - self.build() - self.line_foo = line_number('foo.cpp', '// !BR_foo') - self.line_main = line_number('main.cpp', '// !BR_main') - - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.assertTrue(target, VALID_TARGET) - - env= self.registerSharedLibrariesWithTarget(target, ["foo"]) - - bp_main = lldbutil.run_break_set_by_file_and_line( - self, 'main.cpp', self.line_main) - - bp_foo = lldbutil.run_break_set_by_file_and_line( - self, 'foo.cpp', self.line_foo, num_expected_locations=-2) - - process = target.LaunchSimple( - None, env, self.get_process_working_directory()) - - self.assertIsNotNone( - lldbutil.get_one_thread_stopped_at_breakpoint_id( - self.process(), bp_foo)) - - self.runCmd("continue") - - self.assertIsNotNone( - lldbutil.get_one_thread_stopped_at_breakpoint_id( - self.process(), bp_main)) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp deleted file mode 100644 index f959a295467..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "foo.h" - -Foo::Foo() : x(42) { - bool some_code = x == 42; // !BR_foo -} - -Foo FooObj; diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h deleted file mode 100644 index 3bc63fed755..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef FOO_H -#define FOO_H - -struct LLDB_TEST_API Foo { - Foo(); - int x; -}; - -extern LLDB_TEST_API Foo FooObj; - -#endif diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp deleted file mode 100644 index d1c8038dfad..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "foo.h" - -struct Main { - Main(); - int x; -}; - -Main::Main() : x(47) { - bool some_code = x == 47; // !BR_main -} - -Main MainObj; - -int main() { return MainObj.x + FooObj.x; } diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile deleted file mode 100644 index 3665ae323e7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../../make - -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py deleted file mode 100644 index 95c7966716c..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py +++ /dev/null @@ -1,105 +0,0 @@ -""" -Test hardware breakpoints for multiple threads. -""" - -from __future__ import print_function - - -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'])) - 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'])) - 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 " + self.getBuildArtifact("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/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp deleted file mode 100644 index 94a12c6241d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#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/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/Makefile deleted file mode 100644 index 5b73ae626f3..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := int.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py deleted file mode 100644 index 9f184fb0ff4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Test that inlined breakpoints (breakpoint set on a file/line included from -another source file) works correctly. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class InlinedBreakpointsTestCase(TestBase): - """Bug fixed: rdar://problem/8464339""" - - mydir = TestBase.compute_mydir(__file__) - - def test_with_run_command(self): - """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp).""" - self.build() - self.inlined_breakpoints() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside basic_type.cpp. - self.line = line_number( - 'basic_type.cpp', - '// Set break point at this line.') - - def inlined_breakpoints(self): - """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp).""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # With the inline-breakpoint-strategy, our file+line breakpoint should - # not resolve to a location. - self.runCmd('settings set target.inline-breakpoint-strategy headers') - - # Set a breakpoint and fail because it is in an inlined source - # implemenation file - lldbutil.run_break_set_by_file_and_line( - self, "basic_type.cpp", self.line, num_expected_locations=0) - - # Now enable breakpoints in implementation files and see the breakpoint - # set succeed - self.runCmd('settings set target.inline-breakpoint-strategy always') - # And add hooks to restore the settings during tearDown(). - self.addTearDownHook(lambda: self.runCmd( - "settings set target.inline-breakpoint-strategy always")) - - lldbutil.run_break_set_by_file_and_line( - self, - "basic_type.cpp", - self.line, - num_expected_locations=1, - loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - # And it should break at basic_type.cpp:176. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint', - 'basic_type.cpp:%d' % self.line]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/basic_type.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/basic_type.cpp deleted file mode 100644 index 75d2c3690c8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/basic_type.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// This file must have the following defined before it is included: -// T defined to the type to test (int, float, etc) -// T_CSTR a C string representation of the type T ("int", "float") -// T_VALUE_1 defined to a valid initializer value for TEST_TYPE (7 for int, 2.0 for float) -// T_VALUE_2, T_VALUE_3, T_VALUE_4 defined to a valid initializer value for TEST_TYPE that is different from TEST_VALUE_1 -// T_PRINTF_FORMAT defined if T can be printed with printf -// -// An example for integers is below -#if 0 - -#define T int -#define T_CSTR "int" -#define T_VALUE_1 11001110 -#define T_VALUE_2 22002220 -#define T_VALUE_3 33003330 -#define T_VALUE_4 44044440 -#define T_PRINTF_FORMAT "%i" - -#include "basic_type.cpp" - -#endif - -#include <cstdint> -#include <cstdio> - -class a_class -{ -public: - a_class (const T& a, const T& b) : - m_a (a), - m_b (b) - { - } - - ~a_class () - { - } - - const T& - get_a() - { - return m_a; - } - - void - set_a (const T& a) - { - m_a = a; - } - - const T& - get_b() - { - return m_b; - } - - void - set_b (const T& b) - { - m_b = b; - } - -protected: - T m_a; - T m_b; -}; - -typedef struct a_struct_tag { - T a; - T b; -} a_struct_t; - - -typedef union a_union_zero_tag { - T a; - double a_double; -} a_union_zero_t; - -typedef struct a_union_nonzero_tag { - double a_double; - a_union_zero_t u; -} a_union_nonzero_t; - - -void Puts(char const *msg) -{ - std::puts(msg); -} - -int -main (int argc, char const *argv[]) -{ - T a = T_VALUE_1; - T* a_ptr = &a; - T& a_ref = a; - T a_array_bounded[2] = { T_VALUE_1, T_VALUE_2 }; - T a_array_unbounded[] = { T_VALUE_1, T_VALUE_2 }; - - a_class a_class_instance (T_VALUE_1, T_VALUE_2); - a_class *a_class_ptr = &a_class_instance; - a_class &a_class_ref = a_class_instance; - - a_struct_t a_struct = { T_VALUE_1, T_VALUE_2 }; - a_struct_t *a_struct_ptr = &a_struct; - a_struct_t &a_struct_ref = a_struct; - - // Create a union with type T at offset zero - a_union_zero_t a_union_zero; - a_union_zero.a = T_VALUE_1; - a_union_zero_t *a_union_zero_ptr = &a_union_zero; - a_union_zero_t &a_union_zero_ref = a_union_zero; - - // Create a union with type T at a non-zero offset - a_union_nonzero_t a_union_nonzero; - a_union_nonzero.u.a = T_VALUE_1; - a_union_nonzero_t *a_union_nonzero_ptr = &a_union_nonzero; - a_union_nonzero_t &a_union_nonzero_ref = a_union_nonzero; - - a_struct_t a_struct_array_bounded[2] = {{ T_VALUE_1, T_VALUE_2 }, { T_VALUE_3, T_VALUE_4 }}; - a_struct_t a_struct_array_unbounded[] = {{ T_VALUE_1, T_VALUE_2 }, { T_VALUE_3, T_VALUE_4 }}; - a_union_zero_t a_union_zero_array_bounded[2]; - a_union_zero_array_bounded[0].a = T_VALUE_1; - a_union_zero_array_bounded[1].a = T_VALUE_2; - a_union_zero_t a_union_zero_array_unbounded[] = {{ T_VALUE_1 }, { T_VALUE_2 }}; - -#ifdef T_PRINTF_FORMAT - std::printf ("%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a); - std::printf ("%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr); - std::printf ("%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref); - - std::printf ("%s[2]: a_array_bounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[0]); - std::printf ("%s[2]: a_array_bounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[1]); - - std::printf ("%s[]: a_array_unbounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[0]); - std::printf ("%s[]: a_array_unbounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[1]); - - std::printf ("(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a()); - std::printf ("(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b()); - std::printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a()); - std::printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b()); - std::printf ("(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a()); - std::printf ("(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b()); - - std::printf ("(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a); - std::printf ("(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b); - std::printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a); - std::printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b); - std::printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a); - std::printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b); - - std::printf ("(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a); - std::printf ("(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a); - std::printf ("(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a); - - std::printf ("(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a); - std::printf ("(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a); - std::printf ("(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a); - - std::printf ("(a_struct_t[2]) a_struct_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].a); - std::printf ("(a_struct_t[2]) a_struct_array_bounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].b); - std::printf ("(a_struct_t[2]) a_struct_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].a); - std::printf ("(a_struct_t[2]) a_struct_array_bounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].b); - - std::printf ("(a_struct_t[]) a_struct_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].a); - std::printf ("(a_struct_t[]) a_struct_array_unbounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].b); - std::printf ("(a_struct_t[]) a_struct_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].a); - std::printf ("(a_struct_t[]) a_struct_array_unbounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].b); - - std::printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[0].a); - std::printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[1].a); - - std::printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[0].a); - std::printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[1].a); - -#endif - Puts("About to exit, break here to check values..."); // Set break point at this line. - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/int.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/int.cpp deleted file mode 100644 index 922398b1c6e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/int.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#define T int -#define T_CSTR "int" -#define T_VALUE_1 11001110 -#define T_VALUE_2 22002220 -#define T_VALUE_3 33003330 -#define T_VALUE_4 44004440 -#define T_PRINTF_FORMAT "%i" - -#include "basic_type.cpp" diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile deleted file mode 100644 index 06ef85cf908..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -DYLIB_NAME := foo -DYLIB_CXX_SOURCES := foo.cpp -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py deleted file mode 100644 index b8281e9c85b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py +++ /dev/null @@ -1,69 +0,0 @@ -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_between = line_number('main.cpp', "// BR_Between") - print("BR_Between found at", self.line_between) - self.line_main = line_number('main.cpp', '// !BR_main') - - def test(self): - """Test target.move-to-nearest logic""" - - self.build() - target = self.dbg.CreateTarget(self.getBuildArtifact("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") - - # Make sure we don't put move the breakpoint if it is set between two functions: - lldbutil.run_break_set_by_file_and_line(self, 'main.cpp', - self.line_between, extra_options="-m 1", num_expected_locations=0) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp deleted file mode 100644 index 8dad0a23f36..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "foo.h" - -int call_foo1() { return foo1(); } diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h deleted file mode 100644 index 9f0e56dd22e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h +++ /dev/null @@ -1,5 +0,0 @@ -inline int foo1() { return 1; } // !BR1 - -inline int foo2() { return 2; } // !BR2 - -LLDB_TEST_API extern int call_foo1(); diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp deleted file mode 100644 index 76a22a5420f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "foo.h" - -int call_foo2() { return foo2(); } -// BR_Between -int -main() // !BR_main -{ - return call_foo1() + call_foo2(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile deleted file mode 100644 index ad3cb3fadcd..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py deleted file mode 100644 index c33bd800887..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py +++ /dev/null @@ -1,130 +0,0 @@ -""" -Test that objective-c constant strings are generated correctly by the expression -parser. -""" - -from __future__ import print_function - - -import shutil -import subprocess -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -@skipUnlessDarwin -class TestObjCBreakpoints(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_break(self): - """Test setting Objective-C specific breakpoints (DWARF in .o files).""" - self.build() - self.setTearDownCleanup() - self.check_objc_breakpoints(False) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.main_source = "main.m" - self.line = line_number(self.main_source, '// Set breakpoint here') - - def check_category_breakpoints(self): - name_bp = self.target.BreakpointCreateByName("myCategoryFunction") - selector_bp = self.target.BreakpointCreateByName( - "myCategoryFunction", - lldb.eFunctionNameTypeSelector, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - name_bp.GetNumLocations() == selector_bp.GetNumLocations(), - 'Make sure setting a breakpoint by name "myCategoryFunction" sets a breakpoint even though it is in a category') - for bp_loc in selector_bp: - function_name = bp_loc.GetAddress().GetSymbol().GetName() - self.assertTrue( - " myCategoryFunction]" in function_name, - 'Make sure all function names have " myCategoryFunction]" in their names') - - category_bp = self.target.BreakpointCreateByName( - "-[MyClass(MyCategory) myCategoryFunction]") - stripped_bp = self.target.BreakpointCreateByName( - "-[MyClass myCategoryFunction]") - stripped2_bp = self.target.BreakpointCreateByName( - "[MyClass myCategoryFunction]") - self.assertTrue( - category_bp.GetNumLocations() == 1, - "Make sure we can set a breakpoint using a full objective C function name with the category included (-[MyClass(MyCategory) myCategoryFunction])") - self.assertTrue( - stripped_bp.GetNumLocations() == 1, - "Make sure we can set a breakpoint using a full objective C function name without the category included (-[MyClass myCategoryFunction])") - self.assertTrue( - stripped2_bp.GetNumLocations() == 1, - "Make sure we can set a breakpoint using a full objective C function name without the category included ([MyClass myCategoryFunction])") - - def check_objc_breakpoints(self, have_dsym): - """Test constant string generation amd comparison by the expression parser.""" - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) - - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - #---------------------------------------------------------------------- - # Set breakpoints on all selectors whose name is "count". This should - # catch breakpoints that are both C functions _and_ anything whose - # selector is "count" because just looking at "count" we can't tell - # definitively if the name is a selector or a C function - #---------------------------------------------------------------------- - name_bp = self.target.BreakpointCreateByName("count") - selector_bp = self.target.BreakpointCreateByName( - "count", - lldb.eFunctionNameTypeSelector, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - name_bp.GetNumLocations() >= selector_bp.GetNumLocations(), - 'Make sure we get at least the same amount of breakpoints if not more when setting by name "count"') - self.assertTrue( - selector_bp.GetNumLocations() > 50, - 'Make sure we find a lot of "count" selectors') # There are 93 on the latest MacOSX - for bp_loc in selector_bp: - function_name = bp_loc.GetAddress().GetSymbol().GetName() - self.assertTrue( - " count]" in function_name, - 'Make sure all function names have " count]" in their names') - - #---------------------------------------------------------------------- - # Set breakpoints on all selectors whose name is "isEqual:". This should - # catch breakpoints that are only ObjC selectors because no C function - # can end with a : - #---------------------------------------------------------------------- - name_bp = self.target.BreakpointCreateByName("isEqual:") - selector_bp = self.target.BreakpointCreateByName( - "isEqual:", - lldb.eFunctionNameTypeSelector, - lldb.SBFileSpecList(), - lldb.SBFileSpecList()) - self.assertTrue( - name_bp.GetNumLocations() == selector_bp.GetNumLocations(), - 'Make sure setting a breakpoint by name "isEqual:" only sets selector breakpoints') - for bp_loc in selector_bp: - function_name = bp_loc.GetAddress().GetSymbol().GetName() - self.assertTrue( - " isEqual:]" in function_name, - 'Make sure all function names have " isEqual:]" in their names') - - self.check_category_breakpoints() - - if have_dsym: - shutil.rmtree(exe + ".dSYM") - self.assertTrue(subprocess.call( - ['/usr/bin/strip', '-Sx', exe]) == 0, 'stripping dylib succeeded') - - # Check breakpoints again, this time using the symbol table only - self.check_category_breakpoints() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/main.m deleted file mode 100644 index 53567491219..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/main.m +++ /dev/null @@ -1,98 +0,0 @@ -#import <Foundation/Foundation.h> -#include <unistd.h> - -@interface MyClass : NSObject -@end - -@implementation MyClass : NSObject -@end - -@implementation MyClass (MyCategory) - - -- (void) myCategoryFunction { - NSLog (@"myCategoryFunction"); -} - -@end - - - -int -Test_Selector () -{ - SEL sel = @selector(length); - printf("sel = %p\n", sel); - // Expressions to test here for selector: - // expression (char *)sel_getName(sel) - // The expression above should return "sel" as it should be just - // a uniqued C string pointer. We were seeing the result pointer being - // truncated with recent LLDBs. - return 0; // Break here for selector: tests -} - -int -Test_NSString (const char *program) -{ - NSString *str = [NSString stringWithFormat:@"Hello from '%s'", program]; - NSLog(@"NSString instance: %@", str); - printf("str = '%s'\n", [str cStringUsingEncoding: [NSString defaultCStringEncoding]]); - printf("[str length] = %zu\n", (size_t)[str length]); - printf("[str description] = %s\n", [[str description] UTF8String]); - id str_id = str; - // Expressions to test here for NSString: - // expression (char *)sel_getName(sel) - // expression [str length] - // expression [str_id length] - // expression [str description] - // expression [str_id description] - // expression str.length - // expression str.description - // expression str = @"new" - // expression str = [NSString stringWithFormat: @"%cew", 'N'] - return 0; // Break here for NSString tests -} - -NSString *my_global_str = NULL; - -int -Test_NSArray () -{ - NSMutableArray *nil_mutable_array = nil; - NSArray *array1 = [NSArray arrayWithObjects: @"array1 object1", @"array1 object2", @"array1 object3", nil]; - NSArray *array2 = [NSArray arrayWithObjects: array1, @"array2 object2", @"array2 object3", nil]; - // Expressions to test here for NSArray: - // expression [nil_mutable_array count] - // expression [array1 count] - // expression array1.count - // expression [array2 count] - // expression array2.count - id obj; - // After each object at index call, use expression and validate object - obj = [array1 objectAtIndex: 0]; // Break here for NSArray tests - obj = [array1 objectAtIndex: 1]; - obj = [array1 objectAtIndex: 2]; - - obj = [array2 objectAtIndex: 0]; - obj = [array2 objectAtIndex: 1]; - obj = [array2 objectAtIndex: 2]; - NSUInteger count = [nil_mutable_array count]; - return 0; -} - - -int main (int argc, char const *argv[]) -{ - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - Test_Selector(); // Set breakpoint here - Test_NSArray (); - Test_NSString (argv[0]); - MyClass *my_class = [[MyClass alloc] init]; - [my_class myCategoryFunction]; - printf("sizeof(id) = %zu\n", sizeof(id)); - printf("sizeof(Class) = %zu\n", sizeof(Class)); - printf("sizeof(SEL) = %zu\n", sizeof(SEL)); - - [pool release]; - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile deleted file mode 100644 index 7934cd5db42..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -ifneq (,$(findstring icc,$(CC))) - CFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py deleted file mode 100644 index 020974ee469..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py +++ /dev/null @@ -1,103 +0,0 @@ -""" -Test require hardware breakpoints. -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointLocationsTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - mydir = TestBase.compute_mydir(__file__) - - def test_breakpoint(self): - """Test regular breakpoints when hardware breakpoints are required.""" - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - - self.runCmd("settings set target.require-hardware-breakpoint true") - - breakpoint = target.BreakpointCreateByLocation("main.c", 1) - self.assertTrue(breakpoint.IsHardware()) - - @skipIfWindows - def test_step_range(self): - """Test stepping when hardware breakpoints are required.""" - self.build() - - _, _, thread, _ = lldbutil.run_to_line_breakpoint( - self, lldb.SBFileSpec("main.c"), 1) - - self.runCmd("settings set target.require-hardware-breakpoint true") - - # Ensure we fail in the interpreter. - self.expect("thread step-in") - self.expect("thread step-in", error=True) - - # Ensure we fail when stepping through the API. - error = lldb.SBError() - thread.StepInto('', 4, error) - self.assertTrue(error.Fail()) - self.assertTrue("Could not create hardware breakpoint for thread plan" - in error.GetCString()) - - @skipIfWindows - def test_step_out(self): - """Test stepping out when hardware breakpoints are required.""" - self.build() - - _, _, thread, _ = lldbutil.run_to_line_breakpoint( - self, lldb.SBFileSpec("main.c"), 1) - - self.runCmd("settings set target.require-hardware-breakpoint true") - - # Ensure this fails in the command interpreter. - self.expect("thread step-out", error=True) - - # Ensure we fail when stepping through the API. - error = lldb.SBError() - thread.StepOut(error) - self.assertTrue(error.Fail()) - self.assertTrue("Could not create hardware breakpoint for thread plan" - in error.GetCString()) - - @skipIfWindows - def test_step_over(self): - """Test stepping over when hardware breakpoints are required.""" - self.build() - - _, _, thread, _ = lldbutil.run_to_line_breakpoint( - self, lldb.SBFileSpec("main.c"), 7) - - self.runCmd("settings set target.require-hardware-breakpoint true") - - # Step over doesn't fail immediately but fails later on. - self.expect( - "thread step-over", - error=True, - substrs=[ - 'error: Could not create hardware breakpoint for thread plan.' - ]) - - @skipIfWindows - def test_step_until(self): - """Test stepping until when hardware breakpoints are required.""" - self.build() - - _, _, thread, _ = lldbutil.run_to_line_breakpoint( - self, lldb.SBFileSpec("main.c"), 7) - - self.runCmd("settings set target.require-hardware-breakpoint true") - - self.expect("thread until 5", error=True) - - # Ensure we fail when stepping through the API. - error = thread.StepOverUntil(lldb.SBFrame(), lldb.SBFileSpec(), 5) - self.assertTrue(error.Fail()) - self.assertTrue("Could not create hardware breakpoint for thread plan" - in error.GetCString()) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/main.c deleted file mode 100644 index 7d49a57d4c7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/main.c +++ /dev/null @@ -1,9 +0,0 @@ -int break_on_me() { - int i = 10; - i++; - return i; -} - -int main() { - return break_on_me(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile deleted file mode 100644 index 6067ee45e98..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -std=c99 - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py deleted file mode 100644 index 59abad6110e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py +++ /dev/null @@ -1,197 +0,0 @@ -""" -Test setting breakpoints using a scripted resolver -""" - -from __future__ import print_function - - -import os -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * - - -class TestScriptedResolver(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") - def test_scripted_resolver(self): - """Use a scripted resolver to set a by symbol name breakpoint""" - self.build() - self.do_test() - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") - def test_search_depths(self): - """ Make sure we are called at the right depths depending on what we return - from __get_depth__""" - self.build() - self.do_test_depths() - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") - def test_command_line(self): - """ Make sure we are called at the right depths depending on what we return - from __get_depth__""" - self.build() - self.do_test_cli() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def make_target_and_import(self): - target = lldbutil.run_to_breakpoint_make_target(self) - interp = self.dbg.GetCommandInterpreter() - error = lldb.SBError() - - script_name = os.path.join(self.getSourceDir(), "resolver.py") - source_name = os.path.join(self.getSourceDir(), "main.c") - - command = "command script import " + script_name - result = lldb.SBCommandReturnObject() - interp.HandleCommand(command, result) - self.assertTrue(result.Succeeded(), "com scr imp failed: %s"%(result.GetError())) - return target - - def make_extra_args(self): - json_string = '{"symbol":"break_on_me", "test1": "value1"}' - json_stream = lldb.SBStream() - json_stream.Print(json_string) - extra_args = lldb.SBStructuredData() - error = extra_args.SetFromJSON(json_stream) - self.assertTrue(error.Success(), "Error making SBStructuredData: %s"%(error.GetCString())) - return extra_args - - def do_test(self): - """This reads in a python file and sets a breakpoint using it.""" - - target = self.make_target_and_import() - extra_args = self.make_extra_args() - - file_list = lldb.SBFileSpecList() - module_list = lldb.SBFileSpecList() - - # Make breakpoints with this resolver using different filters, first ones that will take: - right = [] - # one with no file or module spec - this one should fire: - right.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)) - - # one with the right source file and no module - should also fire: - file_list.Append(lldb.SBFileSpec("main.c")) - right.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)) - # Make sure the help text shows up in the "break list" output: - self.expect("break list", substrs=["I am a python breakpoint resolver"], msg="Help is listed in break list") - - # one with the right source file and right module - should also fire: - module_list.Append(lldb.SBFileSpec("a.out")) - right.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)) - - # And one with no source file but the right module: - file_list.Clear() - right.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)) - - # Make sure these all got locations: - for i in range (0, len(right)): - self.assertTrue(right[i].GetNumLocations() >= 1, "Breakpoint %d has no locations."%(i)) - - # Now some ones that won't take: - - module_list.Clear() - file_list.Clear() - wrong = [] - - # one with the wrong module - should not fire: - module_list.Append(lldb.SBFileSpec("noSuchModule")) - wrong.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)) - - # one with the wrong file - also should not fire: - file_list.Clear() - module_list.Clear() - file_list.Append(lldb.SBFileSpec("noFileOfThisName.xxx")) - wrong.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)) - - # Now make sure the CU level iteration obeys the file filters: - file_list.Clear() - module_list.Clear() - file_list.Append(lldb.SBFileSpec("no_such_file.xxx")) - wrong.append(target.BreakpointCreateFromScript("resolver.ResolverCUDepth", extra_args, module_list, file_list)) - - # And the Module filters: - file_list.Clear() - module_list.Clear() - module_list.Append(lldb.SBFileSpec("NoSuchModule.dylib")) - wrong.append(target.BreakpointCreateFromScript("resolver.ResolverCUDepth", extra_args, module_list, file_list)) - - # Now make sure the Function level iteration obeys the file filters: - file_list.Clear() - module_list.Clear() - file_list.Append(lldb.SBFileSpec("no_such_file.xxx")) - wrong.append(target.BreakpointCreateFromScript("resolver.ResolverFuncDepth", extra_args, module_list, file_list)) - - # And the Module filters: - file_list.Clear() - module_list.Clear() - module_list.Append(lldb.SBFileSpec("NoSuchModule.dylib")) - wrong.append(target.BreakpointCreateFromScript("resolver.ResolverFuncDepth", extra_args, module_list, file_list)) - - # Make sure these didn't get locations: - for i in range(0, len(wrong)): - self.assertEqual(wrong[i].GetNumLocations(), 0, "Breakpoint %d has locations."%(i)) - - # Now run to main and ensure we hit the breakpoints we should have: - - lldbutil.run_to_breakpoint_do_run(self, target, right[0]) - - # Test the hit counts: - for i in range(0, len(right)): - self.assertEqual(right[i].GetHitCount(), 1, "Breakpoint %d has the wrong hit count"%(i)) - - for i in range(0, len(wrong)): - self.assertEqual(wrong[i].GetHitCount(), 0, "Breakpoint %d has the wrong hit count"%(i)) - - def do_test_depths(self): - """This test uses a class variable in resolver.Resolver which gets set to 1 if we saw - compile unit and 2 if we only saw modules. If the search depth is module, you get passed just - the modules with no comp_unit. If the depth is comp_unit you get comp_units. So we can use - this to test that our callback gets called at the right depth.""" - - target = self.make_target_and_import() - extra_args = self.make_extra_args() - - file_list = lldb.SBFileSpecList() - module_list = lldb.SBFileSpecList() - module_list.Append(lldb.SBFileSpec("a.out")) - - # Make a breakpoint that has no __get_depth__, check that that is converted to eSearchDepthModule: - bkpt = target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list) - self.assertTrue(bkpt.GetNumLocations() > 0, "Resolver got no locations.") - self.expect("script print(resolver.Resolver.got_files)", substrs=["2"], msg="Was only passed modules") - - # Make a breakpoint that asks for modules, check that we didn't get any files: - bkpt = target.BreakpointCreateFromScript("resolver.ResolverModuleDepth", extra_args, module_list, file_list) - self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverModuleDepth got no locations.") - self.expect("script print(resolver.Resolver.got_files)", substrs=["2"], msg="Was only passed modules") - - # Make a breakpoint that asks for compile units, check that we didn't get any files: - bkpt = target.BreakpointCreateFromScript("resolver.ResolverCUDepth", extra_args, module_list, file_list) - self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverCUDepth got no locations.") - self.expect("script print(resolver.Resolver.got_files)", substrs=["1"], msg="Was passed compile units") - - # Make a breakpoint that returns a bad value - we should convert that to "modules" so check that: - bkpt = target.BreakpointCreateFromScript("resolver.ResolverBadDepth", extra_args, module_list, file_list) - self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverBadDepth got no locations.") - self.expect("script print(resolver.Resolver.got_files)", substrs=["2"], msg="Was only passed modules") - - # Make a breakpoint that searches at function depth: - bkpt = target.BreakpointCreateFromScript("resolver.ResolverFuncDepth", extra_args, module_list, file_list) - self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverFuncDepth got no locations.") - self.expect("script print(resolver.Resolver.got_files)", substrs=["3"], msg="Was only passed modules") - self.expect("script print(resolver.Resolver.func_list)", substrs=["break_on_me", "main", "test_func"], msg="Saw all the functions") - - def do_test_cli(self): - target = self.make_target_and_import() - - lldbutil.run_break_set_by_script(self, "resolver.Resolver", extra_options="-k symbol -v break_on_me") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/main.c deleted file mode 100644 index b91ccfc1b43..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/main.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <stdio.h> - -int -test_func() -{ - return printf("I am a test function."); -} - -void -break_on_me() -{ - printf("I was called.\n"); -} - -int -main() -{ - break_on_me(); - test_func(); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py deleted file mode 100644 index 61f5f2df20a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py +++ /dev/null @@ -1,54 +0,0 @@ -import lldb - -class Resolver: - got_files = 0 - func_list = [] - - def __init__(self, bkpt, extra_args, dict): - self.bkpt = bkpt - self.extra_args = extra_args - Resolver.func_list = [] - Resolver.got_files = 0 - - def __callback__(self, sym_ctx): - sym_name = "not_a_real_function_name" - sym_item = self.extra_args.GetValueForKey("symbol") - if sym_item.IsValid(): - sym_name = sym_item.GetStringValue(1000) - - if sym_ctx.compile_unit.IsValid(): - Resolver.got_files = 1 - else: - Resolver.got_files = 2 - - if sym_ctx.function.IsValid(): - Resolver.got_files = 3 - func_name = sym_ctx.function.GetName() - Resolver.func_list.append(func_name) - if sym_name == func_name: - self.bkpt.AddLocation(sym_ctx.function.GetStartAddress()) - return - - if sym_ctx.module.IsValid(): - sym = sym_ctx.module.FindSymbol(sym_name, lldb.eSymbolTypeCode) - if sym.IsValid(): - self.bkpt.AddLocation(sym.GetStartAddress()) - - def get_short_help(self): - return "I am a python breakpoint resolver" - -class ResolverModuleDepth(Resolver): - def __get_depth__ (self): - return lldb.eSearchDepthModule - -class ResolverCUDepth(Resolver): - def __get_depth__ (self): - return lldb.eSearchDepthCompUnit - -class ResolverFuncDepth(Resolver): - def __get_depth__ (self): - return lldb.eSearchDepthFunction - -class ResolverBadDepth(Resolver): - def __get_depth__ (self): - return lldb.kLastSearchDepthKind + 1 diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py deleted file mode 100644 index 086203ec54a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py +++ /dev/null @@ -1,291 +0,0 @@ -""" -Test breakpoint serialization. -""" - -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 BreakpointSerialization(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @add_test_categories(['pyapi']) - def test_resolvers(self): - """Use Python APIs to test that we serialize resolvers.""" - self.build() - self.setup_targets_and_cleanup() - self.do_check_resolvers() - - def test_filters(self): - """Use Python APIs to test that we serialize search filters correctly.""" - self.build() - self.setup_targets_and_cleanup() - self.do_check_filters() - - def test_options(self): - """Use Python APIs to test that we serialize breakpoint options correctly.""" - self.build() - self.setup_targets_and_cleanup() - self.do_check_options() - - def test_appending(self): - """Use Python APIs to test that we serialize breakpoint options correctly.""" - self.build() - self.setup_targets_and_cleanup() - self.do_check_appending() - - def test_name_filters(self): - """Use python APIs to test that reading in by name works correctly.""" - self.build() - self.setup_targets_and_cleanup() - self.do_check_names() - - def setup_targets_and_cleanup(self): - def cleanup (): - self.RemoveTempFile(self.bkpts_file_path) - - if self.orig_target.IsValid(): - self.dbg.DeleteTarget(self.orig_target) - self.dbg.DeleteTarget(self.copy_target) - - self.addTearDownHook(cleanup) - self.RemoveTempFile(self.bkpts_file_path) - - exe = self.getBuildArtifact("a.out") - - # Create the targets we are making breakpoints in and copying them to: - self.orig_target = self.dbg.CreateTarget(exe) - self.assertTrue(self.orig_target, VALID_TARGET) - - self.copy_target = self.dbg.CreateTarget(exe) - self.assertTrue(self.copy_target, VALID_TARGET) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - self.bkpts_file_path = self.getBuildArtifact("breakpoints.json") - self.bkpts_file_spec = lldb.SBFileSpec(self.bkpts_file_path) - - def check_equivalence(self, source_bps, do_write = True): - - error = lldb.SBError() - - if (do_write): - error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps) - self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString())) - - copy_bps = lldb.SBBreakpointList(self.copy_target) - error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, copy_bps) - self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString())) - - num_source_bps = source_bps.GetSize() - num_copy_bps = copy_bps.GetSize() - self.assertTrue(num_source_bps == num_copy_bps, "Didn't get same number of input and output breakpoints - orig: %d copy: %d"%(num_source_bps, num_copy_bps)) - - for i in range(0, num_source_bps): - source_bp = source_bps.GetBreakpointAtIndex(i) - source_desc = lldb.SBStream() - source_bp.GetDescription(source_desc, False) - source_text = source_desc.GetData() - - # I am assuming here that the breakpoints will get written out in breakpoint ID order, and - # read back in ditto. That is true right now, and I can't see any reason to do it differently - # but if we do we can go to writing the breakpoints one by one, or sniffing the descriptions to - # see which one is which. - copy_id = source_bp.GetID() - copy_bp = copy_bps.FindBreakpointByID(copy_id) - self.assertTrue(copy_bp.IsValid(), "Could not find copy breakpoint %d."%(copy_id)) - - copy_desc = lldb.SBStream() - copy_bp.GetDescription(copy_desc, False) - copy_text = copy_desc.GetData() - - # These two should be identical. - # print ("Source text for %d is %s."%(i, source_text)) - self.assertTrue (source_text == copy_text, "Source and dest breakpoints are not identical: \nsource: %s\ndest: %s"%(source_text, copy_text)) - - def do_check_resolvers(self): - """Use Python APIs to check serialization of breakpoint resolvers""" - - empty_module_list = lldb.SBFileSpecList() - empty_cu_list = lldb.SBFileSpecList() - blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c")) - - # It isn't actually important for these purposes that these breakpoint - # actually have locations. - source_bps = lldb.SBBreakpointList(self.orig_target) - source_bps.Append(self.orig_target.BreakpointCreateByLocation("blubby.c", 666)) - # Make sure we do one breakpoint right: - self.check_equivalence(source_bps) - source_bps.Clear() - - source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list)) - source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list)) - source_bps.Append(self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec)) - - # And some number greater than one: - self.check_equivalence(source_bps) - - def do_check_filters(self): - """Use Python APIs to check serialization of breakpoint filters.""" - module_list = lldb.SBFileSpecList() - module_list.Append(lldb.SBFileSpec("SomeBinary")) - module_list.Append(lldb.SBFileSpec("SomeOtherBinary")) - - cu_list = lldb.SBFileSpecList() - cu_list.Append(lldb.SBFileSpec("SomeCU.c")) - cu_list.Append(lldb.SBFileSpec("AnotherCU.c")) - cu_list.Append(lldb.SBFileSpec("ThirdCU.c")) - - blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c")) - - # It isn't actually important for these purposes that these breakpoint - # actually have locations. - source_bps = lldb.SBBreakpointList(self.orig_target) - bkpt = self.orig_target.BreakpointCreateByLocation(blubby_file_spec, 666, 0, module_list) - source_bps.Append(bkpt) - - # Make sure we do one right: - self.check_equivalence(source_bps) - source_bps.Clear() - - bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, module_list, cu_list) - source_bps.Append(bkpt) - bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, module_list, cu_list) - source_bps.Append(bkpt) - bkpt = self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec) - source_bps.Append(bkpt) - - # And some number greater than one: - self.check_equivalence(source_bps) - - def do_check_options(self): - """Use Python APIs to check serialization of breakpoint options.""" - - empty_module_list = lldb.SBFileSpecList() - empty_cu_list = lldb.SBFileSpecList() - blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c")) - - # It isn't actually important for these purposes that these breakpoint - # actually have locations. - source_bps = lldb.SBBreakpointList(self.orig_target) - - bkpt = self.orig_target.BreakpointCreateByLocation( - lldb.SBFileSpec("blubby.c"), 666, 333, 0, lldb.SBFileSpecList()) - bkpt.SetEnabled(False) - bkpt.SetOneShot(True) - bkpt.SetThreadID(10) - source_bps.Append(bkpt) - - # Make sure we get one right: - self.check_equivalence(source_bps) - source_bps.Clear() - - bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list) - bkpt.SetIgnoreCount(10) - bkpt.SetThreadName("grubby") - source_bps.Append(bkpt) - - bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list) - bkpt.SetCondition("gonna remove this") - bkpt.SetCondition("") - source_bps.Append(bkpt) - - bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list) - bkpt.SetCondition("something != something_else") - bkpt.SetQueueName("grubby") - bkpt.AddName("FirstName") - bkpt.AddName("SecondName") - bkpt.SetScriptCallbackBody('\tprint("I am a function that prints.")\n\tprint("I don\'t do anything else")\n') - source_bps.Append(bkpt) - - bkpt = self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec) - cmd_list = lldb.SBStringList() - cmd_list.AppendString("frame var") - cmd_list.AppendString("thread backtrace") - - bkpt.SetCommandLineCommands(cmd_list) - source_bps.Append(bkpt) - - self.check_equivalence(source_bps) - - def do_check_appending(self): - """Use Python APIs to check appending to already serialized options.""" - - empty_module_list = lldb.SBFileSpecList() - empty_cu_list = lldb.SBFileSpecList() - blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c")) - - # It isn't actually important for these purposes that these breakpoint - # actually have locations. - - all_bps = lldb.SBBreakpointList(self.orig_target) - source_bps = lldb.SBBreakpointList(self.orig_target) - - bkpt = self.orig_target.BreakpointCreateByLocation( - lldb.SBFileSpec("blubby.c"), 666, 333, 0, lldb.SBFileSpecList()) - bkpt.SetEnabled(False) - bkpt.SetOneShot(True) - bkpt.SetThreadID(10) - source_bps.Append(bkpt) - all_bps.Append(bkpt) - - error = lldb.SBError() - error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps) - self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString())) - - source_bps.Clear() - - bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list) - bkpt.SetIgnoreCount(10) - bkpt.SetThreadName("grubby") - source_bps.Append(bkpt) - all_bps.Append(bkpt) - - bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list) - bkpt.SetCondition("something != something_else") - bkpt.SetQueueName("grubby") - bkpt.AddName("FirstName") - bkpt.AddName("SecondName") - - source_bps.Append(bkpt) - all_bps.Append(bkpt) - - error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps, True) - self.assertTrue(error.Success(), "Failed appending breakpoints to file: %s."%(error.GetCString())) - - self.check_equivalence(all_bps) - - def do_check_names(self): - bkpt = self.orig_target.BreakpointCreateByLocation( - lldb.SBFileSpec("blubby.c"), 666, 333, 0, lldb.SBFileSpecList()) - good_bkpt_name = "GoodBreakpoint" - write_bps = lldb.SBBreakpointList(self.orig_target) - bkpt.AddName(good_bkpt_name) - write_bps.Append(bkpt) - - error = lldb.SBError() - error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, write_bps) - self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString())) - - copy_bps = lldb.SBBreakpointList(self.copy_target) - names_list = lldb.SBStringList() - names_list.AppendString("NoSuchName") - - error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps) - self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString())) - self.assertTrue(copy_bps.GetSize() == 0, "Found breakpoints with a nonexistent name.") - - names_list.AppendString(good_bkpt_name) - error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps) - self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString())) - self.assertTrue(copy_bps.GetSize() == 1, "Found the matching breakpoint.") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c deleted file mode 100644 index b1ed4465c1d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c +++ /dev/null @@ -1,53 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -// This simple program is to demonstrate the capability of the lldb command -// "breakpoint modify -i <count> breakpt-id" to set the number of times a -// breakpoint is skipped before stopping. Ignore count can also be set upon -// breakpoint creation by 'breakpoint set ... -i <count>'. - -int a(int); -int b(int); -int c(int); - -int a(int val) -{ - if (val <= 1) - return b(val); - else if (val >= 3) - return c(val); // a(3) -> c(3) Find the call site of c(3). - - return val; -} - -int b(int val) -{ - return c(val); -} - -int c(int val) -{ - return val + 3; // Find the line number of function "c" here. -} - -int main (int argc, char const *argv[]) -{ - int A1 = a(1); // a(1) -> b(1) -> c(1) - printf("a(1) returns %d\n", A1); - - int B2 = b(2); // b(2) -> c(2) Find the call site of b(2). - printf("b(2) returns %d\n", B2); - - int A3 = a(3); // a(3) -> c(3) Find the call site of a(3). - printf("a(3) returns %d\n", A3); - - int C1 = c(5); // Find the call site of c in main. - printf ("c(5) returns %d\n", C1); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/Makefile deleted file mode 100644 index ac984f101c1..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c a.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py deleted file mode 100644 index 22589898060..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -Test lldb breakpoint setting by source regular expression. -This test just tests the source file & function restrictions. -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestSourceRegexBreakpoints(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_location(self): - self.build() - self.source_regex_locations() - - def test_restrictions(self): - self.build() - self.source_regex_restrictions() - - def source_regex_locations(self): - """ Test that restricting source expressions to files & to functions. """ - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # First look just in main: - target_files = lldb.SBFileSpecList() - target_files.Append(lldb.SBFileSpec("a.c")) - - func_names = lldb.SBStringList() - func_names.AppendString("a_func") - - source_regex = "Set . breakpoint here" - main_break = target.BreakpointCreateBySourceRegex( - source_regex, lldb.SBFileSpecList(), target_files, func_names) - num_locations = main_break.GetNumLocations() - self.assertTrue( - num_locations == 1, - "a.c in a_func should give one breakpoint, got %d." % - (num_locations)) - - loc = main_break.GetLocationAtIndex(0) - self.assertTrue(loc.IsValid(), "Got a valid location.") - address = loc.GetAddress() - self.assertTrue( - address.IsValid(), - "Got a valid address from the location.") - - a_func_line = line_number("a.c", "Set A breakpoint here") - line_entry = address.GetLineEntry() - self.assertTrue(line_entry.IsValid(), "Got a valid line entry.") - self.assertTrue(line_entry.line == a_func_line, - "Our line number matches the one lldbtest found.") - - def source_regex_restrictions(self): - """ Test that restricting source expressions to files & to functions. """ - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # First look just in main: - target_files = lldb.SBFileSpecList() - target_files.Append(lldb.SBFileSpec("main.c")) - source_regex = "Set . breakpoint here" - main_break = target.BreakpointCreateBySourceRegex( - source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList()) - - num_locations = main_break.GetNumLocations() - self.assertTrue( - num_locations == 2, - "main.c should have 2 matches, got %d." % - (num_locations)) - - # Now look in both files: - target_files.Append(lldb.SBFileSpec("a.c")) - - main_break = target.BreakpointCreateBySourceRegex( - source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList()) - - num_locations = main_break.GetNumLocations() - self.assertTrue( - num_locations == 4, - "main.c and a.c should have 4 matches, got %d." % - (num_locations)) - - # Now restrict it to functions: - func_names = lldb.SBStringList() - func_names.AppendString("main_func") - main_break = target.BreakpointCreateBySourceRegex( - source_regex, lldb.SBFileSpecList(), target_files, func_names) - - num_locations = main_break.GetNumLocations() - self.assertTrue( - num_locations == 2, - "main_func in main.c and a.c should have 2 matches, got %d." % - (num_locations)) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.c deleted file mode 100644 index 056583f1c42..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <stdio.h> - -#include "a.h" - -static int -main_func(int input) -{ - return printf("Set B breakpoint here: %d", input); -} - -int -a_func(int input) -{ - input += 1; // Set A breakpoint here; - return main_func(input); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.h b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.h deleted file mode 100644 index f578ac0304c..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.h +++ /dev/null @@ -1 +0,0 @@ -int a_func(int); diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/main.c deleted file mode 100644 index 9c8625e877f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/main.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <stdio.h> -#include "a.h" - -int -main_func(int input) -{ - return printf("Set B breakpoint here: %d.\n", input); -} - -int -main() -{ - a_func(10); - main_func(10); - printf("Set a breakpoint here:\n"); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile deleted file mode 100644 index f89b52a972e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -ifneq (,$(findstring icc,$(CC))) - CXXFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py deleted file mode 100644 index 07fd04940d9..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py +++ /dev/null @@ -1,119 +0,0 @@ -""" -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 = self.getBuildArtifact("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() - - # if third argument is true then the count will be the number of - # instructions on which a breakpoint can be set. - # start = addr_1, end = addr_4, canSetBreakpoint = True - steps_expected = instructions.GetInstructionsCount(addr_1, addr_4, True) - 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/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp deleted file mode 100644 index 8cfd34b73b5..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -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/lldb/packages/Python/lldbsuite/test/functionalities/command_history/.categories b/lldb/packages/Python/lldbsuite/test/functionalities/command_history/.categories deleted file mode 100644 index 3a3f4df6416..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_history/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py deleted file mode 100644 index 2763ab50c88..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py +++ /dev/null @@ -1,107 +0,0 @@ -""" -Test the command history mechanism -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CommandHistoryTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_history(self): - self.runCmd('command history --clear', inHistory=False) - self.runCmd('breakpoint list', check=False, inHistory=True) # 0 - self.runCmd('register read', check=False, inHistory=True) # 1 - self.runCmd('apropos hello', check=False, inHistory=True) # 2 - self.runCmd('memory write', check=False, inHistory=True) # 3 - self.runCmd('log list', check=False, inHistory=True) # 4 - self.runCmd('disassemble', check=False, inHistory=True) # 5 - self.runCmd('expression 1', check=False, inHistory=True) # 6 - self.runCmd( - 'type summary list -w default', - check=False, - inHistory=True) # 7 - self.runCmd('version', check=False, inHistory=True) # 8 - self.runCmd('frame select 1', check=False, inHistory=True) # 9 - - self.expect( - "command history -s 3 -c 3", - inHistory=True, - substrs=[ - '3: memory write', - '4: log list', - '5: disassemble']) - - self.expect("command history -s 3 -e 3", inHistory=True, - substrs=['3: memory write']) - - self.expect( - "command history -s 6 -e 7", - inHistory=True, - substrs=[ - '6: expression 1', - '7: type summary list -w default']) - - self.expect("command history -c 2", inHistory=True, - substrs=['0: breakpoint list', '1: register read']) - - self.expect("command history -e 3 -c 1", inHistory=True, - substrs=['3: memory write']) - - self.expect( - "command history -e 2", - inHistory=True, - substrs=[ - '0: breakpoint list', - '1: register read', - '2: apropos hello']) - - self.expect( - "command history -s 12", - inHistory=True, - substrs=[ - '12: command history -s 6 -e 7', - '13: command history -c 2', - '14: command history -e 3 -c 1', - '15: command history -e 2', - '16: command history -s 12']) - - self.expect( - "command history -s end -c 3", - inHistory=True, - substrs=[ - '15: command history -e 2', - '16: command history -s 12', - '17: command history -s end -c 3']) - - self.expect( - "command history -s end -e 15", - inHistory=True, - substrs=[ - '15: command history -e 2', - '16: command history -s 12', - '17: command history -s end -c 3', - 'command history -s end -e 15']) - - self.expect("command history -s 5 -c 1", inHistory=True, - substrs=['5: disassemble']) - - self.expect("command history -c 1 -s 5", inHistory=True, - substrs=['5: disassemble']) - - self.expect("command history -c 1 -e 3", inHistory=True, - substrs=['3: memory write']) - - self.expect( - "command history -c 1 -e 3 -s 5", - error=True, - inHistory=True, - substrs=['error: --count, --start-index and --end-index cannot be all specified in the same invocation']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/.categories b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/.categories deleted file mode 100644 index 3a3f4df6416..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/Makefile deleted file mode 100644 index 8a7102e347a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py deleted file mode 100644 index 6531cd67279..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py +++ /dev/null @@ -1,153 +0,0 @@ -""" -Test lldb Python commands. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * - - -class CmdPythonTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def test(self): - self.build() - self.pycmd_tests() - - def pycmd_tests(self): - self.runCmd("command source py_import") - - # Verify command that specifies eCommandRequiresTarget returns failure - # without a target. - self.expect('targetname', - substrs=['a.out'], matching=False, error=True) - - exe = self.getBuildArtifact("a.out") - self.expect("file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.expect('targetname', - substrs=['a.out'], matching=True, error=False) - - # This is the function to remove the custom commands in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('command script delete welcome', check=False) - self.runCmd('command script delete targetname', check=False) - self.runCmd('command script delete longwait', check=False) - self.runCmd('command script delete mysto', check=False) - self.runCmd('command script delete tell_sync', check=False) - self.runCmd('command script delete tell_async', check=False) - self.runCmd('command script delete tell_curr', check=False) - self.runCmd('command script delete bug11569', check=False) - self.runCmd('command script delete takes_exe_ctx', check=False) - self.runCmd('command script delete decorated', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Interact with debugger in synchronous mode - self.setAsync(False) - - # We don't want to display the stdout if not in TraceOn() mode. - if not self.TraceOn(): - self.HideStdout() - - self.expect('welcome Enrico', - substrs=['Hello Enrico, welcome to LLDB']) - - self.expect("help welcome", - substrs=['Just a docstring for welcome_impl', - 'A command that says hello to LLDB users']) - - decorated_commands = ["decorated" + str(n) for n in range(1, 5)] - for name in decorated_commands: - self.expect(name, substrs=["hello from " + name]) - self.expect("help " + name, - substrs=["Python command defined by @lldb.command"]) - - self.expect("help", - substrs=['For more information run', - 'welcome'] + decorated_commands) - - self.expect("help -a", - substrs=['For more information run', - 'welcome'] + decorated_commands) - - self.expect("help -u", matching=False, - substrs=['For more information run']) - - self.runCmd("command script delete welcome") - - self.expect('welcome Enrico', matching=False, error=True, - substrs=['Hello Enrico, welcome to LLDB']) - - self.expect('targetname fail', error=True, - substrs=['a test for error in command']) - - self.expect('command script list', - substrs=['targetname', - 'For more information run']) - - self.expect("help targetname", - substrs=['Expects', '\'raw\'', 'input', - 'help', 'raw-input']) - - self.expect("longwait", - substrs=['Done; if you saw the delays I am doing OK']) - - self.runCmd("b main") - self.runCmd("run") - self.runCmd("mysto 3") - self.expect("frame variable array", - substrs=['[0] = 79630', '[1] = 388785018', '[2] = 0']) - self.runCmd("mysto 3") - self.expect("frame variable array", - substrs=['[0] = 79630', '[4] = 388785018', '[5] = 0']) - -# we cannot use the stepover command to check for async execution mode since LLDB -# seems to get confused when events start to queue up - self.expect("tell_sync", - substrs=['running sync']) - self.expect("tell_async", - substrs=['running async']) - self.expect("tell_curr", - substrs=['I am running sync']) - -# check that the execution context is passed in to commands that ask for it - self.expect("takes_exe_ctx", substrs=["a.out"]) - - # Test that a python command can redefine itself - self.expect('command script add -f foobar welcome -h "just some help"') - - self.runCmd("command script clear") - - # Test that re-defining an existing command works - self.runCmd( - 'command script add my_command --class welcome.WelcomeCommand') - self.expect('my_command Blah', substrs=['Hello Blah, welcome to LLDB']) - - self.runCmd( - 'command script add my_command --class welcome.TargetnameCommand') - self.expect('my_command', substrs=['a.out']) - - self.runCmd("command script clear") - - self.expect('command script list', matching=False, - substrs=['targetname', - 'longwait']) - - self.expect('command script add -f foobar frame', error=True, - substrs=['cannot add command']) - - # http://llvm.org/bugs/show_bug.cgi?id=11569 - # LLDBSwigPythonCallCommand crashes when a command script returns an - # object - self.runCmd('command script add -f bug11569 bug11569') - # This should not crash. - self.runCmd('bug11569', check=False) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py deleted file mode 100644 index 3c124de79bf..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py +++ /dev/null @@ -1,6 +0,0 @@ -def bug11569(debugger, args, result, dict): - """ - http://llvm.org/bugs/show_bug.cgi?id=11569 - LLDBSwigPythonCallCommand crashes when a command script returns an object. - """ - return ["return", "a", "non-string", "should", "not", "crash", "LLDB"] diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py deleted file mode 100644 index f9707a5706a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py +++ /dev/null @@ -1,35 +0,0 @@ -from __future__ import print_function - -import lldb - - -@lldb.command() -def decorated1(debugger, args, exe_ctx, result, dict): - """ - Python command defined by @lldb.command - """ - print("hello from decorated1", file=result) - - -@lldb.command(doc="Python command defined by @lldb.command") -def decorated2(debugger, args, exe_ctx, result, dict): - """ - This docstring is overridden. - """ - print("hello from decorated2", file=result) - - -@lldb.command() -def decorated3(debugger, args, result, dict): - """ - Python command defined by @lldb.command - """ - print("hello from decorated3", file=result) - - -@lldb.command("decorated4") -def _decorated4(debugger, args, exe_ctx, result, dict): - """ - Python command defined by @lldb.command - """ - print("hello from decorated4", file=result) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/Makefile deleted file mode 100644 index 9374aef487f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -EXE := hello_world - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py deleted file mode 100644 index bbeee1a5e32..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py +++ /dev/null @@ -1,76 +0,0 @@ -"""Test custom import command to import files by path.""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ImportTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @no_debug_info_test - def test_import_command(self): - """Import some Python scripts by path and test them""" - self.run_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def run_test(self): - """Import some Python scripts by path and test them.""" - - # This is the function to remove the custom commands in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('command script delete foo2cmd', check=False) - self.runCmd('command script delete foocmd', check=False) - self.runCmd('command script delete foobarcmd', check=False) - self.runCmd('command script delete barcmd', check=False) - self.runCmd('command script delete barothercmd', check=False) - self.runCmd('command script delete TPcommandA', check=False) - self.runCmd('command script delete TPcommandB', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("command script import ./foo/foo.py --allow-reload") - self.runCmd("command script import ./foo/foo2.py --allow-reload") - self.runCmd("command script import ./foo/bar/foobar.py --allow-reload") - self.runCmd("command script import ./bar/bar.py --allow-reload") - - self.expect("command script import ./nosuchfile.py", - error=True, startstr='error: module importing failed') - self.expect("command script import ./nosuchfolder/", - error=True, startstr='error: module importing failed') - self.expect("command script import ./foo/foo.py", error=False) - - self.runCmd("command script import --allow-reload ./thepackage") - self.expect("TPcommandA", substrs=["hello world A"]) - self.expect("TPcommandB", substrs=["hello world B"]) - - self.runCmd("script import dummymodule") - self.expect("command script import ./dummymodule.py", error=False) - self.expect( - "command script import --allow-reload ./dummymodule.py", - error=False) - - self.runCmd("command script add -f foo.foo_function foocmd") - self.runCmd("command script add -f foobar.foo_function foobarcmd") - self.runCmd("command script add -f bar.bar_function barcmd") - self.expect("foocmd hello", - substrs=['foo says', 'hello']) - self.expect("foo2cmd hello", - substrs=['foo2 says', 'hello']) - self.expect("barcmd hello", - substrs=['barutil says', 'bar told me', 'hello']) - self.expect("barothercmd hello", - substrs=['barutil says', 'bar told me', 'hello']) - self.expect("foobarcmd hello", - substrs=['foobar says', 'hello']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py deleted file mode 100644 index 444e00976ad..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import print_function - - -def bar_function(debugger, args, result, dict): - global UtilityModule - print(UtilityModule.barutil_function("bar told me " + args), file=result) - return None - - -def __lldb_init_module(debugger, session_dict): - global UtilityModule - UtilityModule = __import__("barutil") - debugger.HandleCommand( - "command script add -f bar.bar_function barothercmd") - return None diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py deleted file mode 100644 index 70ecea30057..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py +++ /dev/null @@ -1,2 +0,0 @@ -def barutil_function(x): - return "barutil says: " + x diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py deleted file mode 100644 index 668a5b90ea4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py +++ /dev/null @@ -1,2 +0,0 @@ -def no_useful_code(foo): - return foo diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py deleted file mode 100644 index 6ef71064c9a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py +++ /dev/null @@ -1,6 +0,0 @@ -from __future__ import print_function - - -def foo_function(debugger, args, result, dict): - print("foobar says " + args, file=result) - return None diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py deleted file mode 100644 index 1ccc3892939..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py +++ /dev/null @@ -1,6 +0,0 @@ -from __future__ import print_function - - -def foo_function(debugger, args, result, dict): - print("foo says " + args, file=result) - return None diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py deleted file mode 100644 index 71657c299c2..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py +++ /dev/null @@ -1,11 +0,0 @@ -from __future__ import print_function - - -def foo2_function(debugger, args, result, dict): - print("foo2 says " + args, file=result) - return None - - -def __lldb_init_module(debugger, session_dict): - debugger.HandleCommand("command script add -f foo2.foo2_function foo2cmd") - return None diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/main.c deleted file mode 100644 index dffc8c77b04..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/main.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <stdio.h> - -int main(int argc, char const *argv[]) { - printf("Hello world.\n"); // Set break point at this line. - if (argc == 1) - return 0; - - // Waiting to be attached by the debugger, otherwise. - char line[100]; - while (fgets(line, sizeof(line), stdin)) { // Waiting to be attached... - printf("input line=>%s\n", line); - } - - printf("Exiting now\n"); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/Makefile deleted file mode 100644 index 7913aaa4b74..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../../../make - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py deleted file mode 100644 index fdcf8764e67..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py +++ /dev/null @@ -1,36 +0,0 @@ -"""Check that we handle an ImportError in a special way when command script importing files.""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class Rdar12586188TestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @no_debug_info_test - def test_rdar12586188_command(self): - """Check that we handle an ImportError in a special way when command script importing files.""" - self.run_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def run_test(self): - """Check that we handle an ImportError in a special way when command script importing files.""" - - self.expect( - "command script import ./fail12586188.py --allow-reload", - error=True, - substrs=['raise ImportError("I do not want to be imported")']) - self.expect( - "command script import ./fail212586188.py --allow-reload", - error=True, - substrs=['raise ValueError("I do not want to be imported")']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py deleted file mode 100644 index ea385e03e04..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py +++ /dev/null @@ -1,4 +0,0 @@ -def f(x): - return x + 1 - -raise ImportError("I do not want to be imported") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py deleted file mode 100644 index 8dbc0e67ba1..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py +++ /dev/null @@ -1,4 +0,0 @@ -def f(x): - return x + 1 - -raise ValueError("I do not want to be imported") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py deleted file mode 100644 index 9694b084295..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py +++ /dev/null @@ -1,7 +0,0 @@ - -import six - - -def command(debugger, command, result, internal_dict): - result.PutCString(six.u("hello world A")) - return None diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py deleted file mode 100644 index 94a333bc696..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py +++ /dev/null @@ -1,7 +0,0 @@ - -import six - - -def command(debugger, command, result, internal_dict): - result.PutCString(six.u("hello world B")) - return None diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py deleted file mode 100644 index 24cdea60f2c..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -from __future__ import absolute_import - -from . import TPunitA -from . import TPunitB - - -def __lldb_init_module(debugger, *args): - debugger.HandleCommand( - "command script add -f thepackage.TPunitA.command TPcommandA") - debugger.HandleCommand( - "command script add -f thepackage.TPunitB.command TPcommandB") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/main.cpp deleted file mode 100644 index a0e9efd6ee0..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include <cstdlib> -#include <cstring> -#include <string> -#include <fstream> -#include <iostream> - -int -product (int x, int y) -{ - int result = x * y; - return result; -} - -int -sum (int a, int b) -{ - int result = a + b; - return result; -} - -int -strange_max (int m, int n) -{ - if (m > n) - return m; - else if (n > m) - return n; - else - return 0; -} - -int -foo (int i, int j) -{ - if (strange_max (i, j) == i) - return product (i, j); - else if (strange_max (i, j) == j) - return sum (i, j); - else - return product (sum (i, i), sum (j, j)); -} - -int -main(int argc, char const *argv[]) -{ - - int array[9]; - memset(array,0,9*sizeof(int)); - - array[0] = foo (1238, 78392); - array[1] = foo (379265, 23674); - array[2] = foo (872934, 234); - array[3] = foo (1238, 78392); - array[4] = foo (379265, 23674); - array[5] = foo (872934, 234); - array[6] = foo (1238, 78392); - array[7] = foo (379265, 23674); - array[8] = foo (872934, 234); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py deleted file mode 100644 index 04eceb7eb93..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py +++ /dev/null @@ -1,22 +0,0 @@ -from __future__ import print_function - -import lldb - - -def StepOver(debugger, args, result, dict): - """ - Step over a given number of times instead of only just once - """ - arg_split = args.split(" ") - print(type(arg_split)) - count = int(arg_split[0]) - for i in range(0, count): - debugger.GetSelectedTarget().GetProcess( - ).GetSelectedThread().StepOver(lldb.eOnlyThisThread) - print("step<%d>" % i) - - -def __lldb_init_module(debugger, session_dict): - # by default, --synchronicity is set to synchronous - debugger.HandleCommand("command script add -f mysto.StepOver mysto") - return None diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import deleted file mode 100644 index 6c1f7b8185f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import +++ /dev/null @@ -1,13 +0,0 @@ -script import sys, os -script sys.path.append(os.path.join(os.getcwd(), os.pardir)) -script import welcome -script import bug11569 -command script add welcome --class welcome.WelcomeCommand -command script add targetname --class welcome.TargetnameCommand -command script add longwait --function welcome.print_wait_impl -command script import mysto.py --allow-reload -command script add tell_sync --function welcome.check_for_synchro --synchronicity sync -command script add tell_async --function welcome.check_for_synchro --synchronicity async -command script add tell_curr --function welcome.check_for_synchro --synchronicity curr -command script add takes_exe_ctx --function welcome.takes_exe_ctx -command script import decorated.py diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py deleted file mode 100644 index 0539d7c1721..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py +++ /dev/null @@ -1,53 +0,0 @@ -from __future__ import print_function -import lldb -import sys - - -class WelcomeCommand(object): - - def __init__(self, debugger, session_dict): - pass - - def get_short_help(self): - return "Just a docstring for welcome_impl\nA command that says hello to LLDB users" - - def __call__(self, debugger, args, exe_ctx, result): - print('Hello ' + args + ', welcome to LLDB', file=result) - return None - - -class TargetnameCommand(object): - - def __init__(self, debugger, session_dict): - pass - - def __call__(self, debugger, args, exe_ctx, result): - target = debugger.GetSelectedTarget() - file = target.GetExecutable() - print('Current target ' + file.GetFilename(), file=result) - if args == 'fail': - result.SetError('a test for error in command') - - def get_flags(self): - return lldb.eCommandRequiresTarget - - -def print_wait_impl(debugger, args, result, dict): - result.SetImmediateOutputFile(sys.stdout) - print('Trying to do long task..', file=result) - import time - time.sleep(1) - print('Still doing long task..', file=result) - time.sleep(1) - print('Done; if you saw the delays I am doing OK', file=result) - - -def check_for_synchro(debugger, args, result, dict): - if debugger.GetAsync(): - print('I am running async', file=result) - if debugger.GetAsync() == False: - print('I am running sync', file=result) - - -def takes_exe_ctx(debugger, args, exe_ctx, result, dict): - print(str(exe_ctx.GetTarget()), file=result) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/.categories b/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/.categories deleted file mode 100644 index 3a3f4df6416..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py deleted file mode 100644 index e454365edeb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -Test lldb Python commands. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * - - -class CommandScriptAliasTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - self.pycmd_tests() - - def pycmd_tests(self): - self.runCmd("command script import tcsacmd.py") - self.runCmd("command script add -f tcsacmd.some_command_here attach") - - # This is the function to remove the custom commands in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('command script delete attach', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # We don't want to display the stdout if not in TraceOn() mode. - if not self.TraceOn(): - self.HideStdout() - - self.expect('attach a', substrs=['Victory is mine']) - self.runCmd("command script delete attach") - # this can't crash but we don't care whether the actual attach works - self.runCmd('attach noprocessexistswiththisname', check=False) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py deleted file mode 100644 index 8d3248c2723..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py +++ /dev/null @@ -1,11 +0,0 @@ -from __future__ import print_function -import lldb - - -def some_command_here(debugger, command, result, d): - if command == "a": - print("Victory is mine", file=result) - return True - else: - print("Sadness for all", file=result) - return False diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/.categories b/lldb/packages/Python/lldbsuite/test/functionalities/command_source/.categories deleted file mode 100644 index 3a3f4df6416..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/.lldb b/lldb/packages/Python/lldbsuite/test/functionalities/command_source/.lldb deleted file mode 100644 index ecbdcff4462..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/.lldb +++ /dev/null @@ -1,2 +0,0 @@ -# one more level of indirection to stress the command interpreter reentrancy -command source commands.txt diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py deleted file mode 100644 index a30f0d497be..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Test that lldb command "command source" works correctly. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CommandSourceTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_command_source(self): - """Test that lldb command "command source" works correctly.""" - - # Sourcing .lldb in the current working directory, which in turn imports - # the "my" package that defines the date() function. - self.runCmd("command source .lldb") - - # Python should evaluate "my.date()" successfully. - command_interpreter = self.dbg.GetCommandInterpreter() - self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) - result = lldb.SBCommandReturnObject() - command_interpreter.HandleCommand("script my.date()", result) - - import datetime - self.expect(result.GetOutput(), "script my.date() runs successfully", - exe=False, - substrs=[str(datetime.date.today())]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt b/lldb/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt deleted file mode 100644 index 8e4de66d469..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt +++ /dev/null @@ -1,2 +0,0 @@ -script import my -p 1 + 1 diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/my.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_source/my.py deleted file mode 100644 index bd97fda3cbb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_source/my.py +++ /dev/null @@ -1,7 +0,0 @@ -from __future__ import print_function - - -def date(): - import datetime - today = datetime.date.today() - print(today) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/Makefile deleted file mode 100644 index 8a7102e347a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py deleted file mode 100644 index 1ad8e23ac9b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -Test some lldb command abbreviations. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DisassemblyTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def test(self): - self.build() - target, _, _, bkpt = lldbutil.run_to_source_breakpoint(self, - "Set a breakpoint here", lldb.SBFileSpec("main.cpp")) - self.runCmd("dis -f") - disassembly_with_break = self.res.GetOutput().splitlines() - - self.assertTrue(target.BreakpointDelete(bkpt.GetID())) - - self.runCmd("dis -f") - disassembly_without_break = self.res.GetOutput().splitlines() - - # Make sure all assembly instructions are the same as instructions - # with the breakpoint removed. - self.assertEqual(len(disassembly_with_break), - len(disassembly_without_break)) - for dis_inst_with, dis_inst_without in \ - zip(disassembly_with_break, disassembly_without_break): - inst_with = dis_inst_with.split(':')[-1] - inst_without = dis_inst_without.split(':')[-1] - self.assertEqual(inst_with, inst_without) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py deleted file mode 100644 index 912b37d6d3e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -Test to ensure SBFrame::Disassemble produces SOME output -""" - -from __future__ import print_function - - -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 = self.getBuildArtifact("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/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp deleted file mode 100644 index 93d4b1cbd39..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int -sum (int a, int b) -{ - int result = a + b; // Set a breakpoint here - return result; -} - -int -main(int argc, char const *argv[]) -{ - - int array[3]; - - array[0] = sum (1238, 78392); - array[1] = sum (379265, 23674); - array[2] = sum (872934, 234); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/.categories b/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/.categories deleted file mode 100644 index 897e40a99dd..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/.categories +++ /dev/null @@ -1 +0,0 @@ -expression diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/Makefile deleted file mode 100644 index a10791d5890..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := locking.c -ENABLE_THREADS := YES - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py b/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py deleted file mode 100644 index 5b5042b63e4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Test that expr will time out and allow other threads to run if it blocks. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ExprDoesntDeadlockTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17946') - @expectedFailureAll( - oslist=["windows"], - bugnumber="Windows doesn't have pthreads, test needs to be ported") - @add_test_categories(["basic_process"]) - def test_with_run_command(self): - """Test that expr will time out and allow other threads to run if it blocks.""" - self.build() - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now create a breakpoint at source line before call_me_to_get_lock - # gets called. - - main_file_spec = lldb.SBFileSpec("locking.c") - breakpoint = target.BreakpointCreateBySourceRegex( - 'Break here', main_file_spec) - if self.TraceOn(): - print("breakpoint:", breakpoint) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # Frame #0 should be on self.line1 and the break condition should hold. - from lldbsuite.test.lldbutil import get_stopped_thread - thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint condition") - - frame0 = thread.GetFrameAtIndex(0) - - var = frame0.EvaluateExpression("call_me_to_get_lock()") - self.assertTrue(var.IsValid()) - self.assertTrue(var.GetValueAsSigned(0) == 567) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/locking.c b/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/locking.c deleted file mode 100644 index fae9979611d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/locking.c +++ /dev/null @@ -1,80 +0,0 @@ -#include <pthread.h> -#include <stdlib.h> -#include <unistd.h> -#include <stdio.h> - -pthread_mutex_t contended_mutex = PTHREAD_MUTEX_INITIALIZER; - -pthread_mutex_t control_mutex = PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t control_condition; - -pthread_mutex_t thread_started_mutex = PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t thread_started_condition; - -// This function runs in a thread. The locking dance is to make sure that -// by the time the main thread reaches the pthread_join below, this thread -// has for sure acquired the contended_mutex. So then the call_me_to_get_lock -// function will block trying to get the mutex, and only succeed once it -// signals this thread, then lets it run to wake up from the cond_wait and -// release the mutex. - -void * -lock_acquirer_1 (void *input) -{ - pthread_mutex_lock (&contended_mutex); - - // Grab this mutex, that will ensure that the main thread - // is in its cond_wait for it (since that's when it drops the mutex. - - pthread_mutex_lock (&thread_started_mutex); - pthread_mutex_unlock(&thread_started_mutex); - - // Now signal the main thread that it can continue, we have the contended lock - // so the call to call_me_to_get_lock won't make any progress till this - // thread gets a chance to run. - - pthread_mutex_lock (&control_mutex); - - pthread_cond_signal (&thread_started_condition); - - pthread_cond_wait (&control_condition, &control_mutex); - - pthread_mutex_unlock (&contended_mutex); - return NULL; -} - -int -call_me_to_get_lock () -{ - pthread_cond_signal (&control_condition); - pthread_mutex_lock (&contended_mutex); - return 567; -} - -int main () -{ - pthread_t thread_1; - - pthread_cond_init (&control_condition, NULL); - pthread_cond_init (&thread_started_condition, NULL); - - pthread_mutex_lock (&thread_started_mutex); - - pthread_create (&thread_1, NULL, lock_acquirer_1, NULL); - - pthread_cond_wait (&thread_started_condition, &thread_started_mutex); - - pthread_mutex_lock (&control_mutex); - pthread_mutex_unlock (&control_mutex); - - // Break here. At this point the other thread will have the contended_mutex, - // and be sitting in its cond_wait for the control condition. So there is - // no way that our by-hand calling of call_me_to_get_lock will proceed - // without running the first thread at least somewhat. - - call_me_to_get_lock(); - pthread_join (thread_1, NULL); - - return 0; - -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile deleted file mode 100644 index 0d70f259501..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py b/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py deleted file mode 100644 index 56abc19f4f3..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Tests expressions evaluation when the breakpoint on module's entry is set. -""" - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - -class ExprEntryBPTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def test_expr_entry_bp(self): - """Tests expressions evaluation when the breakpoint on module's entry is set.""" - self.build() - self.main_source_file = lldb.SBFileSpec("main.c") - - (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", self.main_source_file) - - self.assertEqual(1, bkpt.GetNumLocations()) - entry = bkpt.GetLocationAtIndex(0).GetAddress().GetModule().GetObjectFileEntryPointAddress() - self.assertTrue(entry.IsValid(), "Can't get a module entry point") - - entry_bp = target.BreakpointCreateBySBAddress(entry) - self.assertTrue(entry_bp.IsValid(), "Can't set a breakpoint on the module entry point") - - result = target.EvaluateExpression("sum(7, 1)") - self.assertTrue(result.IsValid(), "Can't evaluate expression") - self.assertEqual(8, result.GetValueAsSigned()) - - def setUp(self): - TestBase.setUp(self) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/main.c deleted file mode 100644 index 168fc9c8ccb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> - -int sum(int x, int y) { - return x + y; -} - -int main() { - printf("Set a breakpoint here.\n"); - return sum(-1, 1); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py deleted file mode 100644 index 741fb7bbaa0..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Test the output of `frame diagnose` for an array access -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestArray(TestBase): - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_array(self): - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect( - "frame diagnose", - "Crash diagnosis was accurate", - substrs=["a[10]"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c deleted file mode 100644 index 95c6515e5f5..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c +++ /dev/null @@ -1,9 +0,0 @@ -struct Foo { - int b; - int c; -}; - -int main() { - struct Foo *a = 0; - return a[10].c; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py deleted file mode 100644 index 3ba0f7a6c42..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a bad reference -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestBadReference(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_bad_reference(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect("frame diagnose", "Crash diagnosis was accurate", "f->b") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp deleted file mode 100644 index 2f61152e398..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp +++ /dev/null @@ -1,22 +0,0 @@ -struct Bar { - int c; - int d; -}; - -struct Foo { - int a; - struct Bar &b; -}; - -struct Foo *GetAFoo() { - static struct Foo f = { 0, *((Bar*)0) }; - return &f; -} - -int GetSum(struct Foo *f) { - return f->a + f->b.d; -} - -int main() { - return GetSum(GetAFoo()); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py deleted file mode 100644 index 52691d9f471..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Test the output of `frame diagnose` for a subexpression of a complicated expression -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDiagnoseDereferenceArgument(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_diagnose_dereference_argument(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect( - "frame diagnose", - "Crash diagnosis was accurate", - "f->b->d") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c deleted file mode 100644 index 147aae94614..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c +++ /dev/null @@ -1,26 +0,0 @@ -struct Bar { - int c; - int d; -}; - -struct Foo { - int a; - struct Bar *b; -}; - -struct Foo *GetAFoo() { - static struct Foo f = { 0, 0 }; - return &f; -} - -int SumTwoIntegers(int x, int y) { - return x + y; -} - -int GetSum(struct Foo *f) { - return SumTwoIntegers(f->a, f->b->d ? 0 : 1); -} - -int main() { - return GetSum(GetAFoo()); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py deleted file mode 100644 index c0dac49586f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a function argument -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDiagnoseDereferenceArgument(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_diagnose_dereference_argument(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect( - "frame diagnose", - "Crash diagnosis was accurate", - "f->b->d") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c deleted file mode 100644 index 0ec23b13be1..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c +++ /dev/null @@ -1,22 +0,0 @@ -struct Bar { - int c; - int d; -}; - -struct Foo { - int a; - struct Bar *b; -}; - -struct Foo *GetAFoo() { - static struct Foo f = { 0, 0 }; - return &f; -} - -int GetSum(struct Foo *f) { - return f->a + f->b->d; -} - -int main() { - return GetSum(GetAFoo()); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py deleted file mode 100644 index ebce5ae54c2..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a function's return value -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDiagnoseDereferenceFunctionReturn(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - @expectedFailureAll(oslist=['macosx'], archs=['i386'], bugnumber="rdar://28656408") - def test_diagnose_dereference_function_return(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect( - "frame diagnose", - "Crash diagnosis was accurate", - substrs=[ - "GetAFoo", - "->b"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c deleted file mode 100644 index 420e6f21de6..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c +++ /dev/null @@ -1,12 +0,0 @@ -struct Foo { - int a; - int b; -}; - -struct Foo *GetAFoo() { - return 0; -} - -int main() { - return GetAFoo()->b; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py deleted file mode 100644 index 1251ad551ac..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing `this` -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDiagnoseDereferenceThis(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_diagnose_dereference_this(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect( - "frame diagnose", - "Crash diagnosis was accurate", - "this->a") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp deleted file mode 100644 index 1f177230ed9..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -struct Foo { - int a; - int b; - int Sum() { return a + b; } -}; - -struct Foo *GetAFoo() { - return (struct Foo*)0; -} - -int main() { - struct Foo *foo = GetAFoo(); - return foo->Sum(); -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py deleted file mode 100644 index 18fb263b47b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Test the output of `frame diagnose` for calling virtual methods -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDiagnoseInheritance(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_diagnose_inheritance(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect("frame diagnose", "Crash diagnosis was accurate", "d") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp deleted file mode 100644 index 78cac2c8965..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include <stdio.h> -#include <stdint.h> - -class A -{ -public: - A(int a) : - m_a(a) - { - } - virtual ~A(){} - virtual int get2() const { return m_a; } - virtual int get() const { return m_a; } -protected: - int m_a; -}; - -class B : public A -{ -public: - B(int a, int b) : - A(a), - m_b(b) - { - } - - ~B() override - { - } - - int get2() const override - { - return m_b; - } - int get() const override - { - return m_b; - } - -protected: - int m_b; -}; - -struct C -{ - C(int c) : m_c(c){} - virtual ~C(){} - int m_c; -}; - -class D : public C, public B -{ -public: - D(int a, int b, int c, int d) : - C(c), - B(a, b), - m_d(d) - { - } -protected: - int m_d; -}; -int main (int argc, char const *argv[], char const *envp[]) -{ - D *good_d = new D(1, 2, 3, 4); - D *d = nullptr; - return d->get(); -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py deleted file mode 100644 index e4fd86e0db4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a local variable -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestLocalVariable(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_local_variable(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect("frame diagnose", "Crash diagnosis was accurate", "myInt") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c deleted file mode 100644 index 33307beb070..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() { - int *myInt = 0; - return *myInt; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py deleted file mode 100644 index ed91b487c95..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Test the output of `frame diagnose` for calling virtual methods -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDiagnoseVirtualMethodCall(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64 - def test_diagnose_virtual_method_call(self): - TestBase.setUp(self) - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", "Thread should be stopped", - substrs=['stopped']) - self.expect("frame diagnose", "Crash diagnosis was accurate", "foo") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp deleted file mode 100644 index 2a03dc11bf2..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -class Foo { -public: - int a; - int b; - virtual int Sum() { return a + b; } -}; - -struct Foo *GetAFoo() { - return (struct Foo*)0; -} - -int main() { - struct Foo *foo = GetAFoo(); - return foo->Sum(); -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile deleted file mode 100644 index cb1af719ac3..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -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 $(SRCDIR)/other-2.cpp - -somefunc.o: somefunc.c - $(CC) $(CFLAGS) -std=c99 -c $(SRCDIR)/somefunc.c diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py deleted file mode 100644 index 19fa3e9f0d8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Test the SB API SBFrame::GuessLanguage. -""" - -from __future__ import print_function - - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * -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 - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37658") - 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 = self.getBuildArtifact("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/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp deleted file mode 100644 index f5449f21790..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> -#include "other.h" - -int -main() -{ - int test_var = 10; - Other::DoSomethingElse(); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp deleted file mode 100644 index 77632de3ceb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "other.h" - -void -Other::DoSomethingElse() -{ - DoSomething(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp deleted file mode 100644 index 41f4f26079a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "other.h" - -extern "C" void some_func(); - -void -Other::DoSomething() -{ - some_func(); -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other.h b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other.h deleted file mode 100644 index 0a2c125e6b4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/other.h +++ /dev/null @@ -1,7 +0,0 @@ -class Other -{ - public: - static void DoSomething(); - static void DoSomethingElse(); -}; - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c deleted file mode 100644 index a4b4f47f32e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -void -some_func() -{ - printf("Set breakpoint here."); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile deleted file mode 100644 index 45f00b3e986..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -LEVEL = ../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -g0 # No debug info. -MAKE_DSYM := NO - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py deleted file mode 100644 index 2ecbe1e4c15..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py +++ /dev/null @@ -1,119 +0,0 @@ -# encoding: utf-8 -""" -Test lldb's frame recognizers. -""" - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -import recognizer - -class FrameRecognizerTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @skipUnlessDarwin - def test_frame_recognizer_1(self): - self.build() - - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.assertTrue(target, VALID_TARGET) - - self.runCmd("command script import " + os.path.join(self.getSourceDir(), "recognizer.py")) - - self.expect("frame recognizer list", - substrs=['no matching results found.']) - - self.runCmd("frame recognizer add -l recognizer.MyFrameRecognizer -s a.out -n foo") - - self.expect("frame recognizer list", - substrs=['0: recognizer.MyFrameRecognizer, module a.out, function foo']) - - self.runCmd("frame recognizer add -l recognizer.MyOtherFrameRecognizer -s a.out -n bar -x") - - self.expect("frame recognizer list", - substrs=['0: recognizer.MyFrameRecognizer, module a.out, function foo', - '1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)' - ]) - - self.runCmd("frame recognizer delete 0") - - self.expect("frame recognizer list", - substrs=['1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)']) - - self.runCmd("frame recognizer clear") - - self.expect("frame recognizer list", - substrs=['no matching results found.']) - - self.runCmd("frame recognizer add -l recognizer.MyFrameRecognizer -s a.out -n foo") - - lldbutil.run_break_set_by_symbol(self, "foo") - self.runCmd("r") - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - process = target.GetProcess() - thread = process.GetSelectedThread() - frame = thread.GetSelectedFrame() - - self.assertEqual(frame.GetSymbol().GetName(), "foo") - self.assertFalse(frame.GetLineEntry().IsValid()) - - self.expect("frame variable", - substrs=['(int) a = 42', '(int) b = 56']) - - # Recognized arguments don't show up by default... - variables = frame.GetVariables(lldb.SBVariablesOptions()) - self.assertEqual(variables.GetSize(), 0) - - # ...unless you set target.display-recognized-arguments to 1... - self.runCmd("settings set target.display-recognized-arguments 1") - variables = frame.GetVariables(lldb.SBVariablesOptions()) - self.assertEqual(variables.GetSize(), 2) - - # ...and you can reset it back to 0 to hide them again... - self.runCmd("settings set target.display-recognized-arguments 0") - variables = frame.GetVariables(lldb.SBVariablesOptions()) - self.assertEqual(variables.GetSize(), 0) - - # ... or explicitly ask for them with SetIncludeRecognizedArguments(True). - opts = lldb.SBVariablesOptions() - opts.SetIncludeRecognizedArguments(True) - variables = frame.GetVariables(opts) - - self.assertEqual(variables.GetSize(), 2) - self.assertEqual(variables.GetValueAtIndex(0).name, "a") - self.assertEqual(variables.GetValueAtIndex(0).signed, 42) - self.assertEqual(variables.GetValueAtIndex(0).GetValueType(), lldb.eValueTypeVariableArgument) - self.assertEqual(variables.GetValueAtIndex(1).name, "b") - self.assertEqual(variables.GetValueAtIndex(1).signed, 56) - self.assertEqual(variables.GetValueAtIndex(1).GetValueType(), lldb.eValueTypeVariableArgument) - - self.expect("frame recognizer info 0", - substrs=['frame 0 is recognized by recognizer.MyFrameRecognizer']) - - self.expect("frame recognizer info 999", error=True, - substrs=['no frame with index 999']) - - self.expect("frame recognizer info 1", - substrs=['frame 1 not recognized by any recognizer']) - - # FIXME: The following doesn't work yet, but should be fixed. - """ - lldbutil.run_break_set_by_symbol(self, "bar") - self.runCmd("c") - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - self.expect("frame variable -t", - substrs=['(int *) a = ']) - - self.expect("frame variable -t *a", - substrs=['*a = 78']) - """ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m deleted file mode 100644 index 9c6ce9d2102..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -void foo(int a, int b) -{ - printf("%d %d\n", a, b); -} - -void bar(int *ptr) -{ - printf("%d\n", *ptr); -} - -int main (int argc, const char * argv[]) -{ - foo(42, 56); - int i = 78; - bar(&i); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py deleted file mode 100644 index a8a50674511..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: utf-8 - -import lldb - -class MyFrameRecognizer(object): - def get_recognized_arguments(self, frame): - if frame.name == "foo": - arg1 = frame.EvaluateExpression("$arg1").signed - arg2 = frame.EvaluateExpression("$arg2").signed - val1 = lldb.target.CreateValueFromExpression("a", "%d" % arg1) - val2 = lldb.target.CreateValueFromExpression("b", "%d" % arg2) - return [val1, val2] - elif frame.name == "bar": - arg1 = frame.EvaluateExpression("$arg1").signed - val1 = lldb.target.CreateValueFromExpression("a", "(int *)%d" % arg1) - return [val1] - return [] - -class MyOtherFrameRecognizer(object): - def get_recognized_arguments(self, frame): - return [] diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/Makefile deleted file mode 100644 index 50d4ab65a6e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -std=c99 - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py deleted file mode 100644 index 8b294a71c18..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Make sure the frame variable -g, -a, and -l flags work. -""" - -from __future__ import print_function - - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class TestFrameVar(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_frame_var(self): - self.build() - self.do_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def do_test(self): - exe = self.getBuildArtifact("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.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) - - frame = threads[0].GetFrameAtIndex(0) - command_result = lldb.SBCommandReturnObject() - interp = self.dbg.GetCommandInterpreter() - - # Just get args: - result = interp.HandleCommand("frame var -l", command_result) - self.assertEqual(result, lldb.eReturnStatusSuccessFinishResult, "frame var -a didn't succeed") - output = command_result.GetOutput() - self.assertTrue("argc" in output, "Args didn't find argc") - self.assertTrue("argv" in output, "Args didn't find argv") - self.assertTrue("test_var" not in output, "Args found a local") - self.assertTrue("g_var" not in output, "Args found a global") - - # Just get locals: - result = interp.HandleCommand("frame var -a", command_result) - self.assertEqual(result, lldb.eReturnStatusSuccessFinishResult, "frame var -a didn't succeed") - output = command_result.GetOutput() - self.assertTrue("argc" not in output, "Locals found argc") - self.assertTrue("argv" not in output, "Locals found argv") - self.assertTrue("test_var" in output, "Locals didn't find test_var") - self.assertTrue("g_var" not in output, "Locals found a global") - - # Get the file statics: - result = interp.HandleCommand("frame var -l -a -g", command_result) - self.assertEqual(result, lldb.eReturnStatusSuccessFinishResult, "frame var -a didn't succeed") - output = command_result.GetOutput() - self.assertTrue("argc" not in output, "Globals found argc") - self.assertTrue("argv" not in output, "Globals found argv") - self.assertTrue("test_var" not in output, "Globals found test_var") - self.assertTrue("g_var" in output, "Globals didn't find g_var") - - - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/main.c deleted file mode 100644 index da23af2ac55..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <stdio.h> - -int g_var = 200; - -int -main(int argc, char **argv) -{ - int test_var = 10; - printf ("Set a breakpoint here: %d %d.\n", test_var, g_var); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile deleted file mode 100644 index f5a47fcc46c..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../make -C_SOURCES := main.c -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py deleted file mode 100644 index 48e49ed009b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest( - __file__, globals(), []) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c deleted file mode 100644 index 71f4cb234e3..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c +++ /dev/null @@ -1,20 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int foo(int x, int y) { - int z = 3 + x; - return z + y; //% self.expect("frame variable -s", substrs=['ARG: (int) x = -3','ARG: (int) y = 0']) - //% self.expect("frame variable -s x", substrs=['ARG: (int) x = -3']) - //% self.expect("frame variable -s y", substrs=['ARG: (int) y = 0']) - //% self.expect("frame variable -s z", substrs=['LOCAL: (int) z = 0']) -} - -int main (int argc, char const *argv[]) -{ - return foo(-3,0); //% self.expect("frame variable -s argc argv", substrs=['ARG: (int) argc =']) -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/Makefile deleted file mode 100644 index 8a7102e347a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py deleted file mode 100644 index 1ba812159fb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py +++ /dev/null @@ -1,120 +0,0 @@ -""" -Test that argdumper is a viable launching strategy. -""" -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LaunchWithShellExpandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=[ - "windows", - "linux", - "freebsd"], - bugnumber="llvm.org/pr24778 llvm.org/pr22627") - @skipIfDarwinEmbedded # iOS etc don't launch the binary via a shell, so arg expansion won't happen - @expectedFailureNetBSD - def test(self): - self.build() - exe = self.getBuildArtifact("a.out") - - self.runCmd("target create %s" % exe) - - # Create the target - target = self.dbg.CreateTarget(exe) - - # Create any breakpoints we need - breakpoint = target.BreakpointCreateBySourceRegex( - 'break here', lldb.SBFileSpec("main.cpp", False)) - self.assertTrue(breakpoint, VALID_BREAKPOINT) - - self.runCmd( - "process launch -X true -w %s -- fi*.tx? () > <" % - (self.getSourceDir())) - - process = self.process() - - self.assertTrue(process.GetState() == lldb.eStateStopped, - STOPPED_DUE_TO_BREAKPOINT) - - thread = process.GetThreadAtIndex(0) - - self.assertTrue(thread.IsValid(), - "Process stopped at 'main' should have a valid thread") - - stop_reason = thread.GetStopReason() - - self.assertTrue( - stop_reason == lldb.eStopReasonBreakpoint, - "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint") - - self.expect("frame variable argv[1]", substrs=['file1.txt']) - self.expect("frame variable argv[2]", substrs=['file2.txt']) - self.expect("frame variable argv[3]", substrs=['file3.txt']) - self.expect("frame variable argv[4]", substrs=['file4.txy']) - self.expect("frame variable argv[5]", substrs=['()']) - self.expect("frame variable argv[6]", substrs=['>']) - self.expect("frame variable argv[7]", substrs=['<']) - self.expect( - "frame variable argv[5]", - substrs=['file5.tyx'], - matching=False) - self.expect( - "frame variable argv[8]", - substrs=['file5.tyx'], - matching=False) - - self.runCmd("process kill") - - self.runCmd( - 'process launch -X true -w %s -- "foo bar"' % - (self.getSourceDir())) - - process = self.process() - - self.assertTrue(process.GetState() == lldb.eStateStopped, - STOPPED_DUE_TO_BREAKPOINT) - - thread = process.GetThreadAtIndex(0) - - self.assertTrue(thread.IsValid(), - "Process stopped at 'main' should have a valid thread") - - stop_reason = thread.GetStopReason() - - self.assertTrue( - stop_reason == lldb.eStopReasonBreakpoint, - "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint") - - self.expect("frame variable argv[1]", substrs=['foo bar']) - - self.runCmd("process kill") - - self.runCmd('process launch -X true -w %s -- foo\ bar' - % (self.getBuildDir())) - - process = self.process() - - self.assertTrue(process.GetState() == lldb.eStateStopped, - STOPPED_DUE_TO_BREAKPOINT) - - thread = process.GetThreadAtIndex(0) - - self.assertTrue(thread.IsValid(), - "Process stopped at 'main' should have a valid thread") - - stop_reason = thread.GetStopReason() - - self.assertTrue( - stop_reason == lldb.eStopReasonBreakpoint, - "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint") - - self.expect("frame variable argv[1]", substrs=['foo bar']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file1.txt b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file1.txt deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file1.txt +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file2.txt b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file2.txt deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file2.txt +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file3.txt b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file3.txt deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file3.txt +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file4.txy b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file4.txy deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file4.txy +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file5.tyx b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file5.tyx deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file5.tyx +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/foo bar b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/foo bar deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/foo bar +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/main.cpp deleted file mode 100644 index cbef8d1e6da..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int -main (int argc, char const **argv) -{ - return 0; // break here -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/Makefile deleted file mode 100644 index 8a7102e347a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py b/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py deleted file mode 100644 index 37c56f6d216..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py +++ /dev/null @@ -1,90 +0,0 @@ -""" -Test that an alias can reference other aliases without crashing. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class NestedAliasTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.cpp', '// break here') - - def test_nested_alias(self): - """Test that an alias can reference other aliases without crashing.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break in main() after the variables are assigned values. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - # This is the function to remove the custom aliases in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('command unalias read', check=False) - self.runCmd('command unalias rd', check=False) - self.runCmd('command unalias fo', check=False) - self.runCmd('command unalias foself', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd('command alias read memory read -f A') - self.runCmd('command alias rd read -c 3') - - self.expect( - 'memory read -f A -c 3 `&my_ptr[0]`', - substrs=[ - 'deadbeef', - 'main.cpp:', - 'feedbeef']) - self.expect( - 'rd `&my_ptr[0]`', - substrs=[ - 'deadbeef', - 'main.cpp:', - 'feedbeef']) - - self.expect( - 'memory read -f A -c 3 `&my_ptr[0]`', - substrs=['deadfeed'], - matching=False) - self.expect('rd `&my_ptr[0]`', substrs=['deadfeed'], matching=False) - - self.runCmd('command alias fo frame variable -O --') - self.runCmd('command alias foself fo self') - - self.expect( - 'help foself', - substrs=[ - '--show-all-children', - '--raw-output'], - matching=False) - self.expect( - 'help foself', - substrs=[ - 'Show variables for the current', - 'stack frame.'], - matching=True) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/main.cpp deleted file mode 100644 index 4df7eed40a5..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/nested_alias/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -int main (int argc, char const *argv[]) -{ - void* my_ptr[] = { - reinterpret_cast<void*>(0xDEADBEEF), - reinterpret_cast<void*>(main), - reinterpret_cast<void*>(0xFEEDBEEF), - reinterpret_cast<void*>(0xFEEDDEAD), - reinterpret_cast<void*>(0xDEADFEED) - }; - return 0; // break here -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/Makefile deleted file mode 100644 index 8a7102e347a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py b/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py deleted file mode 100644 index fd9812320f2..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Test that using a non-existent architecture name does not crash LLDB. -""" -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class NoSuchArchTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - self.build() - exe = self.getBuildArtifact("a.out") - - # Check that passing an invalid arch via the command-line fails but - # doesn't crash - self.expect( - "target crete --arch nothingtoseehere %s" % - (exe), error=True) - - # Check that passing an invalid arch via the SB API fails but doesn't - # crash - target = self.dbg.CreateTargetWithFileAndArch(exe, "nothingtoseehere") - self.assertFalse(target.IsValid(), "This target should not be valid") - - # Now just create the target with the default arch and check it's fine - target = self.dbg.CreateTarget(exe) - self.assertTrue(target.IsValid(), "This target should now be valid") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/main.cpp deleted file mode 100644 index 4cce7f667ff..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/nosucharch/main.cpp +++ /dev/null @@ -1,3 +0,0 @@ -int main() { - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py deleted file mode 100644 index 2e1deefe90e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py +++ /dev/null @@ -1,80 +0,0 @@ -""" -Test some lldb platform commands. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class PlatformCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_help_platform(self): - self.runCmd("help platform") - - @no_debug_info_test - def test_list(self): - self.expect("platform list", - patterns=['^Available platforms:']) - - @no_debug_info_test - def test_process_list(self): - self.expect("platform process list", - substrs=['PID', 'TRIPLE', 'NAME']) - - @no_debug_info_test - def test_process_info_with_no_arg(self): - """This is expected to fail and to return a proper error message.""" - self.expect("platform process info", error=True, - substrs=['one or more process id(s) must be specified']) - - @no_debug_info_test - def test_status(self): - self.expect( - "platform status", - substrs=[ - 'Platform', - 'Triple', - 'OS Version', - 'Kernel', - 'Hostname']) - - @expectedFailureAll(oslist=["windows"]) - @no_debug_info_test - def test_shell(self): - """ Test that the platform shell command can invoke ls. """ - triple = self.dbg.GetSelectedPlatform().GetTriple() - if re.match(".*-.*-windows", triple): - self.expect( - "platform shell dir c:\\", substrs=[ - "Windows", "Program Files"]) - elif re.match(".*-.*-.*-android", triple): - self.expect( - "platform shell ls /", - substrs=[ - "cache", - "dev", - "system"]) - else: - self.expect("platform shell ls /", substrs=["dev", "tmp", "usr"]) - - @no_debug_info_test - def test_shell_builtin(self): - """ Test a shell built-in command (echo) """ - self.expect("platform shell echo hello lldb", - substrs=["hello lldb"]) - - # FIXME: re-enable once platform shell -t can specify the desired timeout - @no_debug_info_test - def test_shell_timeout(self): - """ Test a shell built-in command (sleep) that times out """ - self.skipTest("due to taking too long to complete.") - self.expect("platform shell sleep 15", error=True, substrs=[ - "error: timed out waiting for shell command to complete"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py b/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py deleted file mode 100644 index f105847d0bb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py +++ /dev/null @@ -1,82 +0,0 @@ -""" -Test the lldb platform Python API. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class PlatformPythonTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @no_debug_info_test - def test_platform_list(self): - """Test SBDebugger::GetNumPlatforms() & GetPlatformAtIndex() API""" - # Verify the host platform is present by default. - initial_num_platforms = self.dbg.GetNumPlatforms() - self.assertGreater(initial_num_platforms, 0) - host_platform = self.dbg.GetPlatformAtIndex(0) - self.assertTrue(host_platform.IsValid() and - host_platform.GetName() == 'host', - 'The host platform is present') - # Select another platform and verify that the platform is added to - # the platform list. - platform_idx = self.dbg.GetNumAvailablePlatforms() - 1 - if platform_idx < 1: - self.fail('No platforms other than host are available') - platform_data = self.dbg.GetAvailablePlatformInfoAtIndex(platform_idx) - platform_name = platform_data.GetValueForKey('name').GetStringValue(100) - self.assertNotEqual(platform_name, 'host') - self.dbg.SetCurrentPlatform(platform_name) - selected_platform = self.dbg.GetSelectedPlatform() - self.assertTrue(selected_platform.IsValid()) - self.assertEqual(selected_platform.GetName(), platform_name) - self.assertEqual(self.dbg.GetNumPlatforms(), initial_num_platforms + 1) - platform_found = False - for platform_idx in range(self.dbg.GetNumPlatforms()): - platform = self.dbg.GetPlatformAtIndex(platform_idx) - if platform.GetName() == platform_name: - platform_found = True - break - self.assertTrue(platform_found) - - @add_test_categories(['pyapi']) - @no_debug_info_test - def test_host_is_connected(self): - # We've already tested that this one IS the host platform. - host_platform = self.dbg.GetPlatformAtIndex(0) - self.assertTrue(host_platform.IsConnected(), "The host platform is always connected") - - - @add_test_categories(['pyapi']) - @no_debug_info_test - def test_available_platform_list(self): - """Test SBDebugger::GetNumAvailablePlatforms() and GetAvailablePlatformInfoAtIndex() API""" - num_platforms = self.dbg.GetNumAvailablePlatforms() - self.assertGreater( - num_platforms, 0, - 'There should be at least one platform available') - - for i in range(num_platforms): - platform_data = self.dbg.GetAvailablePlatformInfoAtIndex(i) - name_data = platform_data.GetValueForKey('name') - desc_data = platform_data.GetValueForKey('description') - self.assertTrue( - name_data and name_data.IsValid(), - 'Platform has a name') - self.assertEqual( - name_data.GetType(), lldb.eStructuredDataTypeString, - 'Platform name is a string') - self.assertTrue( - desc_data and desc_data.IsValid(), - 'Platform has a description') - self.assertEqual( - desc_data.GetType(), lldb.eStructuredDataTypeString, - 'Platform description is a string') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/Makefile index 8af06446ece..8af06446ece 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/Makefile diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/TestPluginCommands.py index e81d4076574..e81d4076574 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/TestPluginCommands.py diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/plugin.cpp.template index 1667c0d721e..1667c0d721e 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template +++ b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/command_plugin/plugin.cpp.template diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/Makefile deleted file mode 100644 index a964853f534..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -EXE := ProcessAttach - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py deleted file mode 100644 index 6210ba0eefc..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py +++ /dev/null @@ -1,91 +0,0 @@ -""" -Test process attach. -""" - -from __future__ import print_function - - -import os -import lldb -import shutil -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -exe_name = "ProcessAttach" # Must match Makefile - - -class ProcessAttachTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - @skipIfiOSSimulator - @expectedFailureNetBSD - def test_attach_to_process_by_id(self): - """Test attach by process id""" - self.build() - exe = self.getBuildArtifact(exe_name) - - # Spawn a new process - popen = self.spawnSubprocess(exe) - self.addTearDownHook(self.cleanupSubprocesses) - - self.runCmd("process attach -p " + str(popen.pid)) - - target = self.dbg.GetSelectedTarget() - - process = target.GetProcess() - self.assertTrue(process, PROCESS_IS_VALID) - - @expectedFailureNetBSD - def test_attach_to_process_from_different_dir_by_id(self): - """Test attach by process id""" - newdir = self.getBuildArtifact("newdir") - try: - os.mkdir(newdir) - except OSError as e: - if e.errno != os.errno.EEXIST: - raise - testdir = self.getBuildDir() - exe = os.path.join(newdir, 'proc_attach') - self.buildProgram('main.cpp', exe) - self.addTearDownHook(lambda: shutil.rmtree(newdir)) - - # Spawn a new process - popen = self.spawnSubprocess(exe) - self.addTearDownHook(self.cleanupSubprocesses) - - os.chdir(newdir) - self.addTearDownHook(lambda: os.chdir(testdir)) - self.runCmd("process attach -p " + str(popen.pid)) - - target = self.dbg.GetSelectedTarget() - - process = target.GetProcess() - self.assertTrue(process, PROCESS_IS_VALID) - - @expectedFailureNetBSD - def test_attach_to_process_by_name(self): - """Test attach by process name""" - self.build() - exe = self.getBuildArtifact(exe_name) - - # Spawn a new process - popen = self.spawnSubprocess(exe) - self.addTearDownHook(self.cleanupSubprocesses) - - self.runCmd("process attach -n " + exe_name) - - target = self.dbg.GetSelectedTarget() - - process = target.GetProcess() - self.assertTrue(process, PROCESS_IS_VALID) - - def tearDown(self): - # Destroy process before TestBase.tearDown() - self.dbg.GetSelectedTarget().GetProcess().Destroy() - - # Call super's tearDown(). - TestBase.tearDown(self) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile deleted file mode 100644 index 3c1f73515eb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -EXE := AttachDenied - -all: AttachDenied sign - -include $(LEVEL)/Makefile.rules - -sign: entitlements.plist AttachDenied -ifeq ($(OS),Darwin) - codesign -s - -f --entitlements $^ -endif diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py deleted file mode 100644 index 49499554c2e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Test denied process attach. -""" - -from __future__ import print_function - - -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -exe_name = 'AttachDenied' # Must match Makefile - - -class AttachDeniedTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @skipIfWindows - @skipIfiOSSimulator - @skipIfDarwinEmbedded # ptrace(ATTACH_REQUEST...) won't work on ios/tvos/etc - def test_attach_to_process_by_id_denied(self): - """Test attach by process id denied""" - self.build() - exe = self.getBuildArtifact(exe_name) - - # Use a file as a synchronization point between test and inferior. - pid_file_path = lldbutil.append_to_process_working_directory(self, - "pid_file_%d" % (int(time.time()))) - self.addTearDownHook( - lambda: self.run_platform_command( - "rm %s" % - (pid_file_path))) - - # Spawn a new process - popen = self.spawnSubprocess(exe, [pid_file_path]) - self.addTearDownHook(self.cleanupSubprocesses) - - pid = lldbutil.wait_for_file_on_target(self, pid_file_path) - - self.expect('process attach -p ' + pid, - startstr='error: attach failed:', - error=True) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist deleted file mode 100644 index 3d60e8bd0b9..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>com.apple.security.cs.debugger</key> - <true/> -</dict> -</plist> diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/main.cpp deleted file mode 100644 index ff1fccae4b1..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/main.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include <errno.h> -#include <fcntl.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <sys/types.h> -#include <sys/ptrace.h> -#include <sys/stat.h> -#include <sys/wait.h> - -#if defined(PTRACE_ATTACH) -#define ATTACH_REQUEST PTRACE_ATTACH -#define DETACH_REQUEST PTRACE_DETACH -#elif defined(PT_ATTACH) -#define ATTACH_REQUEST PT_ATTACH -#define DETACH_REQUEST PT_DETACH -#else -#error "Unsupported platform" -#endif - -bool writePid (const char* file_name, const pid_t pid) -{ - char *tmp_file_name = (char *)malloc(strlen(file_name) + 16); - strcpy(tmp_file_name, file_name); - strcat(tmp_file_name, "_tmp"); - int fd = open (tmp_file_name, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR); - if (fd == -1) - { - fprintf (stderr, "open(%s) failed: %s\n", tmp_file_name, strerror (errno)); - free(tmp_file_name); - return false; - } - char buffer[64]; - snprintf (buffer, sizeof(buffer), "%ld", (long)pid); - - bool res = true; - if (write (fd, buffer, strlen (buffer)) == -1) - { - fprintf (stderr, "write(%s) failed: %s\n", buffer, strerror (errno)); - res = false; - } - close (fd); - - if (rename (tmp_file_name, file_name) == -1) - { - fprintf (stderr, "rename(%s, %s) failed: %s\n", tmp_file_name, file_name, strerror (errno)); - res = false; - } - free(tmp_file_name); - - return res; -} - -void signal_handler (int) -{ -} - -int main (int argc, char const *argv[]) -{ - if (argc < 2) - { - fprintf (stderr, "invalid number of command line arguments\n"); - return 1; - } - - const pid_t pid = fork (); - if (pid == -1) - { - fprintf (stderr, "fork failed: %s\n", strerror (errno)); - return 1; - } - - if (pid > 0) - { - // Make pause call to return when a signal is received. Normally this happens when the - // test runner tries to terminate us. - signal (SIGHUP, signal_handler); - signal (SIGTERM, signal_handler); - if (ptrace (ATTACH_REQUEST, pid, NULL, 0) == -1) - { - fprintf (stderr, "ptrace(ATTACH) failed: %s\n", strerror (errno)); - } - else - { - if (writePid (argv[1], pid)) - pause (); // Waiting for the debugger trying attach to the child. - - if (ptrace (DETACH_REQUEST, pid, NULL, 0) != 0) - fprintf (stderr, "ptrace(DETACH) failed: %s\n", strerror (errno)); - } - - kill (pid, SIGTERM); - int status = 0; - if (waitpid (pid, &status, 0) == -1) - fprintf (stderr, "waitpid failed: %s\n", strerror (errno)); - } - else - { - // child inferior. - pause (); - } - - printf ("Exiting now\n"); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/main.cpp deleted file mode 100644 index 46ffacc0a84..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include <stdio.h> - -#include <chrono> -#include <thread> - -int main(int argc, char const *argv[]) { - int temp; - lldb_enable_attach(); - - // Waiting to be attached by the debugger. - temp = 0; - - while (temp < 30) // Waiting to be attached... - { - std::this_thread::sleep_for(std::chrono::seconds(2)); - temp++; - } - - printf("Exiting now\n"); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/Makefile deleted file mode 100644 index 313da706b4a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp -#CXX_SOURCES := print-cwd.cpp - -include $(LEVEL)/Makefile.rules - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py deleted file mode 100644 index a2b27c2e590..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py +++ /dev/null @@ -1,205 +0,0 @@ -""" -Test lldb process launch flags. -""" - -from __future__ import print_function - -import os - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -import six - - -class ProcessLaunchTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.runCmd("settings set auto-confirm true") - - def tearDown(self): - self.runCmd("settings clear auto-confirm") - TestBase.tearDown(self) - - @not_remote_testsuite_ready - def test_io(self): - """Test that process launch I/O redirection flags work properly.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.expect("file " + exe, - patterns=["Current executable set to .*a.out"]) - - in_file = os.path.join(self.getSourceDir(), "input-file.txt") - out_file = lldbutil.append_to_process_working_directory(self, "output-test.out") - err_file = lldbutil.append_to_process_working_directory(self, "output-test.err") - - # Make sure the output files do not exist before launching the process - try: - os.remove(out_file) - except OSError: - pass - - try: - os.remove(err_file) - except OSError: - pass - - launch_command = "process launch -i '{0}' -o '{1}' -e '{2}' -w '{3}'".format( - in_file, out_file, err_file, self.get_process_working_directory()) - - if lldb.remote_platform: - self.runCmd('platform put-file "{local}" "{remote}"'.format( - local=in_file, remote=in_file)) - - self.expect(launch_command, - patterns=["Process .* launched: .*a.out"]) - - success = True - err_msg = "" - - out = lldbutil.read_file_on_target(self, out_file) - if out != "This should go to stdout.\n": - success = False - err_msg = err_msg + " ERROR: stdout file does not contain correct output.\n" - - - err = lldbutil.read_file_on_target(self, err_file) - if err != "This should go to stderr.\n": - success = False - err_msg = err_msg + " ERROR: stderr file does not contain correct output.\n" - - if not success: - self.fail(err_msg) - - # rdar://problem/9056462 - # The process launch flag '-w' for setting the current working directory - # not working? - @not_remote_testsuite_ready - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20265") - @expectedFailureNetBSD - def test_set_working_dir_nonexisting(self): - """Test that '-w dir' fails to set the working dir when running the inferior with a dir which doesn't exist.""" - d = {'CXX_SOURCES': 'print_cwd.cpp'} - self.build(dictionary=d) - self.setTearDownCleanup(d) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe) - - mywd = 'my_working_dir' - out_file_name = "my_working_dir_test.out" - err_file_name = "my_working_dir_test.err" - - my_working_dir_path = self.getBuildArtifact(mywd) - out_file_path = os.path.join(my_working_dir_path, out_file_name) - err_file_path = os.path.join(my_working_dir_path, err_file_name) - - # Check that we get an error when we have a nonexisting path - invalid_dir_path = mywd + 'z' - launch_command = "process launch -w %s -o %s -e %s" % ( - invalid_dir_path, out_file_path, err_file_path) - - self.expect( - launch_command, error=True, patterns=[ - "error:.* No such file or directory: %s" % - invalid_dir_path]) - - @not_remote_testsuite_ready - def test_set_working_dir_existing(self): - """Test that '-w dir' sets the working dir when running the inferior.""" - d = {'CXX_SOURCES': 'print_cwd.cpp'} - self.build(dictionary=d) - self.setTearDownCleanup(d) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe) - - mywd = 'my_working_dir' - out_file_name = "my_working_dir_test.out" - err_file_name = "my_working_dir_test.err" - - my_working_dir_path = self.getBuildArtifact(mywd) - lldbutil.mkdir_p(my_working_dir_path) - out_file_path = os.path.join(my_working_dir_path, out_file_name) - err_file_path = os.path.join(my_working_dir_path, err_file_name) - - # Make sure the output files do not exist before launching the process - try: - os.remove(out_file_path) - os.remove(err_file_path) - except OSError: - pass - - launch_command = "process launch -w %s -o %s -e %s" % ( - my_working_dir_path, out_file_path, err_file_path) - - self.expect(launch_command, - patterns=["Process .* launched: .*a.out"]) - - success = True - err_msg = "" - - # Check to see if the 'stdout' file was created - try: - out_f = open(out_file_path) - except IOError: - success = False - err_msg = err_msg + "ERROR: stdout file was not created.\n" - else: - # Check to see if the 'stdout' file contains the right output - line = out_f.readline() - if self.TraceOn(): - print("line:", line) - if not re.search(mywd, line): - success = False - err_msg = err_msg + "The current working directory was not set correctly.\n" - out_f.close() - - # Try to delete the 'stdout' and 'stderr' files - try: - os.remove(out_file_path) - os.remove(err_file_path) - except OSError: - pass - - if not success: - self.fail(err_msg) - - def test_environment_with_special_char(self): - """Test that environment variables containing '*' and '}' are handled correctly by the inferior.""" - source = 'print_env.cpp' - d = {'CXX_SOURCES': source} - self.build(dictionary=d) - self.setTearDownCleanup(d) - exe = self.getBuildArtifact("a.out") - - evil_var = 'INIT*MIDDLE}TAIL' - - target = self.dbg.CreateTarget(exe) - main_source_spec = lldb.SBFileSpec(source) - breakpoint = target.BreakpointCreateBySourceRegex( - '// Set breakpoint here.', main_source_spec) - - process = target.LaunchSimple(None, - ['EVIL=' + evil_var], - self.get_process_working_directory()) - self.assertEqual( - process.GetState(), - lldb.eStateStopped, - PROCESS_STOPPED) - - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, breakpoint) - self.assertEqual(len(threads), 1) - frame = threads[0].GetFrameAtIndex(0) - sbvalue = frame.EvaluateExpression("evil") - value = sbvalue.GetSummary().strip('"') - - self.assertEqual(value, evil_var) - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/input-file.txt b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/input-file.txt deleted file mode 100644 index cc269ba0ff8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/input-file.txt +++ /dev/null @@ -1,2 +0,0 @@ -This should go to stdout. -This should go to stderr. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/main.cpp deleted file mode 100644 index f2035d55167..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -int -main (int argc, char **argv) -{ - char buffer[1024]; - - fgets (buffer, sizeof (buffer), stdin); - fprintf (stdout, "%s", buffer); - - - fgets (buffer, sizeof (buffer), stdin); - fprintf (stderr, "%s", buffer); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/print_cwd.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/print_cwd.cpp deleted file mode 100644 index b4b073fbcb8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/print_cwd.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include <stdio.h> - -#ifdef _MSC_VER -#define _CRT_NONSTDC_NO_WARNINGS -#include <direct.h> -#undef getcwd -#define getcwd(buffer, length) _getcwd(buffer, length) -#else -#include <unistd.h> -#endif - -int -main (int argc, char **argv) -{ - char buffer[1024]; - - fprintf(stdout, "stdout: %s\n", getcwd(buffer, 1024)); - fprintf(stderr, "stderr: %s\n", getcwd(buffer, 1024)); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp deleted file mode 100644 index 8c6df8ea01a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -int main (int argc, char **argv) -{ - char *evil = getenv("EVIL"); - - return 0; // Set breakpoint here. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile deleted file mode 100644 index 1c1be94b3d0..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -CFLAGS_EXTRAS += -mmpx -fcheck-pointer-bounds -fuse-ld=bfd - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py b/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py deleted file mode 100644 index f61ba59a5fe..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -Test the Intel(R) MPX registers. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class RegisterCommandsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - @skipIf(compiler="clang") - @skipIf(oslist=no_match(['linux'])) - @skipIf(archs=no_match(['i386', 'x86_64'])) - @skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX. - def test_mpx_registers_with_example_code(self): - """Test Intel(R) MPX registers with example code.""" - self.build() - self.mpx_registers_with_example_code() - - def mpx_registers_with_example_code(self): - """Test Intel(R) MPX registers after running example code.""" - self.line = line_number('main.cpp', '// Set a break point here.') - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line, num_expected_locations=1) - self.runCmd("run", RUN_SUCCEEDED) - - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - if (process.GetState() == lldb.eStateExited): - self.skipTest("Intel(R) MPX is not supported.") - else: - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs = ["stop reason = breakpoint 1."]) - - if self.getArchitecture() == 'x86_64': - self.expect("register read -s 3", - substrs = ['bnd0 = {0x0000000000000010 0xffffffffffffffe6}', - 'bnd1 = {0x0000000000000020 0xffffffffffffffd6}', - 'bnd2 = {0x0000000000000030 0xffffffffffffffc6}', - 'bnd3 = {0x0000000000000040 0xffffffffffffffb6}', - 'bndcfgu = {0x01 0x80 0xb5 0x76 0xff 0x7f 0x00 0x00}', - 'bndstatus = {0x02 0x80 0xb5 0x76 0xff 0x7f 0x00 0x00}']) - if self.getArchitecture() == 'i386': - self.expect("register read -s 3", - substrs = ['bnd0 = {0x0000000000000010 0x00000000ffffffe6}', - 'bnd1 = {0x0000000000000020 0x00000000ffffffd6}', - 'bnd2 = {0x0000000000000030 0x00000000ffffffc6}', - 'bnd3 = {0x0000000000000040 0x00000000ffffffb6}', - 'bndcfgu = {0x01 0xd0 0x7d 0xf7 0x00 0x00 0x00 0x00}', - 'bndstatus = {0x02 0xd0 0x7d 0xf7 0x00 0x00 0x00 0x00}']) - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp deleted file mode 100644 index 97b50585a52..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -//// -//// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -//// See https://llvm.org/LICENSE.txt for license information. -//// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -//// -////===----------------------------------------------------------------------===// -// - -#include <cpuid.h> -#include <cstddef> - -int -main(int argc, char const *argv[]) -{ -// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 3.19 -#ifndef PR_MPX_ENABLE_MANAGEMENT - return -1; -#endif - - // This call returns 0 only if the CPU and the kernel support Intel(R) MPX. - if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0) - return -1; - -// Run Intel(R) MPX test code. -#if defined(__x86_64__) - asm("mov $16, %rax\n\t" - "mov $9, %rdx\n\t" - "bndmk (%rax,%rdx), %bnd0\n\t" - "mov $32, %rax\n\t" - "mov $9, %rdx\n\t" - "bndmk (%rax,%rdx), %bnd1\n\t" - "mov $48, %rax\n\t" - "mov $9, %rdx\n\t" - "bndmk (%rax,%rdx), %bnd2\n\t" - "mov $64, %rax\n\t" - "mov $9, %rdx\n\t" - "bndmk (%rax,%rdx), %bnd3\n\t" - "bndstx %bnd3, (%rax) \n\t" - "nop\n\t"); -#endif -#if defined(__i386__) - asm("mov $16, %eax\n\t" - "mov $9, %edx\n\t" - "bndmk (%eax,%edx), %bnd0\n\t" - "mov $32, %eax\n\t" - "mov $9, %edx\n\t" - "bndmk (%eax,%edx), %bnd1\n\t" - "mov $48, %eax\n\t" - "mov $9, %edx\n\t" - "bndmk (%eax,%edx), %bnd2\n\t" - "mov $64, %eax\n\t" - "mov $9, %edx\n\t" - "bndmk (%eax,%edx), %bnd3\n\t" - "bndstx %bnd3, (%eax)\n\t" - "nop\n\t"); -#endif - asm("nop\n\t"); // Set a break point here. - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile deleted file mode 100644 index aa88c47ff3f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../make - -CXX_SOURCES := main.cpp - -CFLAGS_EXTRAS += -mmpx -fcheck-pointer-bounds -fuse-ld=bfd - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py b/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py deleted file mode 100644 index 5b5f6aa19cb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Test the Intel(R) MPX bound violation signal. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class RegisterCommandsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIf(compiler="clang") - @skipIf(oslist=no_match(['linux'])) - @skipIf(archs=no_match(['i386', 'x86_64'])) - @skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX. - def test_mpx_boundary_violation(self): - """Test Intel(R) MPX bound violation signal.""" - self.build() - self.mpx_boundary_violation() - - def mpx_boundary_violation(self): - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - if (process.GetState() == lldb.eStateExited): - self.skipTest("Intel(R) MPX is not supported.") - - if (process.GetState() == lldb.eStateStopped): - self.expect("thread backtrace", STOPPED_DUE_TO_SIGNAL, - substrs = ['stop reason = signal SIGSEGV: upper bound violation', - 'fault address:', 'lower bound:', 'upper bound:']) - - self.runCmd("continue") - - if (process.GetState() == lldb.eStateStopped): - self.expect("thread backtrace", STOPPED_DUE_TO_SIGNAL, - substrs = ['stop reason = signal SIGSEGV: lower bound violation', - 'fault address:', 'lower bound:', 'upper bound:']) - - self.runCmd("continue") - self.assertTrue(process.GetState() == lldb.eStateExited, - PROCESS_EXITED) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp deleted file mode 100644 index 3c5ef07e4b6..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -//// -//// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -//// See https://llvm.org/LICENSE.txt for license information. -//// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -//// -////===----------------------------------------------------------------------===// -// - -#include <cstddef> -#include <sys/prctl.h> - -static void violate_upper_bound(int *ptr, int size) -{ - int i; - i = *(ptr + size); -} - -static void violate_lower_bound (int *ptr, int size) -{ - int i; - i = *(ptr - size); -} - -int -main(int argc, char const *argv[]) -{ - unsigned int rax, rbx, rcx, rdx; - int array[5]; - -// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 3.19 -#ifndef PR_MPX_ENABLE_MANAGEMENT - return -1; -#endif - - // This call returns 0 only if the CPU and the kernel support Intel(R) MPX. - if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0) - return -1; - - violate_upper_bound(array, 5); - violate_lower_bound(array, 5); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile deleted file mode 100644 index 3c6deff2d97..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp a.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py deleted file mode 100644 index 2c0425c4225..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py +++ /dev/null @@ -1,505 +0,0 @@ -""" -Test the 'register' command. -""" - -from __future__ import print_function - - -import os -import sys -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class RegisterCommandsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - TestBase.setUp(self) - self.has_teardown = False - - def tearDown(self): - self.dbg.GetSelectedTarget().GetProcess().Destroy() - TestBase.tearDown(self) - - @skipIfiOSSimulator - @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64'])) - @expectedFailureNetBSD - def test_register_commands(self): - """Test commands related to registers, in particular vector registers.""" - self.build() - self.common_setup() - - # verify that logging does not assert - self.log_enable("registers") - - self.expect("register read -a", MISSING_EXPECTED_REGISTERS, - substrs=['registers were unavailable'], matching=False) - - if self.getArchitecture() in ['amd64', 'i386', 'x86_64']: - self.runCmd("register read xmm0") - self.runCmd("register read ymm15") # may be available - self.runCmd("register read bnd0") # may be available - elif self.getArchitecture() in ['arm', 'armv7', 'armv7k', 'arm64']: - self.runCmd("register read s0") - self.runCmd("register read q15") # may be available - - self.expect( - "register read -s 4", - substrs=['invalid register set index: 4'], - error=True) - - @skipIfiOSSimulator - # Writing of mxcsr register fails, presumably due to a kernel/hardware - # problem - @skipIfTargetAndroid(archs=["i386"]) - @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64'])) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995") - @expectedFailureNetBSD - def test_fp_register_write(self): - """Test commands that write to registers, in particular floating-point registers.""" - self.build() - self.fp_register_write() - - @skipIfiOSSimulator - # "register read fstat" always return 0xffff - @expectedFailureAndroid(archs=["i386"]) - @skipIfFreeBSD # llvm.org/pr25057 - @skipIf(archs=no_match(['amd64', 'i386', 'x86_64'])) - @skipIfOutOfTreeDebugserver - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995") - @expectedFailureNetBSD - def test_fp_special_purpose_register_read(self): - """Test commands that read fpu special purpose registers.""" - self.build() - self.fp_special_purpose_register_read() - - @skipIfiOSSimulator - @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64'])) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37683") - def test_register_expressions(self): - """Test expression evaluation with commands related to registers.""" - self.build() - self.common_setup() - - if self.getArchitecture() in ['amd64', 'i386', 'x86_64']: - gpr = "eax" - vector = "xmm0" - elif self.getArchitecture() in ['arm64', 'aarch64']: - gpr = "w0" - vector = "v0" - elif self.getArchitecture() in ['arm', 'armv7', 'armv7k']: - gpr = "r0" - vector = "q0" - - self.expect("expr/x $%s" % gpr, substrs=['unsigned int', ' = 0x']) - self.expect("expr $%s" % vector, substrs=['vector_type']) - self.expect( - "expr (unsigned int)$%s[0]" % - vector, substrs=['unsigned int']) - - if self.getArchitecture() in ['amd64', 'x86_64']: - self.expect( - "expr -- ($rax & 0xffffffff) == $eax", - substrs=['true']) - - @skipIfiOSSimulator - @skipIf(archs=no_match(['amd64', 'x86_64'])) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37683") - def test_convenience_registers(self): - """Test convenience registers.""" - self.build() - self.convenience_registers() - - @skipIfiOSSimulator - @skipIf(archs=no_match(['amd64', 'x86_64'])) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37683") - @expectedFailureNetBSD - def test_convenience_registers_with_process_attach(self): - """Test convenience registers after a 'process attach'.""" - self.build() - self.convenience_registers_with_process_attach(test_16bit_regs=False) - - @skipIfiOSSimulator - @skipIf(archs=no_match(['amd64', 'x86_64'])) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37683") - @expectedFailureNetBSD - def test_convenience_registers_16bit_with_process_attach(self): - """Test convenience registers after a 'process attach'.""" - self.build() - self.convenience_registers_with_process_attach(test_16bit_regs=True) - - def common_setup(self): - exe = self.getBuildArtifact("a.out") - - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break in main(). - lldbutil.run_break_set_by_symbol( - self, "main", num_expected_locations=-1) - - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - # platform specific logging of the specified category - def log_enable(self, category): - # This intentionally checks the host platform rather than the target - # platform as logging is host side. - self.platform = "" - if (sys.platform.startswith("freebsd") or - sys.platform.startswith("linux") or - sys.platform.startswith("netbsd")): - self.platform = "posix" - - if self.platform != "": - self.log_file = self.getBuildArtifact('TestRegisters.log') - self.runCmd( - "log enable " + - self.platform + - " " + - str(category) + - " registers -v -f " + - self.log_file, - RUN_SUCCEEDED) - if not self.has_teardown: - def remove_log(self): - if os.path.exists(self.log_file): - os.remove(self.log_file) - self.has_teardown = True - self.addTearDownHook(remove_log) - - def write_and_read(self, frame, register, new_value, must_exist=True): - value = frame.FindValue(register, lldb.eValueTypeRegister) - if must_exist: - self.assertTrue( - value.IsValid(), - "finding a value for register " + - register) - elif not value.IsValid(): - return # If register doesn't exist, skip this test - - # Also test the 're' alias. - self.runCmd("re write " + register + " \'" + new_value + "\'") - self.expect( - "register read " + - register, - substrs=[ - register + - ' = ', - new_value]) - - def fp_special_purpose_register_read(self): - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Launch the process and stop. - self.expect("run", PROCESS_STOPPED, substrs=['stopped']) - - # Check stop reason; Should be either signal SIGTRAP or EXC_BREAKPOINT - output = self.res.GetOutput() - matched = False - substrs = [ - 'stop reason = EXC_BREAKPOINT', - 'stop reason = signal SIGTRAP'] - for str1 in substrs: - matched = output.find(str1) != -1 - with recording(self, False) as sbuf: - print("%s sub string: %s" % ('Expecting', str1), file=sbuf) - print("Matched" if matched else "Not Matched", file=sbuf) - if matched: - break - self.assertTrue(matched, STOPPED_DUE_TO_SIGNAL) - - process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - - thread = process.GetThreadAtIndex(0) - self.assertTrue(thread.IsValid(), "current thread is valid") - - currentFrame = thread.GetFrameAtIndex(0) - self.assertTrue(currentFrame.IsValid(), "current frame is valid") - - # Extract the value of fstat and ftag flag at the point just before - # we start pushing floating point values on st% register stack - value = currentFrame.FindValue("fstat", lldb.eValueTypeRegister) - error = lldb.SBError() - reg_value_fstat_initial = value.GetValueAsUnsigned(error, 0) - - self.assertTrue(error.Success(), "reading a value for fstat") - value = currentFrame.FindValue("ftag", lldb.eValueTypeRegister) - error = lldb.SBError() - reg_value_ftag_initial = value.GetValueAsUnsigned(error, 0) - - self.assertTrue(error.Success(), "reading a value for ftag") - fstat_top_pointer_initial = (reg_value_fstat_initial & 0x3800) >> 11 - - # Execute 'si' aka 'thread step-inst' instruction 5 times and with - # every execution verify the value of fstat and ftag registers - for x in range(0, 5): - # step into the next instruction to push a value on 'st' register - # stack - self.runCmd("si", RUN_SUCCEEDED) - - # Verify fstat and save it to be used for verification in next - # execution of 'si' command - if not (reg_value_fstat_initial & 0x3800): - self.expect("register read fstat", substrs=[ - 'fstat' + ' = ', str("0x%0.4x" % ((reg_value_fstat_initial & ~(0x3800)) | 0x3800))]) - reg_value_fstat_initial = ( - (reg_value_fstat_initial & ~(0x3800)) | 0x3800) - fstat_top_pointer_initial = 7 - else: - self.expect("register read fstat", substrs=[ - 'fstat' + ' = ', str("0x%0.4x" % (reg_value_fstat_initial - 0x0800))]) - reg_value_fstat_initial = (reg_value_fstat_initial - 0x0800) - fstat_top_pointer_initial -= 1 - - # Verify ftag and save it to be used for verification in next - # execution of 'si' command - self.expect( - "register read ftag", substrs=[ - 'ftag' + ' = ', str( - "0x%0.4x" % - (reg_value_ftag_initial | ( - 1 << fstat_top_pointer_initial)))]) - reg_value_ftag_initial = reg_value_ftag_initial | ( - 1 << fstat_top_pointer_initial) - - def fp_register_write(self): - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Launch the process, stop at the entry point. - error = lldb.SBError() - process = target.Launch( - lldb.SBListener(), - None, None, # argv, envp - None, None, None, # stdin/out/err - self.get_process_working_directory(), - 0, # launch flags - True, # stop at entry - error) - self.assertTrue(error.Success(), "Launch succeeds. Error is :" + str(error)) - - self.assertTrue( - process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - - thread = process.GetThreadAtIndex(0) - self.assertTrue(thread.IsValid(), "current thread is valid") - - currentFrame = thread.GetFrameAtIndex(0) - self.assertTrue(currentFrame.IsValid(), "current frame is valid") - - if self.getArchitecture() in ['amd64', 'i386', 'x86_64']: - reg_list = [ - # reg value must-have - ("fcw", "0x0000ff0e", False), - ("fsw", "0x0000ff0e", False), - ("ftw", "0x0000ff0e", False), - ("ip", "0x0000ff0e", False), - ("dp", "0x0000ff0e", False), - ("mxcsr", "0x0000ff0e", False), - ("mxcsrmask", "0x0000ff0e", False), - ] - - st0regname = None - if currentFrame.FindRegister("st0").IsValid(): - st0regname = "st0" - elif currentFrame.FindRegister("stmm0").IsValid(): - st0regname = "stmm0" - if st0regname is not None: - # reg value - # must-have - reg_list.append( - (st0regname, "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00}", True)) - reg_list.append( - ("xmm0", - "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", - True)) - reg_list.append( - ("xmm15", - "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}", - False)) - elif self.getArchitecture() in ['arm64', 'aarch64']: - reg_list = [ - # reg value - # must-have - ("fpsr", "0xfbf79f9f", True), - ("s0", "1.25", True), - ("s31", "0.75", True), - ("d1", "123", True), - ("d17", "987", False), - ("v1", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True), - ("v14", - "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}", - False), - ] - elif self.getArchitecture() in ['armv7'] and self.platformIsDarwin(): - reg_list = [ - # reg value - # must-have - ("fpsr", "0xfbf79f9f", True), - ("s0", "1.25", True), - ("s31", "0.75", True), - ("d1", "123", True), - ("d17", "987", False), - ("q1", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True), - ("q14", - "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}", - False), - ] - elif self.getArchitecture() in ['arm', 'armv7k']: - reg_list = [ - # reg value - # must-have - ("fpscr", "0xfbf79f9f", True), - ("s0", "1.25", True), - ("s31", "0.75", True), - ("d1", "123", True), - ("d17", "987", False), - ("q1", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True), - ("q14", - "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}", - False), - ] - - for (reg, val, must) in reg_list: - self.write_and_read(currentFrame, reg, val, must) - - if self.getArchitecture() in ['amd64', 'i386', 'x86_64']: - if st0regname is None: - self.fail("st0regname could not be determined") - self.runCmd( - "register write " + - st0regname + - " \"{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}\"") - self.expect( - "register read " + - st0regname + - " --format f", - substrs=[ - st0regname + - ' = 0']) - - has_avx = False - has_mpx = False - # Returns an SBValueList. - registerSets = currentFrame.GetRegisters() - for registerSet in registerSets: - if 'advanced vector extensions' in registerSet.GetName().lower(): - has_avx = True - if 'memory protection extension' in registerSet.GetName().lower(): - has_mpx = True - - if has_avx: - new_value = "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0c 0x0d 0x0e 0x0f}" - self.write_and_read(currentFrame, "ymm0", new_value) - self.write_and_read(currentFrame, "ymm7", new_value) - self.expect("expr $ymm0", substrs=['vector_type']) - else: - self.runCmd("register read ymm0") - - if has_mpx: - # Test write and read for bnd0. - new_value_w = "{0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10}" - self.runCmd("register write bnd0 \'" + new_value_w + "\'") - new_value_r = "{0x0807060504030201 0x100f0e0d0c0b0a09}" - self.expect("register read bnd0", substrs = ['bnd0 = ', new_value_r]) - self.expect("expr $bnd0", substrs = ['vector_type']) - - # Test write and for bndstatus. - new_value = "{0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08}" - self.write_and_read(currentFrame, "bndstatus", new_value) - self.expect("expr $bndstatus", substrs = ['vector_type']) - else: - self.runCmd("register read bnd0") - - def convenience_registers(self): - """Test convenience registers.""" - self.common_setup() - - # The command "register read -a" does output a derived register like - # eax... - self.expect("register read -a", matching=True, - substrs=['eax']) - - # ...however, the vanilla "register read" command should not output derived registers like eax. - self.expect("register read", matching=False, - substrs=['eax']) - - # Test reading of rax and eax. - self.expect("register read rax eax", - substrs=['rax = 0x', 'eax = 0x']) - - # Now write rax with a unique bit pattern and test that eax indeed - # represents the lower half of rax. - self.runCmd("register write rax 0x1234567887654321") - self.expect("register read rax 0x1234567887654321", - substrs=['0x1234567887654321']) - - def convenience_registers_with_process_attach(self, test_16bit_regs): - """Test convenience registers after a 'process attach'.""" - exe = self.getBuildArtifact("a.out") - - # Spawn a new process - pid = self.spawnSubprocess(exe, ['wait_for_attach']).pid - self.addTearDownHook(self.cleanupSubprocesses) - - if self.TraceOn(): - print("pid of spawned process: %d" % pid) - - self.runCmd("process attach -p %d" % pid) - - # Check that "register read eax" works. - self.runCmd("register read eax") - - if self.getArchitecture() in ['amd64', 'x86_64']: - self.expect("expr -- ($rax & 0xffffffff) == $eax", - substrs=['true']) - - if test_16bit_regs: - self.expect("expr -- $ax == (($ah << 8) | $al)", - substrs=['true']) - - @skipIfiOSSimulator - @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64'])) - @expectedFailureNetBSD - def test_invalid_invocation(self): - self.build() - self.common_setup() - - self.expect("register read -a arg", error=True, - substrs=["the --all option can't be used when registers names are supplied as arguments"]) - - self.expect("register read --set 0 r", error=True, - substrs=["the --set <set> option can't be used when registers names are supplied as arguments"]) - - self.expect("register write a", error=True, - substrs=["register write takes exactly 2 arguments: <reg-name> <value>"]) - self.expect("register write a b c", error=True, - substrs=["register write takes exactly 2 arguments: <reg-name> <value>"]) - - @skipIfiOSSimulator - @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64'])) - @expectedFailureNetBSD - def test_write_unknown_register(self): - self.build() - self.common_setup() - - self.expect("register write blub 1", error=True, - substrs=["error: Register not found for 'blub'."]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp deleted file mode 100644 index 79f111aa247..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===-- a.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -long double -return_long_double (long double value) -{ -#if defined (__i386__) || defined (__x86_64__) - float a=2, b=4,c=8, d=16, e=32, f=64, k=128, l=256, add=0; - __asm__ ( - "int3 ;" - "flds %1 ;" - "flds %2 ;" - "flds %3 ;" - "flds %4 ;" - "flds %5 ;" - "flds %6 ;" - "flds %7 ;" - "faddp ;" : "=g" (add) : "g" (a), "g" (b), "g" (c), "g" (d), "g" (e), "g" (f), "g" (k), "g" (l) ); // Set break point at this line. -#endif // #if defined (__i386__) || defined (__x86_64__) - return value; -} - -long double -outer_return_long_double (long double value) -{ - long double val = return_long_double(value); - val *= 2 ; - return val; -} - -long double -outermost_return_long_double (long double value) -{ - long double val = outer_return_long_double(value); - val *= 2 ; - return val; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp deleted file mode 100644 index 493a09e034d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -#include <chrono> -#include <thread> - -long double outermost_return_long_double (long double my_long_double); - -int main (int argc, char const *argv[]) -{ - lldb_enable_attach(); - - char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0}; - double my_double = 1234.5678; - long double my_long_double = 1234.5678; - - // For simplicity assume that any cmdline argument means wait for attach. - if (argc > 1) - { - volatile int wait_for_attach=1; - while (wait_for_attach) - std::this_thread::sleep_for(std::chrono::microseconds(1)); - } - - printf("my_string=%s\n", my_string); - printf("my_double=%g\n", my_double); - outermost_return_long_double (my_long_double); - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/reproducer/TestReproducer.py b/lldb/packages/Python/lldbsuite/test/functionalities/reproducer/TestReproducer.py deleted file mode 100644 index bb013409ace..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/reproducer/TestReproducer.py +++ /dev/null @@ -1,20 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * - -class ReproducerTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - @no_debug_info_test - def test_reproducer_generate_invalid_invocation(self): - self.expect("reproducer generate f", error=True, - substrs=["'reproducer generate' takes no arguments"]) - - @no_debug_info_test - def test_reproducer_status_invalid_invocation(self): - self.expect("reproducer status f", error=True, - substrs=["'reproducer status' takes no arguments"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stats/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/stats/Makefile deleted file mode 100644 index f5a47fcc46c..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/stats/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../make -C_SOURCES := main.c -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stats/TestStats.py b/lldb/packages/Python/lldbsuite/test/functionalities/stats/TestStats.py deleted file mode 100644 index 48e49ed009b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/stats/TestStats.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest( - __file__, globals(), []) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stats/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/stats/main.c deleted file mode 100644 index 9adb3a09a08..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/stats/main.c +++ /dev/null @@ -1,18 +0,0 @@ -// Test that the lldb command `statistics` works. - -int main(void) { - int patatino = 27; - //%self.expect("statistics disable", substrs=['need to enable statistics before disabling'], error=True) - //%self.expect("statistics enable") - //%self.expect("statistics enable", substrs=['already enabled'], error=True) - //%self.expect("expr patatino", substrs=['27']) - //%self.expect("statistics disable") - //%self.expect("statistics dump", substrs=['expr evaluation successes : 1', 'expr evaluation failures : 0']) - //%self.expect("frame var", substrs=['27']) - //%self.expect("statistics enable") - //%self.expect("frame var", substrs=['27']) - //%self.expect("statistics disable") - //%self.expect("statistics dump", substrs=['frame var successes : 1', 'frame var failures : 0']) - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/Makefile deleted file mode 100644 index 50d4ab65a6e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -std=c99 - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/TestStopHooks.py b/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/TestStopHooks.py deleted file mode 100644 index b8f04915563..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/TestStopHooks.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Test that stop hooks trigger on "step-out" -""" - -from __future__ import print_function - - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class TestStopHooks(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_stop_hooks_step_out(self): - """Test that stop hooks fire on step-out.""" - self.build() - self.main_source_file = lldb.SBFileSpec("main.c") - self.step_out_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def step_out_test(self): - (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, - "Set a breakpoint here", self.main_source_file) - - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - interp.HandleCommand("target stop-hook add -o 'expr g_var++'", result) - self.assertTrue(result.Succeeded, "Set the target stop hook") - thread.StepOut() - var = target.FindFirstGlobalVariable("g_var") - self.assertTrue(var.IsValid()) - self.assertEqual(var.GetValueAsUnsigned(), 1, "Updated g_var") - - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/main.c deleted file mode 100644 index d08ad14776b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hooks/main.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <stdio.h> - -static int g_var = 0; - -int step_out_of_me() -{ - return g_var; // Set a breakpoint here and step out. -} - -int -main() -{ - return step_out_of_me(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/Makefile deleted file mode 100644 index 9117ab9388b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../make - -# Example: -# -# C_SOURCES := b.c -# EXE := b.out - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py deleted file mode 100644 index c16c6b46dc8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py +++ /dev/null @@ -1,440 +0,0 @@ -""" -Test some target commands: create, list, select, variable. -""" - -from __future__ import print_function -import os -import stat -import tempfile - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class targetCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers for our breakpoints. - self.line_b = line_number('b.c', '// Set break point at this line.') - self.line_c = line_number('c.c', '// Set break point at this line.') - - def buildB(self): - db = {'C_SOURCES': 'b.c', 'EXE': self.getBuildArtifact('b.out')} - self.build(dictionary=db) - self.addTearDownCleanup(dictionary=db) - - def buildAll(self): - da = {'C_SOURCES': 'a.c', 'EXE': self.getBuildArtifact('a.out')} - self.build(dictionary=da) - self.addTearDownCleanup(dictionary=da) - - self.buildB() - - dc = {'C_SOURCES': 'c.c', 'EXE': self.getBuildArtifact('c.out')} - self.build(dictionary=dc) - self.addTearDownCleanup(dictionary=dc) - - def test_target_command(self): - """Test some target commands: create, list, select.""" - self.buildAll() - self.do_target_command() - - def test_target_variable_command(self): - """Test 'target variable' command before and after starting the inferior.""" - d = {'C_SOURCES': 'globals.c', 'EXE': self.getBuildArtifact('globals')} - self.build(dictionary=d) - self.addTearDownCleanup(dictionary=d) - - self.do_target_variable_command('globals') - - def test_target_variable_command_no_fail(self): - """Test 'target variable' command before and after starting the inferior.""" - d = {'C_SOURCES': 'globals.c', 'EXE': self.getBuildArtifact('globals')} - self.build(dictionary=d) - self.addTearDownCleanup(dictionary=d) - - self.do_target_variable_command_no_fail('globals') - - def do_target_command(self): - """Exercise 'target create', 'target list', 'target select' commands.""" - exe_a = self.getBuildArtifact("a.out") - exe_b = self.getBuildArtifact("b.out") - exe_c = self.getBuildArtifact("c.out") - - self.runCmd("target list") - output = self.res.GetOutput() - if output.startswith("No targets"): - # We start from index 0. - base = 0 - else: - # Find the largest index of the existing list. - import re - pattern = re.compile("target #(\d+):") - for line in reversed(output.split(os.linesep)): - match = pattern.search(line) - if match: - # We will start from (index + 1) .... - base = int(match.group(1), 10) + 1 - #print("base is:", base) - break - - self.runCmd("target create " + exe_a, CURRENT_EXECUTABLE_SET) - self.runCmd("run", RUN_SUCCEEDED) - - self.runCmd("target create " + exe_b, CURRENT_EXECUTABLE_SET) - lldbutil.run_break_set_by_file_and_line( - self, 'b.c', self.line_b, num_expected_locations=1, loc_exact=True) - self.runCmd("run", RUN_SUCCEEDED) - - self.runCmd("target create " + exe_c, CURRENT_EXECUTABLE_SET) - lldbutil.run_break_set_by_file_and_line( - self, 'c.c', self.line_c, num_expected_locations=1, loc_exact=True) - self.runCmd("run", RUN_SUCCEEDED) - - self.runCmd("target list") - - self.runCmd("target select %d" % base) - self.runCmd("thread backtrace") - - self.runCmd("target select %d" % (base + 2)) - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=['c.c:%d' % self.line_c, - 'stop reason = breakpoint']) - - self.runCmd("target select %d" % (base + 1)) - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=['b.c:%d' % self.line_b, - 'stop reason = breakpoint']) - - self.runCmd("target list") - - def do_target_variable_command(self, exe_name): - """Exercise 'target variable' command before and after starting the inferior.""" - self.runCmd("file " + self.getBuildArtifact(exe_name), - CURRENT_EXECUTABLE_SET) - - self.expect( - "target variable my_global_char", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "my_global_char", - "'X'"]) - self.expect( - "target variable my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_global_str', - '"abc"']) - self.expect( - "target variable my_static_int", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_static_int', - '228']) - self.expect("target variable my_global_str_ptr", matching=False, - substrs=['"abc"']) - self.expect("target variable *my_global_str_ptr", matching=True, - substrs=['"abc"']) - self.expect( - "target variable *my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=['a']) - - self.runCmd("b main") - self.runCmd("run") - - self.expect( - "target variable my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_global_str', - '"abc"']) - self.expect( - "target variable my_static_int", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_static_int', - '228']) - self.expect("target variable my_global_str_ptr", matching=False, - substrs=['"abc"']) - self.expect("target variable *my_global_str_ptr", matching=True, - substrs=['"abc"']) - self.expect( - "target variable *my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=['a']) - self.expect( - "target variable my_global_char", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "my_global_char", - "'X'"]) - - self.runCmd("c") - - # rdar://problem/9763907 - # 'target variable' command fails if the target program has been run - self.expect( - "target variable my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_global_str', - '"abc"']) - self.expect( - "target variable my_static_int", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_static_int', - '228']) - self.expect("target variable my_global_str_ptr", matching=False, - substrs=['"abc"']) - self.expect("target variable *my_global_str_ptr", matching=True, - substrs=['"abc"']) - self.expect( - "target variable *my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=['a']) - self.expect( - "target variable my_global_char", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "my_global_char", - "'X'"]) - - def do_target_variable_command_no_fail(self, exe_name): - """Exercise 'target variable' command before and after starting the inferior.""" - self.runCmd("file " + self.getBuildArtifact(exe_name), - CURRENT_EXECUTABLE_SET) - - self.expect( - "target variable my_global_char", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "my_global_char", - "'X'"]) - self.expect( - "target variable my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_global_str', - '"abc"']) - self.expect( - "target variable my_static_int", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_static_int', - '228']) - self.expect("target variable my_global_str_ptr", matching=False, - substrs=['"abc"']) - self.expect("target variable *my_global_str_ptr", matching=True, - substrs=['"abc"']) - self.expect( - "target variable *my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=['a']) - - self.runCmd("b main") - self.runCmd("run") - - # New feature: you don't need to specify the variable(s) to 'target vaiable'. - # It will find all the global and static variables in the current - # compile unit. - self.expect("target variable", - substrs=['my_global_char', - 'my_global_str', - 'my_global_str_ptr', - 'my_static_int']) - - self.expect( - "target variable my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_global_str', - '"abc"']) - self.expect( - "target variable my_static_int", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'my_static_int', - '228']) - self.expect("target variable my_global_str_ptr", matching=False, - substrs=['"abc"']) - self.expect("target variable *my_global_str_ptr", matching=True, - substrs=['"abc"']) - self.expect( - "target variable *my_global_str", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=['a']) - self.expect( - "target variable my_global_char", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "my_global_char", - "'X'"]) - - @no_debug_info_test - def test_target_stop_hook_disable_enable(self): - self.buildB() - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - - self.expect("target stop-hook disable 1", error=True, substrs=['unknown stop hook id: "1"']) - self.expect("target stop-hook disable blub", error=True, substrs=['invalid stop hook id: "blub"']) - self.expect("target stop-hook enable 1", error=True, substrs=['unknown stop hook id: "1"']) - self.expect("target stop-hook enable blub", error=True, substrs=['invalid stop hook id: "blub"']) - - @no_debug_info_test - def test_target_stop_hook_delete(self): - self.buildB() - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - - self.expect("target stop-hook delete 1", error=True, substrs=['unknown stop hook id: "1"']) - self.expect("target stop-hook delete blub", error=True, substrs=['invalid stop hook id: "blub"']) - - @no_debug_info_test - def test_target_list_args(self): - self.expect("target list blub", error=True, - substrs=["the 'target list' command takes no arguments"]) - - @no_debug_info_test - def test_target_select_no_index(self): - self.expect("target select", error=True, - substrs=["'target select' takes a single argument: a target index"]) - - @no_debug_info_test - def test_target_select_invalid_index(self): - self.runCmd("target delete --all") - self.expect("target select 0", error=True, - substrs=["index 0 is out of range since there are no active targets"]) - self.buildB() - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - self.expect("target select 1", error=True, - substrs=["index 1 is out of range, valid target indexes are 0 - 0"]) - - - @no_debug_info_test - def test_target_create_multiple_args(self): - self.expect("target create a b", error=True, - substrs=["'target create' takes exactly one executable path"]) - - @no_debug_info_test - def test_target_create_nonexistent_core_file(self): - self.expect("target create -c doesntexist", error=True, - substrs=["core file 'doesntexist' doesn't exist"]) - - # Write only files don't seem to be supported on Windows. - @skipIfWindows - @no_debug_info_test - def test_target_create_unreadable_core_file(self): - tf = tempfile.NamedTemporaryFile() - os.chmod(tf.name, stat.S_IWRITE) - self.expect("target create -c '" + tf.name + "'", error=True, - substrs=["core file '", "' is not readable"]) - - @no_debug_info_test - def test_target_create_nonexistent_sym_file(self): - self.expect("target create -s doesntexist doesntexisteither", error=True, - substrs=["invalid symbol file path 'doesntexist'"]) - - @skipIfWindows - @no_debug_info_test - def test_target_create_invalid_core_file(self): - invalid_core_path = os.path.join(self.getSourceDir(), "invalid_core_file") - self.expect("target create -c '" + invalid_core_path + "'", error=True, - substrs=["Unable to find process plug-in for core file '"]) - - - # Write only files don't seem to be supported on Windows. - @skipIfWindows - @no_debug_info_test - def test_target_create_unreadable_sym_file(self): - tf = tempfile.NamedTemporaryFile() - os.chmod(tf.name, stat.S_IWRITE) - self.expect("target create -s '" + tf.name + "' no_exe", error=True, - substrs=["symbol file '", "' is not readable"]) - - @no_debug_info_test - def test_target_delete_all(self): - self.buildAll() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - self.expect("target delete --all") - self.expect("target list", substrs=["No targets."]) - - @no_debug_info_test - def test_target_delete_by_index(self): - self.buildAll() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("file " + self.getBuildArtifact("c.out"), CURRENT_EXECUTABLE_SET) - self.expect("target delete 3", error=True, - substrs=["target index 3 is out of range, valid target indexes are 0 - 2"]) - - self.runCmd("target delete 1") - self.expect("target list", matching=False, substrs=["b.out"]) - self.runCmd("target delete 1") - self.expect("target list", matching=False, substrs=["c.out"]) - - self.expect("target delete 1", error=True, - substrs=["target index 1 is out of range, the only valid index is 0"]) - - self.runCmd("target delete 0") - self.expect("target list", matching=False, substrs=["a.out"]) - - self.expect("target delete 0", error=True, substrs=["no targets to delete"]) - self.expect("target delete 1", error=True, substrs=["no targets to delete"]) - - @no_debug_info_test - def test_target_delete_by_index_multiple(self): - self.buildAll() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("file " + self.getBuildArtifact("c.out"), CURRENT_EXECUTABLE_SET) - - self.expect("target delete 0 1 2 3", error=True, - substrs=["target index 3 is out of range, valid target indexes are 0 - 2"]) - self.expect("target list", substrs=["a.out", "b.out", "c.out"]) - - self.runCmd("target delete 0 1 2") - self.expect("target list", matching=False, substrs=["a.out", "c.out"]) - - @no_debug_info_test - def test_target_delete_selected(self): - self.buildAll() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("file " + self.getBuildArtifact("c.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("target select 1") - self.runCmd("target delete") - self.expect("target list", matching=False, substrs=["b.out"]) - self.runCmd("target delete") - self.runCmd("target delete") - self.expect("target list", substrs=["No targets."]) - self.expect("target delete", error=True, substrs=["no target is currently selected"]) - - @no_debug_info_test - def test_target_modules_search_paths_clear(self): - self.buildB() - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("target modules search-paths add foo bar") - self.runCmd("target modules search-paths add foz baz") - self.runCmd("target modules search-paths clear") - self.expect("target list", matching=False, substrs=["bar", "baz"]) - - @no_debug_info_test - def test_target_modules_search_paths_query(self): - self.buildB() - self.runCmd("file " + self.getBuildArtifact("b.out"), CURRENT_EXECUTABLE_SET) - self.runCmd("target modules search-paths add foo bar") - self.expect("target modules search-paths query foo", substrs=["bar"]) - # Query something that doesn't exist. - self.expect("target modules search-paths query faz", substrs=["faz"]) - - # Invalid arguments. - self.expect("target modules search-paths query faz baz", error=True, - substrs=["query requires one argument"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/a.c b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/a.c deleted file mode 100644 index ec4824ad4ad..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/a.c +++ /dev/null @@ -1,15 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -int main(int argc, const char* argv[]) -{ - int *null_ptr = 0; - printf("Hello, segfault!\n"); - printf("Now crash %d\n", *null_ptr); // Crash here. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/b.c b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/b.c deleted file mode 100644 index bcc466c8f96..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/b.c +++ /dev/null @@ -1,12 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int main (int argc, char const *argv[]) -{ - return 0; // Set break point at this line. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/c.c b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/c.c deleted file mode 100644 index a2cb5995aa5..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/c.c +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -int main (int argc, char const *argv[]) -{ - enum days { - Monday = 10, - Tuesday, - Wednesday, - Thursday, - Friday, - Saturday, - Sunday, - kNumDays - }; - enum days day; - for (day = Monday - 1; day <= kNumDays + 1; day++) - { - printf("day as int is %i\n", (int)day); - } - return 0; // Set break point at this line. -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/globals.c b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/globals.c deleted file mode 100644 index 421b34c0cbc..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/globals.c +++ /dev/null @@ -1,24 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -char my_global_char = 'X'; -const char* my_global_str = "abc"; -const char **my_global_str_ptr = &my_global_str; -static int my_static_int = 228; - -int main (int argc, char const *argv[]) -{ - printf("global char: %c\n", my_global_char); - - printf("global str: %s\n", my_global_str); - - printf("argc + my_static_int = %d\n", (argc + my_static_int)); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/invalid_core_file b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/invalid_core_file deleted file mode 100644 index 39802f64280..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/invalid_core_file +++ /dev/null @@ -1 +0,0 @@ -stub diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/Makefile deleted file mode 100644 index 15cb0b64f21..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -LEVEL := ../../make - -LIB_PREFIX := load_ - -LD_EXTRAS := -L. -l$(LIB_PREFIX)a -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules - -a.out: lib_a - -lib_%: - $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/$*.mk - -clean:: - $(MAKE) -f $(SRCDIR)/a.mk clean diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py b/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py deleted file mode 100644 index 2d96433b7d4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -Test that loading of dependents works correctly for all the potential -combinations. -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -@skipIfWindows # Windows deals differently with shared libs. -class TargetDependentsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - TestBase.setUp(self) - self.build() - - def has_exactly_one_image(self, matching, msg=""): - self.expect( - "image list", - "image list should contain at least one image", - substrs=['[ 0]']) - should_match = not matching - self.expect( - "image list", msg, matching=should_match, substrs=['[ 1]']) - - - @expectedFailureAll(oslist=["linux"], - triple=no_match(".*-android")) - #linux does not support loading dependent files, but android does - @expectedFailureNetBSD - def test_dependents_implicit_default_exe(self): - """Test default behavior""" - exe = self.getBuildArtifact("a.out") - self.runCmd("target create " + exe, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(False) - - @expectedFailureAll(oslist=["linux"], - triple=no_match(".*-android")) - #linux does not support loading dependent files, but android does - @expectedFailureNetBSD - def test_dependents_explicit_default_exe(self): - """Test default behavior""" - exe = self.getBuildArtifact("a.out") - self.runCmd("target create -ddefault " + exe, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(False) - - def test_dependents_explicit_true_exe(self): - """Test default behavior""" - exe = self.getBuildArtifact("a.out") - self.runCmd("target create -dtrue " + exe, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(True) - - @expectedFailureAll(oslist=["linux"], - triple=no_match(".*-android")) - #linux does not support loading dependent files, but android does - @expectedFailureNetBSD - def test_dependents_explicit_false_exe(self): - """Test default behavior""" - exe = self.getBuildArtifact("a.out") - self.runCmd("target create -dfalse " + exe, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(False) - - def test_dependents_implicit_false_exe(self): - """Test default behavior""" - exe = self.getBuildArtifact("a.out") - self.runCmd("target create -d " + exe, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(True) - - @expectedFailureAndroid # android will return mutiple images - def test_dependents_implicit_default_lib(self): - ctx = self.platformContext - dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension - lib = self.getBuildArtifact(dylibName) - self.runCmd("target create " + lib, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(True) - - def test_dependents_explicit_default_lib(self): - ctx = self.platformContext - dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension - lib = self.getBuildArtifact(dylibName) - self.runCmd("target create -ddefault " + lib, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(True) - - def test_dependents_explicit_true_lib(self): - ctx = self.platformContext - dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension - lib = self.getBuildArtifact(dylibName) - self.runCmd("target create -dtrue " + lib, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(True) - - @expectedFailureAll(oslist=["linux"], - triple=no_match(".*-android")) - #linux does not support loading dependent files, but android does - @expectedFailureNetBSD - def test_dependents_explicit_false_lib(self): - ctx = self.platformContext - dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension - lib = self.getBuildArtifact(dylibName) - self.runCmd("target create -dfalse " + lib, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(False) - - def test_dependents_implicit_false_lib(self): - ctx = self.platformContext - dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension - lib = self.getBuildArtifact(dylibName) - self.runCmd("target create -d " + lib, CURRENT_EXECUTABLE_SET) - self.has_exactly_one_image(True) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.cpp deleted file mode 100644 index e80612bd5cc..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===-- b.c -----------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -int a_function () -{ - return 500; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.mk b/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.mk deleted file mode 100644 index f199bfed5b0..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.mk +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL := ../../make - -LIB_PREFIX := load_ - -DYLIB_NAME := $(LIB_PREFIX)a -DYLIB_CXX_SOURCES := a.cpp -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/main.cpp deleted file mode 100644 index 7ee1981a4c2..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_create_deps/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -extern int a_function (); -extern int b_function (); - -int -main (int argc, char const *argv[]) -{ - return a_function(); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/version/TestVersion.py b/lldb/packages/Python/lldbsuite/test/functionalities/version/TestVersion.py deleted file mode 100644 index ec449fd0c39..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/version/TestVersion.py +++ /dev/null @@ -1,22 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * - -class VersionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - @no_debug_info_test - def test_version(self): - # Should work even when people patch the output, - # so let's just assume that every vendor at least mentions - # 'lldb' in their version string. - self.expect("version", substrs=['lldb']) - - @no_debug_info_test - def test_version_invalid_invocation(self): - self.expect("version a", error=True, - substrs=['the version command takes no arguments.']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories deleted file mode 100644 index 50c1613cda7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories +++ /dev/null @@ -1 +0,0 @@ -watchpoint diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/Makefile deleted file mode 100644 index 8817fff55e8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py deleted file mode 100644 index da993c049d3..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ /dev/null @@ -1,113 +0,0 @@ -""" -Test lldb watchpoint that uses '-s size' to watch a pointed location with size. -""" - -from __future__ import print_function - - -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class HelloWatchLocationTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - 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.line = line_number( - self.source, '// Set break point at this line.') - # This is for verifying that watch location works. - self.violating_func = "do_bad_thing_with_location" - # Build dictionary to have unique executable names for each test - # method. - self.exe_name = self.testMethodName - self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Most of the MIPS boards provide only one H/W watchpoints, and S/W - # watchpoints are not supported yet - @expectedFailureAll(triple=re.compile('^mips')) - # SystemZ and PowerPC also currently supports only one H/W watchpoint - @expectedFailureAll(archs=['powerpc64le', 's390x']) - @expectedFailureNetBSD - @skipIfDarwin - def test_hello_watchlocation(self): - """Test watching a location with '-s size' option.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, num_expected_locations=1, loc_exact=False) - - # 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 let's set a write-type watchpoint pointed to by 'g_char_ptr'. - self.expect( - "watchpoint set expression -w write -s 1 -- g_char_ptr", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 1', - 'type = w']) - # Get a hold of the watchpoint id just created, it is used later on to - # match the watchpoint id which is expected to be fired. - match = re.match( - "Watchpoint created: Watchpoint (.*):", - self.res.GetOutput().splitlines()[0]) - if match: - expected_wp_id = int(match.group(1), 0) - else: - self.fail("Grokking watchpoint id faailed!") - - self.runCmd("expr unsigned val = *g_char_ptr; val") - self.expect(self.res.GetOutput().splitlines()[0], exe=False, - endstr=' = 0') - - self.runCmd("watchpoint set expression -w write -s 4 -- &threads[0]") - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type), but - # only once. The stop reason of the thread should be watchpoint. - self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', - 'stop reason = watchpoint %d' % expected_wp_id]) - - # Switch to the thread stopped due to watchpoint and issue some - # commands. - self.switch_to_thread_with_stop_reason(lldb.eStopReasonWatchpoint) - self.runCmd("thread backtrace") - self.expect("frame info", - substrs=[self.violating_func]) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 1. - self.expect("watchpoint list -v", - substrs=['hit_count = 1']) - - self.runCmd("thread backtrace all") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp deleted file mode 100644 index ac8cf6be166..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <condition_variable> -#include <cstdio> -#include <random> -#include <thread> - -std::default_random_engine g_random_engine{std::random_device{}()}; -std::uniform_int_distribution<> g_distribution{0, 3000000}; -std::condition_variable g_condition_variable; -std::mutex g_mutex; -int g_count; - -char *g_char_ptr = nullptr; - -void -barrier_wait() -{ - std::unique_lock<std::mutex> lock{g_mutex}; - if (--g_count > 0) - g_condition_variable.wait(lock); - else - g_condition_variable.notify_all(); -} - -void -do_bad_thing_with_location(char *char_ptr, char new_val) -{ - unsigned what = new_val; - printf("new value written to location(%p) = %u\n", char_ptr, what); - *char_ptr = new_val; -} - -uint32_t -access_pool (bool flag = false) -{ - static std::mutex g_access_mutex; - g_access_mutex.lock(); - - char old_val = *g_char_ptr; - if (flag) - do_bad_thing_with_location(g_char_ptr, old_val + 1); - - g_access_mutex.unlock(); - return *g_char_ptr; -} - -void -thread_func (uint32_t thread_index) -{ - printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index); - - barrier_wait(); - - uint32_t count = 0; - uint32_t val; - while (count++ < 15) - { - // random micro second sleep from zero to 3 seconds - int usec = g_distribution(g_random_engine); - printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec); - std::this_thread::sleep_for(std::chrono::microseconds{usec}); - - if (count < 7) - val = access_pool (); - else - val = access_pool (true); - - printf ("%s (thread = %u) after usleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count); - } - printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index); -} - - -int main (int argc, char const *argv[]) -{ - g_count = 4; - std::thread threads[3]; - - g_char_ptr = new char{}; - - // Create 3 threads - for (auto &thread : threads) - thread = std::thread{thread_func, std::distance(threads, &thread)}; - - printf ("Before turning all three threads loose...\n"); // Set break point at this line. - barrier_wait(); - - // Join all of our threads - for (auto &thread : threads) - thread.join(); - - delete g_char_ptr; - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py deleted file mode 100644 index 178507dbdf3..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Test my first lldb watchpoint. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class HelloWatchpointTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Our simple source filename. - self.source = 'main.c' - # Find the line number to break inside main(). - self.line = line_number( - self.source, '// Set break point at this line.') - # And the watchpoint variable declaration line number. - self.decl = line_number(self.source, - '// Watchpoint variable declaration.') - self.exe_name = self.getBuildArtifact('a.out') - self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @add_test_categories(["basic_process"]) - def test_hello_watchpoint_using_watchpoint_set(self): - """Test a simple sequence of watchpoint creation and watchpoint hit.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a write-type watchpoint for 'global'. - # There should be only one watchpoint hit (see main.c). - self.expect( - "watchpoint set variable -w write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w', - '%s:%d' % - (self.source, - self.decl)]) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type), but - # only once. The stop reason of the thread should be watchpoint. - self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', - 'stop reason = watchpoint']) - - self.runCmd("process continue") - - # Don't expect the read of 'global' to trigger a stop exception. - process = self.dbg.GetSelectedTarget().GetProcess() - if process.GetState() == lldb.eStateStopped: - self.assertFalse( - lldbutil.get_stopped_thread( - process, lldb.eStopReasonWatchpoint)) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 1. - self.expect("watchpoint list -v", - substrs=['hit_count = 1']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/main.c deleted file mode 100644 index 173162dd353..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/main.c +++ /dev/null @@ -1,29 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -int32_t global = 10; // Watchpoint variable declaration. -char gchar1 = 'a'; -char gchar2 = 'b'; - -int main(int argc, char** argv) { - int local = 0; - printf("&global=%p\n", &global); - printf("about to write to 'global'...\n"); // Set break point at this line. - // When stopped, watch 'global' for write. - global = 20; - gchar1 += 1; - gchar2 += 1; - local += argc; - ++local; - printf("local: %d\n", local); - printf("global=%d\n", global); - printf("gchar1='%c'\n", gchar1); - printf("gchar2='%c'\n", gchar2); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py deleted file mode 100644 index 589e2a3393b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py +++ /dev/null @@ -1,101 +0,0 @@ -""" -Test watchpoint slots we should not be able to install multiple watchpoints -within same word boundary. We should be able to install individual watchpoints -on any of the bytes, half-word, or word. This is only for ARM/AArch64 targets. -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class WatchpointSlotsTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - # Source filename. - self.source = 'main.c' - - # Output filename. - self.exe_name = self.getBuildArtifact("a.out") - self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} - - # This is a arm and aarch64 specific test case. No other architectures tested. - @skipIf(archs=no_match(['arm', 'aarch64'])) - def test_multiple_watchpoints_on_same_word(self): - - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Detect line number after which we are going to increment arrayName. - loc_line = line_number('main.c', '// About to write byteArray') - - # Set a breakpoint on the line detected above. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", loc_line, num_expected_locations=1, loc_exact=True) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - # Delete breakpoint we just hit. - self.expect("breakpoint delete 1", substrs=['1 breakpoints deleted']) - - # Set a watchpoint at byteArray[0] - self.expect("watchpoint set variable byteArray[0]", WATCHPOINT_CREATED, - substrs=['Watchpoint created','size = 1']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v 1", substrs=['hit_count = 0']) - - # debugserver on ios doesn't give an error, it creates another watchpoint, - # only expect errors on non-darwin platforms. - if not self.platformIsDarwin(): - # Try setting a watchpoint at byteArray[1] - self.expect("watchpoint set variable byteArray[1]", error=True, - substrs=['Watchpoint creation failed']) - - self.runCmd("process continue") - - # We should be stopped due to the watchpoint. - # The stop reason of the thread should be watchpoint. - self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', 'stop reason = watchpoint 1']) - - # Delete the watchpoint we hit above successfully. - self.expect("watchpoint delete 1", substrs=['1 watchpoints deleted']) - - # Set a watchpoint at byteArray[3] - self.expect("watchpoint set variable byteArray[3]", WATCHPOINT_CREATED, - substrs=['Watchpoint created','size = 1']) - - # Resume inferior. - self.runCmd("process continue") - - # We should be stopped due to the watchpoint. - # The stop reason of the thread should be watchpoint. - if self.platformIsDarwin(): - # On darwin we'll hit byteArray[3] which is watchpoint 2 - self.expect("thread list -v", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', 'stop reason = watchpoint 2']) - else: - self.expect("thread list -v", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', 'stop reason = watchpoint 3']) - - # Resume inferior. - self.runCmd("process continue") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c deleted file mode 100644 index 76ad27a4314..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -uint64_t pad0 = 0; -uint8_t byteArray[4] = {0}; -uint64_t pad1 = 0; - -int main(int argc, char** argv) { - - int i; - - for (i = 0; i < 4; i++) - { - printf("About to write byteArray[%d] ...\n", i); // About to write byteArray - pad0++; - byteArray[i] = 7; - pad1++; - } - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile deleted file mode 100644 index 314f1cb2f07..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py deleted file mode 100644 index 59f3d9f716f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Test handling of cases when a single instruction triggers multiple watchpoints -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class MultipleHitsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @skipIf(bugnumber="llvm.org/pr30758", oslist=["linux"], archs=["arm", "aarch64", "powerpc64le"]) - @skipIfwatchOS - def test(self): - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target and target.IsValid(), VALID_TARGET) - - bp = target.BreakpointCreateByName("main") - self.assertTrue(bp and bp.IsValid(), "Breakpoint is valid") - - process = target.LaunchSimple(None, None, - self.get_process_working_directory()) - self.assertEqual(process.GetState(), lldb.eStateStopped) - - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - frame = thread.GetFrameAtIndex(0) - self.assertTrue(frame and frame.IsValid(), "Frame is valid") - - buf = frame.FindValue("buf", lldb.eValueTypeVariableGlobal) - self.assertTrue(buf and buf.IsValid(), "buf is valid") - - for i in [0, target.GetAddressByteSize()]: - member = buf.GetChildAtIndex(i) - self.assertTrue(member and member.IsValid(), "member is valid") - - error = lldb.SBError() - watch = member.Watch(True, True, True, error) - self.assertTrue(error.Success()) - - process.Continue(); - self.assertEqual(process.GetState(), lldb.eStateStopped) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonWatchpoint) - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp deleted file mode 100644 index f99c12597ee..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> -alignas(16) uint8_t buf[32]; -// This uses inline assembly to generate an instruction that writes to a large -// block of memory. If it fails on your compiler/architecture, please add -// appropriate code to generate a large write to "buf". If you cannot write at -// least 2*sizeof(void*) bytes with a single instruction, you will have to skip -// this test. - -int main() { -#if defined(__i386__) || defined(__x86_64__) - asm volatile ("movdqa %%xmm0, %0" : : "m"(buf)); -#elif defined(__arm__) - asm volatile ("stm %0, { r0, r1, r2, r3 }" : : "r"(buf)); -#elif defined(__aarch64__) - asm volatile ("stp x0, x1, %0" : : "m"(buf)); -#elif defined(__mips__) - asm volatile ("lw $2, %0" : : "m"(buf)); -#endif - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/Makefile deleted file mode 100644 index 8817fff55e8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py deleted file mode 100644 index 90a0b207f64..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py +++ /dev/null @@ -1,119 +0,0 @@ -""" -Test that lldb watchpoint works for multiple threads. -""" - -from __future__ import print_function - - -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class WatchpointForMultipleThreadsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - main_spec = lldb.SBFileSpec("main.cpp", False) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @expectedFailureNetBSD - def test_watchpoint_before_thread_start(self): - """Test that we can hit a watchpoint we set before starting another thread""" - self.do_watchpoint_test("Before running the thread") - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @expectedFailureNetBSD - def test_watchpoint_after_thread_start(self): - """Test that we can hit a watchpoint we set after starting another thread""" - self.do_watchpoint_test("After running the thread") - - def do_watchpoint_test(self, line): - self.build() - lldbutil.run_to_source_breakpoint(self, line, self.main_spec) - - # Now let's set a write-type watchpoint for variable 'g_val'. - self.expect( - "watchpoint set variable -w write g_val", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - self.runCmd("thread list") - if "stop reason = watchpoint" in self.res.GetOutput(): - # Good, we verified that the watchpoint works! - self.runCmd("thread backtrace all") - else: - self.fail("The stop reason should be either break or watchpoint") - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 1. - self.expect("watchpoint list -v", - substrs=['hit_count = 1']) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - def test_watchpoint_multiple_threads_wp_set_and_then_delete(self): - """Test that lldb watchpoint works for multiple threads, and after the watchpoint is deleted, the watchpoint event should no longer fires.""" - self.build() - self.setTearDownCleanup() - - lldbutil.run_to_source_breakpoint(self, "After running the thread", self.main_spec) - - # Now let's set a write-type watchpoint for variable 'g_val'. - self.expect( - "watchpoint set variable -w write g_val", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - watchpoint_stops = 0 - while True: - self.runCmd("process continue") - self.runCmd("process status") - if re.search("Process .* exited", self.res.GetOutput()): - # Great, we are done with this test! - break - - self.runCmd("thread list") - if "stop reason = watchpoint" in self.res.GetOutput(): - self.runCmd("thread backtrace all") - watchpoint_stops += 1 - if watchpoint_stops > 1: - self.fail( - "Watchpoint hits not supposed to exceed 1 by design!") - # Good, we verified that the watchpoint works! Now delete the - # watchpoint. - if self.TraceOn(): - print( - "watchpoint_stops=%d at the moment we delete the watchpoint" % - watchpoint_stops) - self.runCmd("watchpoint delete 1") - self.expect("watchpoint list -v", - substrs=['No watchpoints currently set.']) - continue - else: - self.fail("The stop reason should be either break or watchpoint") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp deleted file mode 100644 index 1e6266d2877..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "pseudo_barrier.h" -#include <cstdio> -#include <thread> - -volatile uint32_t g_val = 0; -pseudo_barrier_t g_barrier; - -void thread_func() { - pseudo_barrier_wait(g_barrier); - printf("%s starting...\n", __FUNCTION__); - for (uint32_t i = 0; i < 10; ++i) - g_val = i; -} - -int main(int argc, char const *argv[]) { - printf("Before running the thread\n"); - pseudo_barrier_init(g_barrier, 2); - std::thread thread(thread_func); - - printf("After running the thread\n"); - pseudo_barrier_wait(g_barrier); - - thread.join(); - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py deleted file mode 100644 index e0c77b4ea6b..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ /dev/null @@ -1,122 +0,0 @@ -"""Test stepping over watchpoints.""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestStepOverWatchpoint(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - archs=[ - 'aarch64', - 'arm'], - bugnumber="llvm.org/pr26031") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - @expectedFailureAll(oslist=["ios", "watchos", "tvos", "bridgeos"], bugnumber="<rdar://problem/34027183>") # watchpoint tests aren't working on arm64 - @add_test_categories(["basic_process"]) - def test(self): - """Test stepping over watchpoints.""" - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - lldbutil.run_break_set_by_symbol(self, 'main') - - process = target.LaunchSimple(None, None, - self.get_process_working_directory()) - self.assertTrue(process.IsValid(), PROCESS_IS_VALID) - self.assertTrue(process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - - thread = lldbutil.get_stopped_thread(process, - lldb.eStopReasonBreakpoint) - self.assertTrue(thread.IsValid(), "Failed to get thread.") - - frame = thread.GetFrameAtIndex(0) - self.assertTrue(frame.IsValid(), "Failed to get frame.") - - read_value = frame.FindValue('g_watch_me_read', - lldb.eValueTypeVariableGlobal) - self.assertTrue(read_value.IsValid(), "Failed to find read value.") - - error = lldb.SBError() - - # resolve_location=True, read=True, write=False - read_watchpoint = read_value.Watch(True, True, False, error) - self.assertTrue(error.Success(), - "Error while setting watchpoint: %s" % - error.GetCString()) - self.assertTrue(read_watchpoint, "Failed to set read watchpoint.") - - thread.StepOver() - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, - STOPPED_DUE_TO_WATCHPOINT) - self.assertTrue(thread.GetStopDescription(20) == 'watchpoint 1') - - process.Continue() - self.assertTrue(process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - self.assertTrue(thread.GetStopDescription(20) == 'step over') - - self.step_inst_for_watchpoint(1) - - write_value = frame.FindValue('g_watch_me_write', - lldb.eValueTypeVariableGlobal) - self.assertTrue(write_value, "Failed to find write value.") - - # Most of the MIPS boards provide only one H/W watchpoints, and S/W - # watchpoints are not supported yet - arch = self.getArchitecture() - if re.match("^mips", arch) or re.match("powerpc64le", arch): - self.runCmd("watchpoint delete 1") - - # resolve_location=True, read=False, write=True - write_watchpoint = write_value.Watch(True, False, True, error) - self.assertTrue(write_watchpoint, "Failed to set write watchpoint.") - self.assertTrue(error.Success(), - "Error while setting watchpoint: %s" % - error.GetCString()) - - thread.StepOver() - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, - STOPPED_DUE_TO_WATCHPOINT) - self.assertTrue(thread.GetStopDescription(20) == 'watchpoint 2') - - process.Continue() - self.assertTrue(process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - self.assertTrue(thread.GetStopDescription(20) == 'step over') - - self.step_inst_for_watchpoint(2) - - def step_inst_for_watchpoint(self, wp_id): - watchpoint_hit = False - current_line = self.frame().GetLineEntry().GetLine() - while self.frame().GetLineEntry().GetLine() == current_line: - self.thread().StepInstruction(False) # step_over=False - stop_reason = self.thread().GetStopReason() - if stop_reason == lldb.eStopReasonWatchpoint: - self.assertFalse(watchpoint_hit, "Watchpoint already hit.") - expected_stop_desc = "watchpoint %d" % wp_id - actual_stop_desc = self.thread().GetStopDescription(20) - self.assertTrue(actual_stop_desc == expected_stop_desc, - "Watchpoint ID didn't match.") - watchpoint_hit = True - else: - self.assertTrue(stop_reason == lldb.eStopReasonPlanComplete, - STOPPED_DUE_TO_STEP_IN) - self.assertTrue(watchpoint_hit, "Watchpoint never hit.") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/main.c deleted file mode 100644 index 2d87d9a2f73..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/main.c +++ /dev/null @@ -1,19 +0,0 @@ -char g_watch_me_read; -char g_watch_me_write; -char g_temp; - -void watch_read() { - g_temp = g_watch_me_read; -} - -void watch_write() { - g_watch_me_write = g_temp; -} - -int main() { - watch_read(); - g_temp = g_watch_me_read; - watch_write(); - g_watch_me_write = g_temp; - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py deleted file mode 100644 index 79cb5ae4761..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -Test that a variable watchpoint should only hit when in scope. -""" - -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 WatchedVariableHitWhenInScopeTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - # This test depends on not tracking watchpoint expression hits if we have - # left the watchpoint scope. We will provide such an ability at some point - # but the way this was done was incorrect, and it is unclear that for the - # most part that's not what folks mostly want, so we have to provide a - # clearer API to express this. - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Our simple source filename. - self.source = 'main.c' - self.exe_name = self.testMethodName - self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} - - # Test hangs due to a kernel bug, see fdfeff0f in the linux kernel for details - @skipIfTargetAndroid(api_levels=list(range(25+1)), archs=["aarch64", "arm"]) - @skipIf - def test_watched_var_should_only_hit_when_in_scope(self): - """Test that a variable watchpoint should only hit when in scope.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped in main. - lldbutil.run_break_set_by_symbol( - self, "main", 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 let's set a watchpoint for 'c.a'. - # There should be only one watchpoint hit (see main.c). - self.expect("watchpoint set variable c.a", WATCHPOINT_CREATED, - substrs=['Watchpoint created', 'size = 4', 'type = w']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type), but - # only once. The stop reason of the thread should be watchpoint. - self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', - 'stop reason = watchpoint']) - - self.runCmd("process continue") - # Don't expect the read of 'global' to trigger a stop exception. - # The process status should be 'exited'. - self.expect("process status", - substrs=['exited']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 1. - self.expect("watchpoint list -v", - substrs=['hit_count = 1']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/main.c deleted file mode 100644 index 1bf7a00ac83..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/main.c +++ /dev/null @@ -1,15 +0,0 @@ -typedef struct -{ - int a; - float b; -} mystruct; - -int main() -{ - mystruct c; - - c.a = 5; - c.b = 3.6; - - return 0; -}
\ No newline at end of file diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py deleted file mode 100644 index b17d28082ce..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py +++ /dev/null @@ -1,375 +0,0 @@ -""" -Test watchpoint list, enable, disable, and delete commands. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class WatchpointCommandsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Our simple source filename. - self.source = 'main.c' - # Find the line number to break inside main(). - self.line = line_number( - self.source, '// Set break point at this line.') - self.line2 = line_number( - self.source, - '// Set 2nd break point for disable_then_enable test case.') - # And the watchpoint variable declaration line number. - self.decl = line_number(self.source, - '// Watchpoint variable declaration.') - # Build dictionary to have unique executable names for each test - # method. - self.exe_name = self.testMethodName - self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_rw_watchpoint(self): - """Test read_write watchpoint and expect to stop two times.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a read_write-type watchpoint for 'global'. - # There should be two watchpoint hits (see main.c). - self.expect( - "watchpoint set variable -w read_write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = rw', - '%s:%d' % - (self.source, - self.decl)]) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['Number of supported hardware watchpoints:', - 'hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (read_write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (read_write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - self.runCmd("process continue") - - # There should be no more watchpoint hit and the process status should - # be 'exited'. - self.expect("process status", - substrs=['exited']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 2. - self.expect("watchpoint list -v", - substrs=['hit_count = 2']) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_rw_watchpoint_delete(self): - """Test delete watchpoint and expect not to stop for watchpoint.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a read_write-type watchpoint for 'global'. - # There should be two watchpoint hits (see main.c). - self.expect( - "watchpoint set variable -w read_write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = rw', - '%s:%d' % - (self.source, - self.decl)]) - - # Delete the watchpoint immediately, but set auto-confirm to true - # first. - self.runCmd("settings set auto-confirm true") - self.expect("watchpoint delete", - substrs=['All watchpoints removed.']) - # Restore the original setting of auto-confirm. - self.runCmd("settings clear auto-confirm") - - # Use the '-v' option to do verbose listing of the watchpoint. - self.runCmd("watchpoint list -v") - - self.runCmd("process continue") - - # There should be no more watchpoint hit and the process status should - # be 'exited'. - self.expect("process status", - substrs=['exited']) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_rw_watchpoint_set_ignore_count(self): - """Test watchpoint ignore count and expect to not to stop at all.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a read_write-type watchpoint for 'global'. - # There should be two watchpoint hits (see main.c). - self.expect( - "watchpoint set variable -w read_write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = rw', - '%s:%d' % - (self.source, - self.decl)]) - - # Set the ignore count of the watchpoint immediately. - self.expect("watchpoint ignore -i 2", - substrs=['All watchpoints ignored.']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # Expect to find an ignore_count of 2. - self.expect("watchpoint list -v", - substrs=['hit_count = 0', 'ignore_count = 2']) - - self.runCmd("process continue") - - # There should be no more watchpoint hit and the process status should - # be 'exited'. - self.expect("process status", - substrs=['exited']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # Expect to find a hit_count of 2 as well. - self.expect("watchpoint list -v", - substrs=['hit_count = 2', 'ignore_count = 2']) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_rw_disable_after_first_stop(self): - """Test read_write watchpoint but disable it after the first stop.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a read_write-type watchpoint for 'global'. - # There should be two watchpoint hits (see main.c). - self.expect( - "watchpoint set variable -w read_write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = rw', - '%s:%d' % - (self.source, - self.decl)]) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['state = enabled', 'hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (read_write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - # Before continuing, we'll disable the watchpoint, which means we won't - # stop again after this. - self.runCmd("watchpoint disable") - - self.expect("watchpoint list -v", - substrs=['state = disabled', 'hit_count = 1']) - - self.runCmd("process continue") - - # There should be no more watchpoint hit and the process status should - # be 'exited'. - self.expect("process status", - substrs=['exited']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 1. - self.expect("watchpoint list -v", - substrs=['hit_count = 1']) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_rw_disable_then_enable(self): - """Test read_write watchpoint, disable initially, then enable it.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line( - self, None, self.line2, 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 let's set a read_write-type watchpoint for 'global'. - # There should be two watchpoint hits (see main.c). - self.expect( - "watchpoint set variable -w read_write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = rw', - '%s:%d' % - (self.source, - self.decl)]) - - # Immediately, we disable the watchpoint. We won't be stopping due to a - # watchpoint after this. - self.runCmd("watchpoint disable") - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['state = disabled', 'hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the breakpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stop reason = breakpoint']) - - # Before continuing, we'll enable the watchpoint, which means we will - # stop again after this. - self.runCmd("watchpoint enable") - - self.expect("watchpoint list -v", - substrs=['state = enabled', 'hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (read_write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - self.runCmd("process continue") - - # There should be no more watchpoint hit and the process status should - # be 'exited'. - self.expect("process status", - substrs=['exited']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 1. - self.expect("watchpoint list -v", - substrs=['hit_count = 1']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/Makefile deleted file mode 100644 index ee6b9cc62b4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py deleted file mode 100644 index 1919602f0c8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py +++ /dev/null @@ -1,172 +0,0 @@ -""" -Test 'watchpoint command'. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class WatchpointLLDBCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - 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.line = line_number( - self.source, '// Set break point at this line.') - # And the watchpoint variable declaration line number. - self.decl = line_number(self.source, - '// Watchpoint variable declaration.') - # Build dictionary to have unique executable names for each test - # method. - self.exe_name = 'a%d.out' % self.test_number - self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} - - @expectedFailureAll( - oslist=["linux"], - archs=["aarch64"], - triple=no_match(".*-android"), - bugnumber="llvm.org/pr27710") # work on android - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @expectedFailureNetBSD - def test_watchpoint_command(self): - """Test 'watchpoint command'.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a write-type watchpoint for 'global'. - self.expect( - "watchpoint set variable -w write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w', - '%s:%d' % - (self.source, - self.decl)]) - - self.runCmd('watchpoint command add 1 -o "expr -- cookie = 777"') - - # List the watchpoint command we just added. - self.expect("watchpoint command list 1", - substrs=['expr -- cookie = 777']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - # Check that the watchpoint snapshoting mechanism is working. - self.expect("watchpoint list -v", - substrs=['old value:', ' = 0', - 'new value:', ' = 1']) - - # The watchpoint command "forced" our global variable 'cookie' to - # become 777. - self.expect("frame variable --show-globals cookie", - substrs=['(int32_t)', 'cookie = 777']) - - @expectedFailureAll( - oslist=["linux"], - archs=["aarch64"], - triple=no_match(".*-android"), - bugnumber="llvm.org/pr27710") # work on android - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - def test_watchpoint_command_can_disable_a_watchpoint(self): - """Test that 'watchpoint command' action can disable a watchpoint after it is triggered.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a write-type watchpoint for 'global'. - self.expect( - "watchpoint set variable -w write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w', - '%s:%d' % - (self.source, - self.decl)]) - - self.runCmd('watchpoint command add 1 -o "watchpoint disable 1"') - - # List the watchpoint command we just added. - self.expect("watchpoint command list 1", - substrs=['watchpoint disable 1']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - # Check that the watchpoint has been disabled. - self.expect("watchpoint list -v", - substrs=['disabled']) - - self.runCmd("process continue") - - # There should be no more watchpoint hit and the process status should - # be 'exited'. - self.expect("process status", - substrs=['exited']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py deleted file mode 100644 index e7e17a982de..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py +++ /dev/null @@ -1,172 +0,0 @@ -""" -Test 'watchpoint 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 WatchpointPythonCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - 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.line = line_number( - self.source, '// Set break point at this line.') - # And the watchpoint variable declaration line number. - self.decl = line_number(self.source, - '// Watchpoint variable declaration.') - # Build dictionary to have unique executable names for each test - # method. - self.exe_name = self.testMethodName - self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @expectedFailureAll( - oslist=["linux"], - archs=["aarch64"], - triple=no_match(".*-android"), - bugnumber="llvm.org/pr27710") # work on android - @expectedFailureNetBSD - def test_watchpoint_command(self): - """Test 'watchpoint command'.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a write-type watchpoint for 'global'. - self.expect( - "watchpoint set variable -w write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w', - '%s:%d' % - (self.source, - self.decl)]) - - self.runCmd( - 'watchpoint command add -s python 1 -o \'frame.EvaluateExpression("cookie = 777")\'') - - # List the watchpoint command we just added. - self.expect("watchpoint command list 1", - substrs=['frame.EvaluateExpression', 'cookie = 777']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - # Check that the watchpoint snapshoting mechanism is working. - self.expect("watchpoint list -v", - substrs=['old value:', ' = 0', - 'new value:', ' = 1']) - - # The watchpoint command "forced" our global variable 'cookie' to - # become 777. - self.expect("frame variable --show-globals cookie", - substrs=['(int32_t)', 'cookie = 777']) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @expectedFailureAll( - oslist=["linux"], - archs=["aarch64"], - triple=no_match(".*-android"), - bugnumber="llvm.org/pr27710") # work on android - @expectedFailureNetBSD - def test_continue_in_watchpoint_command(self): - """Test continue in a watchpoint command.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a write-type watchpoint for 'global'. - self.expect( - "watchpoint set variable -w write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w', - '%s:%d' % - (self.source, - self.decl)]) - - cmd_script_file = os.path.join(self.getSourceDir(), - "watchpoint_command.py") - self.runCmd("command script import '%s'" % (cmd_script_file)) - - self.runCmd( - 'watchpoint command add -F watchpoint_command.watchpoint_command') - - # List the watchpoint command we just added. - self.expect("watchpoint command list 1", - substrs=['watchpoint_command.watchpoint_command']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - - # We should have hit the watchpoint once, set cookie to 888, then continued to the - # second hit and set it to 999 - self.expect("frame variable --show-globals cookie", - substrs=['(int32_t)', 'cookie = 999']) - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/main.cpp deleted file mode 100644 index 43e4c1a7a34..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -int32_t global = 0; // Watchpoint variable declaration. -int32_t cookie = 0; - -static void modify(int32_t &var) { - ++var; -} - -int main(int argc, char** argv) { - int local = 0; - printf("&global=%p\n", &global); - printf("about to write to 'global'...\n"); // Set break point at this line. - for (int i = 0; i < 10; ++i) - modify(global); - - printf("global=%d\n", global); - printf("cookie=%d\n", cookie); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py deleted file mode 100644 index ae5913a500e..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py +++ /dev/null @@ -1,15 +0,0 @@ -import lldb - -num_hits = 0 - - -def watchpoint_command(frame, wp, dict): - global num_hits - if num_hits == 0: - print ("I stopped the first time") - frame.EvaluateExpression("cookie = 888") - num_hits += 1 - frame.thread.process.Continue() - else: - print ("I stopped the %d time" % (num_hits)) - frame.EvaluateExpression("cookie = 999") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/Makefile deleted file mode 100644 index ee6b9cc62b4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py deleted file mode 100644 index edd1cfba26f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Test watchpoint modify command to set condition on a watchpoint. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class WatchpointConditionCmdTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - 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.line = line_number( - self.source, '// Set break point at this line.') - # And the watchpoint variable declaration line number. - self.decl = line_number(self.source, - '// Watchpoint variable declaration.') - # Build dictionary to have unique executable names for each test - # method. - self.exe_name = self.testMethodName - self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} - - @expectedFailureAll( - oslist=["linux"], - archs=["aarch64"], - triple=no_match(".*-android"), - bugnumber="llvm.org/pr27710") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @expectedFailureNetBSD - def test_watchpoint_cond(self): - """Test watchpoint condition.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a write-type watchpoint for 'global'. - # With a condition of 'global==5'. - self.expect( - "watchpoint set variable -w write global", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 4', - 'type = w', - '%s:%d' % - (self.source, - self.decl)]) - - self.runCmd("watchpoint modify -c 'global==5'") - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0', 'global==5']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type). - # The stop reason of the thread should be watchpoint. - self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stop reason = watchpoint']) - self.expect("frame variable --show-globals global", - substrs=['(int32_t)', 'global = 5']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 2. - self.expect("watchpoint list -v", - substrs=['hit_count = 5']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/main.cpp deleted file mode 100644 index 3f7c5f5be96..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -int32_t global = 0; // Watchpoint variable declaration. - -static void modify(int32_t &var) { - ++var; -} - -int main(int argc, char** argv) { - int local = 0; - printf("&global=%p\n", &global); - printf("about to write to 'global'...\n"); // Set break point at this line. - // When stopped, watch 'global', - // for the condition "global == 5". - for (int i = 0; i < 10; ++i) - modify(global); - - printf("global=%d\n", global); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/main.c deleted file mode 100644 index a9d1cf28da0..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/main.c +++ /dev/null @@ -1,23 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -int32_t global = 10; // Watchpoint variable declaration. - -int main(int argc, char** argv) { - int local = 0; - printf("&global=%p\n", &global); - printf("about to write to 'global'...\n"); // Set break point at this line. - // When stopped, watch 'global'. - global = 20; - local += argc; - ++local; // Set 2nd break point for disable_then_enable test case. - printf("local: %d\n", local); - printf("global=%d\n", global); -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py deleted file mode 100644 index 7acf4e3ff65..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py +++ /dev/null @@ -1,80 +0,0 @@ -""" -Test that the SBWatchpoint::SetEnable API works. -""" - -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from lldbsuite.test import lldbplatform, lldbplatformutil - - -class TestWatchpointSetEnable(TestBase): - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - def test_disable_works (self): - """Set a watchpoint, disable it, and make sure it doesn't get hit.""" - self.build() - self.do_test(False) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - def test_disable_enable_works (self): - """Set a watchpoint, disable it, and make sure it doesn't get hit.""" - self.build() - self.do_test(True) - - def do_test(self, test_enable): - """Set a watchpoint, disable it and make sure it doesn't get hit.""" - - exe = self.getBuildArtifact("a.out") - main_file_spec = lldb.SBFileSpec("main.c") - - # Create a target by the debugger. - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - bkpt_before = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", main_file_spec) - self.assertEqual(bkpt_before.GetNumLocations(), 1, "Failed setting the before breakpoint.") - - bkpt_after = self.target.BreakpointCreateBySourceRegex("We should have stopped", main_file_spec) - self.assertEqual(bkpt_after.GetNumLocations(), 1, "Failed setting the after breakpoint.") - - process = self.target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, bkpt_before) - self.assertTrue(thread.IsValid(), "We didn't stop at the before breakpoint.") - - ret_val = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand("watchpoint set variable -w write global_var", ret_val) - self.assertTrue(ret_val.Succeeded(), "Watchpoint set variable did not return success.") - - wp = self.target.FindWatchpointByID(1) - self.assertTrue(wp.IsValid(), "Didn't make a valid watchpoint.") - self.assertTrue(wp.GetWatchAddress() != lldb.LLDB_INVALID_ADDRESS, "Watch address is invalid") - - wp.SetEnabled(False) - self.assertTrue(not wp.IsEnabled(), "The watchpoint thinks it is still enabled") - - process.Continue() - - stop_reason = thread.GetStopReason() - - self.assertEqual(stop_reason, lldb.eStopReasonBreakpoint, "We didn't stop at our breakpoint.") - - if test_enable: - wp.SetEnabled(True) - self.assertTrue(wp.IsEnabled(), "The watchpoint thinks it is still disabled.") - process.Continue() - stop_reason = thread.GetStopReason() - self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "We didn't stop at our watchpoint") - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c deleted file mode 100644 index dcbc766c594..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <stdio.h> - -int global_var = 10; - -int -main() -{ - printf("Set a breakpoint here: %d.\n", global_var); - global_var = 20; - printf("We should have stopped on the previous line: %d.\n", global_var); - global_var = 30; - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py deleted file mode 100644 index c14961c8e8f..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py +++ /dev/null @@ -1,117 +0,0 @@ -"""Test that adding, deleting and modifying watchpoints sends the appropriate events.""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestWatchpointEvents (TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers that we will step to in main: - self.main_source = "main.c" - - @add_test_categories(['pyapi']) - @expectedFailureAll( - oslist=["linux"], - archs=["aarch64"], - triple=no_match(".*-android"), - bugnumber="llvm.org/pr27710") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - def test_with_python_api(self): - """Test that adding, deleting and modifying watchpoints sends the appropriate events.""" - self.build() - - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - self.main_source_spec = lldb.SBFileSpec(self.main_source) - - break_in_main = target.BreakpointCreateBySourceRegex( - '// Put a breakpoint here.', self.main_source_spec) - self.assertTrue(break_in_main, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, break_in_main) - - if len(threads) != 1: - self.fail("Failed to stop at first breakpoint in main.") - - thread = threads[0] - frame = thread.GetFrameAtIndex(0) - local_var = frame.FindVariable("local_var") - self.assertTrue(local_var.IsValid()) - - self.listener = lldb.SBListener("com.lldb.testsuite_listener") - self.target_bcast = target.GetBroadcaster() - self.target_bcast.AddListener( - self.listener, lldb.SBTarget.eBroadcastBitWatchpointChanged) - self.listener.StartListeningForEvents( - self.target_bcast, lldb.SBTarget.eBroadcastBitWatchpointChanged) - - error = lldb.SBError() - local_watch = local_var.Watch(True, False, True, error) - if not error.Success(): - self.fail( - "Failed to make watchpoint for local_var: %s" % - (error.GetCString())) - - self.GetWatchpointEvent(lldb.eWatchpointEventTypeAdded) - # Now change some of the features of this watchpoint and make sure we - # get events: - local_watch.SetEnabled(False) - self.GetWatchpointEvent(lldb.eWatchpointEventTypeDisabled) - - local_watch.SetEnabled(True) - self.GetWatchpointEvent(lldb.eWatchpointEventTypeEnabled) - - local_watch.SetIgnoreCount(10) - self.GetWatchpointEvent(lldb.eWatchpointEventTypeIgnoreChanged) - - condition = "1 == 2" - local_watch.SetCondition(condition) - self.GetWatchpointEvent(lldb.eWatchpointEventTypeConditionChanged) - - self.assertTrue(local_watch.GetCondition() == condition, - 'make sure watchpoint condition is "' + condition + '"') - - def GetWatchpointEvent(self, event_type): - # We added a watchpoint so we should get a watchpoint added event. - event = lldb.SBEvent() - success = self.listener.WaitForEvent(1, event) - self.assertTrue(success, "Successfully got watchpoint event") - self.assertTrue( - lldb.SBWatchpoint.EventIsWatchpointEvent(event), - "Event is a watchpoint event.") - found_type = lldb.SBWatchpoint.GetWatchpointEventTypeFromEvent(event) - self.assertTrue( - found_type == event_type, - "Event is not correct type, expected: %d, found: %d" % - (event_type, - found_type)) - # There shouldn't be another event waiting around: - found_event = self.listener.PeekAtNextEventForBroadcasterWithType( - self.target_bcast, lldb.SBTarget.eBroadcastBitBreakpointChanged, event) - if found_event: - print("Found an event I didn't expect: ", event) - - self.assertTrue(not found_event, "Only one event per change.") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/main.c deleted file mode 100644 index 4b917536a16..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/main.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdio.h> - -int -main (int argc, char **argv) -{ - int local_var = 10; - printf ("local_var is: %d.\n", local_var++); // Put a breakpoint here. - return local_var; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py deleted file mode 100644 index 4964fbcb217..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -Test displayed value of a vector variable while doing watchpoint operations -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestValueOfVectorVariableTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - def test_value_of_vector_variable_using_watchpoint_set(self): - """Test verify displayed value of vector variable.""" - exe = self.getBuildArtifact("a.out") - d = {'C_SOURCES': self.source, 'EXE': exe} - self.build(dictionary=d) - self.setTearDownCleanup(dictionary=d) - self.value_of_vector_variable_with_watchpoint_set() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Our simple source filename. - self.source = 'main.c' - - def value_of_vector_variable_with_watchpoint_set(self): - """Test verify displayed value of vector variable""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Set break to get a frame - self.runCmd("b main") - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Value of a vector variable should be displayed correctly - self.expect( - "watchpoint set variable global_vector", - WATCHPOINT_CREATED, - substrs=['new value: (1, 2, 3, 4)']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/main.c deleted file mode 100644 index 04d8a06a354..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/main.c +++ /dev/null @@ -1,15 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -typedef signed char v4i8 __attribute__ ((vector_size(4))); -v4i8 global_vector = {1, 2, 3, 4}; - -int -main () -{ - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/Makefile deleted file mode 100644 index 8817fff55e8..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py deleted file mode 100644 index 7a00244309a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py +++ /dev/null @@ -1,107 +0,0 @@ -""" -Test lldb watchpoint that uses 'watchpoint set -w write -s size' to watch a pointed location with size. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class WatchLocationUsingWatchpointSetTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - 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.line = line_number( - self.source, '// Set break point at this line.') - # This is for verifying that watch location works. - self.violating_func = "do_bad_thing_with_location" - # Build dictionary to have unique executable names for each test - # method. - - @expectedFailureAll( - oslist=["linux"], - archs=[ - 'aarch64', - 'arm'], - bugnumber="llvm.org/pr26031") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - @expectedFailureNetBSD - def test_watchlocation_using_watchpoint_set(self): - """Test watching a location with 'watchpoint set expression -w write -s size' option.""" - self.build() - self.setTearDownCleanup() - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Add a breakpoint to set a watchpoint when stopped on the breakpoint. - lldbutil.run_break_set_by_file_and_line( - self, None, self.line, 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 let's set a write-type watchpoint pointed to by 'g_char_ptr' and - # with offset as 7. - # The main.cpp, by design, misbehaves by not following the agreed upon - # protocol of only accessing the allowable index range of [0, 6]. - self.expect( - "watchpoint set expression -w write -s 1 -- g_char_ptr + 7", - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = 1', - 'type = w']) - self.runCmd("expr unsigned val = g_char_ptr[7]; val") - self.expect(self.res.GetOutput().splitlines()[0], exe=False, - endstr=' = 0') - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", - substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped again due to the watchpoint (write type), but - # only once. The stop reason of the thread should be watchpoint. - self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', - 'stop reason = watchpoint', - self.violating_func]) - - # Switch to the thread stopped due to watchpoint and issue some - # commands. - self.switch_to_thread_with_stop_reason(lldb.eStopReasonWatchpoint) - self.runCmd("thread backtrace") - self.runCmd("expr unsigned val = g_char_ptr[7]; val") - self.expect(self.res.GetOutput().splitlines()[0], exe=False, - endstr=' = 99') - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be the same as the number of threads that - # stopped on a watchpoint. - threads = lldbutil.get_stopped_threads( - self.process(), lldb.eStopReasonWatchpoint) - self.expect("watchpoint list -v", - substrs=['hit_count = %d' % len(threads)]) - - self.runCmd("thread backtrace all") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp deleted file mode 100644 index f21d2b33ff4..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <condition_variable> -#include <cstdio> -#include <thread> - -std::condition_variable g_condition_variable; -std::mutex g_mutex; -int g_count; - -char *g_char_ptr = nullptr; - -void -barrier_wait() -{ - std::unique_lock<std::mutex> lock{g_mutex}; - if (--g_count > 0) - g_condition_variable.wait(lock); - else - g_condition_variable.notify_all(); -} - -void -do_bad_thing_with_location(unsigned index, char *char_ptr, char new_val) -{ - unsigned what = new_val; - printf("new value written to array(%p) and index(%u) = %u\n", char_ptr, index, what); - char_ptr[index] = new_val; -} - -uint32_t -access_pool (bool flag = false) -{ - static std::mutex g_access_mutex; - static unsigned idx = 0; // Well-behaving thread only writes into indexs from 0..6. - if (!flag) - g_access_mutex.lock(); - - // idx valid range is [0, 6]. - if (idx > 6) - idx = 0; - - if (flag) - { - // Write into a forbidden area. - do_bad_thing_with_location(7, g_char_ptr, 99); - } - - unsigned index = idx++; - - if (!flag) - g_access_mutex.unlock(); - return g_char_ptr[index]; -} - -void -thread_func (uint32_t thread_index) -{ - printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index); - - barrier_wait(); - - uint32_t count = 0; - uint32_t val; - while (count++ < 15) - { - printf ("%s (thread = %u) sleeping for 1 second...\n", __FUNCTION__, thread_index); - std::this_thread::sleep_for(std::chrono::seconds(1)); - - if (count < 7) - val = access_pool (); - else - val = access_pool (true); - - printf ("%s (thread = %u) after sleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count); - } - printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index); -} - - -int main (int argc, char const *argv[]) -{ - g_count = 4; - std::thread threads[3]; - - g_char_ptr = new char[10]{}; - - // Create 3 threads - for (auto &thread : threads) - thread = std::thread{thread_func, std::distance(threads, &thread)}; - - struct { - int a; - int b; - int c; - } MyAggregateDataType; - - printf ("Before turning all three threads loose...\n"); // Set break point at this line. - barrier_wait(); - - // Join all of our threads - for (auto &thread : threads) - thread.join(); - - delete[] g_char_ptr; - - return 0; -} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/Makefile deleted file mode 100644 index b09a579159d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py deleted file mode 100644 index bcfc2a45883..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py +++ /dev/null @@ -1,132 +0,0 @@ -""" -Test watchpoint size cases (1-byte, 2-byte, 4-byte). -Make sure we can watch all bytes, words or double words individually -when they are packed in a 8-byte region. - -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class WatchpointSizeTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - # Source filename. - self.source = 'main.c' - - # Output filename. - self.exe_name = self.getBuildArtifact("a.out") - self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name} - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_byte_size_watchpoints_with_byte_selection(self): - """Test to selectively watch different bytes in a 8-byte array.""" - self.run_watchpoint_size_test('byteArray', 8, '1') - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_two_byte_watchpoints_with_word_selection(self): - """Test to selectively watch different words in an 8-byte word array.""" - self.run_watchpoint_size_test('wordArray', 4, '2') - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - # Read-write watchpoints not supported on SystemZ - @expectedFailureAll(archs=['s390x']) - def test_four_byte_watchpoints_with_dword_selection(self): - """Test to selectively watch two double words in an 8-byte dword array.""" - self.run_watchpoint_size_test('dwordArray', 2, '4') - - def run_watchpoint_size_test(self, arrayName, array_size, watchsize): - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - - exe = self.getBuildArtifact(self.exe_name) - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Detect line number after which we are going to increment arrayName. - loc_line = line_number('main.c', '// About to write ' + arrayName) - - # Set a breakpoint on the line detected above. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", loc_line, num_expected_locations=1, loc_exact=True) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - for i in range(array_size): - # 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']) - - # Set a read_write type watchpoint arrayName - watch_loc = arrayName + "[" + str(i) + "]" - self.expect( - "watchpoint set variable -w read_write " + - watch_loc, - WATCHPOINT_CREATED, - substrs=[ - 'Watchpoint created', - 'size = ' + - watchsize, - 'type = rw']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should be 0 initially. - self.expect("watchpoint list -v", substrs=['hit_count = 0']) - - self.runCmd("process continue") - - # We should be stopped due to the watchpoint. - # The stop reason of the thread should be watchpoint. - self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', 'stop reason = watchpoint']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 1. - self.expect("watchpoint list -v", - substrs=['hit_count = 1']) - - self.runCmd("process continue") - - # We should be stopped due to the watchpoint. - # The stop reason of the thread should be watchpoint. - self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT, - substrs=['stopped', 'stop reason = watchpoint']) - - # Use the '-v' option to do verbose listing of the watchpoint. - # The hit count should now be 1. - # Verify hit_count has been updated after value has been read. - self.expect("watchpoint list -v", - substrs=['hit_count = 2']) - - # Delete the watchpoint immediately, but set auto-confirm to true - # first. - self.runCmd("settings set auto-confirm true") - self.expect( - "watchpoint delete", - substrs=['All watchpoints removed.']) - # Restore the original setting of auto-confirm. - self.runCmd("settings clear auto-confirm") - - self.runCmd("process continue") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/main.c deleted file mode 100644 index 4edcf877e74..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/main.c +++ /dev/null @@ -1,65 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -uint64_t pad0 = 0; -uint8_t byteArray[8] = {0}; -uint64_t pad1 = 0; -uint16_t wordArray[4] = {0}; -uint64_t pad2 = 0; -uint32_t dwordArray[2] = {0}; - -int main(int argc, char** argv) { - - int i; - uint8_t localByte; - uint16_t localWord; - uint32_t localDword; - - for (i = 0; i < 8; i++) - { - printf("About to write byteArray[%d] ...\n", i); // About to write byteArray - pad0++; - byteArray[i] = 7; - pad1++; - localByte = byteArray[i]; // Here onwards we should'nt be stopped in loop - byteArray[i]++; - localByte = byteArray[i]; - } - - pad0 = 0; - pad1 = 0; - - for (i = 0; i < 4; i++) - { - printf("About to write wordArray[%d] ...\n", i); // About to write wordArray - pad0++; - wordArray[i] = 7; - pad1++; - localWord = wordArray[i]; // Here onwards we should'nt be stopped in loop - wordArray[i]++; - localWord = wordArray[i]; - } - - pad0 = 0; - pad1 = 0; - - for (i = 0; i < 2; i++) - { - printf("About to write dwordArray[%d] ...\n", i); // About to write dwordArray - pad0++; - dwordArray[i] = 7; - pad1++; - localDword = dwordArray[i]; // Here onwards we shouldn't be stopped in loop - dwordArray[i]++; - localDword = dwordArray[i]; - } - - return 0; -} |