diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities')
1034 files changed, 0 insertions, 49030 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/abbreviation/.categories b/packages/Python/lldbsuite/test/functionalities/abbreviation/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/abbreviation/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py b/packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py deleted file mode 100644 index b3095c758f9b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py +++ /dev/null @@ -1,112 +0,0 @@ -""" -Test some lldb command abbreviations and aliases for proper resolution. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class AbbreviationsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_command_abbreviations_and_aliases(self): - command_interpreter = self.dbg.GetCommandInterpreter() - self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) - result = lldb.SBCommandReturnObject() - - # Check that abbreviations are expanded to the full command. - command_interpreter.ResolveCommand("ap script", result) - self.assertTrue(result.Succeeded()) - self.assertEqual("apropos script", result.GetOutput()) - - command_interpreter.ResolveCommand("h", result) - self.assertTrue(result.Succeeded()) - self.assertEqual("help", result.GetOutput()) - - # Check resolution of abbreviations for multi-word commands. - command_interpreter.ResolveCommand("lo li", result) - self.assertTrue(result.Succeeded()) - self.assertEqual("log list", result.GetOutput()) - - command_interpreter.ResolveCommand("br s", result) - self.assertTrue(result.Succeeded()) - self.assertEqual("breakpoint set", result.GetOutput()) - - # Try an ambiguous abbreviation. - # "pl" could be "platform" or "plugin". - command_interpreter.ResolveCommand("pl", result) - self.assertFalse(result.Succeeded()) - self.assertTrue(result.GetError().startswith("Ambiguous command")) - - # Make sure an unabbreviated command is not mangled. - command_interpreter.ResolveCommand( - "breakpoint set --name main --line 123", result) - self.assertTrue(result.Succeeded()) - self.assertEqual( - "breakpoint set --name main --line 123", - result.GetOutput()) - - # Create some aliases. - self.runCmd("com a alias com al") - self.runCmd("alias gurp help") - - # Check that an alias is replaced with the actual command - command_interpreter.ResolveCommand("gurp target create", result) - self.assertTrue(result.Succeeded()) - self.assertEqual("help target create", result.GetOutput()) - - # Delete the alias and make sure it no longer has an effect. - self.runCmd("com u gurp") - command_interpreter.ResolveCommand("gurp", result) - self.assertFalse(result.Succeeded()) - - # Check aliases with text replacement. - self.runCmd("alias pltty process launch -s -o %1 -e %1") - command_interpreter.ResolveCommand("pltty /dev/tty0", result) - self.assertTrue(result.Succeeded()) - self.assertEqual( - "process launch -s -o /dev/tty0 -e /dev/tty0", - result.GetOutput()) - - self.runCmd("alias xyzzy breakpoint set -n %1 -l %2") - command_interpreter.ResolveCommand("xyzzy main 123", result) - self.assertTrue(result.Succeeded()) - self.assertEqual( - "breakpoint set -n main -l 123", - result.GetOutput().strip()) - - # And again, without enough parameters. - command_interpreter.ResolveCommand("xyzzy main", result) - self.assertFalse(result.Succeeded()) - - # Check a command that wants the raw input. - command_interpreter.ResolveCommand( - r'''sc print("\n\n\tHello!\n")''', result) - self.assertTrue(result.Succeeded()) - self.assertEqual( - r'''script print("\n\n\tHello!\n")''', - result.GetOutput()) - - # Prompt changing stuff should be tested, but this doesn't seem like the - # right test to do it in. It has nothing to do with aliases or abbreviations. - #self.runCmd("com sou ./change_prompt.lldb") - # self.expect("settings show prompt", - # startstr = 'prompt (string) = "[with-three-trailing-spaces] "') - #self.runCmd("settings clear prompt") - # self.expect("settings show prompt", - # startstr = 'prompt (string) = "(lldb) "') - #self.runCmd("se se prompt 'Sycamore> '") - # self.expect("se sh prompt", - # startstr = 'prompt (string) = "Sycamore> "') - #self.runCmd("se cl prompt") - # self.expect("set sh prompt", - # startstr = 'prompt (string) = "(lldb) "') diff --git a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py b/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py deleted file mode 100644 index 519b93efebe2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -Test some lldb command abbreviations to make sure the common short spellings of -many commands remain available even after we add/delete commands in the future. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CommonShortSpellingsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_abbrevs2(self): - command_interpreter = self.dbg.GetCommandInterpreter() - self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) - result = lldb.SBCommandReturnObject() - - abbrevs = [ - ('br s', 'breakpoint set'), - ('disp', '_regexp-display'), # a.k.a., 'display' - ('di', 'disassemble'), - ('dis', 'disassemble'), - ('ta st a', 'target stop-hook add'), - ('fr v', 'frame variable'), - ('f 1', 'frame select 1'), - ('ta st li', 'target stop-hook list'), - ] - - for (short_val, long_val) in abbrevs: - command_interpreter.ResolveCommand(short_val, result) - self.assertTrue(result.Succeeded()) - self.assertEqual(long_val, result.GetOutput()) diff --git a/packages/Python/lldbsuite/test/functionalities/alias/.categories b/packages/Python/lldbsuite/test/functionalities/alias/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/alias/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/apropos_with_process/Makefile b/packages/Python/lldbsuite/test/functionalities/apropos_with_process/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py b/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py deleted file mode 100644 index aa80c9976eb8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Test that apropos env doesn't crash trying to touch the process plugin command -""" - -from __future__ import print_function - - -import os -import time -import re -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/packages/Python/lldbsuite/test/functionalities/apropos_with_process/main.cpp b/packages/Python/lldbsuite/test/functionalities/apropos_with_process/main.cpp deleted file mode 100644 index 44c149687f21..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/apropos_with_process/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -int main (int argc, char const *argv[]) -{ - return 0; // break here -} - diff --git a/packages/Python/lldbsuite/test/functionalities/archives/Makefile b/packages/Python/lldbsuite/test/functionalities/archives/Makefile deleted file mode 100644 index 64da83becbda..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/archives/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -MAKE_DSYM := NO -ARCHIVE_NAME := libfoo.a -ARCHIVE_C_SOURCES := a.c b.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/archives/README b/packages/Python/lldbsuite/test/functionalities/archives/README deleted file mode 100644 index d327f4585c67..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/archives/README +++ /dev/null @@ -1,62 +0,0 @@ -a.out file refers to libfoo.a for a.o and b.o, which is what we want to accomplish for -this test case. - -[16:17:44] johnny:/Volumes/data/lldb/svn/latest/test/functionalities/archives $ dsymutil -s a.out ----------------------------------------------------------------------- -Symbol table for: 'a.out' (x86_64) ----------------------------------------------------------------------- -Index n_strx n_type n_sect n_desc n_value -======== -------- ------------------ ------ ------ ---------------- -[ 0] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/lldb/svn/latest/test/functionalities/archives/' -[ 1] 0000003f 64 (N_SO ) 00 0000 0000000000000000 'main.c' -[ 2] 00000046 66 (N_OSO ) 03 0001 000000004f0f780c '/Volumes/data/lldb/svn/latest/test/functionalities/archives/main.o' -[ 3] 00000001 2e (N_BNSYM ) 01 0000 0000000100000d70 -[ 4] 00000089 24 (N_FUN ) 01 0000 0000000100000d70 '_main' -[ 5] 00000001 24 (N_FUN ) 00 0000 000000000000005d -[ 6] 00000001 4e (N_ENSYM ) 01 0000 000000000000005d -[ 7] 00000001 64 (N_SO ) 01 0000 0000000000000000 -[ 8] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/lldb/svn/latest/test/functionalities/archives/' -[ 9] 0000008f 64 (N_SO ) 00 0000 0000000000000000 'a.c' -[ 10] 00000093 66 (N_OSO ) 03 0001 000000004f0f780c '/Volumes/data/lldb/svn/latest/test/functionalities/archives/libfoo.a(a.o)' -[ 11] 00000001 2e (N_BNSYM ) 01 0000 0000000100000dd0 -[ 12] 000000dd 24 (N_FUN ) 01 0000 0000000100000dd0 '_a' -[ 13] 00000001 24 (N_FUN ) 00 0000 0000000000000020 -[ 14] 00000001 4e (N_ENSYM ) 01 0000 0000000000000020 -[ 15] 00000001 2e (N_BNSYM ) 01 0000 0000000100000df0 -[ 16] 000000e0 24 (N_FUN ) 01 0000 0000000100000df0 '_aa' -[ 17] 00000001 24 (N_FUN ) 00 0000 0000000000000018 -[ 18] 00000001 4e (N_ENSYM ) 01 0000 0000000000000018 -[ 19] 000000e4 20 (N_GSYM ) 00 0000 0000000000000000 '___a_global' -[ 20] 00000001 64 (N_SO ) 01 0000 0000000000000000 -[ 21] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/lldb/svn/latest/test/functionalities/archives/' -[ 22] 000000f0 64 (N_SO ) 00 0000 0000000000000000 'b.c' -[ 23] 000000f4 66 (N_OSO ) 03 0001 000000004f0f780c '/Volumes/data/lldb/svn/latest/test/functionalities/archives/libfoo.a(b.o)' -[ 24] 00000001 2e (N_BNSYM ) 01 0000 0000000100000e10 -[ 25] 0000013e 24 (N_FUN ) 01 0000 0000000100000e10 '_b' -[ 26] 00000001 24 (N_FUN ) 00 0000 0000000000000020 -[ 27] 00000001 4e (N_ENSYM ) 01 0000 0000000000000020 -[ 28] 00000001 2e (N_BNSYM ) 01 0000 0000000100000e30 -[ 29] 00000141 24 (N_FUN ) 01 0000 0000000100000e30 '_bb' -[ 30] 00000001 24 (N_FUN ) 00 0000 0000000000000018 -[ 31] 00000001 4e (N_ENSYM ) 01 0000 0000000000000018 -[ 32] 00000145 26 (N_STSYM ) 0a 0000 000000010000104c '___b_global' -[ 33] 00000001 64 (N_SO ) 01 0000 0000000000000000 -[ 34] 00000151 0e ( SECT ) 07 0000 0000000100001000 '_pvars' -[ 35] 00000158 0e ( SECT ) 0a 0000 000000010000104c '___b_global' -[ 36] 00000164 0f ( SECT EXT) 0b 0000 0000000100001050 '_NXArgc' -[ 37] 0000016c 0f ( SECT EXT) 0b 0000 0000000100001058 '_NXArgv' -[ 38] 00000174 0f ( SECT EXT) 0a 0000 0000000100001048 '___a_global' -[ 39] 00000180 0f ( SECT EXT) 0b 0000 0000000100001068 '___progname' -[ 40] 0000018c 03 ( ABS EXT) 01 0010 0000000100000000 '__mh_execute_header' -[ 41] 000001a0 0f ( SECT EXT) 01 0000 0000000100000dd0 '_a' -[ 42] 000001a3 0f ( SECT EXT) 01 0000 0000000100000df0 '_aa' -[ 43] 000001a7 0f ( SECT EXT) 01 0000 0000000100000e10 '_b' -[ 44] 000001aa 0f ( SECT EXT) 01 0000 0000000100000e30 '_bb' -[ 45] 000001ae 0f ( SECT EXT) 0b 0000 0000000100001060 '_environ' -[ 46] 000001b7 0f ( SECT EXT) 01 0000 0000000100000d70 '_main' -[ 47] 000001bd 0f ( SECT EXT) 01 0000 0000000100000d30 'start' -[ 48] 000001c3 01 ( UNDF EXT) 00 0100 0000000000000000 '_exit' -[ 49] 000001c9 01 ( UNDF EXT) 00 0100 0000000000000000 '_printf' -[ 50] 000001d1 01 ( UNDF EXT) 00 0100 0000000000000000 'dyld_stub_binder' - - diff --git a/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py b/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py deleted file mode 100644 index a0c096865558..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py +++ /dev/null @@ -1,70 +0,0 @@ -"""Test breaking inside functions defined within a BSD archive file libfoo.a.""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BSDArchivesTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number in a(int) to break at. - self.line = line_number( - 'a.c', '// Set file and line breakpoint inside a().') - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24527. Makefile.rules doesn't know how to build static libs on Windows") - @expectedFailureAll( - oslist=["linux"], - archs=[ - "arm", - "aarch64"], - bugnumber="llvm.org/pr27795") - def test(self): - """Break inside a() and b() defined within libfoo.a.""" - self.build() - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside a() by file and line first. - lldbutil.run_break_set_by_file_and_line( - self, "a.c", 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']) - - # Break at a(int) first. - self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(int) arg = 1']) - self.expect("frame variable __a_global", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(int) __a_global = 1']) - - # Set breakpoint for b() next. - lldbutil.run_break_set_by_symbol( - self, "b", num_expected_locations=1, sym_exact=True) - - # Continue the program, we should break at b(int) next. - self.runCmd("continue") - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(int) arg = 2']) - self.expect("frame variable __b_global", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(int) __b_global = 2']) diff --git a/packages/Python/lldbsuite/test/functionalities/archives/a.c b/packages/Python/lldbsuite/test/functionalities/archives/a.c deleted file mode 100644 index 2b6ebbe47a76..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/archives/a.c +++ /dev/null @@ -1,19 +0,0 @@ -//===-- a.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -int __a_global = 1; - -int a(int arg) { - int result = arg + __a_global; - return result; // Set file and line breakpoint inside a(). -} - -int aa(int arg1) { - int result1 = arg1 - __a_global; - return result1; -} diff --git a/packages/Python/lldbsuite/test/functionalities/archives/b.c b/packages/Python/lldbsuite/test/functionalities/archives/b.c deleted file mode 100644 index 51d77dd4bcdc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/archives/b.c +++ /dev/null @@ -1,19 +0,0 @@ -//===-- b.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -static int __b_global = 2; - -int b(int arg) { - int result = arg + __b_global; - return result; -} - -int bb(int arg1) { - int result2 = arg1 - __b_global; - return result2; -} diff --git a/packages/Python/lldbsuite/test/functionalities/archives/main.c b/packages/Python/lldbsuite/test/functionalities/archives/main.c deleted file mode 100644 index c5b1cc2f0d1c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/archives/main.c +++ /dev/null @@ -1,17 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -extern int a(int); -extern int b(int); -int main (int argc, char const *argv[]) -{ - printf ("a(1) returns %d\n", a(1)); - printf ("b(2) returns %d\n", b(2)); -} diff --git a/packages/Python/lldbsuite/test/functionalities/asan/Makefile b/packages/Python/lldbsuite/test/functionalities/asan/Makefile deleted file mode 100644 index dc8d682f831a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/asan/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=address -g -gcolumn-info - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py b/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py deleted file mode 100644 index 5827dc3b4653..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py +++ /dev/null @@ -1,134 +0,0 @@ -""" -Test that ASan memory history provider returns correct stack traces -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbplatform -from lldbsuite.test import lldbutil - - -class AsanTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessAddressSanitizer - def test(self): - self.build() - self.asan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.line_malloc = line_number('main.c', '// malloc line') - self.line_malloc2 = line_number('main.c', '// malloc2 line') - self.line_free = line_number('main.c', '// free line') - self.line_breakpoint = line_number('main.c', '// break line') - - def asan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("breakpoint set -f main.c -l %d" % self.line_breakpoint) - - # "memory history" command should not work without a process - self.expect("memory history 0", - error=True, - substrs=["invalid process"]) - - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - # the stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - # test that the ASan dylib is present - self.expect( - "image lookup -n __asan_describe_address", - "__asan_describe_address should be present", - substrs=['1 match found']) - - # test the 'memory history' command - self.expect( - "memory history 'pointer'", - substrs=[ - 'Memory allocated by Thread', - 'a.out`f1', - 'main.c:%d' % - self.line_malloc, - 'Memory deallocated by Thread', - 'a.out`f2', - 'main.c:%d' % - self.line_free]) - - # do the same using SB API - process = self.dbg.GetSelectedTarget().process - val = process.GetSelectedThread().GetSelectedFrame().EvaluateExpression("pointer") - addr = val.GetValueAsUnsigned() - threads = process.GetHistoryThreads(addr) - self.assertEqual(threads.GetSize(), 2) - - history_thread = threads.GetThreadAtIndex(0) - self.assertTrue(history_thread.num_frames >= 2) - self.assertEqual(history_thread.frames[1].GetLineEntry( - ).GetFileSpec().GetFilename(), "main.c") - self.assertEqual( - history_thread.frames[1].GetLineEntry().GetLine(), - self.line_free) - - history_thread = threads.GetThreadAtIndex(1) - self.assertTrue(history_thread.num_frames >= 2) - self.assertEqual(history_thread.frames[1].GetLineEntry( - ).GetFileSpec().GetFilename(), "main.c") - self.assertEqual( - history_thread.frames[1].GetLineEntry().GetLine(), - self.line_malloc) - - # let's free the container (SBThreadCollection) and see if the - # SBThreads still live - threads = None - self.assertTrue(history_thread.num_frames >= 2) - self.assertEqual(history_thread.frames[1].GetLineEntry( - ).GetFileSpec().GetFilename(), "main.c") - self.assertEqual( - history_thread.frames[1].GetLineEntry().GetLine(), - self.line_malloc) - - # ASan will break when a report occurs and we'll try the API then - self.runCmd("continue") - - self.expect( - "thread list", - "Process should be stopped due to ASan report", - substrs=[ - 'stopped', - 'stop reason = Use of deallocated memory']) - - # make sure the 'memory history' command still works even when we're - # generating a report now - self.expect( - "memory history 'another_pointer'", - substrs=[ - 'Memory allocated by Thread', - 'a.out`f1', - 'main.c:%d' % - self.line_malloc2]) diff --git a/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py b/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py deleted file mode 100644 index ca070fa97dfa..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Test the AddressSanitizer runtime support for report breakpoint and data extraction. -""" - -from __future__ import print_function - - -import os -import time -import json -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class AsanTestReportDataCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessAddressSanitizer - @skipIf(archs=['i386'], bugnumber="llvm.org/PR36710") - def test(self): - self.build() - self.asan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.line_malloc = line_number('main.c', '// malloc line') - self.line_malloc2 = line_number('main.c', '// malloc2 line') - self.line_free = line_number('main.c', '// free line') - self.line_breakpoint = line_number('main.c', '// break line') - self.line_crash = line_number('main.c', '// BOOM line') - self.col_crash = 16 - - def asan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - self.expect( - "thread list", - "Process should be stopped due to ASan report", - substrs=[ - 'stopped', - 'stop reason = Use of deallocated memory']) - - self.assertEqual( - self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), - lldb.eStopReasonInstrumentation) - - self.expect("bt", "The backtrace should show the crashing line", - substrs=['main.c:%d:%d' % (self.line_crash, self.col_crash)]) - - self.expect( - "thread info -s", - "The extended stop info should contain the ASan provided fields", - substrs=[ - "access_size", - "access_type", - "address", - "pc", - "description", - "heap-use-after-free"]) - - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - self.assertEqual(data["description"], "heap-use-after-free") - self.assertEqual(data["instrumentation_class"], "AddressSanitizer") - self.assertEqual(data["stop_type"], "fatal_error") - - # now let's try the SB API - process = self.dbg.GetSelectedTarget().process - thread = process.GetSelectedThread() - - s = lldb.SBStream() - self.assertTrue(thread.GetStopReasonExtendedInfoAsJSON(s)) - s = s.GetData() - data2 = json.loads(s) - self.assertEqual(data, data2) diff --git a/packages/Python/lldbsuite/test/functionalities/asan/main.c b/packages/Python/lldbsuite/test/functionalities/asan/main.c deleted file mode 100644 index fab760e49f00..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/asan/main.c +++ /dev/null @@ -1,34 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdlib.h> - -char *pointer; -char *another_pointer; - -void f1() { - pointer = malloc(10); // malloc line - another_pointer = malloc(20); // malloc2 line -} - -void f2() { - free(pointer); // free line -} - -int main (int argc, char const *argv[]) -{ - f1(); - f2(); - - printf("Hello world!\n"); // break line - - pointer[0] = 'A'; // BOOM line - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/attach_resume/Makefile b/packages/Python/lldbsuite/test/functionalities/attach_resume/Makefile deleted file mode 100644 index 13d40a13b3e3..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py b/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py deleted file mode 100644 index 754acade015a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py +++ /dev/null @@ -1,94 +0,0 @@ -""" -Test process attach/resume. -""" - -from __future__ import print_function - - -import os -import time -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') - @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/packages/Python/lldbsuite/test/functionalities/attach_resume/main.cpp b/packages/Python/lldbsuite/test/functionalities/attach_resume/main.cpp deleted file mode 100644 index 82aad70eed56..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile b/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py b/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py deleted file mode 100644 index 38848e87cc4a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py +++ /dev/null @@ -1,108 +0,0 @@ -""" -Test whether a process started by lldb has no extra file descriptors open. -""" - -from __future__ import print_function - - -import os -import lldb -from lldbsuite.test import lldbutil -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * - - -def python_leaky_fd_version(test): - import sys - # Python random module leaks file descriptors on some versions. - if sys.version_info >= (2, 7, 8) and sys.version_info < (2, 7, 10): - return "Python random module leaks file descriptors in this python version" - return None - - -class AvoidsFdLeakTestCase(TestBase): - - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376") - @expectedFailureAll( - oslist=['freebsd'], - bugnumber="llvm.org/pr25624 still failing with Python 2.7.10") - # The check for descriptor leakage needs to be implemented differently - # here. - @skipIfWindows - @skipIfTargetAndroid() # Android have some other file descriptors open by the shell - @skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch - def test_fd_leak_basic(self): - self.do_test([]) - - @expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376") - @expectedFailureAll( - oslist=['freebsd'], - bugnumber="llvm.org/pr25624 still failing with Python 2.7.10") - # The check for descriptor leakage needs to be implemented differently - # here. - @skipIfWindows - @skipIfTargetAndroid() # Android have some other file descriptors open by the shell - @skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch - def test_fd_leak_log(self): - self.do_test(["log enable -f '/dev/null' lldb commands"]) - - def do_test(self, commands): - self.build() - exe = self.getBuildArtifact("a.out") - - for c in commands: - self.runCmd(c) - - target = self.dbg.CreateTarget(exe) - - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - self.assertTrue( - process.GetState() == lldb.eStateExited, - "Process should have exited.") - self.assertTrue( - process.GetExitStatus() == 0, - "Process returned non-zero status. Were incorrect file descriptors passed?") - - @expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376") - @expectedFailureAll( - oslist=['freebsd'], - bugnumber="llvm.org/pr25624 still failing with Python 2.7.10") - # The check for descriptor leakage needs to be implemented differently - # here. - @skipIfWindows - @skipIfTargetAndroid() # Android have some other file descriptors open by the shell - @skipIfDarwinEmbedded # <rdar://problem/33888742> # debugserver on ios has an extra fd open on launch - def test_fd_leak_multitarget(self): - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - breakpoint = target.BreakpointCreateBySourceRegex( - 'Set breakpoint here', lldb.SBFileSpec("main.c", False)) - self.assertTrue(breakpoint, VALID_BREAKPOINT) - - process1 = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process1, PROCESS_IS_VALID) - self.assertTrue( - process1.GetState() == lldb.eStateStopped, - "Process should have been stopped.") - - target2 = self.dbg.CreateTarget(exe) - process2 = target2.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process2, PROCESS_IS_VALID) - - self.assertTrue( - process2.GetState() == lldb.eStateExited, - "Process should have exited.") - self.assertTrue( - process2.GetExitStatus() == 0, - "Process returned non-zero status. Were incorrect file descriptors passed?") diff --git a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/main.c b/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/main.c deleted file mode 100644 index 5bdf227928ed..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/main.c +++ /dev/null @@ -1,28 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <errno.h> -#include <stdio.h> - -int -main (int argc, char const **argv) -{ - struct stat buf; - int i, rv = 0; // Set breakpoint here. - - // Make sure stdin/stdout/stderr exist. - for (i = 0; i <= 2; ++i) { - if (fstat(i, &buf) != 0) - return 1; - } - - // Make sure no other file descriptors are open. - for (i = 3; i <= 256; ++i) { - if (fstat(i, &buf) == 0 || errno != EBADF) { - fprintf(stderr, "File descriptor %d is open.\n", i); - rv = 2; - } - } - - return rv; -} diff --git a/packages/Python/lldbsuite/test/functionalities/backticks/.categories b/packages/Python/lldbsuite/test/functionalities/backticks/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/backticks/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py b/packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py deleted file mode 100644 index 528e52565b5e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -Test that backticks without a target should work (not infinite looping). -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BackticksWithNoTargetTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_backticks_no_target(self): - """A simple test of backticks without a target.""" - self.expect("print `1+2-3`", - substrs=[' = 0']) diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/Makefile deleted file mode 100644 index 6067ee45e984..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py deleted file mode 100644 index 46191d85296a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py +++ /dev/null @@ -1,99 +0,0 @@ -""" -Test address breakpoints set with shared library of SBAddress work correctly. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class 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/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py deleted file mode 100644 index 460e07ceadf0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -Test that breakpoints set on a bad address say they are bad. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class 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/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/main.c deleted file mode 100644 index 6b779296e188..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/Makefile deleted file mode 100644 index 6067ee45e984..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py deleted file mode 100644 index b5e38eec5793..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/TestBreakpointAutoContinue.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -Test that the breakpoint auto-continue flag works correctly. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class 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/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/auto_continue/main.c deleted file mode 100644 index a37f05e0290a..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/Makefile deleted file mode 100644 index 6c22351dc3b5..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py deleted file mode 100644 index 07032cc0380c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Test setting a breakpoint by line and column. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -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, 20, 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(), 20) - 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, 20) - 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(), 20) - in_condition |= b_loc.GetColumn() < 30 - self.assertTrue(in_condition) diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/main.c deleted file mode 100644 index 921bc382023f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_by_line_and_column/main.c +++ /dev/null @@ -1,23 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/Makefile deleted file mode 100644 index a6376f9b165d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py deleted file mode 100644 index 8143fa96433f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py +++ /dev/null @@ -1,287 +0,0 @@ -""" -Test lldb breakpoint command add/list/delete. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py deleted file mode 100644 index 7c7aad0bc81e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py +++ /dev/null @@ -1,102 +0,0 @@ -""" -Test that you can set breakpoint commands successfully with the Python API's: -""" - -from __future__ import print_function - - -import os -import re -import sys -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py deleted file mode 100644 index d064b75b91cf..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py +++ /dev/null @@ -1,72 +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 time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/a.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/a.c deleted file mode 100644 index 870e4a6ab166..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/b.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/b.c deleted file mode 100644 index 02b78e7bd855..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py deleted file mode 100644 index ac0f753ccd8d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c deleted file mode 100644 index 702644b692d8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c +++ /dev/null @@ -1,17 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/side_effect.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/side_effect.py deleted file mode 100644 index ef4ab2b159cc..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/Makefile deleted file mode 100644 index 6067ee45e984..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py deleted file mode 100644 index 959c7e8f95cc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py +++ /dev/null @@ -1,237 +0,0 @@ -""" -Test breakpoint conditions with 'breakpoint modify -c <expr> id'. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointConditionsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - # Requires EE to support COFF on Windows (http://llvm.org/pr22232) - @skipIfWindows - def test_breakpoint_condition_and_run_command(self): - """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'.""" - self.build() - self.breakpoint_conditions() - - # Requires EE to support COFF on Windows (http://llvm.org/pr22232) - @skipIfWindows - def test_breakpoint_condition_inline_and_run_command(self): - """Exercise breakpoint condition inline with 'breakpoint set'.""" - self.build() - self.breakpoint_conditions(inline=True) - - # Requires EE to support COFF on Windows (http://llvm.org/pr22232) - @skipIfWindows - @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() - - # Requires EE to support COFF on Windows (http://llvm.org/pr22232) - @skipIfWindows - @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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/main.c deleted file mode 100644 index 1aa8235e1b0c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/main.c +++ /dev/null @@ -1,54 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py deleted file mode 100644 index 6f696be83249..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp deleted file mode 100644 index 333e9b6405a7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/Makefile deleted file mode 100644 index f89b52a972e9..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py deleted file mode 100644 index 02fb1e0f49d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Test lldb breakpoint ids. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/main.cpp deleted file mode 100644 index 3deef22c93c8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py deleted file mode 100644 index e3bf4c27f31e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py +++ /dev/null @@ -1,154 +0,0 @@ -""" -Test breakpoint ignore count features. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/main.c deleted file mode 100644 index b74b37b48b08..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/main.c +++ /dev/null @@ -1,54 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/Makefile deleted file mode 100644 index 77aa24afc0f7..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py deleted file mode 100644 index 6eaab0c680f5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -Test specific to MIPS -""" - -from __future__ import print_function - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/main.c deleted file mode 100644 index bc3eceea7693..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/Makefile deleted file mode 100644 index 4f6b058fa324..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py deleted file mode 100644 index b69007014b10..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py +++ /dev/null @@ -1,137 +0,0 @@ -""" -Test that the language option for breakpoints works correctly -parser. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil -import shutil -import subprocess - - -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/a.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/a.c deleted file mode 100644 index b90e2bdcca5d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/b.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/b.cpp deleted file mode 100644 index 89373445b9aa..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/main.cpp deleted file mode 100644 index b7d00a602029..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/Makefile deleted file mode 100644 index 7934cd5db427..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py deleted file mode 100644 index f4835a9b9c44..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py +++ /dev/null @@ -1,200 +0,0 @@ -""" -Test breakpoint commands for a breakpoint ID with multiple locations. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/main.c deleted file mode 100644 index 7ec3ded67b74..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py deleted file mode 100644 index b36e915e2204..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py +++ /dev/null @@ -1,367 +0,0 @@ -""" -Test breakpoint names. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c deleted file mode 100644 index b74b37b48b08..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c +++ /dev/null @@ -1,54 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/Makefile deleted file mode 100644 index 457c4972f2d5..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py deleted file mode 100644 index c9ef2a730010..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py +++ /dev/null @@ -1,115 +0,0 @@ -""" -Test breakpoint command for different options. -""" - -from __future__ import print_function - - -import os -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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/foo.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/foo.cpp deleted file mode 100644 index e5d0e09803e6..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/main.cpp deleted file mode 100644 index b2e8f523c84d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py deleted file mode 100644 index 7603bd90ffc5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Test inferior restart when breakpoint is set on running target. -""" - -import os -import lldb -from lldbsuite.test.lldbtest import * - - -class BreakpointSetRestart(TestBase): - - mydir = TestBase.compute_mydir(__file__) - BREAKPOINT_TEXT = 'Set a breakpoint here' - - 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/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp deleted file mode 100644 index e6d3a95d017f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <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/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile deleted file mode 100644 index 2d7f20f43fed..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py deleted file mode 100644 index 4385304c88b6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -Test breakpoint command with AT_comp_dir set to symbolic link. -""" -from __future__ import print_function - - -import os -import shutil -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) - 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/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/main.cpp deleted file mode 100644 index fef06a011e92..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main (int argc, char const *argv[]) -{ - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/Makefile deleted file mode 100644 index f89b52a972e9..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py deleted file mode 100644 index 6afde150d8d7..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/main.cpp deleted file mode 100644 index c1943f03dbf1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/main.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -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/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/Makefile deleted file mode 100644 index f89b52a972e9..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py deleted file mode 100644 index e4c19fd0d3da..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -Test lldb breakpoint ids. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/main.cpp deleted file mode 100644 index 01f679139249..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/main.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <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/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py deleted file mode 100644 index 26fe02ba56ce..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -Test that you can set breakpoint and hit the C++ language exception breakpoint -""" - -from __future__ import print_function - - -import os -import re -import sys -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") - 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/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp deleted file mode 100644 index 76cb22735a71..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py deleted file mode 100644 index 11ec67d91097..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -Test embedded breakpoints, like `asm int 3;` in x86 or or `__debugbreak` on Windows. -""" - -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 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/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/main.c deleted file mode 100644 index 5f936327e4ea..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/Makefile deleted file mode 100644 index 7934cd5db427..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py deleted file mode 100644 index 4b595ab7819e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Test breakpoint commands set before we have a target -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/main.c deleted file mode 100644 index e1f03237cd11..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile deleted file mode 100644 index 06ef85cf908d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py deleted file mode 100644 index 9551ab278ebf..000000000000 --- a/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 os -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestBreakpointInGlobalConstructors(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def 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/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp deleted file mode 100644 index f959a295467f..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.h deleted file mode 100644 index 3bc63fed7555..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp deleted file mode 100644 index d1c8038dfadb..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile deleted file mode 100644 index 3665ae323e7b..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py deleted file mode 100644 index 99b54329a0e1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py +++ /dev/null @@ -1,110 +0,0 @@ -""" -Test hardware breakpoints for multiple threads. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -# Hardware breakpoints are supported only by platforms mentioned in oslist. -@skipUnlessPlatform(oslist=['linux']) -class HardwareBreakpointMultiThreadTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - # LLDB supports hardware breakpoints for arm and aarch64 architectures. - @skipIf(archs=no_match(['arm', 'aarch64'])) - @expectedFailureAndroid - def test_hw_break_set_delete_multi_thread(self): - self.build() - self.setTearDownCleanup() - self.break_multi_thread('delete') - - # LLDB supports hardware breakpoints for arm and aarch64 architectures. - @skipIf(archs=no_match(['arm', 'aarch64'])) - @expectedFailureAndroid - def test_hw_break_set_disable_multi_thread(self): - self.build() - self.setTearDownCleanup() - self.break_multi_thread('disable') - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Our simple source filename. - self.source = 'main.cpp' - # Find the line number to break inside main(). - self.first_stop = line_number( - self.source, 'Starting thread creation with hardware breakpoint set') - - def break_multi_thread(self, removal_type): - """Test that lldb hardware breakpoints work for multiple threads.""" - self.runCmd("file " + 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/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp deleted file mode 100644 index d13393095c61..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <cstdio> -#include <mutex> -#include <random> -#include <thread> - -#define NUM_OF_THREADS 4 - -std::mutex hw_break_mutex; - -void -hw_break_function (uint32_t thread_index) { - printf ("%s called by Thread #%u...\n", __FUNCTION__, thread_index); -} - - -void -thread_func (uint32_t thread_index) { - printf ("%s (thread index = %u) starting...\n", __FUNCTION__, thread_index); - - hw_break_mutex.lock(); - - hw_break_function(thread_index); // Call hw_break_function - - hw_break_mutex.unlock(); -} - - -int main (int argc, char const *argv[]) -{ - std::thread threads[NUM_OF_THREADS]; - - printf ("Starting thread creation with hardware breakpoint set...\n"); - - for (auto &thread : threads) - thread = std::thread{thread_func, std::distance(threads, &thread)}; - - for (auto &thread : threads) - thread.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/Makefile deleted file mode 100644 index 5b73ae626f34..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py deleted file mode 100644 index ee67dda62420..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py +++ /dev/null @@ -1,69 +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 os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/basic_type.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/basic_type.cpp deleted file mode 100644 index 75d2c3690c89..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/int.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/int.cpp deleted file mode 100644 index 922398b1c6e3..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile deleted file mode 100644 index 06ef85cf908d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/TestMoveNearest.py deleted file mode 100644 index b8281e9c85bd..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.cpp deleted file mode 100644 index 8dad0a23f368..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/foo.h deleted file mode 100644 index 9f0e56dd22ee..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/main.cpp deleted file mode 100644 index 76a22a5420fe..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/Makefile deleted file mode 100644 index ad3cb3fadcde..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py deleted file mode 100644 index e5e8473eedd6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py +++ /dev/null @@ -1,132 +0,0 @@ -""" -Test that objective-c constant strings are generated correctly by the expression -parser. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/main.m b/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/main.m deleted file mode 100644 index 53567491219b..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile deleted file mode 100644 index 7934cd5db427..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py deleted file mode 100644 index cda15fee84b8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py +++ /dev/null @@ -1,106 +0,0 @@ -""" -Test require hardware breakpoints. -""" - -from __future__ import print_function - -import os -import time -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") - self.expect( - "process status", - substrs=[ - 'step over failed', - '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/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/main.c deleted file mode 100644 index 7d49a57d4c7b..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile deleted file mode 100644 index 6067ee45e984..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py deleted file mode 100644 index 0eb9033e754b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py +++ /dev/null @@ -1,199 +0,0 @@ -""" -Test setting breakpoints using a scripted resolver -""" - -from __future__ import print_function - - -import os -import time -import re -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/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/main.c deleted file mode 100644 index b91ccfc1b43e..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py deleted file mode 100644 index 61f5f2df20ac..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py deleted file mode 100644 index 943998a421be..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py +++ /dev/null @@ -1,287 +0,0 @@ -""" -Test breakpoint serialization. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointSerialization(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @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.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/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c deleted file mode 100644 index b74b37b48b08..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c +++ /dev/null @@ -1,54 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/Makefile deleted file mode 100644 index ac984f101c18..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py deleted file mode 100644 index 4256c70a0265..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py +++ /dev/null @@ -1,106 +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 os -import time -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/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.c deleted file mode 100644 index 056583f1c42c..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.h b/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.h deleted file mode 100644 index f578ac0304cd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/a.h +++ /dev/null @@ -1 +0,0 @@ -int a_func(int); diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/main.c deleted file mode 100644 index 9c8625e877f5..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/Makefile deleted file mode 100644 index f89b52a972e9..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py deleted file mode 100644 index 07fd04940d96..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp b/packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/main.cpp deleted file mode 100644 index 8cfd34b73b55..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_history/.categories b/packages/Python/lldbsuite/test/functionalities/command_history/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_history/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py b/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py deleted file mode 100644 index 17b7b6d395db..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py +++ /dev/null @@ -1,108 +0,0 @@ -""" -Test the command history mechanism -""" - -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 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/packages/Python/lldbsuite/test/functionalities/command_regex/.categories b/packages/Python/lldbsuite/test/functionalities/command_regex/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_regex/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py b/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py deleted file mode 100644 index e1c5b4b48258..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Test lldb 'commands regex' command which allows the user to create a regular expression command. -""" - -from __future__ import print_function - - -import os -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CommandRegexTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - hostoslist=["windows"], - bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") - @no_debug_info_test - def test_command_regex(self): - """Test a simple scenario of 'command regex' invocation and subsequent use.""" - import pexpect - prompt = "(lldb) " - regex_prompt = "Enter one of more sed substitution commands in the form: 's/<regex>/<subst>/'.\r\nTerminate the substitution list with an empty line.\r\n" - regex_prompt1 = "\r\n" - - child = pexpect.spawn('%s %s' % - (lldbtest_config.lldbExec, self.lldbOption)) - # Turn on logging for what the child sends back. - if self.TraceOn(): - child.logfile_read = sys.stdout - # So that the spawned lldb session gets shutdown durng teardown. - self.child = child - - # Substitute 'Help!' for 'help' using the 'commands regex' mechanism. - child.expect_exact(prompt) - child.sendline("command regex 'Help__'") - child.expect_exact(regex_prompt) - child.sendline('s/^$/help/') - child.expect_exact(regex_prompt1) - child.sendline('') - child.expect_exact(prompt) - # Help! - child.sendline('Help__') - # If we see the familiar 'help' output, the test is done. - child.expect('Debugger commands:') - # Try and incorrectly remove "Help__" using "command unalias" and - # verify we fail - child.sendline('command unalias Help__') - child.expect_exact( - "error: 'Help__' is not an alias, it is a debugger command which can be removed using the 'command delete' command") - child.expect_exact(prompt) - - # Delete the regex command using "command delete" - child.sendline('command delete Help__') - child.expect_exact(prompt) - # Verify the command was removed - child.sendline('Help__') - child.expect_exact("error: 'Help__' is not a valid command") - child.expect_exact(prompt) diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/.categories b/packages/Python/lldbsuite/test/functionalities/command_script/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/Makefile b/packages/Python/lldbsuite/test/functionalities/command_script/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py b/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py deleted file mode 100644 index 1698c0d0c35f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py +++ /dev/null @@ -1,156 +0,0 @@ -""" -Test lldb Python commands. -""" - -from __future__ import print_function - - -import os -import time -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 - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - 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/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py b/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py deleted file mode 100644 index 3c124de79bf3..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py b/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py deleted file mode 100644 index f9707a5706ac..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/Makefile b/packages/Python/lldbsuite/test/functionalities/command_script/import/Makefile deleted file mode 100644 index 9374aef487fe..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py deleted file mode 100644 index 01e7902b0f32..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py +++ /dev/null @@ -1,79 +0,0 @@ -"""Test custom import command to import files by path.""" - -from __future__ import print_function - - -import os -import sys -import time -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/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py deleted file mode 100644 index 444e00976ad9..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py deleted file mode 100644 index 70ecea300578..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py deleted file mode 100644 index 668a5b90ea4f..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py deleted file mode 100644 index 6ef71064c9a9..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py deleted file mode 100644 index 1ccc38929396..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py deleted file mode 100644 index 71657c299c21..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/main.c b/packages/Python/lldbsuite/test/functionalities/command_script/import/main.c deleted file mode 100644 index dffc8c77b04c..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/Makefile b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/Makefile deleted file mode 100644 index 7913aaa4b746..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py deleted file mode 100644 index 01fd51385836..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py +++ /dev/null @@ -1,39 +0,0 @@ -"""Check that we handle an ImportError in a special way when command script importing files.""" - -from __future__ import print_function - - -import os -import sys -import time -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/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py deleted file mode 100644 index ea385e03e046..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py deleted file mode 100644 index 8dbc0e67ba19..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py deleted file mode 100644 index 9694b084295f..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py deleted file mode 100644 index 94a333bc696b..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py deleted file mode 100644 index 24cdea60f2c4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/main.cpp b/packages/Python/lldbsuite/test/functionalities/command_script/main.cpp deleted file mode 100644 index 0b24cb73a619..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <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/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py b/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py deleted file mode 100644 index 88a20cb4567f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py +++ /dev/null @@ -1,25 +0,0 @@ -from __future__ import print_function - -import lldb -import sys -import os -import time - - -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/packages/Python/lldbsuite/test/functionalities/command_script/py_import b/packages/Python/lldbsuite/test/functionalities/command_script/py_import deleted file mode 100644 index 6c1f7b8185f6..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py b/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py deleted file mode 100644 index 0539d7c17211..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_script_alias/.categories b/packages/Python/lldbsuite/test/functionalities/command_script_alias/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script_alias/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py b/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py deleted file mode 100644 index eb63c7079893..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Test lldb Python commands. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py b/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py deleted file mode 100644 index d5bb6131210c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py +++ /dev/null @@ -1,12 +0,0 @@ -from __future__ import print_function -import lldb -import sys - - -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/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py b/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py deleted file mode 100644 index c1595cf25515..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py +++ /dev/null @@ -1,99 +0,0 @@ -""" -Test that LLDB correctly allows scripted commands to set an immediate output file -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test.lldbpexpect import * -from lldbsuite.test import lldbutil - - -class CommandScriptImmediateOutputTestCase (PExpectTest): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - # Call super's setUp(). - PExpectTest.setUp(self) - - @skipIfRemote # test not remote-ready llvm.org/pr24813 - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139") - @skipIfDarwin - def test_command_script_immediate_output_console(self): - """Test that LLDB correctly allows scripted commands to set immediate output to the console.""" - self.launch(timeout=10) - - script = os.path.join(self.getSourceDir(), 'custom_command.py') - prompt = "\(lldb\) " - - self.sendline('command script import %s' % script, patterns=[prompt]) - self.sendline( - 'command script add -f custom_command.command_function mycommand', - patterns=[prompt]) - self.sendline( - 'mycommand', - patterns='this is a test string, just a test string') - self.sendline('command script delete mycommand', patterns=[prompt]) - self.quit(gracefully=False) - - @skipIfRemote # test not remote-ready llvm.org/pr24813 - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139") - @skipIfDarwin - def test_command_script_immediate_output_file(self): - """Test that LLDB correctly allows scripted commands to set immediate output to a file.""" - self.launch(timeout=10) - - test_files = {self.getBuildArtifact('read.txt'): 'r', - self.getBuildArtifact('write.txt'): 'w', - self.getBuildArtifact('append.txt'): 'a', - self.getBuildArtifact('write_plus.txt'): 'w+', - self.getBuildArtifact('read_plus.txt'): 'r+', - self.getBuildArtifact('append_plus.txt'): 'a+'} - - starter_string = 'Starter Garbage\n' - write_string = 'writing to file with mode: ' - - for path, mode in test_files.iteritems(): - with open(path, 'w+') as init: - init.write(starter_string) - - script = os.path.join(self.getSourceDir(), 'custom_command.py') - prompt = "\(lldb\) " - - self.sendline('command script import %s' % script, patterns=[prompt]) - - self.sendline( - 'command script add -f custom_command.write_file mywrite', - patterns=[prompt]) - for path, mode in test_files.iteritems(): - command = 'mywrite "' + path + '" ' + mode - - self.sendline(command, patterns=[prompt]) - - self.sendline('command script delete mywrite', patterns=[prompt]) - - self.quit(gracefully=False) - - for path, mode in test_files.iteritems(): - with open(path, 'r') as result: - if mode in ['r', 'a', 'a+']: - self.assertEquals(result.readline(), starter_string) - if mode in ['w', 'w+', 'r+', 'a', 'a+']: - self.assertEquals( - result.readline(), write_string + mode + '\n') - - self.assertTrue(os.path.isfile(path)) - os.remove(path) diff --git a/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py b/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py deleted file mode 100644 index e0c24055c838..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py +++ /dev/null @@ -1,19 +0,0 @@ -from __future__ import print_function - -import sys -import shlex - - -def command_function(debugger, command, exe_ctx, result, internal_dict): - result.SetImmediateOutputFile(sys.__stdout__) - print('this is a test string, just a test string', file=result) - - -def write_file(debugger, command, exe_ctx, result, internal_dict): - args = shlex.split(command) - path = args[0] - mode = args[1] - with open(path, mode) as f: - result.SetImmediateOutputFile(f) - if not mode in ['r']: - print('writing to file with mode: ' + mode, file=result) diff --git a/packages/Python/lldbsuite/test/functionalities/command_source/.categories b/packages/Python/lldbsuite/test/functionalities/command_source/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_source/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/command_source/.lldb b/packages/Python/lldbsuite/test/functionalities/command_source/.lldb deleted file mode 100644 index ecbdcff44626..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py b/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py deleted file mode 100644 index cee9bd272189..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -Test that lldb command "command source" works correctly. - -See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673. -""" - -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 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/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt b/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt deleted file mode 100644 index 8e4de66d4690..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/command_source/commands.txt +++ /dev/null @@ -1,2 +0,0 @@ -script import my -p 1 + 1 diff --git a/packages/Python/lldbsuite/test/functionalities/command_source/my.py b/packages/Python/lldbsuite/test/functionalities/command_source/my.py deleted file mode 100644 index bd97fda3cbbf..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/completion/.categories b/packages/Python/lldbsuite/test/functionalities/completion/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/completion/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/completion/Makefile b/packages/Python/lldbsuite/test/functionalities/completion/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/completion/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py b/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py deleted file mode 100644 index c073425a93fb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py +++ /dev/null @@ -1,299 +0,0 @@ -""" -Test the lldb command line completion mechanism. -""" - -from __future__ import print_function - - -import os -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbplatform -from lldbsuite.test import lldbutil - - -class CommandLineCompletionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - @classmethod - def classCleanup(cls): - """Cleanup the test byproducts.""" - try: - os.remove("child_send.txt") - os.remove("child_read.txt") - except: - pass - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_at(self): - """Test that 'at' completes to 'attach '.""" - self.complete_from_to('at', 'attach ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_de(self): - """Test that 'de' completes to 'detach '.""" - self.complete_from_to('de', 'detach ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_frame_variable(self): - self.build() - self.main_source = "main.cpp" - self.main_source_spec = lldb.SBFileSpec(self.main_source) - - (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, - '// Break here', self.main_source_spec) - self.assertEquals(process.GetState(), lldb.eStateStopped) - # FIXME: This pulls in the debug information to make the completions work, - # but the completions should also work without. - self.runCmd("frame variable fooo") - - self.complete_from_to('frame variable fo', - 'frame variable fooo') - self.complete_from_to('frame variable fooo.', - 'frame variable fooo.') - self.complete_from_to('frame variable fooo.dd', - 'frame variable fooo.dd') - - self.complete_from_to('frame variable ptr_fooo->', - 'frame variable ptr_fooo->') - self.complete_from_to('frame variable ptr_fooo->dd', - 'frame variable ptr_fooo->dd') - - self.complete_from_to('frame variable cont', - 'frame variable container') - self.complete_from_to('frame variable container.', - 'frame variable container.MemberVar') - self.complete_from_to('frame variable container.Mem', - 'frame variable container.MemberVar') - - self.complete_from_to('frame variable ptr_cont', - 'frame variable ptr_container') - self.complete_from_to('frame variable ptr_container->', - 'frame variable ptr_container->MemberVar') - self.complete_from_to('frame variable ptr_container->Mem', - 'frame variable ptr_container->MemberVar') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_process_attach_dash_dash_con(self): - """Test that 'process attach --con' completes to 'process attach --continue '.""" - self.complete_from_to( - 'process attach --con', - 'process attach --continue ') - - # <rdar://problem/11052829> - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_infinite_loop_while_completing(self): - """Test that 'process print hello\' completes to itself and does not infinite loop.""" - self.complete_from_to('process print hello\\', 'process print hello\\', - turn_off_re_match=True) - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_watchpoint_co(self): - """Test that 'watchpoint co' completes to 'watchpoint command '.""" - self.complete_from_to('watchpoint co', 'watchpoint command ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_watchpoint_command_space(self): - """Test that 'watchpoint command ' completes to ['add', 'delete', 'list'].""" - self.complete_from_to( - 'watchpoint command ', [ - 'add', 'delete', 'list']) - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_watchpoint_command_a(self): - """Test that 'watchpoint command a' completes to 'watchpoint command add '.""" - self.complete_from_to( - 'watchpoint command a', - 'watchpoint command add ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_watchpoint_set_ex(self): - """Test that 'watchpoint set ex' completes to 'watchpoint set expression '.""" - self.complete_from_to( - 'watchpoint set ex', - 'watchpoint set expression ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_watchpoint_set_var(self): - """Test that 'watchpoint set var' completes to 'watchpoint set variable '.""" - self.complete_from_to('watchpoint set var', 'watchpoint set variable ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_help_fi(self): - """Test that 'help fi' completes to ['file', 'finish'].""" - self.complete_from_to( - 'help fi', [ - 'file', 'finish']) - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_help_watchpoint_s(self): - """Test that 'help watchpoint s' completes to 'help watchpoint set '.""" - self.complete_from_to('help watchpoint s', 'help watchpoint set ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_append_target_er(self): - """Test that 'settings append target.er' completes to 'settings append target.error-path'.""" - self.complete_from_to( - 'settings append target.er', - 'settings append target.error-path') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_insert_after_target_en(self): - """Test that 'settings insert-after target.env' completes to 'settings insert-after target.env-vars'.""" - self.complete_from_to( - 'settings insert-after target.env', - 'settings insert-after target.env-vars') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_insert_before_target_en(self): - """Test that 'settings insert-before target.env' completes to 'settings insert-before target.env-vars'.""" - self.complete_from_to( - 'settings insert-before target.env', - 'settings insert-before target.env-vars') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_replace_target_ru(self): - """Test that 'settings replace target.ru' completes to 'settings replace target.run-args'.""" - self.complete_from_to( - 'settings replace target.ru', - 'settings replace target.run-args') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_s(self): - """Test that 'settings s' completes to ['set', 'show'].""" - self.complete_from_to( - 'settings s', [ - 'set', 'show']) - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_set_th(self): - """Test that 'settings set thread-f' completes to 'settings set thread-format'.""" - self.complete_from_to('settings set thread-f', 'settings set thread-format') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_s_dash(self): - """Test that 'settings set --g' completes to 'settings set --global'.""" - self.complete_from_to('settings set --g', 'settings set --global') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_clear_th(self): - """Test that 'settings clear thread-f' completes to 'settings clear thread-format'.""" - self.complete_from_to( - 'settings clear thread-f', - 'settings clear thread-format') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_set_ta(self): - """Test that 'settings set ta' completes to 'settings set target.'.""" - self.complete_from_to( - 'settings set target.ma', - 'settings set target.max-') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_set_target_exec(self): - """Test that 'settings set target.exec' completes to 'settings set target.exec-search-paths '.""" - self.complete_from_to( - 'settings set target.exec', - 'settings set target.exec-search-paths') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_set_target_pr(self): - """Test that 'settings set target.pr' completes to [ - 'target.prefer-dynamic-value', 'target.process.'].""" - self.complete_from_to('settings set target.pr', - ['target.prefer-dynamic-value', - 'target.process.']) - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_set_target_process(self): - """Test that 'settings set target.process' completes to 'settings set target.process.'.""" - self.complete_from_to( - 'settings set target.process', - 'settings set target.process.') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_set_target_process_dot(self): - """Test that 'settings set target.process.t' completes to 'settings set target.process.thread.'.""" - self.complete_from_to( - 'settings set target.process.t', - 'settings set target.process.thread.') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_settings_set_target_process_thread_dot(self): - """Test that 'settings set target.process.thread.' completes to [ - 'target.process.thread.step-avoid-regexp', 'target.process.thread.trace-thread'].""" - self.complete_from_to('settings set target.process.thread.', - ['target.process.thread.step-avoid-regexp', - 'target.process.thread.trace-thread']) - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_target_space(self): - """Test that 'target ' completes to ['create', 'delete', 'list', - 'modules', 'select', 'stop-hook', 'variable'].""" - self.complete_from_to('target ', - ['create', - 'delete', - 'list', - 'modules', - 'select', - 'stop-hook', - 'variable']) - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_target_create_dash_co(self): - """Test that 'target create --co' completes to 'target variable --core '.""" - self.complete_from_to('target create --co', 'target create --core ') - - @skipIfFreeBSD # timing out on the FreeBSD buildbot - def test_target_va(self): - """Test that 'target va' completes to 'target variable '.""" - self.complete_from_to('target va', 'target variable ') - - def test_command_argument_completion(self): - """Test completion of command arguments""" - self.complete_from_to("watchpoint set variable -", ["-w", "-s"]) - self.complete_from_to('watchpoint set variable -w', 'watchpoint set variable -w ') - self.complete_from_to("watchpoint set variable --", ["--watch", "--size"]) - self.complete_from_to("watchpoint set variable --w", "watchpoint set variable --watch") - self.complete_from_to('watchpoint set variable -w ', ['read', 'write', 'read_write']) - self.complete_from_to("watchpoint set variable --watch ", ["read", "write", "read_write"]) - self.complete_from_to("watchpoint set variable --watch w", "watchpoint set variable --watch write") - self.complete_from_to('watchpoint set variable -w read_', 'watchpoint set variable -w read_write') - # Now try the same thing with a variable name (non-option argument) to - # test that getopts arg reshuffling doesn't confuse us. - self.complete_from_to("watchpoint set variable foo -", ["-w", "-s"]) - self.complete_from_to('watchpoint set variable foo -w', 'watchpoint set variable foo -w ') - self.complete_from_to("watchpoint set variable foo --", ["--watch", "--size"]) - self.complete_from_to("watchpoint set variable foo --w", "watchpoint set variable foo --watch") - self.complete_from_to('watchpoint set variable foo -w ', ['read', 'write', 'read_write']) - self.complete_from_to("watchpoint set variable foo --watch ", ["read", "write", "read_write"]) - self.complete_from_to("watchpoint set variable foo --watch w", "watchpoint set variable foo --watch write") - self.complete_from_to('watchpoint set variable foo -w read_', 'watchpoint set variable foo -w read_write') - - def test_completion_description_commands(self): - """Test descriptions of top-level command completions""" - self.check_completion_with_desc("", [ - ["command", "Commands for managing custom LLDB commands."], - ["bugreport", "Commands for creating domain-specific bug reports."] - ]) - - self.check_completion_with_desc("pl", [ - ["platform", "Commands to manage and create platforms."], - ["plugin", "Commands for managing LLDB plugins."] - ]) - - # Just check that this doesn't crash. - self.check_completion_with_desc("comman", []) - self.check_completion_with_desc("non-existent-command", []) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489") - def test_symbol_name(self): - self.build() - self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.complete_from_to('breakpoint set -n Fo', - 'breakpoint set -n Foo::Bar(int,\\ int)', - turn_off_re_match=True) diff --git a/packages/Python/lldbsuite/test/functionalities/completion/main.cpp b/packages/Python/lldbsuite/test/functionalities/completion/main.cpp deleted file mode 100644 index 0814bb9cc0ac..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/completion/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -class Foo -{ -public: - int Bar(int x, int y) - { - return x + y; - } -}; - -struct Container { int MemberVar; }; - -int main() -{ - Foo fooo; - Foo *ptr_fooo = &fooo; - fooo.Bar(1, 2); - - Container container; - Container *ptr_container = &container; - return container.MemberVar = 3; // Break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/conditional_break/.lldb b/packages/Python/lldbsuite/test/functionalities/conditional_break/.lldb deleted file mode 100644 index 4be90efee23b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/conditional_break/.lldb +++ /dev/null @@ -1,3 +0,0 @@ -breakpoint set -n c -command script import -r conditional_break.py -breakpoint command add 1 -F "conditional_break.stop_if_called_from_a" diff --git a/packages/Python/lldbsuite/test/functionalities/conditional_break/Makefile b/packages/Python/lldbsuite/test/functionalities/conditional_break/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/conditional_break/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py b/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py deleted file mode 100644 index 7b123950c23d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py +++ /dev/null @@ -1,141 +0,0 @@ -""" -Test conditionally break on a function and inspect its variables. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -# rdar://problem/8532131 -# lldb not able to digest the clang-generated debug info correctly with respect to function name -# -# This class currently fails for clang as well as llvm-gcc. - - -class ConditionalBreakTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - def test_with_python(self): - """Exercise some thread and frame APIs to break if c() is called by a().""" - self.build() - self.do_conditional_break() - - def test_with_command(self): - """Simulate a user using lldb commands to break on c() if called from a().""" - self.build() - self.simulate_conditional_break_by_user() - - def do_conditional_break(self): - """Exercise some thread and frame APIs to break if c() is called by a().""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - breakpoint = target.BreakpointCreateByName("c", exe) - self.assertTrue(breakpoint, 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. - self.assertTrue(process.GetState() == lldb.eStateStopped, - STOPPED_DUE_TO_BREAKPOINT) - - # Find the line number where a's parent frame function is c. - line = line_number( - 'main.c', - "// Find the line number where c's parent frame is a here.") - - # Suppose we are only interested in the call scenario where c()'s - # immediate caller is a() and we want to find out the value passed from - # a(). - # - # The 10 in range(10) is just an arbitrary number, which means we would - # like to try for at most 10 times. - for j in range(10): - if self.TraceOn(): - print("j is: ", j) - thread = lldbutil.get_one_thread_stopped_at_breakpoint( - process, breakpoint) - self.assertIsNotNone( - thread, "Expected one thread to be stopped at the breakpoint") - - if thread.GetNumFrames() >= 2: - frame0 = thread.GetFrameAtIndex(0) - name0 = frame0.GetFunction().GetName() - frame1 = thread.GetFrameAtIndex(1) - name1 = frame1.GetFunction().GetName() - # lldbutil.print_stacktrace(thread) - self.assertTrue(name0 == "c", "Break on function c()") - if (name1 == "a"): - # By design, we know that a() calls c() only from main.c:27. - # In reality, similar logic can be used to find out the call - # site. - self.assertTrue(frame1.GetLineEntry().GetLine() == line, - "Immediate caller a() at main.c:%d" % line) - - # And the local variable 'val' should have a value of (int) - # 3. - val = frame1.FindVariable("val") - self.assertEqual("int", val.GetTypeName()) - self.assertEqual("3", val.GetValue()) - break - - process.Continue() - - def simulate_conditional_break_by_user(self): - """Simulate a user using lldb commands to break on c() if called from a().""" - - # Sourcing .lldb in the current working directory, which sets the main - # executable, sets the breakpoint on c(), and adds the callback for the - # breakpoint such that lldb only stops when the caller of c() is a(). - # the "my" package that defines the date() function. - if self.TraceOn(): - print("About to source .lldb") - - if not self.TraceOn(): - self.HideStdout() - - # Separate out the "file " + self.getBuildArtifact("a.out") command from .lldb file, for the sake of - # remote testsuite. - self.runCmd("file " + self.getBuildArtifact("a.out")) - self.runCmd("command source .lldb") - - self.runCmd("break list") - - if self.TraceOn(): - print("About to run.") - self.runCmd("run", RUN_SUCCEEDED) - - self.runCmd("break list") - - if self.TraceOn(): - print("Done running") - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - # The frame info for frame #0 points to a.out`c and its immediate caller - # (frame #1) points to a.out`a. - - self.expect("frame info", "We should stop at c()", - substrs=["a.out`c"]) - - # Select our parent frame as the current frame. - self.runCmd("frame select 1") - self.expect("frame info", "The immediate caller should be a()", - substrs=["a.out`a"]) diff --git a/packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py b/packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py deleted file mode 100644 index a62dd923af9d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import lldb - - -def stop_if_called_from_a(frame, bp_loc, dict): - - thread = frame.GetThread() - process = thread.GetProcess() - target = process.GetTarget() - dbg = target.GetDebugger() - - # Perform synchronous interaction with the debugger. - old_async = dbg.GetAsync() - dbg.SetAsync(True) - - # We check the call frames in order to stop only when the immediate caller - # of the leaf function c() is a(). If it's not the right caller, we ask the - # command interpreter to continue execution. - - should_stop = True - if thread.GetNumFrames() >= 2: - - if (thread.frames[0].function.name == - 'c' and thread.frames[1].function.name == 'a'): - should_stop = True - else: - should_stop = False - - dbg.SetAsync(old_async) - return should_stop diff --git a/packages/Python/lldbsuite/test/functionalities/conditional_break/main.c b/packages/Python/lldbsuite/test/functionalities/conditional_break/main.c deleted file mode 100644 index 1329fd69a2e1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/conditional_break/main.c +++ /dev/null @@ -1,54 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -// This simple program is to demonstrate the capability of the lldb command -// "breakpoint command add" to add a set of commands to a breakpoint to be -// executed when the breakpoint is hit. -// -// In particular, we want to break within c(), but only if the immediate caller -// is a(). - -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 where c's parent frame is a here. - - return val; -} - -int b(int val) -{ - return c(val); -} - -int c(int val) -{ - return val + 3; -} - -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); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/.categories b/packages/Python/lldbsuite/test/functionalities/darwin_log/.categories deleted file mode 100644 index ea135483a483..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/.categories +++ /dev/null @@ -1 +0,0 @@ -darwin-log diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py deleted file mode 100644 index f65b1b89d35b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -# System imports -from __future__ import print_function - -# LLDB imports -from lldbsuite.test import darwin_log -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest - - -class TestDarwinLogBasic(darwin_log.DarwinLogEventBasedTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - @decorators.add_test_categories(['pyapi']) - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(archs=["i386"], bugnumber="rdar://28655626") - @decorators.expectedFailureAll(bugnumber="rdar://30645203") - def test_SBStructuredData_gets_broadcasted(self): - """Exercise SBStructuredData API.""" - - # Run the test. - log_entries = self.do_test(None, max_entry_count=2) - - # Validate that we received our two log entries. - self.assertEqual(len(log_entries), 1, - "Expected one log entry to arrive via events.") - self.assertEqual(log_entries[0]['message'], "Hello, world", - "Log message should match expected content.") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c deleted file mode 100644 index e6554564411f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c +++ /dev/null @@ -1,32 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/log.h> -#include <stdio.h> - -#include "../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger = os_log_create("org.llvm.lldb.test", "basic-test"); - if (!logger) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_log(logger, "Hello, world"); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/common/darwin_log_common.h b/packages/Python/lldbsuite/test/functionalities/darwin_log/common/darwin_log_common.h deleted file mode 100644 index de923b949116..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/common/darwin_log_common.h +++ /dev/null @@ -1,6 +0,0 @@ -// The number of seconds to wait at the end of the test inferior before -// exiting. This delay is needed to ensure the logging infrastructure -// has flushed out the message. If we finished before all messages were -// flushed, then the test will never see the unflushed messages, causing -// some test logic to fail. -#define FINAL_WAIT_SECONDS 5 diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/TestDarwinLogFilterMatchActivityChain.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/TestDarwinLogFilterMatchActivityChain.py deleted file mode 100644 index c8f93c1db3a8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/TestDarwinLogFilterMatchActivityChain.py +++ /dev/null @@ -1,123 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterMatchActivityChain(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterMatchActivityChain, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterMatchActivityChain, self).tearDown() - - # ========================================================================== - # activity-chain filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_chain_match(self): - """Test that fall-through reject, accept full-match activity chain works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity-chain match " - "parent-activity:child-activity\""]) - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_chain_partial_match(self): - """Test that fall-through reject, doesn't accept only partial match of activity-chain.""" - self.do_test( - ["--no-match-accepts false", - # Match the second fully. - "--filter \"accept activity-chain match parent-activity:child-activity\"", - "--filter \"accept activity-chain match parent-ac\""]) # Only partially match the first. - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_chain_full_match(self): - """Test that fall-through accept, reject match activity-chain works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject activity-chain match parent-activity\""]) - - # We should only see the second log message as we rejected the first - # via activity-chain rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_chain_second_rule(self): - """Test that fall-through reject, accept activity-chain on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity-chain match non-existent\"", - "--filter \"accept activity-chain match parent-activity:child-activity\""]) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the activity-chain of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/TestDarwinLogFilterMatchActivity.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/TestDarwinLogFilterMatchActivity.py deleted file mode 100644 index 32b2623dfb98..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/TestDarwinLogFilterMatchActivity.py +++ /dev/null @@ -1,127 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterMatchActivity(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterMatchActivity, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterMatchActivity, self).tearDown() - - # ========================================================================== - # activity filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_match(self): - """Test that fall-through reject, accept match activity works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity match child-activity\""] - ) - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_partial_match(self): - """Test that fall-through reject, accept match activity via partial match does not accept.""" - self.do_test( - ["--no-match-accepts false", - # Fully match second message. - "--filter \"accept activity match child-activity\"", - "--filter \"accept activity match parent-\""] # Only partially match first message. - ) - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_full_match(self): - """Test that fall-through accept, reject match activity works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject activity match parent-activity\""] - ) - - # We should only see the second log message as we rejected the first - # via activity rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_second_rule(self): - """Test that fall-through reject, accept regex activity on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity match non-existent\"", - "--filter \"accept activity match child-activity\"" - ] - ) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the activity of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/TestDarwinLogFilterMatchCategory.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/TestDarwinLogFilterMatchCategory.py deleted file mode 100644 index 088d1036d1c4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/TestDarwinLogFilterMatchCategory.py +++ /dev/null @@ -1,127 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterMatchCategory(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterMatchCategory, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterMatchCategory, self).tearDown() - - # ========================================================================== - # category filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_category_full_match(self): - """Test that fall-through reject, accept match single category works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept category match cat2\""] - ) - - # We should only see the second log message as we only accept - # that category. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_category_partial_match(self): - """Test that fall-through reject, accept regex category via partial match works.""" - self.do_test( - ["--no-match-accepts false", - # Fully match the second message. - "--filter \"accept category match cat2\"", - "--filter \"accept category match at1\""] # Only partially match first message. Should not show up. - ) - - # We should only see the second log message as we only accept - # that category. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_category_full_match(self): - """Test that fall-through accept, reject match category works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject category match cat1\""] - ) - - # We should only see the second log message as we rejected the first - # via category rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_category_second_rule(self): - """Test that fall-through reject, accept match category on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept category match non-existent\"", - "--filter \"accept category match cat2\"" - ] - ) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the category of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/TestDarwinLogFilterMatchMessage.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/TestDarwinLogFilterMatchMessage.py deleted file mode 100644 index 5a377f99128b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/TestDarwinLogFilterMatchMessage.py +++ /dev/null @@ -1,147 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterMatchMessage(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterMatchMessage, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - self.strict_sources = True - - # Turn on process monitor logging while we work out issues. - self.enable_process_monitor_logging = True - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterMatchMessage, self).tearDown() - - # ========================================================================== - # category filter tests - # ========================================================================== - - EXPECT_REGEXES = [ - re.compile(r"log message ([^-]+)-(\S+)"), - re.compile(r"exited with status") - ] - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_accept_message_full_match(self): - """Test that fall-through reject, accept match whole message works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept message match log message sub2-cat2\""], - expect_regexes=self.EXPECT_REGEXES - ) - - # We should only see the second log message as we only accept - # that message contents. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_no_accept_message_partial_match(self): - """Test that fall-through reject, match message via partial content match doesn't accept.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept message match log message sub2-cat2\"", - "--filter \"accept message match sub1-cat1\""], - expect_regexes=self.EXPECT_REGEXES - ) - - # We should only see the second log message as the partial match on - # the first message should not pass. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_reject_category_full_match(self): - """Test that fall-through accept, reject match message works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject message match log message sub1-cat1\""], - expect_regexes=self.EXPECT_REGEXES - ) - - # We should only see the second log message as we rejected the first - # via message contents rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_accept_category_second_rule(self): - """Test that fall-through reject, accept match category on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept message match non-existent\"", - "--filter \"accept message match log message sub2-cat2\""], - expect_regexes=self.EXPECT_REGEXES - ) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the category of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/main.c deleted file mode 100644 index f851e23d8800..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/main.c +++ /dev/null @@ -1,35 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_log(logger_sub1, "log message sub%d-cat%d", 1, 1); - os_log(logger_sub2, "log message sub%d-cat%d", 2, 2); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(1); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/TestDarwinLogFilterMatchSubsystem.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/TestDarwinLogFilterMatchSubsystem.py deleted file mode 100644 index f3d4d4de92f0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/TestDarwinLogFilterMatchSubsystem.py +++ /dev/null @@ -1,127 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterMatchSubsystem(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterMatchSubsystem, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterMatchSubsystem, self).tearDown() - - # ========================================================================== - # subsystem filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_subsystem_full_match(self): - """Test that fall-through reject, accept match single subsystem works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept subsystem match org.llvm.lldb.test.sub2\""] - ) - - # We should only see the second log message as we only accept - # that subsystem. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_subsystem_partial_match(self): - """Test that fall-through reject, doesn't accept match subsystem via partial-match.""" - self.do_test( - ["--no-match-accepts false", - # Fully match second message subsystem. - "--filter \"accept subsystem match org.llvm.lldb.test.sub2\"", - "--filter \"accept subsystem match sub1\""] # Only partially match first subsystem. - ) - - # We should only see the second log message as we only accept - # that subsystem. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_subsystem_full_match(self): - """Test that fall-through accept, reject match subsystem works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject subsystem match org.llvm.lldb.test.sub1\""] - ) - - # We should only see the second log message as we rejected the first - # via subsystem rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_subsystem_second_rule(self): - """Test that fall-through reject, accept match subsystem on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept subsystem match non-existent\"", - "--filter \"accept subsystem match org.llvm.lldb.test.sub2\"" - ] - ) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the subsystem of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/TestDarwinLogFilterRegexActivityChain.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/TestDarwinLogFilterRegexActivityChain.py deleted file mode 100644 index 16d678aa2417..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/TestDarwinLogFilterRegexActivityChain.py +++ /dev/null @@ -1,138 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterRegexActivityChain(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterRegexActivityChain, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterRegexActivityChain, self).tearDown() - - # ========================================================================== - # activity-chain filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_chain_full_match(self): - """Test that fall-through reject, accept full-match activity chain works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity-chain regex " - "parent-activity:child-activity\""]) - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_chain_partial_match(self): - """Test that fall-through reject, accept activity-chain via partial match works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity-chain regex :child-activity\""]) - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_chain_full_match(self): - """Test that fall-through accept, reject activity-chain works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject activity-chain regex parent-activity:child-..tivity\""]) - - # We should only see the second log message as we rejected the first - # via activity-chain rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat1"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_chain_partial_match(self): - """Test that fall-through accept, reject activity-chain by partial match works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject activity-chain regex ^p[^:]+$\""]) - - # We should only see the second log message as we rejected the first - # via activity-chain rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_chain_second_rule(self): - """Test that fall-through reject, accept activity-chain on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity-chain regex non-existent\"", - "--filter \"accept activity-chain regex child-activity\""]) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the activity-chain of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/TestDarwinLogFilterRegexActivity.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/TestDarwinLogFilterRegexActivity.py deleted file mode 100644 index e017d56af31c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/TestDarwinLogFilterRegexActivity.py +++ /dev/null @@ -1,143 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterRegexActivity(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterRegexActivity, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterRegexActivity, self).tearDown() - - # ========================================================================== - # activity filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_full_match(self): - """Test that fall-through reject, accept regex full-match activity works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity regex child-activity\""] - ) - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_partial_match(self): - """Test that fall-through reject, regex accept activity via partial match works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity regex child-.*\""] - ) - - # We should only see the second log message as we only accept - # that activity. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_full_match(self): - """Test that fall-through accept, reject regex activity works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject activity regex parent-activity\""] - ) - - # We should only see the second log message as we rejected the first - # via activity rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_activity_partial_match(self): - """Test that fall-through accept, reject regex activity by partial match works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject activity regex p.+-activity\""] - ) - - # We should only see the second log message as we rejected the first - # via activity rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_activity_second_rule(self): - """Test that fall-through reject, accept regex activity on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept activity regex non-existent\"", - "--filter \"accept activity regex child-activity\"" - ] - ) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the activity of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py deleted file mode 100644 index 5a618b11680c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py +++ /dev/null @@ -1,143 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterRegexCategory(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterRegexCategory, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterRegexCategory, self).tearDown() - - # ========================================================================== - # category filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_category_full_match(self): - """Test that fall-through reject, accept regex single category works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept category regex cat2\""] - ) - - # We should only see the second log message as we only accept - # that category. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_category_partial_match(self): - """Test that fall-through reject, accept regex category via partial match works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept category regex .+2\""] - ) - - # We should only see the second log message as we only accept - # that category. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_category_full_match(self): - """Test that fall-through accept, reject regex category works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject category regex cat1\""] - ) - - # We should only see the second log message as we rejected the first - # via category rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_category_partial_match(self): - """Test that fall-through accept, reject regex category by partial match works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject category regex t1\""] - ) - - # We should only see the second log message as we rejected the first - # via category rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_category_second_rule(self): - """Test that fall-through reject, accept regex category on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept category regex non-existent\"", - "--filter \"accept category regex cat2\"" - ] - ) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the category of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/TestDarwinLogFilterRegexMessage.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/TestDarwinLogFilterRegexMessage.py deleted file mode 100644 index eceedce2954e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/TestDarwinLogFilterRegexMessage.py +++ /dev/null @@ -1,128 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -# System imports -from __future__ import print_function - -import re - -# LLDB imports -import lldb - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterRegexMessage(darwin_log.DarwinLogEventBasedTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_accept_message_full_match(self): - """Test that fall-through reject, accept regex whole message works.""" - log_entries = self.do_test( - ["--no-match-accepts false", - # Note below, the four '\' characters are to get us two - # backslashes over on the gdb-remote side, which then - # becomes one as the cstr interprets it as an escape - # sequence. This needs to be rationalized. Initially I - # supported std::regex ECMAScript, which has the - # [[:digit:]] character classes and such. That was much - # more tenable. The backslashes have to travel through - # so many layers of escaping. (And note if you take - # off the Python raw string marker here, you need to put - # in 8 backslashes to go to two on the remote side.) - r'--filter "accept message regex log message sub2-cat\\\\d+"']) - - # We should have received at least one log entry. - self.assertIsNotNone(log_entries, - "Log entry list should not be None.") - self.assertEqual(len(log_entries), 1, - "Should receive one log entry.") - self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2", - "First os_log call should have been skipped.") - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_accept_message_partial_match(self): - """Test that fall-through reject, accept regex message via partial - match works.""" - log_entries = self.do_test( - ["--no-match-accepts false", - "--filter \"accept message regex [^-]+2\""]) - - # We should only see the second log message as we only accept - # that message contents. - self.assertIsNotNone(log_entries, - "Log entry list should not be None.") - self.assertEqual(len(log_entries), 1, - "Should receive one log entry.") - self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2", - "First os_log call should have been skipped.") - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_reject_message_full_match(self): - """Test that fall-through accept, reject regex message works.""" - log_entries = self.do_test( - ["--no-match-accepts true", - "--filter \"reject message regex log message sub1-cat1\""]) - - # We should only see the second log message as we rejected the first - # via message contents rejection. - self.assertIsNotNone(log_entries, - "Log entry list should not be None.") - self.assertEqual(len(log_entries), 1, - "Should receive one log entry.") - self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2", - "First os_log call should have been skipped.") - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_reject_message_partial_match(self): - """Test that fall-through accept, reject regex message by partial - match works.""" - log_entries = self.do_test( - ["--no-match-accepts true", - "--filter \"reject message regex t1\""]) - - # We should only see the second log message as we rejected the first - # via partial message contents rejection. - self.assertIsNotNone(log_entries, - "Log entry list should not be None.") - self.assertEqual(len(log_entries), 1, - "Should receive one log entry.") - self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2", - "First os_log call should have been skipped.") - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(oslist=["macosx"], - bugnumber="llvm.org/pr30299") - def test_filter_accept_message_second_rule(self): - """Test that fall-through reject, accept regex message on second rule - works.""" - log_entries = self.do_test( - ["--no-match-accepts false", - "--filter \"accept message regex non-existent\"", - "--filter \"accept message regex cat2\""]) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the message of the second log message. - self.assertIsNotNone(log_entries, - "Log entry list should not be None.") - self.assertEqual(len(log_entries), 1, - "Should receive one log entry.") - self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2", - "First os_log call should have been skipped.") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/main.c deleted file mode 100644 index 5648ddae74b8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/main.c +++ /dev/null @@ -1,35 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_log(logger_sub1, "log message sub%d-cat%d", 1, 1); - os_log(logger_sub2, "log message sub%d-cat%d", 2, 2); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/Makefile deleted file mode 100644 index 4f4176f23f3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/TestDarwinLogFilterRegexSubsystem.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/TestDarwinLogFilterRegexSubsystem.py deleted file mode 100644 index 679db2ea37bb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/TestDarwinLogFilterRegexSubsystem.py +++ /dev/null @@ -1,160 +0,0 @@ -""" -Test basic DarwinLog functionality provided by the StructuredDataDarwinLog -plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogFilterRegexSubsystem(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogFilterRegexSubsystem, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogFilterRegexSubsystem, self).tearDown() - - # ========================================================================== - # basic filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_fallthrough_reject(self): - """Test that a single fall-through reject regex rule rejects all logging.""" - self.do_test( - ["--no-match-accepts false"] - ) - - # We should not match any log lines. - self.assertIsNotNone(self.child.match) - self.assertFalse((len(self.child.match.groups()) > 0) and - (self.child.match.group(1) in ["sub1", "sub2"]), - "log line should not have been received") - - # ========================================================================== - # subsystem filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_filter_accept_subsystem_full_match(self): - """Test that fall-through reject, accept regex single subsystem works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept subsystem regex org.llvm.lldb.test.sub2\""] - ) - - # We should only see the second log message as we only accept - # that subsystem. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_subsystem_partial_match(self): - """Test that fall-through reject, accept regex subsystem via partial-match works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept subsystem regex org.llvm.+.sub2\""] - ) - - # We should only see the second log message as we only accept - # that subsystem. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_subsystem_full_match(self): - """Test that fall-through accept, reject regex subsystem works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject subsystem regex org.llvm.lldb.test.sub1\""] - ) - - # We should only see the second log message as we rejected the first - # via subsystem rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_reject_subsystem_partial_match(self): - """Test that fall-through accept, reject regex subsystem by partial match works.""" - self.do_test( - ["--no-match-accepts true", - "--filter \"reject subsystem regex org.*sub1\""] - ) - - # We should only see the second log message as we rejected the first - # via subsystem rejection. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_filter_accept_subsystem_second_rule(self): - """Test that fall-through reject, accept regex subsystem on second rule works.""" - self.do_test( - ["--no-match-accepts false", - "--filter \"accept subsystem regex non-existent\"", - "--filter \"accept subsystem regex org.llvm.lldb.test.sub2\"" - ] - ) - - # We should only see the second message since we reject by default, - # the first filter doesn't match any, and the second filter matches - # the subsystem of the second log message. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 0) and ( - self.child.match.group(1) == "sub2"), - "first log line should not be present, second log line " - "should be") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/main.c deleted file mode 100644 index c93474eedb01..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/main.c +++ /dev/null @@ -1,43 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_log(logger_sub1, "source-log-sub1-cat1"); - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub2, "source-log-sub2-cat2"); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/TestDarwinLogMessageFormat.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/TestDarwinLogMessageFormat.py deleted file mode 100644 index 8c9e2875aec5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/TestDarwinLogMessageFormat.py +++ /dev/null @@ -1,188 +0,0 @@ -""" -Test DarwinLog log message formatting options provided by the -StructuredDataDarwinLog plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogMessageFormat(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogMessageFormat, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogMessageFormat, self).tearDown() - - # ========================================================================== - # Test settings around log message formatting - # ========================================================================== - - REGEXES = [ - re.compile(r"\[([^]]+)\] This is the log message."), # Match log - # with header. - re.compile(r"This is the log message."), # Match no-header content. - re.compile(r"exited with status") # Fallback if no log emitted. - ] - - @decorators.skipUnlessDarwin - def test_display_without_header_works(self): - """Test that turning off log message headers works as advertised.""" - self.do_test([], expect_regexes=self.REGEXES) - - # We should not match the first pattern as we shouldn't have header - # content. - self.assertIsNotNone(self.child.match) - self.assertFalse((len(self.child.match.groups()) > 0) and - (self.child.match.group(1) != ""), - "we should not have seen a header") - - @decorators.skipUnlessDarwin - def test_display_with_header_works(self): - """Test that displaying any header works.""" - self.do_test( - ["--timestamp-relative", "--subsystem", "--category", - "--activity-chain"], - expect_regexes=self.REGEXES, - settings_commands=[ - "display-header true" - ]) - - # We should match the first pattern as we should have header - # content. - self.assertIsNotNone(self.child.match) - self.assertTrue((len(self.child.match.groups()) > 0) and - (self.child.match.group(1) != ""), - "we should have printed a header") - - def assert_header_contains_timestamp(self, header): - fields = header.split(',') - self.assertGreater(len(fields), 0, - "there should have been header content present") - self.assertRegexpMatches(fields[0], - r"^\d+:\d{2}:\d{2}.\d{9}$", - "time field should match expected format") - - @decorators.skipUnlessDarwin - def test_header_timefield_only_works(self): - """Test that displaying a header with only the timestamp works.""" - self.do_test(["--timestamp-relative"], expect_regexes=self.REGEXES) - - # We should match the first pattern as we should have header - # content. - self.assertIsNotNone(self.child.match) - self.assertTrue((len(self.child.match.groups()) > 0) and - (self.child.match.group(1) != ""), - "we should have printed a header") - header = self.child.match.group(1) - self.assertEqual(len(header.split(',')), 1, - "there should only be one header field") - self.assert_header_contains_timestamp(header) - - @decorators.skipUnlessDarwin - def test_header_subsystem_only_works(self): - """Test that displaying a header with only the subsystem works.""" - self.do_test(["--subsystem"], expect_regexes=self.REGEXES) - - # We should match the first pattern as we should have header - # content. - self.assertIsNotNone(self.child.match) - self.assertTrue((len(self.child.match.groups()) > 0) and - (self.child.match.group(1) != ""), - "we should have printed a header") - header = self.child.match.group(1) - self.assertEqual(len(header.split(',')), 1, - "there should only be one header field") - self.assertEquals(header, - "subsystem=org.llvm.lldb.test.sub1") - - @decorators.skipUnlessDarwin - def test_header_category_only_works(self): - """Test that displaying a header with only the category works.""" - self.do_test(["--category"], expect_regexes=self.REGEXES) - - # We should match the first pattern as we should have header - # content. - self.assertIsNotNone(self.child.match) - self.assertTrue((len(self.child.match.groups()) > 0) and - (self.child.match.group(1) != ""), - "we should have printed a header") - header = self.child.match.group(1) - self.assertEqual(len(header.split(',')), 1, - "there should only be one header field") - self.assertEquals(header, - "category=cat1") - - @decorators.skipUnlessDarwin - def test_header_activity_chain_only_works(self): - """Test that displaying a header with only the activity chain works.""" - self.do_test(["--activity-chain"], expect_regexes=self.REGEXES) - - # We should match the first pattern as we should have header - # content. - self.assertIsNotNone(self.child.match) - self.assertTrue((len(self.child.match.groups()) > 0) and - (self.child.match.group(1) != ""), - "we should have printed a header") - header = self.child.match.group(1) - self.assertEqual(len(header.split(',')), 1, - "there should only be one header field") - self.assertEquals(header, - "activity-chain=parent-activity:child-activity") - - # @decorators.skipUnlessDarwin - # def test_header_activity_no_chain_only_works(self): - # """Test that displaying a header with only the activity works.""" - # self.do_test( - # [], - # expect_regexes=self.REGEXES, - # settings_commands=[ - # "display-header true", - # "format-include-timestamp false", - # "format-include-activity true", - # "format-include-category false", - # "format-include-subsystem false", - # "display-activity-chain false" - # ]) - - # # We should match the first pattern as we should have header - # # content. - # self.assertIsNotNone(self.child.match) - # self.assertTrue((len(self.child.match.groups()) > 0) and - # (self.child.match.group(1) != ""), - # "we should have printed a header") - # header = self.child.match.group(1) - # self.assertEqual(len(header.split(',')), 1, - # "there should only be one header field") - # self.assertEquals(header, - # "activity=child-activity") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/main.c deleted file mode 100644 index e371a547438a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/main.c +++ /dev/null @@ -1,41 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/activity.h> -#include <os/log.h> -#include <stdio.h> - -#include "../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - if (!logger_sub1) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_activity_t parent_activity = os_activity_create("parent-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(parent_activity, ^{ - os_activity_t child_activity = os_activity_create("child-activity", - OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - os_activity_apply(child_activity, ^{ - os_log(logger_sub1, "This is the log message."); - }); - }); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/Makefile deleted file mode 100644 index 214cedd96f1a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py deleted file mode 100644 index 89791097a3f8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Test DarwinLog "source include debug-level" functionality provided by the -StructuredDataDarwinLog plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogSourceDebug(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogSourceDebug, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - # Indicate we want strict-sources behavior. - self.strict_sources = True - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogSourceDebug, self).tearDown() - - # ========================================================================== - # source include/exclude debug filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - def test_source_default_exclude_debug(self): - """Test that default excluding of debug-level log messages works.""" - self.do_test([]) - - # We should only see the second log message as the first is a - # debug-level message and we're not including debug-level messages. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_source_explicitly_include_debug(self): - """Test that explicitly including debug-level log messages works.""" - self.do_test(["--debug"]) - - # We should only see the second log message as the first is a - # debug-level message and we're not including debug-level messages. - self.assertIsNotNone(self.child.match) - self.assertTrue((len(self.child.match.groups()) > 1) and - (self.child.match.group(2) == "cat1"), - "first log line should be present since we're " - "including debug-level log messages") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/main.c deleted file mode 100644 index 1f5cd1aa6c70..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/main.c +++ /dev/null @@ -1,34 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/log.h> -#include <stdio.h> - -#include "../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_log_debug(logger_sub1, "source-log-sub1-cat1"); - os_log(logger_sub2, "source-log-sub2-cat2"); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/Makefile deleted file mode 100644 index 214cedd96f1a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/TestDarwinLogSourceInfo.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/TestDarwinLogSourceInfo.py deleted file mode 100644 index 865eea241981..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/TestDarwinLogSourceInfo.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -Test DarwinLog "source include info-level" functionality provided by the -StructuredDataDarwinLog plugin. - -These tests are currently only supported when running against Darwin -targets. -""" - -from __future__ import print_function - -import lldb -import os -import re - -from lldbsuite.test import decorators -from lldbsuite.test import lldbtest -from lldbsuite.test import darwin_log - - -class TestDarwinLogSourceInfo(darwin_log.DarwinLogTestBase): - - mydir = lldbtest.TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - super(TestDarwinLogSourceInfo, self).setUp() - - # 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} - - # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') - - # Indicate we want strict-sources behavior. - self.strict_sources = True - - def tearDown(self): - # Shut down the process if it's still running. - if self.child: - self.runCmd('process kill') - self.expect_prompt() - self.runCmd('quit') - - # Let parent clean up - super(TestDarwinLogSourceInfo, self).tearDown() - - # ========================================================================== - # source include/exclude debug filter tests - # ========================================================================== - - @decorators.skipUnlessDarwin - @decorators.expectedFailureAll(bugnumber="rdar://27316264") - def test_source_exclude_info_level(self): - """Test that default excluding of info-level log messages works.""" - self.do_test([]) - - # We should only see the second log message as the first is an - # info-level message and we're not including debug-level messages. - self.assertIsNotNone(self.child.match) - self.assertTrue( - (len( - self.child.match.groups()) > 1) and ( - self.child.match.group(2) == "cat2"), - "first log line should not be present, second log line " - "should be") - - @decorators.skipUnlessDarwin - def test_source_include_info_level(self): - """Test that explicitly including info-level log messages works.""" - self.do_test( - ["--info"] - ) - - # We should only see the second log message as the first is a - # debug-level message and we're not including debug-level messages. - self.assertIsNotNone(self.child.match) - self.assertTrue((len(self.child.match.groups()) > 1) and - (self.child.match.group(2) == "cat1"), - "first log line should be present since we're " - "including info-level log messages") diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/main.c deleted file mode 100644 index 5ab6f39c0079..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/main.c +++ /dev/null @@ -1,34 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <os/log.h> -#include <stdio.h> - -#include "../../common/darwin_log_common.h" - -int main(int argc, char** argv) -{ - os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); - os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); - if (!logger_sub1 || !logger_sub2) - return 1; - - // Note we cannot use the os_log() line as the breakpoint because, as of - // the initial writing of this test, we get multiple breakpoints for that - // line, which confuses the pexpect test logic. - printf("About to log\n"); // break here - os_log_info(logger_sub1, "source-log-sub1-cat1"); - os_log(logger_sub2, "source-log-sub2-cat2"); - - // Sleep, as the darwin log reporting doesn't always happen until a bit - // later. We need the message to come out before the process terminates. - sleep(FINAL_WAIT_SECONDS); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/.categories b/packages/Python/lldbsuite/test/functionalities/data-formatter/.categories deleted file mode 100644 index fe1da0247c62..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/.categories +++ /dev/null @@ -1 +0,0 @@ -dataformatters diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/Makefile deleted file mode 100644 index 261658b10ae8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJCXX_SOURCES := main.mm - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py deleted file mode 100644 index 18aac237672c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DataFormatterBoolRefPtr(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - def test_boolrefptr_with_run_command(self): - """Test the formatters we use for BOOL& and BOOL* in Objective-C.""" - self.build() - self.boolrefptr_data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.mm', '// Set break point at this line.') - - def boolrefptr_data_formatter_commands(self): - """Test the formatters we use for BOOL& and BOOL* in Objective-C.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.mm", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - isiOS = (lldbplatformutil.getPlatform() == 'ios' or lldbplatformutil.getPlatform() == 'watchos') - - # Now check that we use the right summary for BOOL& - self.expect('frame variable yes_ref', - substrs=['YES']) - self.expect('frame variable no_ref', - substrs=['NO']) - if not(isiOS): - self.expect('frame variable unset_ref', substrs=['12']) - - # Now check that we use the right summary for BOOL* - self.expect('frame variable yes_ptr', - substrs=['YES']) - self.expect('frame variable no_ptr', - substrs=['NO']) - if not(isiOS): - self.expect('frame variable unset_ptr', substrs=['12']) - - # Now check that we use the right summary for BOOL - self.expect('frame variable yes', - substrs=['YES']) - self.expect('frame variable no', - substrs=['NO']) - if not(isiOS): - self.expect('frame variable unset', substrs=['12']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/main.mm b/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/main.mm deleted file mode 100644 index 22c8790a7541..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/main.mm +++ /dev/null @@ -1,31 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main (int argc, const char * argv[]) -{ - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - BOOL yes = YES; - BOOL no = NO; - BOOL unset = 12; - - BOOL &yes_ref = yes; - BOOL &no_ref = no; - BOOL &unset_ref = unset; - - BOOL* yes_ptr = &yes; - BOOL* no_ptr = &no; - BOOL* unset_ptr = &unset; - - [pool drain];// Set break point at this line. - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/Makefile deleted file mode 100644 index 9b06ad7d705a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Accelerate
\ No newline at end of file diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py deleted file mode 100644 index 891448f00d29..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CompactVectorsFormattingTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @skipUnlessDarwin - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect( - 'frame variable', - substrs=[ - '(vFloat) valueFL = (1.25, 0, 0.25, 0)', - '(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)', - '(int32_t [4]) valueI32 = (1, 0, 4, 0)', - '(vDouble) valueDL = (1.25, 2.25)', - '(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)', - '(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)', - '(vUInt32) valueU32 = (1, 2, 3, 4)', - "(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)", - '(vSInt16) valueS16 = (1, 0, 4, 0, 0, 1, 0, 4)', - '(vSInt32) valueS32 = (4, 3, 2, 1)', - '(vBool32) valueBool32 = (0, 1, 0, 1)']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/main.cpp deleted file mode 100644 index bbbd823ec313..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ - //===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <Accelerate/Accelerate.h> - -int main() -{ - vFloat valueFL = {1.25,0,0.25,0}; - vDouble valueDL = {1.25,2.25}; - int16_t valueI16[8] = {1,0,4,0,0,1,0,4}; - int32_t valueI32[4] = {1,0,4,0}; - vUInt8 valueU8 = {1,0,4,0,0,1,0,4}; - vUInt16 valueU16 = {1,0,4,0,0,1,0,4}; - vUInt32 valueU32 = {1,2,3,4}; - vSInt8 valueS8 = {1,0,4,0,0,1,0,4}; - vSInt16 valueS16 = {1,0,4,0,0,1,0,4}; - vSInt32 valueS32 = {4,3,2,1}; - vBool32 valueBool32 = {false,true,false,true}; - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py deleted file mode 100644 index 6d8a794070d7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py +++ /dev/null @@ -1,322 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class AdvDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("type summary add --summary-string \"pippo\" \"i_am_cool\"") - - self.runCmd( - "type summary add --summary-string \"pluto\" -x \"i_am_cool[a-z]*\"") - - self.expect("frame variable cool_boy", - substrs=['pippo']) - - self.expect("frame variable cooler_boy", - substrs=['pluto']) - - self.runCmd("type summary delete i_am_cool") - - self.expect("frame variable cool_boy", - substrs=['pluto']) - - self.runCmd("type summary clear") - - self.runCmd( - "type summary add --summary-string \"${var[]}\" -x \"int \\[[0-9]\\]") - - self.expect("frame variable int_array", - substrs=['1,2,3,4,5']) - - # this will fail if we don't do [] as regex correctly - self.runCmd( - 'type summary add --summary-string "${var[].integer}" "i_am_cool[]') - - self.expect("frame variable cool_array", - substrs=['1,1,1,1,6']) - - self.runCmd("type summary clear") - - self.runCmd( - "type summary add --summary-string \"${var[1-0]%x}\" \"int\"") - - self.expect("frame variable iAmInt", - substrs=['01']) - - self.runCmd( - "type summary add --summary-string \"${var[0-1]%x}\" \"int\"") - - self.expect("frame variable iAmInt", - substrs=['01']) - - self.runCmd("type summary clear") - - self.runCmd("type summary add --summary-string \"${var[0-1]%x}\" int") - self.runCmd( - "type summary add --summary-string \"${var[0-31]%x}\" float") - - self.expect("frame variable *pointer", - substrs=['0x', - '2']) - - # check fix for <rdar://problem/11338654> LLDB crashes when using a - # "type summary" that uses bitfields with no format - self.runCmd("type summary add --summary-string \"${var[0-1]}\" int") - self.expect("frame variable iAmInt", - substrs=['9 1']) - - self.expect("frame variable cool_array[3].floating", - substrs=['0x']) - - self.runCmd( - "type summary add --summary-string \"low bits are ${*var[0-1]} tgt is ${*var}\" \"int *\"") - - self.expect("frame variable pointer", - substrs=['low bits are', - 'tgt is 6']) - - self.expect( - "frame variable int_array --summary-string \"${*var[0-1]}\"", - substrs=['3']) - - self.runCmd("type summary clear") - - self.runCmd( - 'type summary add --summary-string \"${var[0-1]}\" -x \"int \[[0-9]\]\"') - - self.expect("frame variable int_array", - substrs=['1,2']) - - self.runCmd( - 'type summary add --summary-string \"${var[0-1]}\" "int []"') - - self.expect("frame variable int_array", - substrs=['1,2']) - - self.runCmd("type summary clear") - - self.runCmd("type summary add -c -x \"i_am_cool \[[0-9]\]\"") - self.runCmd("type summary add -c i_am_cool") - - self.expect("frame variable cool_array", - substrs=['[0]', - '[1]', - '[2]', - '[3]', - '[4]', - 'integer', - 'character', - 'floating']) - - self.runCmd( - "type summary add --summary-string \"int = ${*var.int_pointer}, float = ${*var.float_pointer}\" IWrapPointers") - - self.expect("frame variable wrapper", - substrs=['int = 4', - 'float = 1.1']) - - self.runCmd( - "type summary add --summary-string \"low bits = ${*var.int_pointer[2]}\" IWrapPointers -p") - - self.expect("frame variable wrapper", - substrs=['low bits = 1']) - - self.expect("frame variable *wrap_pointer", - substrs=['low bits = 1']) - - self.runCmd("type summary clear") - - self.expect( - "frame variable int_array --summary-string \"${var[0][0-2]%hex}\"", - substrs=[ - '0x', - '7']) - - self.runCmd("type summary clear") - - self.runCmd( - "type summary add --summary-string \"${*var[].x[0-3]%hex} is a bitfield on a set of integers\" -x \"SimpleWithPointers \[[0-9]\]\"") - - self.expect( - "frame variable couple --summary-string \"${*var.sp.x[0-2]} are low bits of integer ${*var.sp.x}. If I pretend it is an array I get ${var.sp.x[0-5]}\"", - substrs=[ - '1 are low bits of integer 9.', - 'If I pretend it is an array I get [9,']) - - # if the summary has an error, we still display the value - self.expect( - "frame variable couple --summary-string \"${*var.sp.foo[0-2]\"", - substrs=[ - '(Couple) couple = {', - 'x = 0x', - 'y = 0x', - 'z = 0x', - 's = 0x']) - - self.runCmd( - "type summary add --summary-string \"${*var.sp.x[0-2]} are low bits of integer ${*var.sp.x}. If I pretend it is an array I get ${var.sp.x[0-5]}\" Couple") - - self.expect("frame variable sparray", - substrs=['[0x0000000f,0x0000000c,0x00000009]']) - - # check that we can format a variable in a summary even if a format is - # defined for its datatype - self.runCmd("type format add -f hex int") - self.runCmd( - "type summary add --summary-string \"x=${var.x%d}\" Simple") - - self.expect("frame variable a_simple_object", - substrs=['x=3']) - - self.expect("frame variable a_simple_object", matching=False, - substrs=['0x0']) - - # now check that the default is applied if we do not hand out a format - self.runCmd("type summary add --summary-string \"x=${var.x}\" Simple") - - self.expect("frame variable a_simple_object", matching=False, - substrs=['x=3']) - - self.expect("frame variable a_simple_object", matching=True, - substrs=['x=0x00000003']) - - # check that we can correctly cap the number of children shown - self.runCmd("settings set target.max-children-count 5") - - self.expect('frame variable a_long_guy', matching=True, - substrs=['a_1', - 'b_1', - 'c_1', - 'd_1', - 'e_1', - '...']) - - # check that no further stuff is printed (not ALL values are checked!) - self.expect('frame variable a_long_guy', matching=False, - substrs=['f_1', - 'g_1', - 'h_1', - 'i_1', - 'j_1', - 'q_1', - 'a_2', - 'f_2', - 't_2', - 'w_2']) - - self.runCmd("settings set target.max-children-count 1") - self.expect('frame variable a_long_guy', matching=True, - substrs=['a_1', - '...']) - self.expect('frame variable a_long_guy', matching=False, - substrs=['b_1', - 'c_1', - 'd_1', - 'e_1']) - self.expect('frame variable a_long_guy', matching=False, - substrs=['f_1', - 'g_1', - 'h_1', - 'i_1', - 'j_1', - 'q_1', - 'a_2', - 'f_2', - 't_2', - 'w_2']) - - self.runCmd("settings set target.max-children-count 30") - self.expect('frame variable a_long_guy', matching=True, - substrs=['a_1', - 'b_1', - 'c_1', - 'd_1', - 'e_1', - 'z_1', - 'a_2', - 'b_2', - 'c_2', - 'd_2', - '...']) - self.expect('frame variable a_long_guy', matching=False, - substrs=['e_2', - 'n_2', - 'r_2', - 'i_2', - 'k_2', - 'o_2']) - - # override the cap - self.expect( - 'frame variable a_long_guy --show-all-children', - matching=True, - substrs=[ - 'a_1', - 'b_1', - 'c_1', - 'd_1', - 'e_1', - 'z_1', - 'a_2', - 'b_2', - 'c_2', - 'd_2']) - self.expect( - 'frame variable a_long_guy --show-all-children', - matching=True, - substrs=[ - 'e_2', - 'n_2', - 'r_2', - 'i_2', - 'k_2', - 'o_2']) - self.expect( - 'frame variable a_long_guy --show-all-children', - matching=False, - substrs=['...']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/main.cpp deleted file mode 100644 index 2462e28db127..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/main.cpp +++ /dev/null @@ -1,174 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -struct i_am_cool -{ - int integer; - float floating; - char character; - i_am_cool(int I, float F, char C) : - integer(I), floating(F), character(C) {} - i_am_cool() : integer(1), floating(2), character('3') {} - -}; - -struct i_am_cooler -{ - i_am_cool first_cool; - i_am_cool second_cool; - float floating; - - i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) : - first_cool(I1,F1,C1), - second_cool(I2,F2,C2), - floating((F1 + F2)/2) {} -}; - -struct IWrapPointers -{ - int* int_pointer; - float* float_pointer; - IWrapPointers() : int_pointer(new int(4)), float_pointer(new float(1.111)) {} -}; - -struct Simple -{ - int x; - float y; - char z; - Simple(int X, float Y, char Z) : - x(X), - y(Y), - z(Z) - {} -}; - -struct SimpleWithPointers -{ - int *x; - float *y; - char *z; - SimpleWithPointers(int X, float Y, char Z) : - x(new int (X)), - y(new float (Y)), - z(new char[2]) - { - z[0] = Z; - z[1] = '\0'; - } -}; - -struct Couple -{ - SimpleWithPointers sp; - Simple* s; - Couple(int X, float Y, char Z) : sp(X,Y,Z), - s(new Simple(X,Y,Z)) {} -}; - -struct VeryLong -{ - int a_1; - int b_1; - int c_1; - int d_1; - int e_1; - int f_1; - int g_1; - int h_1; - int i_1; - int j_1; - int k_1; - int l_1; - int m_1; - int n_1; - int o_1; - int p_1; - int q_1; - int r_1; - int s_1; - int t_1; - int u_1; - int v_1; - int w_1; - int x_1; - int y_1; - int z_1; - - int a_2; - int b_2; - int c_2; - int d_2; - int e_2; - int f_2; - int g_2; - int h_2; - int i_2; - int j_2; - int k_2; - int l_2; - int m_2; - int n_2; - int o_2; - int p_2; - int q_2; - int r_2; - int s_2; - int t_2; - int u_2; - int v_2; - int w_2; - int x_2; - int y_2; - int z_2; -}; - -int main (int argc, const char * argv[]) -{ - - int iAmInt = 9; - - i_am_cool cool_boy(1,0.5,3); - i_am_cooler cooler_boy(1,2,0.1,0.2,'A','B'); - - i_am_cool *cool_pointer = new i_am_cool(3,-3.141592,'E'); - - i_am_cool cool_array[5]; - - cool_array[3].floating = 5.25; - cool_array[4].integer = 6; - cool_array[2].character = 'Q'; - - int int_array[] = {1,2,3,4,5}; - - IWrapPointers wrapper; - - *int_array = -1; - - int* pointer = &cool_array[4].integer; - - IWrapPointers *wrap_pointer = &wrapper; - - Couple couple(9,9.99,'X'); - - SimpleWithPointers sparray[] = - {SimpleWithPointers(-1,-2,'3'), - SimpleWithPointers(-4,-5,'6'), - SimpleWithPointers(-7,-8,'9')}; - - Simple a_simple_object(3,0.14,'E'); - - VeryLong a_long_guy; - - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py deleted file mode 100644 index 4e61b7419d5b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py +++ /dev/null @@ -1,359 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CategoriesDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case (most of these categories do not - # exist anymore, but we just make sure we delete all of them) - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type category delete Category1', check=False) - self.runCmd('type category delete Category2', check=False) - self.runCmd('type category delete NewCategory', check=False) - self.runCmd("type category delete CircleCategory", check=False) - self.runCmd( - "type category delete RectangleStarCategory", - check=False) - self.runCmd("type category delete BaseCategory", check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Add a summary to a new category and check that it works - self.runCmd( - "type summary add Rectangle --summary-string \"ARectangle\" -w NewCategory") - - self.expect("frame variable r1 r2 r3", matching=False, - substrs=['r1 = ARectangle', - 'r2 = ARectangle', - 'r3 = ARectangle']) - - self.runCmd("type category enable NewCategory") - - self.expect("frame variable r1 r2 r3", matching=True, - substrs=['r1 = ARectangle', - 'r2 = ARectangle', - 'r3 = ARectangle']) - - # Disable the category and check that the old stuff is there - self.runCmd("type category disable NewCategory") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = {', - 'r2 = {', - 'r3 = {']) - - # Re-enable the category and check that it works - self.runCmd("type category enable NewCategory") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = ARectangle', - 'r2 = ARectangle', - 'r3 = ARectangle']) - - # Delete the category and the old stuff should be there - self.runCmd("type category delete NewCategory") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = {', - 'r2 = {', - 'r3 = {']) - - # Add summaries to two different categories and check that we can - # switch - self.runCmd( - "type summary add --summary-string \"Width = ${var.w}, Height = ${var.h}\" Rectangle -w Category1") - self.runCmd("type summary add --python-script \"return 'Area = ' + str( int(valobj.GetChildMemberWithName('w').GetValue()) * int(valobj.GetChildMemberWithName('h').GetValue()) );\" Rectangle -w Category2") - - # check that enable A B is the same as enable B enable A - self.runCmd("type category enable Category1 Category2") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Width = ', - 'r2 = Width = ', - 'r3 = Width = ']) - - self.runCmd("type category disable Category1") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Area = ', - 'r2 = Area = ', - 'r3 = Area = ']) - - # switch again - - self.runCmd("type category enable Category1") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Width = ', - 'r2 = Width = ', - 'r3 = Width = ']) - - # Re-enable the category and show that the preference is persisted - self.runCmd("type category disable Category2") - self.runCmd("type category enable Category2") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Area = ', - 'r2 = Area = ', - 'r3 = Area = ']) - - # Now delete the favorite summary - self.runCmd("type summary delete Rectangle -w Category2") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Width = ', - 'r2 = Width = ', - 'r3 = Width = ']) - - # Delete the summary from the default category (that does not have it) - self.runCmd("type summary delete Rectangle", check=False) - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Width = ', - 'r2 = Width = ', - 'r3 = Width = ']) - - # Now add another summary to another category and switch back and forth - self.runCmd("type category delete Category1 Category2") - - self.runCmd( - "type summary add Rectangle -w Category1 --summary-string \"Category1\"") - self.runCmd( - "type summary add Rectangle -w Category2 --summary-string \"Category2\"") - - self.runCmd("type category enable Category2") - self.runCmd("type category enable Category1") - - self.runCmd("type summary list -w Category1") - self.expect("type summary list -w NoSuchCategoryHere", - substrs=['no matching results found']) - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Category1', - 'r2 = Category1', - 'r3 = Category1']) - - self.runCmd("type category disable Category1") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Category2', - 'r2 = Category2', - 'r3 = Category2']) - - # Check that re-enabling an enabled category works - self.runCmd("type category enable Category1") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Category1', - 'r2 = Category1', - 'r3 = Category1']) - - self.runCmd("type category delete Category1") - self.runCmd("type category delete Category2") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = {', - 'r2 = {', - 'r3 = {']) - - # Check that multiple summaries can go into one category - self.runCmd( - "type summary add -w Category1 --summary-string \"Width = ${var.w}, Height = ${var.h}\" Rectangle") - self.runCmd( - "type summary add -w Category1 --summary-string \"Radius = ${var.r}\" Circle") - - self.runCmd("type category enable Category1") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Width = ', - 'r2 = Width = ', - 'r3 = Width = ']) - - self.expect("frame variable c1 c2 c3", - substrs=['c1 = Radius = ', - 'c2 = Radius = ', - 'c3 = Radius = ']) - - self.runCmd("type summary delete Circle -w Category1") - - self.expect("frame variable c1 c2 c3", - substrs=['c1 = {', - 'c2 = {', - 'c3 = {']) - - # Add a regex based summary to a category - self.runCmd( - "type summary add -w Category1 --summary-string \"Radius = ${var.r}\" -x Circle") - - self.expect("frame variable r1 r2 r3", - substrs=['r1 = Width = ', - 'r2 = Width = ', - 'r3 = Width = ']) - - self.expect("frame variable c1 c2 c3", - substrs=['c1 = Radius = ', - 'c2 = Radius = ', - 'c3 = Radius = ']) - - # Delete it - self.runCmd("type summary delete Circle -w Category1") - - self.expect("frame variable c1 c2 c3", - substrs=['c1 = {', - 'c2 = {', - 'c3 = {']) - - # Change a summary inside a category and check that the change is - # reflected - self.runCmd( - "type summary add Circle -w Category1 --summary-string \"summary1\"") - - self.expect("frame variable c1 c2 c3", - substrs=['c1 = summary1', - 'c2 = summary1', - 'c3 = summary1']) - - self.runCmd( - "type summary add Circle -w Category1 --summary-string \"summary2\"") - - self.expect("frame variable c1 c2 c3", - substrs=['c1 = summary2', - 'c2 = summary2', - 'c3 = summary2']) - - # Check that our order of priority works. Start by clearing categories - self.runCmd("type category delete Category1") - - self.runCmd( - "type summary add Shape -w BaseCategory --summary-string \"AShape\"") - self.runCmd("type category enable BaseCategory") - - self.expect("print (Shape*)&c1", - substrs=['AShape']) - self.expect("print (Shape*)&r1", - substrs=['AShape']) - self.expect("print (Shape*)c_ptr", - substrs=['AShape']) - self.expect("print (Shape*)r_ptr", - substrs=['AShape']) - - self.runCmd( - "type summary add Circle -w CircleCategory --summary-string \"ACircle\"") - self.runCmd( - "type summary add Rectangle -w RectangleCategory --summary-string \"ARectangle\"") - self.runCmd("type category enable CircleCategory") - - self.expect("frame variable c1", - substrs=['ACircle']) - self.expect("frame variable c_ptr", - substrs=['ACircle']) - - self.runCmd( - "type summary add \"Rectangle *\" -w RectangleStarCategory --summary-string \"ARectangleStar\"") - self.runCmd("type category enable RectangleStarCategory") - - self.expect("frame variable c1 r1 c_ptr r_ptr", - substrs=['ACircle', - 'ARectangleStar']) - - self.runCmd("type category enable RectangleCategory") - - self.expect("frame variable c1 r1 c_ptr r_ptr", - substrs=['ACircle', - 'ACircle', - 'ARectangle']) - - # Check that abruptly deleting an enabled category does not crash us - self.runCmd("type category delete RectangleCategory") - - self.expect("frame variable c1 r1 c_ptr r_ptr", - substrs=['ACircle', - '(Rectangle) r1 = ', 'w = 5', 'h = 6', - 'ACircle', - 'ARectangleStar']) - - # check that list commands work - self.expect("type category list", - substrs=['RectangleStarCategory (enabled)']) - - self.expect("type summary list", - substrs=['ARectangleStar']) - - # Disable a category and check that it fallsback - self.runCmd("type category disable CircleCategory") - - # check that list commands work - self.expect("type category list", - substrs=['CircleCategory (disabled']) - - self.expect("frame variable c1 r_ptr", - substrs=['AShape', - 'ARectangleStar']) - - # check that filters work into categories - self.runCmd( - "type filter add Rectangle --child w --category RectangleCategory") - self.runCmd("type category enable RectangleCategory") - self.runCmd( - "type summary add Rectangle --category RectangleCategory --summary-string \" \" -e") - self.expect('frame variable r2', - substrs=['w = 9']) - self.runCmd("type summary add Rectangle --summary-string \" \" -e") - self.expect('frame variable r2', matching=False, - substrs=['h = 16']) - - # Now delete all categories - self.runCmd( - "type category delete CircleCategory RectangleStarCategory BaseCategory RectangleCategory") - - # check that a deleted category with filter does not blow us up - self.expect('frame variable r2', - substrs=['w = 9', - 'h = 16']) - - # and also validate that one can print formatters for a language - self.expect( - 'type summary list -l c++', - substrs=[ - 'vector', - 'map', - 'list', - 'string']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/main.cpp deleted file mode 100644 index b51dd45a7f60..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -struct Shape -{ - bool dummy; - Shape() : dummy(true) {} -}; - -struct Rectangle : public Shape { - int w; - int h; - Rectangle(int W = 3, int H = 5) : w(W), h(H) {} -}; - -struct Circle : public Shape { - int r; - Circle(int R = 6) : r(R) {} -}; - -int main (int argc, const char * argv[]) -{ - Rectangle r1(5,6); - Rectangle r2(9,16); - Rectangle r3(4,4); - - Circle c1(5); - Circle c2(6); - Circle c3(7); - - Circle *c_ptr = new Circle(8); - Rectangle *r_ptr = new Rectangle(9,7); - - return 0; // Set break point at this line. -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py deleted file mode 100644 index 4b9de961724b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py +++ /dev/null @@ -1,297 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CppDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @skipIf(debug_info="gmodules", - bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048") - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - self.expect("frame variable", - substrs=['(Speed) SPILookHex = 5.55' # Speed by default is 5.55. - ]) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("type format add -C yes -f x Speed BitField") - self.runCmd("type format add -C no -f c RealNumber") - self.runCmd("type format add -C no -f x Type2") - self.runCmd("type format add -C yes -f c Type1") - - # The type format list should show our custom formats. - self.expect("type format list", - substrs=['RealNumber', - 'Speed', - 'BitField', - 'Type1', - 'Type2']) - - self.expect("frame variable", - patterns=['\(Speed\) SPILookHex = 0x[0-9a-f]+' # Speed should look hex-ish now. - ]) - - # gcc4.2 on Mac OS X skips typedef chains in the DWARF output - if self.getCompiler() in ['clang', 'llvm-gcc']: - self.expect("frame variable", - patterns=['\(SignalMask\) SMILookHex = 0x[0-9a-f]+' # SignalMask should look hex-ish now. - ]) - self.expect("frame variable", matching=False, - patterns=['\(Type4\) T4ILookChar = 0x[0-9a-f]+' # Type4 should NOT look hex-ish now. - ]) - - # Now let's delete the 'Speed' custom format. - self.runCmd("type format delete Speed") - - # The type format list should not show 'Speed' at this point. - self.expect("type format list", matching=False, - substrs=['Speed']) - - # Delete type format for 'Speed', we should expect an error message. - self.expect("type format delete Speed", error=True, - substrs=['no custom formatter for Speed']) - - self.runCmd( - "type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\" -v") - - self.expect("frame variable strarr", - substrs=['arr = "Hello world!"']) - - self.runCmd("type summary clear") - - self.runCmd( - "type summary add --summary-string \"ptr = ${var%s}\" \"char *\" -v") - - self.expect("frame variable strptr", - substrs=['ptr = "Hello world!"']) - - self.runCmd( - "type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\" -v") - - self.expect("frame variable strarr", - substrs=['arr = "Hello world!']) - - # check that rdar://problem/10011145 (Standard summary format for - # char[] doesn't work as the result of "expr".) is solved - self.expect("p strarr", - substrs=['arr = "Hello world!']) - - self.expect("frame variable strptr", - substrs=['ptr = "Hello world!"']) - - self.expect("p strptr", - substrs=['ptr = "Hello world!"']) - - self.expect( - "p (char*)\"1234567890123456789012345678901234567890123456789012345678901234ABC\"", - substrs=[ - '(char *) $', - ' = ptr = ', - ' "1234567890123456789012345678901234567890123456789012345678901234ABC"']) - - self.runCmd("type summary add -c Point") - - self.expect("frame variable iAmSomewhere", - substrs=['x = 4', - 'y = 6']) - - self.expect("type summary list", - substrs=['Point', - 'one-line']) - - self.runCmd("type summary add --summary-string \"y=${var.y%x}\" Point") - - self.expect("frame variable iAmSomewhere", - substrs=['y=0x']) - - self.runCmd( - "type summary add --summary-string \"y=${var.y},x=${var.x}\" Point") - - self.expect("frame variable iAmSomewhere", - substrs=['y=6', - 'x=4']) - - self.runCmd("type summary add --summary-string \"hello\" Point -e") - - self.expect("type summary list", - substrs=['Point', - 'show children']) - - self.expect("frame variable iAmSomewhere", - substrs=['hello', - 'x = 4', - '}']) - - self.runCmd( - "type summary add --summary-string \"Sign: ${var[31]%B} Exponent: ${var[23-30]%x} Mantissa: ${var[0-22]%u}\" ShowMyGuts") - - self.expect("frame variable cool_pointer->floating", - substrs=['Sign: true', - 'Exponent: 0x', - '80']) - - self.runCmd("type summary add --summary-string \"a test\" i_am_cool") - - self.expect("frame variable cool_pointer", - substrs=['a test']) - - self.runCmd( - "type summary add --summary-string \"a test\" i_am_cool --skip-pointers") - - self.expect("frame variable cool_pointer", - substrs=['a test'], - matching=False) - - self.runCmd( - "type summary add --summary-string \"${var[1-3]}\" \"int [5]\"") - - self.expect("frame variable int_array", - substrs=['2', - '3', - '4']) - - self.runCmd("type summary clear") - - self.runCmd( - "type summary add --summary-string \"${var[0-2].integer}\" \"i_am_cool *\"") - self.runCmd( - "type summary add --summary-string \"${var[2-4].integer}\" \"i_am_cool [5]\"") - - self.expect("frame variable cool_array", - substrs=['1,1,6']) - - self.expect("frame variable cool_pointer", - substrs=['3,0,0']) - - # test special symbols for formatting variables into summaries - self.runCmd( - "type summary add --summary-string \"cool object @ ${var%L}\" i_am_cool") - self.runCmd("type summary delete \"i_am_cool [5]\"") - - # this test might fail if the compiler tries to store - # these values into registers.. hopefully this is not - # going to be the case - self.expect("frame variable cool_array", - substrs=['[0] = cool object @ 0x', - '[1] = cool object @ 0x', - '[2] = cool object @ 0x', - '[3] = cool object @ 0x', - '[4] = cool object @ 0x']) - - # test getting similar output by exploiting ${var} = 'type @ location' - # for aggregates - self.runCmd("type summary add --summary-string \"${var}\" i_am_cool") - - # this test might fail if the compiler tries to store - # these values into registers.. hopefully this is not - # going to be the case - self.expect("frame variable cool_array", - substrs=['[0] = i_am_cool @ 0x', - '[1] = i_am_cool @ 0x', - '[2] = i_am_cool @ 0x', - '[3] = i_am_cool @ 0x', - '[4] = i_am_cool @ 0x']) - - # test getting same output by exploiting %T and %L together for - # aggregates - self.runCmd( - "type summary add --summary-string \"${var%T} @ ${var%L}\" i_am_cool") - - # this test might fail if the compiler tries to store - # these values into registers.. hopefully this is not - # going to be the case - self.expect("frame variable cool_array", - substrs=['[0] = i_am_cool @ 0x', - '[1] = i_am_cool @ 0x', - '[2] = i_am_cool @ 0x', - '[3] = i_am_cool @ 0x', - '[4] = i_am_cool @ 0x']) - - self.runCmd("type summary add --summary-string \"goofy\" i_am_cool") - self.runCmd( - "type summary add --summary-string \"${var.second_cool%S}\" i_am_cooler") - - self.expect("frame variable the_coolest_guy", - substrs=['(i_am_cooler) the_coolest_guy = goofy']) - - # check that unwanted type specifiers are removed - self.runCmd("type summary delete i_am_cool") - self.runCmd( - "type summary add --summary-string \"goofy\" \"class i_am_cool\"") - self.expect("frame variable the_coolest_guy", - substrs=['(i_am_cooler) the_coolest_guy = goofy']) - - self.runCmd("type summary delete i_am_cool") - self.runCmd( - "type summary add --summary-string \"goofy\" \"enum i_am_cool\"") - self.expect("frame variable the_coolest_guy", - substrs=['(i_am_cooler) the_coolest_guy = goofy']) - - self.runCmd("type summary delete i_am_cool") - self.runCmd( - "type summary add --summary-string \"goofy\" \"struct i_am_cool\"") - self.expect("frame variable the_coolest_guy", - substrs=['(i_am_cooler) the_coolest_guy = goofy']) - - # many spaces, but we still do the right thing - self.runCmd("type summary delete i_am_cool") - self.runCmd( - "type summary add --summary-string \"goofy\" \"union i_am_cool\"") - self.expect("frame variable the_coolest_guy", - substrs=['(i_am_cooler) the_coolest_guy = goofy']) - - # but that not *every* specifier is removed - self.runCmd("type summary delete i_am_cool") - self.runCmd( - "type summary add --summary-string \"goofy\" \"wrong i_am_cool\"") - self.expect("frame variable the_coolest_guy", matching=False, - substrs=['(i_am_cooler) the_coolest_guy = goofy']) - - # check that formats are not sticking since that is the behavior we - # want - self.expect("frame variable iAmInt --format hex", - substrs=['(int) iAmInt = 0x00000001']) - self.expect( - "frame variable iAmInt", - matching=False, - substrs=['(int) iAmInt = 0x00000001']) - self.expect("frame variable iAmInt", substrs=['(int) iAmInt = 1']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/main.cpp deleted file mode 100644 index 5bcfbfd4d46e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/main.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -typedef float RealNumber; // should show as char -typedef RealNumber Temperature; // should show as float -typedef RealNumber Speed; // should show as hex - -typedef int Counter; // should show as int -typedef int BitField; // should show as hex - -typedef BitField SignalMask; // should show as hex -typedef BitField Modifiers; // should show as hex - -typedef Counter Accumulator; // should show as int - -typedef int Type1; // should show as char -typedef Type1 Type2; // should show as hex -typedef Type2 Type3; // should show as char -typedef Type3 Type4; // should show as char - -typedef int ChildType; // should show as int -typedef int AnotherChildType; // should show as int - -struct Point { - int x; - int y; - Point(int X = 3, int Y = 2) : x(X), y(Y) {} -}; - -typedef float ShowMyGuts; - -struct i_am_cool -{ - int integer; - ShowMyGuts floating; - char character; - i_am_cool(int I, ShowMyGuts F, char C) : - integer(I), floating(F), character(C) {} - i_am_cool() : integer(1), floating(2), character('3') {} - -}; - -struct i_am_cooler -{ - i_am_cool first_cool; - i_am_cool second_cool; - ShowMyGuts floating; - - i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) : - first_cool(I1,F1,C1), - second_cool(I2,F2,C2), - floating((F1 + F2)/2) {} -}; - -struct IUseCharStar -{ - const char* pointer; - IUseCharStar() : pointer("Hello world") {} -}; - -int main (int argc, const char * argv[]) -{ - - int iAmInt = 1; - const float& IAmFloat = float(2.45); - - RealNumber RNILookChar = 3.14; - Temperature TMILookFloat = 4.97; - Speed SPILookHex = 5.55; - - Counter CTILookInt = 6; - BitField BFILookHex = 7; - SignalMask SMILookHex = 8; - Modifiers MFILookHex = 9; - - Accumulator* ACILookInt = new Accumulator(10); - - const Type1& T1ILookChar = 11; - Type2 T2ILookHex = 12; - Type3 T3ILookChar = 13; - Type4 T4ILookChar = 14; - - AnotherChildType AHILookInt = 15; - - Speed* SPPtrILookHex = new Speed(16); - - Point iAmSomewhere(4,6); - - i_am_cool *cool_pointer = (i_am_cool*)malloc(sizeof(i_am_cool)*3); - cool_pointer[0] = i_am_cool(3,-3.141592,'E'); - cool_pointer[1] = i_am_cool(0,-3.141592,'E'); - cool_pointer[2] = i_am_cool(0,-3.141592,'E'); - - i_am_cool cool_array[5]; - - cool_array[3].floating = 5.25; - cool_array[4].integer = 6; - cool_array[2].character = 'Q'; - - int int_array[] = {1,2,3,4,5}; - - IUseCharStar iEncapsulateCharStar; - - char strarr[32] = "Hello world!"; - char* strptr = "Hello world!"; - - i_am_cooler the_coolest_guy(1,2,3.14,6.28,'E','G'); - - return 0; // Set break point at this line. -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py deleted file mode 100644 index c451d0f82792..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py +++ /dev/null @@ -1,91 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DataFormatterDisablingTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24462, Data formatters have problems on Windows") - def test_with_run_command(self): - """Check that we can properly disable all data formatter categories.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type category enable *', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - #self.runCmd('type category enable system VectorTypes libcxx gnu-libstdc++ CoreGraphics CoreServices AppKit CoreFoundation objc default', check=False) - - self.expect('type category list', substrs=['system', 'enabled', ]) - - self.expect("frame variable numbers", - substrs=['[0] = 1', '[3] = 1234']) - - self.expect('frame variable string1', substrs=['hello world']) - - # now disable them all and check that nothing is formatted - self.runCmd('type category disable *') - - self.expect("frame variable numbers", matching=False, - substrs=['[0] = 1', '[3] = 1234']) - - self.expect( - 'frame variable string1', - matching=False, - substrs=['hello world']) - - self.expect('type summary list', substrs=[ - 'Category: system (disabled)']) - - self.expect('type category list', substrs=['system', 'disabled', ]) - - # now enable and check that we are back to normal - self.runCmd("type category enable *") - - self.expect('type category list', substrs=['system', 'enabled']) - - self.expect("frame variable numbers", - substrs=['[0] = 1', '[3] = 1234']) - - self.expect('frame variable string1', substrs=['hello world']) - - self.expect('type category list', substrs=['system', 'enabled']) - - # last check - our cleanup will re-enable everything - self.runCmd('type category disable *') - self.expect('type category list', substrs=['system', 'disabled']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/main.cpp deleted file mode 100644 index 9374642fb0d2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/main.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include <vector> - -int main() -{ - - const char* string1 = "hello world"; - - std::vector<int> numbers; - numbers.push_back(1); - numbers.push_back(12); - numbers.push_back(123); - numbers.push_back(1234); - numbers.push_back(12345); - numbers.push_back(123456); - numbers.push_back(1234567); // Set break point at this line. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py deleted file mode 100644 index 2d09be5441ba..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class EnumFormatTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - self.expect("frame variable", - substrs=['(Foo) f = Case45', - '(int) x = 1', - '(int) y = 45', - '(int) z = 43' - ]) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("type format add --type Foo int") - - # The type format list should show our custom formats. - self.expect("type format list -w default", - substrs=['int: as type Foo']) - - self.expect("frame variable", - substrs=['(Foo) f = Case45', - '(int) x = Case1', - '(int) y = Case45', - '(int) z = 43' - ]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/main.cpp deleted file mode 100644 index 6a8074ff9fbe..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -enum Foo { - Case1 = 1, - Case2 = 2, - Case45 = 45 -}; - -int main() { - Foo f = Case45; - int x = 1; - int y = 45; - int z = 43; - return 1; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py deleted file mode 100644 index 81ddf597def6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil - - -class GlobalsDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @skipIf(debug_info="gmodules", - bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048") - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("type summary add --summary-string \"JustATest\" Point") - - # Simply check we can get at global variables - self.expect("target variable g_point", - substrs=['JustATest']) - - self.expect("target variable g_point_pointer", - substrs=['(Point *) g_point_pointer =']) - - # Print some information about the variables - # (we ignore the actual values) - self.runCmd( - "type summary add --summary-string \"(x=${var.x},y=${var.y})\" Point") - - self.expect("target variable g_point", - substrs=['x=', - 'y=']) - - self.expect("target variable g_point_pointer", - substrs=['(Point *) g_point_pointer =']) - - # Test Python code on resulting SBValue - self.runCmd( - "type summary add --python-script \"return 'x=' + str(valobj.GetChildMemberWithName('x').GetValue());\" Point") - - self.expect("target variable g_point", - substrs=['x=']) - - self.expect("target variable g_point_pointer", - substrs=['(Point *) g_point_pointer =']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/main.cpp deleted file mode 100644 index 521f7a6931e9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -struct Point { - int x; - int y; - Point(int X = 3, int Y = 2) : x(X), y(Y) {} -}; - -Point g_point(3,4); -Point* g_point_pointer = new Point(7,5); - -int main (int argc, const char * argv[]) -{ - return 0; // Set break point at this line. -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py deleted file mode 100644 index 8b354d764e58..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py +++ /dev/null @@ -1,133 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class NamedSummariesDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd( - "type summary add --summary-string \"AllUseIt: x=${var.x} {y=${var.y}} {z=${var.z}}\" --name AllUseIt") - self.runCmd( - "type summary add --summary-string \"First: x=${var.x} y=${var.y} dummy=${var.dummy}\" First") - self.runCmd( - "type summary add --summary-string \"Second: x=${var.x} y=${var.y%hex}\" Second") - self.runCmd( - "type summary add --summary-string \"Third: x=${var.x} z=${var.z}\" Third") - - self.expect('type summary list', substrs=['AllUseIt']) - - self.expect("frame variable first", - substrs=['First: x=12']) - - self.expect("frame variable first --summary AllUseIt", - substrs=['AllUseIt: x=12']) - - # We *DO NOT* remember the summary choice anymore - self.expect("frame variable first", matching=False, - substrs=['AllUseIt: x=12']) - self.expect("frame variable first", - substrs=['First: x=12']) - - self.runCmd("thread step-over") # 2 - - self.expect("frame variable first", - substrs=['First: x=12']) - - self.expect("frame variable first --summary AllUseIt", - substrs=['AllUseIt: x=12', - 'y=34']) - - self.expect("frame variable second --summary AllUseIt", - substrs=['AllUseIt: x=65', - 'y=43.25']) - - self.expect("frame variable third --summary AllUseIt", - substrs=['AllUseIt: x=96', - 'z=', - 'E']) - - self.runCmd("thread step-over") # 3 - - self.expect("frame variable second", - substrs=['Second: x=65', - 'y=0x']) - - # <rdar://problem/11576143> decided that invalid summaries will raise an error - # instead of just defaulting to the base summary - self.expect( - "frame variable second --summary NoSuchSummary", - error=True, - substrs=['must specify a valid named summary']) - - self.runCmd("thread step-over") - - self.runCmd( - "type summary add --summary-string \"FirstAndFriends: x=${var.x} {y=${var.y}} {z=${var.z}}\" First --name FirstAndFriends") - - self.expect("frame variable first", - substrs=['FirstAndFriends: x=12', - 'y=34']) - - self.runCmd("type summary delete First") - - self.expect("frame variable first --summary FirstAndFriends", - substrs=['FirstAndFriends: x=12', - 'y=34']) - - self.expect("frame variable first", matching=True, - substrs=['x = 12', - 'y = 34']) - - self.runCmd("type summary delete FirstAndFriends") - self.expect("type summary delete NoSuchSummary", error=True) - self.runCmd("type summary delete AllUseIt") - - self.expect("frame variable first", matching=False, - substrs=['FirstAndFriends']) - - self.runCmd("thread step-over") # 4 - - self.expect("frame variable first", matching=False, - substrs=['FirstAndFriends: x=12', - 'y=34']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp deleted file mode 100644 index fdec5fecd3a2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -struct First -{ - int x; - int y; - float dummy; - First(int X, int Y) : - x(X), - y(Y), - dummy(3.14) - {} -}; - -struct Second -{ - int x; - float y; - Second(int X, float Y) : - x(X), - y(Y) - {} -}; - -struct Third -{ - int x; - char z; - Third(int X, char Z) : - x(X), - z(Z) - {} -}; - -int main (int argc, const char * argv[]) -{ - First first(12,34); - Second second(65,43.25); - Third *third = new Third(96,'E'); - - first.dummy = 1; // Set break point at this line. - first.dummy = 2; - first.dummy = 3; - first.dummy = 4; - first.dummy = 5; - -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/.categories b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/.categories deleted file mode 100644 index 6326dbcec91b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/.categories +++ /dev/null @@ -1 +0,0 @@ -dataformatters,objc diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/Makefile deleted file mode 100644 index 9f7fb1ca6231..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py deleted file mode 100644 index 4643e4738229..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py +++ /dev/null @@ -1,530 +0,0 @@ -# encoding: utf-8 -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ObjCDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - def test_plain_objc_with_run_command(self): - """Test basic ObjC formatting behavior.""" - self.build() - self.plain_data_formatter_commands() - - def appkit_tester_impl(self, commands): - self.build() - self.appkit_common_data_formatters_command() - commands() - - @skipUnlessDarwin - def test_nsnumber_with_run_command(self): - """Test formatters for NSNumber.""" - self.appkit_tester_impl(self.nsnumber_data_formatter_commands) - - @skipUnlessDarwin - def test_nscontainers_with_run_command(self): - """Test formatters for NS container classes.""" - self.appkit_tester_impl(self.nscontainers_data_formatter_commands) - - @skipUnlessDarwin - def test_nsdata_with_run_command(self): - """Test formatters for NSData.""" - self.appkit_tester_impl(self.nsdata_data_formatter_commands) - - @skipUnlessDarwin - def test_nsurl_with_run_command(self): - """Test formatters for NSURL.""" - self.appkit_tester_impl(self.nsurl_data_formatter_commands) - - @skipUnlessDarwin - def test_nserror_with_run_command(self): - """Test formatters for NSError.""" - self.appkit_tester_impl(self.nserror_data_formatter_commands) - - @skipUnlessDarwin - def test_nsbundle_with_run_command(self): - """Test formatters for NSBundle.""" - self.appkit_tester_impl(self.nsbundle_data_formatter_commands) - - @skipUnlessDarwin - def test_nsexception_with_run_command(self): - """Test formatters for NSException.""" - self.appkit_tester_impl(self.nsexception_data_formatter_commands) - - @skipUnlessDarwin - def test_nsdate_with_run_command(self): - """Test formatters for NSDate.""" - self.appkit_tester_impl(self.nsdate_data_formatter_commands) - - @skipUnlessDarwin - def test_coreframeworks_and_run_command(self): - """Test formatters for Core OSX frameworks.""" - self.build() - self.cf_data_formatter_commands() - - @skipUnlessDarwin - def test_kvo_with_run_command(self): - """Test the behavior of formatters when KVO is in use.""" - self.build() - self.kvo_data_formatter_commands() - - @skipUnlessDarwin - def test_expr_with_run_command(self): - """Test common cases of expression parser <--> formatters interaction.""" - self.build() - self.expr_objc_data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// Set break point at this line.') - - def plain_data_formatter_commands(self): - """Test basic ObjC formatting behavior.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("type summary add --summary-string \"${var%@}\" MyClass") - - self.expect("frame variable object2", - substrs=['MyOtherClass']) - - self.expect("frame variable *object2", - substrs=['MyOtherClass']) - - # Now let's delete the 'MyClass' custom summary. - self.runCmd("type summary delete MyClass") - - # The type format list should not show 'MyClass' at this point. - self.expect("type summary list", matching=False, - substrs=['MyClass']) - - self.runCmd("type summary add --summary-string \"a test\" MyClass") - - self.expect("frame variable *object2", - substrs=['*object2 =', - 'MyClass = a test', - 'backup = ']) - - self.expect("frame variable object2", matching=False, - substrs=['a test']) - - self.expect("frame variable object", - substrs=['a test']) - - self.expect("frame variable *object", - substrs=['a test']) - - self.expect('frame variable myclass', - substrs=['(Class) myclass = NSValue']) - self.expect('frame variable myclass2', - substrs=['(Class) myclass2 = ', 'NS', 'String']) - self.expect('frame variable myclass3', - substrs=['(Class) myclass3 = Molecule']) - self.expect('frame variable myclass4', - substrs=['(Class) myclass4 = NSMutableArray']) - self.expect('frame variable myclass5', - substrs=['(Class) myclass5 = nil']) - - def appkit_common_data_formatters_command(self): - """Test formatters for AppKit classes.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - def nsnumber_data_formatter_commands(self): - # Now enable AppKit and check we are displaying Cocoa classes correctly - self.expect('frame variable num1 num2 num3 num5 num6 num7 num8_Y num8_N num9', - substrs=['(NSNumber *) num1 = ', ' (int)5', - '(NSNumber *) num2 = ', ' (float)3.1', - '(NSNumber *) num3 = ', ' (double)3.14', - '(NSNumber *) num5 = ', ' (char)65', - '(NSNumber *) num6 = ', ' (long)255', - '(NSNumber *) num7 = ', '2000000', - '(NSNumber *) num8_Y = ', 'YES', - '(NSNumber *) num8_N = ', 'NO', - '(NSNumber *) num9 = ', ' (short)-31616']) - - - self.runCmd('frame variable num4', check=True) - output = self.res.GetOutput() - i128_handled_correctly = False - - if output.find('long') >= 0: - i128_handled_correctly = (output.find('(long)-2') >= 0) - if output.find('int128_t') >= 0: - i128_handled_correctly = (output.find('(int128_t)18446744073709551614') >= 0) # deliberately broken, should be ..14 - - self.assertTrue(i128_handled_correctly, "Expected valid output for int128_t; got " + output) - - self.expect('frame variable num_at1 num_at2 num_at3 num_at4', - substrs=['(NSNumber *) num_at1 = ', ' (int)12', - '(NSNumber *) num_at2 = ', ' (int)-12', - '(NSNumber *) num_at3 = ', ' (double)12.5', - '(NSNumber *) num_at4 = ', ' (double)-12.5']) - - def nsdecimalnumber_data_formatter_commands(self): - self.expect('frame variable decimal_number decimal_neg_number decimal_one decimal_zero decimal_nan', - substrs=['(NSDecimalNumber *) decimal_number = ', '123456 x 10^-10', - '(NSDecimalNumber *) decimal_neg_number = ', '-123456 x 10^10', - '(NSDecimalNumber *) decimal_one = ', '1 x 10^0', - '(NSDecimalNumber *) decimal_zero = ', '0', - '(NSDecimalNumber *) decimal_nan = ', 'NaN']) - - def nscontainers_data_formatter_commands(self): - self.expect( - 'frame variable newArray nsDictionary newDictionary nscfDictionary cfDictionaryRef newMutableDictionary cfarray_ref mutable_array_ref', - substrs=[ - '(NSArray *) newArray = ', - '@"50 elements"', - '(NSDictionary *) newDictionary = ', - ' 12 key/value pairs', - '(NSDictionary *) newMutableDictionary = ', - ' 21 key/value pairs', - '(NSDictionary *) nsDictionary = ', - ' 2 key/value pairs', - '(CFDictionaryRef) cfDictionaryRef = ', - ' 3 key/value pairs', - '(CFArrayRef) cfarray_ref = ', - '@"3 elements"', - '(CFMutableArrayRef) mutable_array_ref = ', - '@"11 elements"']) - - self.expect('frame variable iset1 iset2 imset', - substrs=['4 indexes', '512 indexes', '10 indexes']) - - self.expect( - 'frame variable binheap_ref', - substrs=[ - '(CFBinaryHeapRef) binheap_ref = ', - '@"21 items"']) - - self.expect( - 'expression -d run -- (NSArray*)[NSArray new]', - substrs=['@"0 elements"']) - - def nsdata_data_formatter_commands(self): - self.expect( - 'frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref concreteData concreteMutableData', - substrs=[ - '(NSData *) immutableData = ', - ' 4 bytes', - '(NSData *) mutableData = ', - ' 14 bytes', - '(CFDataRef) data_ref = ', - '@"5 bytes"', - '(CFMutableDataRef) mutable_data_ref = ', - '@"5 bytes"', - '(CFMutableStringRef) mutable_string_ref = ', - ' @"Wish ya knew"', - '(NSData *) concreteData = ', - ' 100000 bytes', - '(NSMutableData *) concreteMutableData = ', - ' 100000 bytes']) - - - def nsurl_data_formatter_commands(self): - self.expect( - 'frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref', - substrs=[ - '(CFURLRef) cfurl_ref = ', - '@"http://www.foo.bar', - 'cfchildurl_ref = ', - '@"page.html -- http://www.foo.bar', - '(CFURLRef) cfgchildurl_ref = ', - '@"?whatever -- http://www.foo.bar/page.html"']) - - self.expect( - 'frame variable nsurl nsurl2 nsurl3', - substrs=[ - '(NSURL *) nsurl = ', - '@"http://www.foo.bar', - '(NSURL *) nsurl2 =', - '@"page.html -- http://www.foo.bar', - '(NSURL *) nsurl3 = ', - '@"?whatever -- http://www.foo.bar/page.html"']) - - def nserror_data_formatter_commands(self): - self.expect('frame variable nserror', - substrs=['domain: @"Foobar" - code: 12']) - - self.expect('frame variable nserrorptr', - substrs=['domain: @"Foobar" - code: 12']) - - self.expect('frame variable nserror->_userInfo', - substrs=['2 key/value pairs']) - - self.expect( - 'frame variable nserror->_userInfo --ptr-depth 1 -d run-target', - substrs=[ - '@"a"', - '@"b"', - "1", - "2"]) - - def nsbundle_data_formatter_commands(self): - self.expect( - 'frame variable bundle_string bundle_url main_bundle', - substrs=[ - '(NSBundle *) bundle_string = ', - ' @"/System/Library/Frameworks/Accelerate.framework"', - '(NSBundle *) bundle_url = ', - ' @"/System/Library/Frameworks/Foundation.framework"', - '(NSBundle *) main_bundle = ', - 'data-formatter-objc']) - - def nsexception_data_formatter_commands(self): - self.expect( - 'frame variable except0 except1 except2 except3', - substrs=[ - '(NSException *) except0 = ', - 'name: @"TheGuyWhoHasNoName" - reason: @"cuz it\'s funny"', - '(NSException *) except1 = ', - 'name: @"TheGuyWhoHasNoName~1" - reason: @"cuz it\'s funny"', - '(NSException *) except2 = ', - 'name: @"TheGuyWhoHasNoName`2" - reason: @"cuz it\'s funny"', - '(NSException *) except3 = ', - 'name: @"TheGuyWhoHasNoName/3" - reason: @"cuz it\'s funny"']) - - def nsdate_data_formatter_commands(self): - self.expect( - 'frame variable date1 date2', - patterns=[ - '(1985-04-10|1985-04-11)', - '(2011-01-01|2010-12-31)']) - - # this test might fail if we hit the breakpoint late on December 31st of some given year - # and midnight comes between hitting the breakpoint and running this line of code - # hopefully the output will be revealing enough in that case :-) - now_year = '%s-' % str(datetime.datetime.now().year) - - self.expect('frame variable date3', substrs=[now_year]) - self.expect('frame variable date4', substrs=['1970']) - self.expect('frame variable date5', substrs=[now_year]) - - self.expect('frame variable date1_abs date2_abs', - substrs=['1985-04', '2011-01']) - - self.expect('frame variable date3_abs', substrs=[now_year]) - self.expect('frame variable date4_abs', substrs=['1970']) - self.expect('frame variable date5_abs', substrs=[now_year]) - - self.expect('frame variable cupertino home europe', - substrs=['@"America/Los_Angeles"', - '@"Europe/Rome"', - '@"Europe/Paris"']) - - self.expect('frame variable cupertino_ns home_ns europe_ns', - substrs=['@"America/Los_Angeles"', - '@"Europe/Rome"', - '@"Europe/Paris"']) - - self.expect( - 'frame variable mut_bv', - substrs=[ - '(CFMutableBitVectorRef) mut_bv = ', - '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00']) - - def expr_objc_data_formatter_commands(self): - """Test common cases of expression parser <--> formatters interaction.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # check that the formatters are able to deal safely and correctly - # with ValueObjects that the expression parser returns - self.expect( - 'expression ((id)@"Hello for long enough to avoid short string types")', - matching=False, - substrs=['Hello for long enough to avoid short string types']) - - self.expect( - 'expression -d run -- ((id)@"Hello for long enough to avoid short string types")', - substrs=['Hello for long enough to avoid short string types']) - - self.expect('expr -d run -- label1', - substrs=['Process Name']) - - self.expect( - 'expr -d run -- @"Hello for long enough to avoid short string types"', - substrs=['Hello for long enough to avoid short string types']) - - self.expect( - 'expr -d run --object-description -- @"Hello for long enough to avoid short string types"', - substrs=['Hello for long enough to avoid short string types']) - self.expect('expr -d run --object-description -- @"Hello"', - matching=False, substrs=['@"Hello" Hello']) - - def cf_data_formatter_commands(self): - """Test formatters for Core OSX frameworks.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # check formatters for common Objective-C types - expect_strings = [ - '(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds', - '(CFRange) cf_range = location=4 length=4', - '(NSPoint) ns_point = (x = 4, y = 4)', - '(NSRange) ns_range = location=4, length=4', - '(NSRect) ns_rect = (origin = (x = 1, y = 1), size = (width = 5, height = 5))', - '(NSRectArray) ns_rect_arr = ((x = 1, y = 1), (width = 5, height = 5)), ...', - '(NSSize) ns_size = (width = 5, height = 7)', - '(CGSize) cg_size = (width = 1, height = 6)', - '(CGPoint) cg_point = (x = 2, y = 7)', - '(CGRect) cg_rect = (origin = (x = 1, y = 2), size = (width = 7, height = 7))', - '(Rect) rect = (t=4, l=8, b=4, r=7)', - '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)', - '(Point) point = (v=7, h=12)', - '(Point *) point_ptr = (v=7, h=12)', - '1985', - 'foo_selector_impl'] - - if self.getArchitecture() in ['i386', 'x86_64']: - expect_strings.append('(HIPoint) hi_point = (x=7, y=12)') - expect_strings.append( - '(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)') - expect_strings.append( - '(RGBColor) rgb_color = red=3 green=56 blue=35') - expect_strings.append( - '(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35') - - self.expect("frame variable", - substrs=expect_strings) - - def kvo_data_formatter_commands(self): - """Test the behavior of formatters when KVO is in use.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # as long as KVO is implemented by subclassing, this test should succeed - # we should be able to dynamically figure out that the KVO implementor class - # is a subclass of Molecule, and use the appropriate summary for it - self.runCmd("type summary add -s JustAMoleculeHere Molecule") - self.expect('frame variable molecule', substrs=['JustAMoleculeHere']) - self.runCmd("next") - self.expect("thread list", - substrs=['stopped', - 'step over']) - self.expect('frame variable molecule', substrs=['JustAMoleculeHere']) - - self.runCmd("next") - # check that NSMutableDictionary's formatter is not confused when - # dealing with a KVO'd dictionary - self.expect( - 'frame variable newMutableDictionary', - substrs=[ - '(NSDictionary *) newMutableDictionary = ', - ' 21 key/value pairs']) - - lldbutil.run_break_set_by_regexp(self, 'setAtoms') - - self.runCmd("continue") - self.expect("frame variable _cmd", substrs=['setAtoms:']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m deleted file mode 100644 index 37b34f2ac8b9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m +++ /dev/null @@ -1,632 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -#if defined(__APPLE__) -#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) -#define IOS -#endif -#endif - -#if defined(IOS) -#import <Foundation/NSGeometry.h> -#else -#import <Carbon/Carbon.h> -#endif - -@interface MyClass : NSObject -{ - int i; - char c; - float f; -} - -- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z; -- (int)doIncrementByInt: (int)x; - -@end - -@interface MyOtherClass : MyClass -{ - int i2; - MyClass *backup; -} -- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q; - -@end - -@implementation MyClass - -- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z -{ - self = [super init]; - if (self) { - self->i = x; - self->f = y; - self->c = z; - } - return self; -} - -- (int)doIncrementByInt: (int)x -{ - self->i += x; - return self->i; -} - -@end - -@implementation MyOtherClass - -- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q -{ - self = [super initWithInt:x andFloat:y andChar:z]; - if (self) { - self->i2 = q; - self->backup = [[MyClass alloc] initWithInt:x andFloat:y andChar:z]; - } - return self; -} - -@end - -@interface Atom : NSObject { - float mass; -} --(void)setMass:(float)newMass; --(float)mass; -@end - -@interface Molecule : NSObject { - NSArray *atoms; -} --(void)setAtoms:(NSArray *)newAtoms; --(NSArray *)atoms; -@end - -@implementation Atom - --(void)setMass:(float)newMass -{ - mass = newMass; -} --(float)mass -{ - return mass; -} - -@end - -@implementation Molecule - --(void)setAtoms:(NSArray *)newAtoms -{ - atoms = newAtoms; -} --(NSArray *)atoms -{ - return atoms; -} -@end - -@interface My_KVO_Observer : NSObject --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change - context:(void *)context; -- (id) init; -- (void) dealloc; -@end - -@implementation My_KVO_Observer --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change - context:(void *)context { - // we do not really care about KVO'ing - do nothing - return; -} -- (id) init -{ - self = [super init]; - return self; -} - -- (void) dealloc -{ - [super dealloc]; -} -@end - -int main (int argc, const char * argv[]) -{ - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - MyClass *object = [[MyClass alloc] initWithInt:1 andFloat:3.14 andChar: 'E']; - - [object doIncrementByInt:3]; - - MyOtherClass *object2 = [[MyOtherClass alloc] initWithInt:2 andFloat:6.28 andChar: 'G' andOtherInt:-1]; - - [object2 doIncrementByInt:3]; - - NSNumber* num1 = [NSNumber numberWithInt:5]; - NSNumber* num2 = [NSNumber numberWithFloat:3.14]; - NSNumber* num3 = [NSNumber numberWithDouble:3.14]; - NSNumber* num4 = [NSNumber numberWithUnsignedLongLong:0xFFFFFFFFFFFFFFFE]; - NSNumber* num5 = [NSNumber numberWithChar:'A']; - NSNumber* num6 = [NSNumber numberWithUnsignedLongLong:0xFF]; - NSNumber* num7 = [NSNumber numberWithLong:0x1E8480]; - NSNumber* num8_Y = [NSNumber numberWithBool:YES]; - NSNumber* num8_N = [NSNumber numberWithBool:NO]; - NSNumber* num9 = [NSNumber numberWithShort:0x1E8480]; - NSNumber* num_at1 = @12; - NSNumber* num_at2 = @-12; - NSNumber* num_at3 = @12.5; - NSNumber* num_at4 = @-12.5; - - NSDecimalNumber* decimal_number = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:-10 isNegative:NO]; - NSDecimalNumber* decimal_number_neg = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:10 isNegative:YES]; - NSDecimalNumber* decimal_one = [NSDecimalNumber one]; - NSDecimalNumber* decimal_zero = [NSDecimalNumber zero]; - NSDecimalNumber* decimal_nan = [NSDecimalNumber notANumber]; - - NSString *str0 = [num6 stringValue]; - - NSString *str1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; - - NSString *str2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; - - NSString *str3 = @"A string made with the at sign is here"; - - NSString *str4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; - - NSRect ns_rect_4str = {{1,1},{5,5}}; - - NSString* str5 = NSStringFromRect(ns_rect_4str); - - NSString* str6 = [@"/usr/doc/README.1ST" pathExtension]; - - const unichar myCharacters[] = {0x03C3,'x','x'}; - NSString *str7 = [NSString stringWithCharacters: myCharacters - length: sizeof myCharacters / sizeof *myCharacters]; - - NSString* str8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; - - const unichar myOtherCharacters[] = {'a',' ', 'v','e','r','y',' ', - 'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k', - ' ','t','o',' ','w','r','i','t','e', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', - 't','h','i','s',' ','w','a','y','!','!',0x03C3, 0}; - NSString *str9 = [NSString stringWithCharacters: myOtherCharacters - length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; - - const unichar myNextCharacters[] = {0x03C3, 0x0000}; - - NSString *str10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; - - NSString *str11 = NSStringFromClass([str10 class]); - - NSString *label1 = @"Process Name: "; - NSString *label2 = @"Process Id: "; - NSString *processName = [[NSProcessInfo processInfo] processName]; - NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]]; - NSString *str12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; - - NSString *strA1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; - - NSString *strA2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; - - NSString *strA3 = @"A string made with the at sign is here"; - - NSString *strA4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; - - NSString* strA5 = NSStringFromRect(ns_rect_4str); - - NSString* strA6 = [@"/usr/doc/README.1ST" pathExtension]; - - NSString *strA7 = [NSString stringWithCharacters: myCharacters - length: sizeof myCharacters / sizeof *myCharacters]; - - NSString* strA8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; - - NSString *strA9 = [NSString stringWithCharacters: myOtherCharacters - length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; - - NSString *strA10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; - - NSString *strA11 = NSStringFromClass([str10 class]); - - NSString *strA12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; - - NSString *strB1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; - - NSString *strB2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; - - NSString *strB3 = @"A string made with the at sign is here"; - - NSString *strB4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; - - NSString* strB5 = NSStringFromRect(ns_rect_4str); - - NSString* strB6 = [@"/usr/doc/README.1ST" pathExtension]; - - NSString *strB7 = [NSString stringWithCharacters: myCharacters - length: sizeof myCharacters / sizeof *myCharacters]; - - NSString* strB8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; - - NSString *strB9 = [NSString stringWithCharacters: myOtherCharacters - length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; - - NSString *strB10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; - - NSString *strB11 = NSStringFromClass([str10 class]); - - NSString *strB12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; - - NSString *strC11 = NSStringFromClass([str10 class]); - - NSString *strC12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; - - NSString *strC1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; - - NSString *strC2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; - - NSString *strC3 = @"A string made with the at sign is here"; - - NSString *strC4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; - - NSString* strC5 = NSStringFromRect(ns_rect_4str); - - NSString* strC6 = [@"/usr/doc/README.1ST" pathExtension]; - - NSString *strC7 = [NSString stringWithCharacters: myCharacters - length: sizeof myCharacters / sizeof *myCharacters]; - - NSString* strC8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; - - NSString *strC9 = [NSString stringWithCharacters: myOtherCharacters - length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; - - NSString *strC10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; - - NSString *strD11 = NSStringFromClass([str10 class]); - - NSString *strD12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; - - NSString *eAcute = [NSString stringWithFormat: @"%C", 0x00E9]; - NSString *randomHaziChar = [NSString stringWithFormat: @"%C", 0x9DC5]; - NSString *japanese = @"色は匂へど散りぬるを"; - NSString *italian = @"L'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione."; - NSString* french = @"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?"; - NSString* german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt"; - - void* data_set[3] = {str1,str2,str3}; - - NSString *hebrew = [NSString stringWithString:@"לילה טוב"]; - - NSArray* newArray = [[NSMutableArray alloc] init]; - [newArray addObject:str1]; - [newArray addObject:str2]; - [newArray addObject:str3]; - [newArray addObject:str4]; - [newArray addObject:str5]; - [newArray addObject:str6]; - [newArray addObject:str7]; - [newArray addObject:str8]; - [newArray addObject:str9]; - [newArray addObject:str10]; - [newArray addObject:str11]; - [newArray addObject:str12]; - [newArray addObject:strA1]; - [newArray addObject:strA2]; - [newArray addObject:strA3]; - [newArray addObject:strA4]; - [newArray addObject:strA5]; - [newArray addObject:strA6]; - [newArray addObject:strA7]; - [newArray addObject:strA8]; - [newArray addObject:strA9]; - [newArray addObject:strA10]; - [newArray addObject:strA11]; - [newArray addObject:strA12]; - [newArray addObject:strB1]; - [newArray addObject:strB2]; - [newArray addObject:strB3]; - [newArray addObject:strB4]; - [newArray addObject:strB5]; - [newArray addObject:strB6]; - [newArray addObject:strB7]; - [newArray addObject:strB8]; - [newArray addObject:strB9]; - [newArray addObject:strB10]; - [newArray addObject:strB11]; - [newArray addObject:strB12]; - [newArray addObject:strC1]; - [newArray addObject:strC2]; - [newArray addObject:strC3]; - [newArray addObject:strC4]; - [newArray addObject:strC5]; - [newArray addObject:strC6]; - [newArray addObject:strC7]; - [newArray addObject:strC8]; - [newArray addObject:strC9]; - [newArray addObject:strC10]; - [newArray addObject:strC11]; - [newArray addObject:strC12]; - [newArray addObject:strD11]; - [newArray addObject:strD12]; - - NSDictionary* newDictionary = [[NSDictionary alloc] initWithObjects:newArray forKeys:newArray]; - NSDictionary *newMutableDictionary = [[NSMutableDictionary alloc] init]; - [newMutableDictionary setObject:@"foo" forKey:@"bar0"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar1"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar2"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar3"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar4"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar5"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar6"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar7"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar8"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar9"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar10"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar11"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar12"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar13"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar14"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar15"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar16"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar17"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar18"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar19"]; - [newMutableDictionary setObject:@"foo" forKey:@"bar20"]; - - id cfKeys[2] = { @"foo", @"bar", @"baz", @"quux" }; - id cfValues[2] = { @"foo", @"bar", @"baz", @"quux" }; - NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil)); - CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil); - - NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary]; - [attrString isEqual:nil]; - NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary]; - [mutableAttrString isEqual:nil]; - - NSString* mutableString = [[NSMutableString alloc] initWithString:@"foo"]; - [mutableString insertString:@"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear " atIndex:0]; - - NSString* mutableGetConst = [NSString stringWithCString:[mutableString cString]]; - - [mutableGetConst length]; - - NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:4]; - NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" length:6]; - - // No-copy versions of NSData initializers use NSConcreteData if over 2^16 elements are specified. - unsigned concreteLength = 100000; - void *zeroes = calloc(1, concreteLength); - NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes length:concreteLength]; - NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes length:concreteLength]; - - [mutableData appendBytes:"MOREDATA" length:8]; - - [immutableData length]; - [mutableData length]; - - NSSet* nsset = [[NSSet alloc] initWithObjects:str1,str2,str3,nil]; - NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil]; - [nsmutableset addObject:str4]; - - CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5); - - CFMutableDataRef mutable_data_ref = CFDataCreateMutable(kCFAllocatorDefault, 8); - CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5); - - CFMutableStringRef mutable_string_ref = CFStringCreateMutable(NULL,100); - CFStringAppend(mutable_string_ref, CFSTR("Wish ya knew")); - - CFStringRef cfstring_ref = CFSTR("HELLO WORLD"); - - CFArrayRef cfarray_ref = CFArrayCreate(NULL, data_set, 3, NULL); - CFMutableArrayRef mutable_array_ref = CFArrayCreateMutable(NULL, 16, NULL); - - CFArraySetValueAtIndex(mutable_array_ref, 0, str1); - CFArraySetValueAtIndex(mutable_array_ref, 1, str2); - CFArraySetValueAtIndex(mutable_array_ref, 2, str3); - CFArraySetValueAtIndex(mutable_array_ref, 3, str4); - CFArraySetValueAtIndex(mutable_array_ref, 0, str5); // replacing value at 0!! - CFArraySetValueAtIndex(mutable_array_ref, 4, str6); - CFArraySetValueAtIndex(mutable_array_ref, 5, str7); - CFArraySetValueAtIndex(mutable_array_ref, 6, str8); - CFArraySetValueAtIndex(mutable_array_ref, 7, str9); - CFArraySetValueAtIndex(mutable_array_ref, 8, str10); - CFArraySetValueAtIndex(mutable_array_ref, 9, str11); - CFArraySetValueAtIndex(mutable_array_ref, 10, str12); - - CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL); - CFBinaryHeapAddValue(binheap_ref, str1); - CFBinaryHeapAddValue(binheap_ref, str2); - CFBinaryHeapAddValue(binheap_ref, str3); - CFBinaryHeapAddValue(binheap_ref, str4); - CFBinaryHeapAddValue(binheap_ref, str5); - CFBinaryHeapAddValue(binheap_ref, str6); - CFBinaryHeapAddValue(binheap_ref, str7); - CFBinaryHeapAddValue(binheap_ref, str8); - CFBinaryHeapAddValue(binheap_ref, str9); - CFBinaryHeapAddValue(binheap_ref, str10); - CFBinaryHeapAddValue(binheap_ref, str11); - CFBinaryHeapAddValue(binheap_ref, str12); - CFBinaryHeapAddValue(binheap_ref, strA1); - CFBinaryHeapAddValue(binheap_ref, strB1); - CFBinaryHeapAddValue(binheap_ref, strC1); - CFBinaryHeapAddValue(binheap_ref, strA11); - CFBinaryHeapAddValue(binheap_ref, strB11); - CFBinaryHeapAddValue(binheap_ref, strC11); - CFBinaryHeapAddValue(binheap_ref, strB12); - CFBinaryHeapAddValue(binheap_ref, strC12); - CFBinaryHeapAddValue(binheap_ref, strA12); - - CFURLRef cfurl_ref = CFURLCreateWithString(NULL, CFSTR("http://www.foo.bar/"), NULL); - CFURLRef cfchildurl_ref = CFURLCreateWithString(NULL, CFSTR("page.html"), cfurl_ref); - CFURLRef cfgchildurl_ref = CFURLCreateWithString(NULL, CFSTR("?whatever"), cfchildurl_ref); - - NSDictionary *error_userInfo = @{@"a": @1, @"b" : @2}; - NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar" code:12 userInfo:error_userInfo]; - NSError **nserrorptr = &nserror; - - NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"]; - NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Foundation.framework"]]; - - NSBundle* main_bundle = [NSBundle mainBundle]; - - NSArray* bundles = [NSBundle allBundles]; - - NSURL *nsurl0; - - for (NSBundle* bundle in bundles) - { - nsurl0 = [bundle bundleURL]; - } - - NSException* except0 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName" reason:@"cuz it's funny" userInfo:nil]; - NSException* except1 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName~1" reason:@"cuz it's funny" userInfo:nil]; - NSException* except2 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName`2" reason:@"cuz it's funny" userInfo:nil]; - NSException* except3 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName/3" reason:@"cuz it's funny" userInfo:nil]; - - NSURL *nsurl = [[NSURL alloc] initWithString:@"http://www.foo.bar"]; - NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl]; - NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2]; - - NSDate *date1 = [NSDate dateWithNaturalLanguageString:@"6pm April 10, 1985"]; - NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"]; - NSDate *date3 = [NSDate date]; - NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60]; - NSDate *date5 = [NSDate dateWithTimeIntervalSinceReferenceDate: floor([[NSDate date] timeIntervalSinceReferenceDate])]; - - CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1); - CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2); - CFAbsoluteTime date3_abs = CFDateGetAbsoluteTime(date3); - CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4); - CFAbsoluteTime date5_abs = CFDateGetAbsoluteTime(date5); - - NSIndexSet *iset1 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)]; - NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)]; - - NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init]; - [imset addIndex:1936]; - [imset addIndex:7]; - [imset addIndex:9]; - [imset addIndex:11]; - [imset addIndex:24]; - [imset addIndex:41]; - [imset addIndex:58]; - [imset addIndex:61]; - [imset addIndex:62]; - [imset addIndex:63]; - - CFTimeZoneRef cupertino = CFTimeZoneCreateWithName ( - NULL, - CFSTR("PST"), - YES); - CFTimeZoneRef home = CFTimeZoneCreateWithName ( - NULL, - CFSTR("Europe/Rome"), - YES); - CFTimeZoneRef europe = CFTimeZoneCreateWithName ( - NULL, - CFSTR("CET"), - YES); - - NSTimeZone *cupertino_ns = [NSTimeZone timeZoneWithAbbreviation:@"PST"]; - NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"]; - NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"]; - - CFGregorianUnits cf_greg_units = {1,3,5,12,5,7}; - CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL); - CFRange cf_range = {4,4}; - NSPoint ns_point = {4,4}; - NSRange ns_range = {4,4}; - - NSRect ns_rect = {{1,1},{5,5}}; - NSRect* ns_rect_ptr = &ns_rect; - NSRectArray ns_rect_arr = &ns_rect; - NSSize ns_size = {5,7}; - NSSize* ns_size_ptr = &ns_size; - - CGSize cg_size = {1,6}; - CGPoint cg_point = {2,7}; - CGRect cg_rect = {{1,2}, {7,7}}; - -#ifndef IOS - RGBColor rgb_color = {3,56,35}; - RGBColor* rgb_color_ptr = &rgb_color; -#endif - - Rect rect = {4,8,4,7}; - Rect* rect_ptr = ▭ - - Point point = {7,12}; - Point* point_ptr = &point; - -#ifndef IOS - HIPoint hi_point = {7,12}; - HIRect hi_rect = {{3,5},{4,6}}; -#endif - - SEL foo_selector = @selector(foo_selector_impl); - - CFMutableBitVectorRef mut_bv = CFBitVectorCreateMutable(NULL, 64); - CFBitVectorSetCount(mut_bv, 50); - CFBitVectorSetBitAtIndex(mut_bv, 0, 1); - CFBitVectorSetBitAtIndex(mut_bv, 1, 1); - CFBitVectorSetBitAtIndex(mut_bv, 2, 1); - CFBitVectorSetBitAtIndex(mut_bv, 5, 1); - CFBitVectorSetBitAtIndex(mut_bv, 6, 1); - CFBitVectorSetBitAtIndex(mut_bv, 8, 1); - CFBitVectorSetBitAtIndex(mut_bv, 10, 1); - CFBitVectorSetBitAtIndex(mut_bv, 11, 1); - CFBitVectorSetBitAtIndex(mut_bv, 16, 1); - CFBitVectorSetBitAtIndex(mut_bv, 17, 1); - CFBitVectorSetBitAtIndex(mut_bv, 19, 1); - CFBitVectorSetBitAtIndex(mut_bv, 20, 1); - CFBitVectorSetBitAtIndex(mut_bv, 22, 1); - CFBitVectorSetBitAtIndex(mut_bv, 24, 1); - CFBitVectorSetBitAtIndex(mut_bv, 28, 1); - CFBitVectorSetBitAtIndex(mut_bv, 29, 1); - CFBitVectorSetBitAtIndex(mut_bv, 30, 1); - CFBitVectorSetBitAtIndex(mut_bv, 30, 1); - CFBitVectorSetBitAtIndex(mut_bv, 31, 1); - CFBitVectorSetBitAtIndex(mut_bv, 34, 1); - CFBitVectorSetBitAtIndex(mut_bv, 35, 1); - CFBitVectorSetBitAtIndex(mut_bv, 37, 1); - CFBitVectorSetBitAtIndex(mut_bv, 39, 1); - CFBitVectorSetBitAtIndex(mut_bv, 40, 1); - CFBitVectorSetBitAtIndex(mut_bv, 41, 1); - CFBitVectorSetBitAtIndex(mut_bv, 43, 1); - CFBitVectorSetBitAtIndex(mut_bv, 47, 1); - - Molecule *molecule = [Molecule new]; - - Class myclass = NSClassFromString(@"NSValue"); - Class myclass2 = [str0 class]; - Class myclass3 = [molecule class]; - Class myclass4 = NSClassFromString(@"NSMutableArray"); - Class myclass5 = [nil class]; - - NSArray *components = @[@"usr", @"blah", @"stuff"]; - NSString *path = [NSString pathWithComponents: components]; - - [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL]; // Set break point at this line. - [newMutableDictionary addObserver:[My_KVO_Observer new] forKeyPath:@"weirdKeyToKVO" options:NSKeyValueObservingOptionNew context:NULL]; - - [molecule setAtoms:nil]; - [molecule setAtoms:[NSMutableArray new]]; - - free(zeroes); - [pool drain]; - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile deleted file mode 100644 index 0d94c2247f14..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py deleted file mode 100644 index 605b543a1b93..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py +++ /dev/null @@ -1,116 +0,0 @@ -# encoding: utf-8 -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import datetime -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class NSIndexPathDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def appkit_tester_impl(self, commands): - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - commands() - - @skipUnlessDarwin - @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656605") - @expectedFailureAll(archs=['armv7', 'armv7k'], bugnumber="rdar://problem/34561607") # NSIndexPath formatter isn't working for 32-bit arm - def test_nsindexpath_with_run_command(self): - """Test formatters for NSIndexPath.""" - self.appkit_tester_impl(self.nsindexpath_data_formatter_commands) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// break here') - - def nsindexpath_data_formatter_commands(self): - # check 'frame variable' - self.expect( - 'frame variable --ptr-depth=1 -d run -- indexPath1', - substrs=['[0] = 1']) - self.expect( - 'frame variable --ptr-depth=1 -d run -- indexPath2', - substrs=[ - '[0] = 1', - '[1] = 2']) - self.expect( - 'frame variable --ptr-depth=1 -d run -- indexPath3', - substrs=[ - '[0] = 1', - '[1] = 2', - '[2] = 3']) - self.expect( - 'frame variable --ptr-depth=1 -d run -- indexPath4', - substrs=[ - '[0] = 1', - '[1] = 2', - '[2] = 3', - '[3] = 4']) - self.expect( - 'frame variable --ptr-depth=1 -d run -- indexPath5', - substrs=[ - '[0] = 1', - '[1] = 2', - '[2] = 3', - '[3] = 4', - '[4] = 5']) - - # and 'expression' - self.expect( - 'expression --ptr-depth=1 -d run -- indexPath1', - substrs=['[0] = 1']) - self.expect( - 'expression --ptr-depth=1 -d run -- indexPath2', - substrs=[ - '[0] = 1', - '[1] = 2']) - self.expect( - 'expression --ptr-depth=1 -d run -- indexPath3', - substrs=[ - '[0] = 1', - '[1] = 2', - '[2] = 3']) - self.expect('expression --ptr-depth=1 -d run -- indexPath4', - substrs=['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4']) - self.expect( - 'expression --ptr-depth=1 -d run -- indexPath5', - substrs=[ - '[0] = 1', - '[1] = 2', - '[2] = 3', - '[3] = 4', - '[4] = 5']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m deleted file mode 100644 index baaff180e34e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m +++ /dev/null @@ -1,31 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main(int argc, const char **argv) -{ - @autoreleasepool - { - const NSUInteger values[] = { 1, 2, 3, 4, 5 }; - - NSIndexPath* indexPath1 = [NSIndexPath indexPathWithIndexes:values length:1]; - NSIndexPath* indexPath2 = [NSIndexPath indexPathWithIndexes:values length:2]; - NSIndexPath* indexPath3 = [NSIndexPath indexPathWithIndexes:values length:3]; - NSIndexPath* indexPath4 = [NSIndexPath indexPathWithIndexes:values length:4]; - NSIndexPath* indexPath5 = [NSIndexPath indexPathWithIndexes:values length:5]; - - NSLog(@"%@", indexPath1); // break here - NSLog(@"%@", indexPath2); - NSLog(@"%@", indexPath3); - NSLog(@"%@", indexPath4); - NSLog(@"%@", indexPath5); - } - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/Makefile deleted file mode 100644 index 0d94c2247f14..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py deleted file mode 100644 index 41a6def00c49..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py +++ /dev/null @@ -1,121 +0,0 @@ -# encoding: utf-8 -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import datetime -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class NSStringDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def appkit_tester_impl(self, commands): - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - commands() - - @skipUnlessDarwin - def test_nsstring_with_run_command(self): - """Test formatters for NSString.""" - self.appkit_tester_impl(self.nsstring_data_formatter_commands) - - @skipUnlessDarwin - def test_rdar11106605_with_run_command(self): - """Check that Unicode characters come out of CFString summary correctly.""" - self.appkit_tester_impl(self.rdar11106605_commands) - - @skipUnlessDarwin - def test_nsstring_withNULS_with_run_command(self): - """Test formatters for NSString.""" - self.appkit_tester_impl(self.nsstring_withNULs_commands) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// break here') - - def rdar11106605_commands(self): - """Check that Unicode characters come out of CFString summary correctly.""" - self.expect('frame variable italian', substrs=[ - 'L\'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.']) - self.expect('frame variable french', substrs=[ - 'Que veut cette horde d\'esclaves, De traîtres, de rois conjurés?']) - self.expect('frame variable german', substrs=[ - 'Über-Ich und aus den Ansprüchen der sozialen Umwelt']) - self.expect('frame variable japanese', substrs=['色は匂へど散りぬるを']) - self.expect('frame variable hebrew', substrs=['לילה טוב']) - - def nsstring_data_formatter_commands(self): - self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 str9 str10 str11 label1 label2 processName str12', - substrs=['(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"', - # '(NSString *) str0 = ',' @"255"', - '(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"', - '(NSString *) str2 = ', ' @"A rather short UTF8 NSString object is here"', - '(NSString *) str3 = ', ' @"A string made with the at sign is here"', - '(NSString *) str4 = ', ' @"This is string number 4 right here"', - '(NSString *) str5 = ', ' @"{{1, 1}, {5, 5}}"', - '(NSString *) str6 = ', ' @"1ST"', - '(NSString *) str8 = ', ' @"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime', - '(NSString *) str9 = ', ' @"a very much boring task to write a string this way!!', - '(NSString *) str10 = ', ' @"This is a Unicode string σ number 4 right here"', - '(NSString *) str11 = ', ' @"__NSCFString"', - '(NSString *) label1 = ', ' @"Process Name: "', - '(NSString *) label2 = ', ' @"Process Id: "', - '(NSString *) str12 = ', ' @"Process Name: a.out Process Id:']) - self.expect( - 'frame variable attrString mutableAttrString mutableGetConst', - substrs=[ - '(NSAttributedString *) attrString = ', - ' @"hello world from foo"', - '(NSAttributedString *) mutableAttrString = ', - ' @"hello world from foo"', - '(NSString *) mutableGetConst = ', - ' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"']) - - self.expect('expr -d run-target -- path', substrs=['usr/blah/stuff']) - self.expect('frame variable path', substrs=['usr/blah/stuff']) - - def nsstring_withNULs_commands(self): - """Check that the NSString formatter supports embedded NULs in the text""" - self.expect( - 'po strwithNULs', - substrs=['a very much boring task to write']) - self.expect('expr [strwithNULs length]', substrs=['54']) - self.expect('frame variable strwithNULs', substrs=[ - '@"a very much boring task to write\\0a string this way!!']) - self.expect('po strwithNULs2', substrs=[ - 'a very much boring task to write']) - self.expect('expr [strwithNULs2 length]', substrs=['52']) - self.expect('frame variable strwithNULs2', substrs=[ - '@"a very much boring task to write\\0a string this way!!']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/main.m deleted file mode 100644 index 7b8c3785a18c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/main.m +++ /dev/null @@ -1,99 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -#if defined(__APPLE__) -#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) -#define IOS -#endif -#endif - -#if defined(IOS) -#import <Foundation/NSGeometry.h> -#else -#import <Carbon/Carbon.h> -#endif - -int main (int argc, const char * argv[]) -{ - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - NSString *str0 = [[NSNumber numberWithUnsignedLongLong:0xFF] stringValue]; - NSString *str1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; - NSString *str2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; - NSString *str3 = @"A string made with the at sign is here"; - NSString *str4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; - NSRect ns_rect_4str = {{1,1},{5,5}}; - NSString* str5 = NSStringFromRect(ns_rect_4str); - NSString* str6 = [@"/usr/doc/README.1ST" pathExtension]; - const unichar myCharacters[] = {0x03C3,'x','x'}; - NSString *str7 = [NSString stringWithCharacters: myCharacters - length: sizeof myCharacters / sizeof *myCharacters]; - NSString* str8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; - const unichar myOtherCharacters[] = {'a',' ', 'v','e','r','y',' ', - 'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k', - ' ','t','o',' ','w','r','i','t','e', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', - 't','h','i','s',' ','w','a','y','!','!',0x03C3, 0}; - NSString *str9 = [NSString stringWithCharacters: myOtherCharacters - length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; - const unichar myNextCharacters[] = {0x03C3, 0x0000}; - NSString *str10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; - NSString *str11 = NSStringFromClass([str10 class]); - NSString *label1 = @"Process Name: "; - NSString *label2 = @"Process Id: "; - NSString *processName = [[NSProcessInfo processInfo] processName]; - NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]]; - NSString *str12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; - NSString *eAcute = [NSString stringWithFormat: @"%C", 0x00E9]; - NSString *randomHaziChar = [NSString stringWithFormat: @"%C", 0x9DC5]; - NSString *japanese = @"色は匂へど散りぬるを"; - NSString *italian = @"L'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione."; - NSString* french = @"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?"; - NSString* german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt"; - void* data_set[3] = {str1,str2,str3}; - NSString *hebrew = [NSString stringWithString:@"לילה טוב"]; - - NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:[NSDictionary new]]; - [attrString isEqual:nil]; - NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:[NSDictionary new]]; - [mutableAttrString isEqual:nil]; - - NSString* mutableString = [[NSMutableString alloc] initWithString:@"foo"]; - [mutableString insertString:@"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear " atIndex:0]; - - NSString* mutableGetConst = [NSString stringWithCString:[mutableString cString]]; - - [mutableGetConst length]; - CFMutableStringRef mutable_string_ref = CFStringCreateMutable(NULL,100); - CFStringAppend(mutable_string_ref, CFSTR("Wish ya knew")); - CFStringRef cfstring_ref = CFSTR("HELLO WORLD"); - - NSArray *components = @[@"usr", @"blah", @"stuff"]; - NSString *path = [NSString pathWithComponents: components]; - - const unichar someOfTheseAreNUL[] = {'a',' ', 'v','e','r','y',' ', - 'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k', - ' ','t','o',' ','w','r','i','t','e', 0, 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', - 't','h','i','s',' ','w','a','y','!','!', 0x03C3, 0}; - NSString *strwithNULs = [NSString stringWithCharacters: someOfTheseAreNUL - length: sizeof someOfTheseAreNUL / sizeof *someOfTheseAreNUL]; - - const unichar someOfTheseAreNUL2[] = {'a',' ', 'v','e','r','y',' ', - 'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k', - ' ','t','o',' ','w','r','i','t','e', 0, 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', - 't','h','i','s',' ','w','a','y','!','!'}; - NSString *strwithNULs2 = [NSString stringWithCharacters: someOfTheseAreNUL2 - length: sizeof someOfTheseAreNUL2 / sizeof *someOfTheseAreNUL2]; - - [pool drain]; // break here - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/Makefile deleted file mode 100644 index 9f7fb1ca6231..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py deleted file mode 100644 index 2c5041142fa9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DataFormatterOneIsSingularTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - def test_one_is_singular_with_run_command(self): - """Test that 1 item is not as reported as 1 items.""" - self.build() - self.oneness_data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// Set break point at this line.') - - def oneness_data_formatter_commands(self): - """Test that 1 item is not as reported as 1 items.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Now check that we are displaying Cocoa classes correctly - self.expect('frame variable key', - substrs=['@"1 element"']) - self.expect('frame variable key', matching=False, - substrs=['1 elements']) - self.expect('frame variable value', - substrs=['@"1 element"']) - self.expect('frame variable value', matching=False, - substrs=['1 elements']) - self.expect('frame variable dict', - substrs=['1 key/value pair']) - self.expect('frame variable dict', matching=False, - substrs=['1 key/value pairs']) - self.expect('frame variable imset', - substrs=['1 index']) - self.expect('frame variable imset', matching=False, - substrs=['1 indexes']) - self.expect('frame variable binheap_ref', - substrs=['@"1 item"']) - self.expect('frame variable binheap_ref', matching=False, - substrs=['1 items']) - self.expect('frame variable immutableData', - substrs=['1 byte']) - self.expect('frame variable immutableData', matching=False, - substrs=['1 bytes']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/main.m deleted file mode 100644 index 71ab8a746bb6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/main.m +++ /dev/null @@ -1,31 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main (int argc, const char * argv[]) -{ - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - NSArray* key = [NSArray arrayWithObjects:@"foo",nil]; - NSArray* value = [NSArray arrayWithObjects:@"key",nil]; - NSDictionary *dict = [NSDictionary dictionaryWithObjects:value forKeys:key]; - - NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init]; - [imset addIndex:4]; - - CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL); - CFBinaryHeapAddValue(binheap_ref, CFSTR("Hello world")); - - NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:1]; - - [pool drain];// Set break point at this line. - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py deleted file mode 100644 index 397a461db683..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class PtrToArrayDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_with_run_command(self): - """Test that LLDB handles the clang typeclass Paren correctly.""" - self.build() - self.data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def data_formatter_commands(self): - """Test that LLDB handles the clang typeclass Paren correctly.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format delete hex', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect('p *(int (*)[3])foo', - substrs=['(int [3]) $', '[0] = 1', '[1] = 2', '[2] = 3']) - - self.expect('p *(int (*)[3])foo', matching=False, - substrs=['01 00 00 00 02 00 00 00 03 00 00 00']) - self.expect('p *(int (*)[3])foo', matching=False, - substrs=['0x000000030000000200000001']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/main.cpp deleted file mode 100644 index 15fa5614d7fd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -bool bar(int const *foo) { - return foo != 0; // Set break point at this line. -} - -int main() { - int foo[] = {1,2,3}; - return bar(foo); -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py deleted file mode 100644 index cc4cfd2ceb72..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py +++ /dev/null @@ -1,291 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class PythonSynthDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser - def test_with_run_command(self): - """Test data formatter commands.""" - self.build() - self.data_formatter_commands() - - def test_rdar10960550_with_run_command(self): - """Test data formatter commands.""" - self.build() - self.rdar10960550_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - self.line2 = line_number('main.cpp', - '// Set cast break point at this line.') - self.line3 = line_number( - 'main.cpp', '// Set second cast break point at this line.') - - def data_formatter_commands(self): - """Test using Python synthetic children provider.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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) - - process = self.dbg.GetSelectedTarget().GetProcess() - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # print the f00_1 variable without a synth - self.expect("frame variable f00_1", - substrs=['a = 1', - 'b = 2', - 'r = 34']) - - # now set up the synth - self.runCmd("script from fooSynthProvider import *") - self.runCmd("type synth add -l fooSynthProvider foo") - self.expect("type synthetic list foo", substrs=['fooSynthProvider']) - - # note that the value of fake_a depends on target byte order - if process.GetByteOrder() == lldb.eByteOrderLittle: - fake_a_val = 0x02000000 - else: - fake_a_val = 0x00000100 - - # check that we get the two real vars and the fake_a variables - self.expect("frame variable f00_1", - substrs=['r = 34', - 'fake_a = %d' % fake_a_val, - 'a = 1']) - - # check that we do not get the extra vars - self.expect("frame variable f00_1", matching=False, - substrs=['b = 2']) - - # check access to members by name - self.expect('frame variable f00_1.fake_a', - substrs=['%d' % fake_a_val]) - - # check access to members by index - self.expect('frame variable f00_1[1]', - substrs=['%d' % fake_a_val]) - - # put synthetic children in summary in several combinations - self.runCmd( - "type summary add --summary-string \"fake_a=${svar.fake_a}\" foo") - self.expect('frame variable f00_1', - substrs=['fake_a=%d' % fake_a_val]) - self.runCmd( - "type summary add --summary-string \"fake_a=${svar[1]}\" foo") - self.expect('frame variable f00_1', - substrs=['fake_a=%d' % fake_a_val]) - - # clear the summary - self.runCmd("type summary delete foo") - - # check that the caching does not span beyond the stopoint - self.runCmd("n") - - if process.GetByteOrder() == lldb.eByteOrderLittle: - fake_a_val = 0x02000000 - else: - fake_a_val = 0x00000200 - - self.expect("frame variable f00_1", - substrs=['r = 34', - 'fake_a = %d' % fake_a_val, - 'a = 2']) - - # check that altering the object also alters fake_a - self.runCmd("expr f00_1.a = 280") - - if process.GetByteOrder() == lldb.eByteOrderLittle: - fake_a_val = 0x02000001 - else: - fake_a_val = 0x00011800 - - self.expect("frame variable f00_1", - substrs=['r = 34', - 'fake_a = %d' % fake_a_val, - 'a = 280']) - - # check that expanding a pointer does the right thing - if process.GetByteOrder() == lldb.eByteOrderLittle: - fake_a_val = 0x0d000000 - else: - fake_a_val = 0x00000c00 - - self.expect("frame variable --ptr-depth 1 f00_ptr", - substrs=['r = 45', - 'fake_a = %d' % fake_a_val, - 'a = 12']) - - # now add a filter.. it should fail - self.expect("type filter add foo --child b --child j", error=True, - substrs=['cannot add']) - - # we get the synth again.. - self.expect('frame variable f00_1', matching=False, - substrs=['b = 1', - 'j = 17']) - self.expect("frame variable --ptr-depth 1 f00_ptr", - substrs=['r = 45', - 'fake_a = %d' % fake_a_val, - 'a = 12']) - - # now delete the synth and add the filter - self.runCmd("type synth delete foo") - self.runCmd("type filter add foo --child b --child j") - - self.expect('frame variable f00_1', - substrs=['b = 2', - 'j = 18']) - self.expect("frame variable --ptr-depth 1 f00_ptr", matching=False, - substrs=['r = 45', - 'fake_a = %d' % fake_a_val, - 'a = 12']) - - # now add the synth and it should fail - self.expect("type synth add -l fooSynthProvider foo", error=True, - substrs=['cannot add']) - - # check the listing - self.expect('type synth list', matching=False, - substrs=['foo', - 'Python class fooSynthProvider']) - self.expect('type filter list', - substrs=['foo', - '.b', - '.j']) - - # delete the filter, add the synth - self.runCmd("type filter delete foo") - self.runCmd("type synth add -l fooSynthProvider foo") - - self.expect('frame variable f00_1', matching=False, - substrs=['b = 2', - 'j = 18']) - self.expect("frame variable --ptr-depth 1 f00_ptr", - substrs=['r = 45', - 'fake_a = %d' % fake_a_val, - 'a = 12']) - - # check the listing - self.expect('type synth list', - substrs=['foo', - 'Python class fooSynthProvider']) - self.expect('type filter list', matching=False, - substrs=['foo', - '.b', - '.j']) - - # delete the synth and check that we get good output - self.runCmd("type synth delete foo") - - self.expect("frame variable f00_1", - substrs=['a = 280', - 'b = 2', - 'j = 18']) - - self.expect("frame variable f00_1", matching=False, - substrs=['fake_a = ']) - - def rdar10960550_formatter_commands(self): - """Test that synthetic children persist stoppoints.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - # The second breakpoint is on a multi-line expression, so the comment - # can't be on the right line... - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line2, num_expected_locations=1, loc_exact=False) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line3, 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("command script import ./ftsp.py --allow-reload") - self.runCmd("type synth add -l ftsp.ftsp wrapint") - - # we need to check that the VO is properly updated so that the same synthetic children are reused - # but their values change correctly across stop-points - in order to do this, self.runCmd("next") - # does not work because it forces a wipe of the stack frame - this is why we are using this more contrived - # mechanism to achieve our goal of preserving test_cast as a VO - test_cast = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable('test_cast') - - str_cast = str(test_cast) - - if self.TraceOn(): - print(str_cast) - - self.assertTrue(str_cast.find('A') != -1, 'could not find A in output') - self.assertTrue(str_cast.find('B') != -1, 'could not find B in output') - self.assertTrue(str_cast.find('C') != -1, 'could not find C in output') - self.assertTrue(str_cast.find('D') != -1, 'could not find D in output') - self.assertTrue( - str_cast.find("4 = '\\0'") != -1, - 'could not find item 4 == 0') - - self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().StepOver() - - str_cast = str(test_cast) - - if self.TraceOn(): - print(str_cast) - - # we detect that all the values of the child objects have changed - but the counter-generated item - # is still fixed at 0 because it is cached - this would fail if update(self): in ftsp returned False - # or if synthetic children were not being preserved - self.assertTrue(str_cast.find('Q') != -1, 'could not find Q in output') - self.assertTrue(str_cast.find('X') != -1, 'could not find X in output') - self.assertTrue(str_cast.find('T') != -1, 'could not find T in output') - self.assertTrue(str_cast.find('F') != -1, 'could not find F in output') - self.assertTrue( - str_cast.find("4 = '\\0'") != -1, - 'could not find item 4 == 0') diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py deleted file mode 100644 index 45fb00468e08..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py +++ /dev/null @@ -1,30 +0,0 @@ -import lldb - - -class fooSynthProvider: - - def __init__(self, valobj, dict): - self.valobj = valobj - self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt) - - def num_children(self): - return 3 - - def get_child_at_index(self, index): - if index == 0: - child = self.valobj.GetChildMemberWithName('a') - if index == 1: - child = self.valobj.CreateChildAtOffset('fake_a', 1, self.int_type) - if index == 2: - child = self.valobj.GetChildMemberWithName('r') - return child - - def get_child_index(self, name): - if name == 'a': - return 0 - if name == 'fake_a': - return 1 - return 2 - - def update(self): - return True diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py deleted file mode 100644 index b96dbac6f503..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py +++ /dev/null @@ -1,40 +0,0 @@ -import lldb - -counter = 0 - - -class ftsp: - - def __init__(self, valobj, dict): - self.valobj = valobj - - def num_children(self): - if self.char.IsValid(): - return 5 - return 0 - - def get_child_index(self, name): - return 0 - - def get_child_at_index(self, index): - if index == 0: - return self.x.Cast(self.char) - if index == 4: - return self.valobj.CreateValueFromExpression( - str(index), '(char)(' + str(self.count) + ')') - return self.x.CreateChildAtOffset(str(index), - index, - self.char) - - def update(self): - self.x = self.valobj.GetChildMemberWithName('x') - self.char = self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar) - global counter - self.count = counter - counter = counter + 1 - return True # important: if we return False here, or fail to return, the test will fail - - -def __lldb_init_module(debugger, dict): - global counter - counter = 0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp deleted file mode 100644 index f45a2abfb9f1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -struct foo -{ - int a; - int b; - int c; - int d; - int e; - int f; - int g; - int h; - int i; - int j; - int k; - int l; - int m; - int n; - int o; - int p; - int q; - int r; - - foo(int X) : - a(X), - b(X+1), - c(X+3), - d(X+5), - e(X+7), - f(X+9), - g(X+11), - h(X+13), - i(X+15), - j(X+17), - k(X+19), - l(X+21), - m(X+23), - n(X+25), - o(X+27), - p(X+29), - q(X+31), - r(X+33) {} -}; - -struct wrapint -{ - int x; - wrapint(int X) : x(X) {} -}; - -int main() -{ - foo f00_1(1); - foo *f00_ptr = new foo(12); - - f00_1.a++; // Set break point at this line. - - wrapint test_cast('A' + - 256*'B' + - 256*256*'C'+ - 256*256*256*'D'); - // Set cast break point at this line. - test_cast.x = 'Q' + - 256*'X' + - 256*256*'T'+ - 256*256*256*'F'; - return 0; // Set second cast break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py deleted file mode 100644 index 1dd1912f4c73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py +++ /dev/null @@ -1,185 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class ScriptDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_with_run_command(self): - """Test data formatter commands.""" - self.build() - self.data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def data_formatter_commands(self): - """Test that that file and class static variables display correctly.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Set the script here to ease the formatting - script = 'a = valobj.GetChildMemberWithName(\'integer\'); a_val = a.GetValue(); str = \'Hello from Python, \' + a_val + \' time\'; return str + (\'!\' if a_val == \'1\' else \'s!\');' - - self.runCmd( - "type summary add i_am_cool --python-script \"%s\"" % - script) - self.expect('type summary list i_am_cool', substrs=[script]) - - self.expect("frame variable one", - substrs=['Hello from Python', - '1 time!']) - - self.expect("frame variable two", - substrs=['Hello from Python', - '4 times!']) - - self.runCmd("n") # skip ahead to make values change - - self.expect("frame variable three", - substrs=['Hello from Python, 10 times!', - 'Hello from Python, 4 times!']) - - self.runCmd("n") # skip ahead to make values change - - self.expect("frame variable two", - substrs=['Hello from Python', - '1 time!']) - - script = 'a = valobj.GetChildMemberWithName(\'integer\'); a_val = a.GetValue(); str = \'int says \' + a_val; return str;' - - # Check that changes in the script are immediately reflected - self.runCmd( - "type summary add i_am_cool --python-script \"%s\"" % - script) - - self.expect("frame variable two", - substrs=['int says 1']) - - self.expect("frame variable twoptr", - substrs=['int says 1']) - - # Change the summary - self.runCmd( - "type summary add --summary-string \"int says ${var.integer}, and float says ${var.floating}\" i_am_cool") - - self.expect("frame variable two", - substrs=['int says 1', - 'and float says 2.71']) - # Try it for pointers - self.expect("frame variable twoptr", - substrs=['int says 1', - 'and float says 2.71']) - - # Force a failure for pointers - self.runCmd( - "type summary add i_am_cool -p --python-script \"%s\"" % - script) - - self.expect("frame variable twoptr", matching=False, - substrs=['and float says 2.71']) - - script = 'return \'Python summary\'' - - self.runCmd( - "type summary add --name test_summary --python-script \"%s\"" % - script) - - # attach the Python named summary to someone - self.expect("frame variable one --summary test_summary", - substrs=['Python summary']) - - # should not bind to the type - self.expect("frame variable two", matching=False, - substrs=['Python summary']) - - # and should not stick to the variable - self.expect("frame variable one", matching=False, - substrs=['Python summary']) - - self.runCmd( - "type summary add i_am_cool --summary-string \"Text summary\"") - - # should be temporary only - self.expect("frame variable one", matching=False, - substrs=['Python summary']) - - # use the type summary - self.expect("frame variable two", - substrs=['Text summary']) - - self.runCmd("n") # skip ahead to make values change - - # both should use the type summary now - self.expect("frame variable one", - substrs=['Text summary']) - - self.expect("frame variable two", - substrs=['Text summary']) - - # disable type summary for pointers, and make a Python regex summary - self.runCmd( - "type summary add i_am_cool -p --summary-string \"Text summary\"") - self.runCmd("type summary add -x cool --python-script \"%s\"" % script) - - # variables should stick to the type summary - self.expect("frame variable one", - substrs=['Text summary']) - - self.expect("frame variable two", - substrs=['Text summary']) - - # array and pointer should match the Python one - self.expect("frame variable twoptr", - substrs=['Python summary']) - - self.expect("frame variable array", - substrs=['Python summary']) - - # return pointers to the type summary - self.runCmd( - "type summary add i_am_cool --summary-string \"Text summary\"") - - self.expect("frame variable one", - substrs=['Text summary']) - - self.expect("frame variable two", - substrs=['Text summary']) - - self.expect("frame variable twoptr", - substrs=['Text summary']) - - self.expect("frame variable array", - substrs=['Python summary']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/main.cpp deleted file mode 100644 index 1c98f3db24c8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -struct i_am_cool -{ - int integer; - float floating; - char character; - i_am_cool(int I, float F, char C) : - integer(I), floating(F), character(C) {} - i_am_cool() : integer(1), floating(2), character('3') {} - -}; - -struct i_am_cooler -{ - i_am_cool first_cool; - i_am_cool second_cool; - float floating; - - i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) : - first_cool(I1,F1,C1), - second_cool(I2,F2,C2), - floating((F1 + F2)/2) {} -}; - -int main (int argc, const char * argv[]) -{ - i_am_cool one(1,3.14,'E'); - i_am_cool two(4,2.71,'G'); - - i_am_cool* twoptr = &two; - - i_am_cool array[5]; - - i_am_cooler three(10,4,1985,1/1/2011,'B','E'); // Set break point at this line. - - two.integer = 1; - - int dummy = 1; - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile deleted file mode 100644 index 637404f1bd0a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -USE_LIBSTDCPP := 0 - -include $(LEVEL)/Makefile.rules - -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py deleted file mode 100644 index 4ec7f13d1152..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py +++ /dev/null @@ -1,188 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class SkipSummaryDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=['freebsd'], - bugnumber="llvm.org/pr20548 fails to build on lab.llvm.org buildbot") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24462, Data formatters have problems on Windows") - def test_with_run_command(self): - """Test data formatter commands.""" - self.build() - self.data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def data_formatter_commands(self): - """Test that that file and class static variables display correctly.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - #import lldbsuite.test.lldbutil as lldbutil - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Setup the summaries for this scenario - #self.runCmd("type summary add --summary-string \"${var._M_dataplus._M_p}\" std::string") - self.runCmd( - "type summary add --summary-string \"Level 1\" \"DeepData_1\"") - self.runCmd( - "type summary add --summary-string \"Level 2\" \"DeepData_2\" -e") - self.runCmd( - "type summary add --summary-string \"Level 3\" \"DeepData_3\"") - self.runCmd( - "type summary add --summary-string \"Level 4\" \"DeepData_4\"") - self.runCmd( - "type summary add --summary-string \"Level 5\" \"DeepData_5\"") - - # Default case, just print out summaries - self.expect('frame variable', - substrs=['(DeepData_1) data1 = Level 1', - '(DeepData_2) data2 = Level 2 {', - 'm_child1 = Level 3', - 'm_child2 = Level 3', - 'm_child3 = Level 3', - 'm_child4 = Level 3', - '}']) - - # Skip the default (should be 1) levels of summaries - self.expect('frame variable --no-summary-depth', - substrs=['(DeepData_1) data1 = {', - 'm_child1 = 0x', - '}', - '(DeepData_2) data2 = {', - 'm_child1 = Level 3', - 'm_child2 = Level 3', - 'm_child3 = Level 3', - 'm_child4 = Level 3', - '}']) - - # Now skip 2 levels of summaries - self.expect('frame variable --no-summary-depth=2', - substrs=['(DeepData_1) data1 = {', - 'm_child1 = 0x', - '}', - '(DeepData_2) data2 = {', - 'm_child1 = {', - 'm_child1 = 0x', - 'Level 4', - 'm_child2 = {', - 'm_child3 = {', - '}']) - - # Check that no "Level 3" comes out - self.expect( - 'frame variable data1.m_child1 --no-summary-depth=2', - matching=False, - substrs=['Level 3']) - - # Now expand a pointer with 2 level of skipped summaries - self.expect('frame variable data1.m_child1 --no-summary-depth=2', - substrs=['(DeepData_2 *) data1.m_child1 = 0x']) - - # Deref and expand said pointer - self.expect('frame variable *data1.m_child1 --no-summary-depth=2', - substrs=['(DeepData_2) *data1.m_child1 = {', - 'm_child2 = {', - 'm_child1 = 0x', - 'Level 4', - '}']) - - # Expand an expression, skipping 2 layers of summaries - self.expect( - 'frame variable data1.m_child1->m_child2 --no-summary-depth=2', - substrs=[ - '(DeepData_3) data1.m_child1->m_child2 = {', - 'm_child2 = {', - 'm_child1 = Level 5', - 'm_child2 = Level 5', - 'm_child3 = Level 5', - '}']) - - # Expand same expression, skipping only 1 layer of summaries - self.expect( - 'frame variable data1.m_child1->m_child2 --no-summary-depth=1', - substrs=[ - '(DeepData_3) data1.m_child1->m_child2 = {', - 'm_child1 = 0x', - 'Level 4', - 'm_child2 = Level 4', - '}']) - - # Bad debugging info on SnowLeopard gcc (Apple Inc. build 5666). - # Skip the following tests if the condition is met. - if self.getCompiler().endswith('gcc') and not self.getCompiler().endswith('llvm-gcc'): - import re - gcc_version_output = system( - [[lldbutil.which(self.getCompiler()), "-v"]])[1] - #print("my output:", gcc_version_output) - for line in gcc_version_output.split(os.linesep): - m = re.search('\(Apple Inc\. build ([0-9]+)\)', line) - #print("line:", line) - if m: - gcc_build = int(m.group(1)) - #print("gcc build:", gcc_build) - if gcc_build >= 5666: - # rdar://problem/9804600" - self.skipTest( - "rdar://problem/9804600 wrong namespace for std::string in debug info") - - # Expand same expression, skipping 3 layers of summaries - self.expect( - 'frame variable data1.m_child1->m_child2 --show-types --no-summary-depth=3', - substrs=[ - '(DeepData_3) data1.m_child1->m_child2 = {', - 'm_some_text = "Just a test"', - 'm_child2 = {', - 'm_some_text = "Just a test"']) - - # Change summary and expand, first without --no-summary-depth then with - # --no-summary-depth - self.runCmd( - "type summary add --summary-string \"${var.m_some_text}\" DeepData_5") - - self.expect('fr var data2.m_child4.m_child2.m_child2', substrs=[ - '(DeepData_5) data2.m_child4.m_child2.m_child2 = "Just a test"']) - - self.expect( - 'fr var data2.m_child4.m_child2.m_child2 --no-summary-depth', - substrs=[ - '(DeepData_5) data2.m_child4.m_child2.m_child2 = {', - 'm_some_text = "Just a test"', - '}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/main.cpp deleted file mode 100644 index 665c9fe75d1c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include <string> - -struct DeepData_5 -{ - std::string m_some_text; - DeepData_5() : - m_some_text("Just a test") {} -}; - -struct DeepData_4 -{ - DeepData_5 m_child1; - DeepData_5 m_child2; - DeepData_5 m_child3; -}; - -struct DeepData_3 -{ - DeepData_4& m_child1; - DeepData_4 m_child2; - - DeepData_3() : m_child1(* (new DeepData_4())), m_child2(DeepData_4()) {} -}; - -struct DeepData_2 -{ - DeepData_3 m_child1; - DeepData_3 m_child2; - DeepData_3 m_child3; - DeepData_3 m_child4; -}; - -struct DeepData_1 -{ - DeepData_2 *m_child1; - - DeepData_1() : - m_child1(new DeepData_2()) - {} -}; - -/* - type summary add -f "${var._M_dataplus._M_p}" std::string - type summary add -f "Level 1" "DeepData_1" - type summary add -f "Level 2" "DeepData_2" -e - type summary add -f "Level 3" "DeepData_3" - type summary add -f "Level 4" "DeepData_4" - type summary add -f "Level 5" "DeepData_5" - */ - -int main() -{ - DeepData_1 data1; - DeepData_2 data2; - - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py deleted file mode 100644 index 54e9c346df31..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py +++ /dev/null @@ -1,456 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class SmartArrayDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_with_run_command(self): - """Test data formatter commands.""" - self.build() - self.data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def data_formatter_commands(self): - """Test that that file and class static variables display correctly.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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) - - process = self.dbg.GetSelectedTarget().GetProcess() - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - -# check that we are not looping here - self.runCmd("type summary add --summary-string \"${var%V}\" SomeData") - - self.expect("frame variable data", - substrs=['SomeData @ 0x']) -# ${var%s} - self.runCmd( - "type summary add --summary-string \"ptr = ${var%s}\" \"char *\"") - - self.expect("frame variable strptr", - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("frame variable other.strptr", - substrs=['ptr = \"', - 'Nested Hello world!']) - - self.runCmd( - "type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\"") - - self.expect("frame variable strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("frame variable other.strarr", - substrs=['arr = \"', - 'Nested Hello world!']) - - self.expect("p strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("p other.strarr", - substrs=['arr = \"', - 'Nested Hello world!']) - -# ${var%c} - self.runCmd( - "type summary add --summary-string \"ptr = ${var%c}\" \"char *\"") - - self.expect("frame variable strptr", - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("frame variable other.strptr", - substrs=['ptr = \"', - 'Nested Hello world!']) - - self.expect("p strptr", - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("p other.strptr", - substrs=['ptr = \"', - 'Nested Hello world!']) - - self.runCmd( - "type summary add --summary-string \"arr = ${var%c}\" -x \"char \\[[0-9]+\\]\"") - - self.expect("frame variable strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("frame variable other.strarr", - substrs=['arr = \"', - 'Nested Hello world!']) - - self.expect("p strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("p other.strarr", - substrs=['arr = \"', - 'Nested Hello world!']) - -# ${var%char[]} - self.runCmd( - "type summary add --summary-string \"arr = ${var%char[]}\" -x \"char \\[[0-9]+\\]\"") - - self.expect("frame variable strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("frame variable other.strarr", - substrs=['arr = ', - 'Nested Hello world!']) - - self.expect("p strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("p other.strarr", - substrs=['arr = ', - 'Nested Hello world!']) - - self.runCmd( - "type summary add --summary-string \"ptr = ${var%char[]}\" \"char *\"") - - self.expect("frame variable strptr", - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("frame variable other.strptr", - substrs=['ptr = \"', - 'Nested Hello world!']) - - self.expect("p strptr", - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("p other.strptr", - substrs=['ptr = \"', - 'Nested Hello world!']) - -# ${var%a} - self.runCmd( - "type summary add --summary-string \"arr = ${var%a}\" -x \"char \\[[0-9]+\\]\"") - - self.expect("frame variable strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("frame variable other.strarr", - substrs=['arr = ', - 'Nested Hello world!']) - - self.expect("p strarr", - substrs=['arr = \"', - 'Hello world!']) - - self.expect("p other.strarr", - substrs=['arr = ', - 'Nested Hello world!']) - - self.runCmd( - "type summary add --summary-string \"ptr = ${var%a}\" \"char *\"") - - self.expect("frame variable strptr", - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("frame variable other.strptr", - substrs=['ptr = \"', - 'Nested Hello world!']) - - self.expect("p strptr", - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("p other.strptr", - substrs=['ptr = \"', - 'Nested Hello world!']) - - self.runCmd( - "type summary add --summary-string \"ptr = ${var[]%char[]}\" \"char *\"") - -# I do not know the size of the data, but you are asking for a full array slice.. -# use the ${var%char[]} to obtain a string as result - self.expect("frame variable strptr", matching=False, - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("frame variable other.strptr", matching=False, - substrs=['ptr = \"', - 'Nested Hello world!']) - - self.expect("p strptr", matching=False, - substrs=['ptr = \"', - 'Hello world!']) - - self.expect("p other.strptr", matching=False, - substrs=['ptr = \"', - 'Nested Hello world!']) - -# You asked an array-style printout... - self.runCmd( - "type summary add --summary-string \"ptr = ${var[0-1]%char[]}\" \"char *\"") - - self.expect("frame variable strptr", - substrs=['ptr = ', - '[{H},{e}]']) - - self.expect("frame variable other.strptr", - substrs=['ptr = ', - '[{N},{e}]']) - - self.expect("p strptr", - substrs=['ptr = ', - '[{H},{e}]']) - - self.expect("p other.strptr", - substrs=['ptr = ', - '[{N},{e}]']) - -# using [] is required here - self.runCmd( - "type summary add --summary-string \"arr = ${var%x}\" \"int [5]\"") - - self.expect("frame variable intarr", matching=False, substrs=[ - '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005']) - - self.expect("frame variable other.intarr", matching=False, substrs=[ - '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005']) - - self.runCmd( - "type summary add --summary-string \"arr = ${var[]%x}\" \"int [5]\"") - - self.expect( - "frame variable intarr", - substrs=[ - 'intarr = arr =', - '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005']) - - self.expect( - "frame variable other.intarr", - substrs=[ - 'intarr = arr =', - '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005']) - -# printing each array item as an array - self.runCmd( - "type summary add --summary-string \"arr = ${var[]%uint32_t[]}\" \"int [5]\"") - - self.expect( - "frame variable intarr", - substrs=[ - 'intarr = arr =', - '{0x00000001},{0x00000001},{0x00000002},{0x00000003},{0x00000005}']) - - self.expect( - "frame variable other.intarr", - substrs=[ - 'intarr = arr = ', - '{0x00000009},{0x00000008},{0x00000007},{0x00000006},{0x00000005}']) - -# printing full array as an array - self.runCmd( - "type summary add --summary-string \"arr = ${var%uint32_t[]}\" \"int [5]\"") - - self.expect( - "frame variable intarr", - substrs=[ - 'intarr = arr =', - '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005']) - - self.expect( - "frame variable other.intarr", - substrs=[ - 'intarr = arr =', - '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005']) - -# printing each array item as an array - self.runCmd( - "type summary add --summary-string \"arr = ${var[]%float32[]}\" \"float [7]\"") - - self.expect( - "frame variable flarr", - substrs=[ - 'flarr = arr =', - '{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}']) - - self.expect( - "frame variable other.flarr", - substrs=[ - 'flarr = arr = ', - '{25.5},{25.25},{25.125},{26.75},{27.375},{27.5},{26.125}']) - -# printing full array as an array - self.runCmd( - "type summary add --summary-string \"arr = ${var%float32[]}\" \"float [7]\"") - - self.expect("frame variable flarr", - substrs=['flarr = arr =', - '78.5,77.25,78,76.125,76.75,76.875,77']) - - self.expect("frame variable other.flarr", - substrs=['flarr = arr =', - '25.5,25.25,25.125,26.75,27.375,27.5,26.125']) - -# using array smart summary strings for pointers should make no sense - self.runCmd( - "type summary add --summary-string \"arr = ${var%float32[]}\" \"float *\"") - self.runCmd( - "type summary add --summary-string \"arr = ${var%int32_t[]}\" \"int *\"") - - self.expect("frame variable flptr", matching=False, - substrs=['78.5,77.25,78,76.125,76.75,76.875,77']) - - self.expect("frame variable intptr", matching=False, - substrs=['1,1,2,3,5']) - -# use y and Y - self.runCmd( - "type summary add --summary-string \"arr = ${var%y}\" \"float [7]\"") - self.runCmd( - "type summary add --summary-string \"arr = ${var%y}\" \"int [5]\"") - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect( - "frame variable flarr", - substrs=[ - 'flarr = arr =', - '00 00 9d 42,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42']) - else: - self.expect( - "frame variable flarr", - substrs=[ - 'flarr = arr =', - '42 9d 00 00,42 9a 80 00,42 9c 00 00,42 98 40 00,42 99 80 00,42 99 c0 00,42 9a 00 00']) - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect( - "frame variable other.flarr", - substrs=[ - 'flarr = arr =', - '00 00 cc 41,00 00 ca 41,00 00 c9 41,00 00 d6 41,00 00 db 41,00 00 dc 41,00 00 d1 41']) - else: - self.expect( - "frame variable other.flarr", - substrs=[ - 'flarr = arr =', - '41 cc 00 00,41 ca 00 00,41 c9 00 00,41 d6 00 00,41 db 00 00,41 dc 00 00,41 d1 00 00']) - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect( - "frame variable intarr", - substrs=[ - 'intarr = arr =', - '01 00 00 00,01 00 00 00,02 00 00 00,03 00 00 00,05 00 00 00']) - else: - self.expect( - "frame variable intarr", - substrs=[ - 'intarr = arr =', - '00 00 00 01,00 00 00 01,00 00 00 02,00 00 00 03,00 00 00 05']) - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect( - "frame variable other.intarr", - substrs=[ - 'intarr = arr = ', - '09 00 00 00,08 00 00 00,07 00 00 00,06 00 00 00,05 00 00 00']) - else: - self.expect( - "frame variable other.intarr", - substrs=[ - 'intarr = arr = ', - '00 00 00 09,00 00 00 08,00 00 00 07,00 00 00 06,00 00 00 05']) - - self.runCmd( - "type summary add --summary-string \"arr = ${var%Y}\" \"float [7]\"") - self.runCmd( - "type summary add --summary-string \"arr = ${var%Y}\" \"int [5]\"") - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect( - "frame variable flarr", - substrs=[ - 'flarr = arr =', - '00 00 9d 42 ...B,00 80 9a 42 ...B,00 00 9c 42 ...B,00 40 98 42 .@.B,00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...B']) - else: - self.expect( - "frame variable flarr", - substrs=[ - 'flarr = arr =', - '42 9d 00 00 B...,42 9a 80 00 B...,42 9c 00 00 B...,42 98 40 00 B.@.,42 99 80 00 B...,42 99 c0 00 B...,42 9a 00 00 B...']) - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect( - "frame variable other.flarr", - substrs=[ - 'flarr = arr =', - '00 00 cc 41 ...A,00 00 ca 41 ...A,00 00 c9 41 ...A,00 00 d6 41 ...A,00 00 db 41 ...A,00 00 dc 41 ...A,00 00 d1 41 ...A']) - else: - self.expect( - "frame variable other.flarr", - substrs=[ - 'flarr = arr =', - '41 cc 00 00 A...,41 ca 00 00 A...,41 c9 00 00 A...,41 d6 00 00 A...,41 db 00 00 A...,41 dc 00 00 A...,41 d1 00 00 A...']) - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect("frame variable intarr", - substrs=['intarr = arr =', - '....,01 00 00 00', - '....,05 00 00 00']) - else: - self.expect("frame variable intarr", - substrs=['intarr = arr =', - '....,00 00 00 01', - '....,00 00 00 05']) - - if process.GetByteOrder() == lldb.eByteOrderLittle: - self.expect("frame variable other.intarr", - substrs=['intarr = arr = ', - '09 00 00 00', - '....,07 00 00 00']) - else: - self.expect("frame variable other.intarr", - substrs=['intarr = arr = ', - '00 00 00 09', - '....,00 00 00 07']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp deleted file mode 100644 index 9279e414be31..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <string.h> - -struct SomeData -{ - int x; -}; - -struct SomeOtherData -{ - char strarr[32]; - char *strptr; - int intarr[5]; - float flarr[7]; - - SomeOtherData() - { - strcpy(strarr,"Nested Hello world!"); - strptr = new char[128]; - strcpy(strptr,"Nested Hello world!"); - intarr[0] = 9; - intarr[1] = 8; - intarr[2] = 7; - intarr[3] = 6; - intarr[4] = 5; - - flarr[0] = 25.5; - flarr[1] = 25.25; - flarr[2] = 25.125; - flarr[3] = 26.75; - flarr[4] = 27.375; - flarr[5] = 27.5; - flarr[6] = 26.125; - } -}; - -int main (int argc, const char * argv[]) -{ - char strarr[32] = "Hello world!"; - char *strptr = NULL; - strptr = "Hello world!"; - int intarr[5] = {1,1,2,3,5}; - float flarr[7] = {78.5,77.25,78.0,76.125,76.75,76.875,77.0}; - - SomeData data; - - SomeOtherData other; - - float* flptr = flarr; - int* intptr = intarr; - - return 0; // Set break point at this line. - -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile deleted file mode 100644 index fdd717119d95..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make -CXX_SOURCES := main.cpp -CXXFLAGS += -std=c++11 -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py deleted file mode 100644 index 1f7a175974f9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibCxxAtomicTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def get_variable(self, name): - var = self.frame().FindVariable(name) - var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) - var.SetPreferSyntheticValue(True) - return var - - @skipIf(compiler=["gcc"]) - @add_test_categories(["libc++"]) - def test(self): - """Test that std::atomic as defined by libc++ is correctly printed by LLDB""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - bkpt = self.target().FindBreakpointByID( - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.")) - - self.runCmd("run", RUN_SUCCEEDED) - - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - s = self.get_variable('s') - i = self.get_variable('i') - - if self.TraceOn(): - print(s) - if self.TraceOn(): - print(i) - - self.assertTrue(i.GetValueAsUnsigned(0) == 5, "i == 5") - self.assertTrue(s.GetNumChildren() == 2, "s has two children") - self.assertTrue( - s.GetChildAtIndex(0).GetValueAsUnsigned(0) == 1, - "s.x == 1") - self.assertTrue( - s.GetChildAtIndex(1).GetValueAsUnsigned(0) == 2, - "s.y == 2") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp deleted file mode 100644 index 0eb2418c628a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===-- main.cpp --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <atomic> - -struct S { - int x = 1; - int y = 2; -}; - -int main () -{ - std::atomic<S> s; - s.store(S()); - std::atomic<int> i; - i.store(5); - - return 0; // Set break point at this line. -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile deleted file mode 100644 index bf75013f531d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py deleted file mode 100644 index a0da4e41afef..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDataFormatterLibcxxBitset(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - primes = [1]*300 - primes[0] = primes[1] = 0 - for i in range(2, len(primes)): - for j in range(2*i, len(primes), i): - primes[j] = 0 - self.primes = primes - - def check(self, name, size): - var = self.frame().FindVariable(name) - self.assertTrue(var.IsValid()) - self.assertEqual(var.GetNumChildren(), size) - for i in range(size): - child = var.GetChildAtIndex(i) - self.assertEqual(child.GetValueAsUnsigned(), self.primes[i], - "variable: %s, index: %d"%(name, size)) - - @add_test_categories(["libc++"]) - def test_value(self): - """Test that std::bitset is displayed correctly""" - self.build() - lldbutil.run_to_source_breakpoint(self, '// break here', - lldb.SBFileSpec("main.cpp", False)) - - self.check("empty", 0) - self.check("small", 13) - self.check("large", 200) - - @add_test_categories(["libc++"]) - def test_ptr_and_ref(self): - """Test that ref and ptr to std::bitset is displayed correctly""" - self.build() - (_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(self, - 'Check ref and ptr', - lldb.SBFileSpec("main.cpp", False)) - - self.check("ref", 13) - self.check("ptr", 13) - - lldbutil.continue_to_breakpoint(process, bkpt) - - self.check("ref", 200) - self.check("ptr", 200) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp deleted file mode 100644 index 2a1532adb4b2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include <bitset> -#include <stdio.h> - -template<std::size_t N> -void fill(std::bitset<N> &b) { - b.set(); - b[0] = b[1] = false; - for (std::size_t i = 2; i < N; ++i) { - for (std::size_t j = 2*i; j < N; j+=i) - b[j] = false; - } -} - -template<std::size_t N> -void by_ref_and_ptr(std::bitset<N> &ref, std::bitset<N> *ptr) { - // Check ref and ptr - return; -} - -int main() { - std::bitset<0> empty; - std::bitset<13> small; - fill(small); - std::bitset<200> large; - fill(large); - by_ref_and_ptr(small, &small); // break here - by_ref_and_ptr(large, &large); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/Makefile deleted file mode 100644 index bf75013f531d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py deleted file mode 100644 index 1cc454a473a8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDataFormatterLibcxxForwardList(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - self.line = line_number('main.cpp', '// break here') - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - @add_test_categories(["libc++"]) - def test(self): - """Test that std::forward_list is displayed correctly""" - self.build() - lldbutil.run_to_source_breakpoint(self, '// break here', - lldb.SBFileSpec("main.cpp", False)) - - forward_list = self.namespace + '::forward_list' - self.expect("frame variable empty", - substrs=[forward_list, - 'size=0', - '{}']) - - self.expect("frame variable one_elt", - substrs=[forward_list, - 'size=1', - '{', - '[0] = 47', - '}']) - - self.expect("frame variable five_elts", - substrs=[forward_list, - 'size=5', - '{', - '[0] = 1', - '[1] = 22', - '[2] = 333', - '[3] = 4444', - '[4] = 55555', - '}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/main.cpp deleted file mode 100644 index 73abda6e82e5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include <forward_list> - -int main() -{ - std::forward_list<int> empty{}, one_elt{47}, five_elts{1,22,333,4444,55555}; - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile deleted file mode 100644 index fdd717119d95..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../../make -CXX_SOURCES := main.cpp -CXXFLAGS += -std=c++11 -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py deleted file mode 100644 index e44ea61d120f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibCxxFunctionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def get_variable(self, name): - var = self.frame().FindVariable(name) - var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) - var.SetPreferSyntheticValue(True) - return var - - @add_test_categories(["libc++"]) - def test(self): - """Test that std::function as defined by libc++ is correctly printed by LLDB""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - bkpt = self.target().FindBreakpointByID( - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.")) - - 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']) - - self.expect("frame variable f1", - substrs=['f1 = Function = foo(int, int)']) - - self.expect("frame variable f2", - substrs=['f2 = Lambda in File main.cpp at Line 27']) - - self.expect("frame variable f3", - substrs=['f3 = Lambda in File main.cpp at Line 31']) - - self.expect("frame variable f4", - substrs=['f4 = Function in File main.cpp at Line 17']) - - self.expect("frame variable f5", - substrs=['f5 = Function = Bar::add_num(int) const']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp deleted file mode 100644 index 541fdaca2afa..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===-- main.cpp --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <functional> - -int foo(int x, int y) { - return x + y - 1; -} - -struct Bar { - int operator()() { - return 66 ; - } - int add_num(int i) const { return i + 3 ; } -} ; - -int main (int argc, char *argv[]) -{ - int acc = 42; - std::function<int (int,int)> f1 = foo; - std::function<int (int)> f2 = [acc,f1] (int x) -> int { - return x+f1(acc,x); - }; - - auto f = [](int x, int y) { return x + y; }; - auto g = [](int x, int y) { return x * y; } ; - std::function<int (int,int)> f3 = argc %2 ? f : g ; - - Bar bar1 ; - std::function<int ()> f4( bar1 ) ; - std::function<int (const Bar&, int)> f5 = &Bar::add_num; - - return f1(acc,acc) + f2(acc) + f3(acc+1,acc+2) + f4() + f5(bar1, 10); // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile deleted file mode 100644 index d37bef7dc5cc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../../../make -CXX_SOURCES := main.cpp -CXXFLAGS += -std=c++11 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py deleted file mode 100644 index 9c9b2473aa74..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class InitializerListTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfWindows # libc++ not ported to Windows yet - @skipIf(compiler="gcc") - @expectedFailureAll( - oslist=["linux"], - bugnumber="fails on clang 3.5 and tot") - def test(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - bkpt = self.target().FindBreakpointByID( - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.")) - - self.runCmd("run", RUN_SUCCEEDED) - - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - self.expect("frame variable ili", substrs=['[1] = 2', '[4] = 5']) - self.expect("frame variable ils", substrs=[ - '[4] = "surprise it is a long string!! yay!!"']) - - self.expect('image list', substrs=self.getLibcPlusPlusLibs()) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/main.cpp deleted file mode 100644 index 9109a20cb510..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- main.cpp --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <string> -#include <vector> -#include <initializer_list> - -int main () -{ - std::initializer_list<int> ili{1,2,3,4,5}; - std::initializer_list<std::string> ils{"1","2","3","4","surprise it is a long string!! yay!!"}; - - return 0; // Set break point at this line. -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile deleted file mode 100644 index 1f609a41d908..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py deleted file mode 100644 index b36fa6ee1dc8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxIteratorDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that libc++ iterators format properly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), 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) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect('frame variable ivI', substrs=['item = 3']) - self.expect('expr ivI', substrs=['item = 3']) - - self.expect( - 'frame variable iimI', - substrs=[ - 'first = 43981', - 'second = 61681']) - self.expect('expr iimI', substrs=['first = 43981', 'second = 61681']) - - self.expect( - 'frame variable simI', - substrs=[ - 'first = "world"', - 'second = 42']) - self.expect('expr simI', substrs=['first = "world"', 'second = 42']) - - self.expect('frame variable svI', substrs=['item = "hello"']) - self.expect('expr svI', substrs=['item = "hello"']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp deleted file mode 100644 index 9d1cbfd91286..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <string> -#include <map> -#include <vector> - -typedef std::map<int, int> intint_map; -typedef std::map<std::string, int> strint_map; - -typedef std::vector<int> int_vector; -typedef std::vector<std::string> string_vector; - -typedef intint_map::iterator iimter; -typedef strint_map::iterator simter; - -typedef int_vector::iterator ivter; -typedef string_vector::iterator svter; - -int main() -{ - intint_map iim; - iim[0xABCD] = 0xF0F1; - - strint_map sim; - sim["world"] = 42; - - int_vector iv; - iv.push_back(3); - - string_vector sv; - sv.push_back("hello"); - - iimter iimI = iim.begin(); - simter simI = sim.begin(); - - ivter ivI = iv.begin(); - svter svI = sv.begin(); - - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile deleted file mode 100644 index 1f609a41d908..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py deleted file mode 100644 index 86248d1cac24..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py +++ /dev/null @@ -1,220 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxListDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - self.line2 = line_number('main.cpp', - '// Set second break point at this line.') - self.line3 = line_number('main.cpp', - '// Set third break point at this line.') - self.line4 = line_number('main.cpp', - '// Set fourth break point at this line.') - - @add_test_categories(["libc++"]) - @skipIf(debug_info="gmodules", - bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048") - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=-1) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line2, num_expected_locations=-1) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line3, num_expected_locations=-1) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line4, num_expected_locations=-1) - - self.runCmd("run", RUN_SUCCEEDED) - - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("frame variable numbers_list --show-types") - self.runCmd( - "type summary add std::int_list std::string_list int_list string_list --summary-string \"list has ${svar%#} items\" -e") - self.runCmd("type format add -f hex int") - - self.expect("frame variable numbers_list --raw", matching=False, - substrs=['list has 0 items', - '{}']) - - self.expect("frame variable numbers_list", - substrs=['list has 0 items', - '{}']) - - self.expect("p numbers_list", - substrs=['list has 0 items', - '{}']) - - self.runCmd("n") # This gets up past the printf - self.runCmd("n") # Now advance over the first push_back. - - self.expect("frame variable numbers_list", - substrs=['list has 1 items', - '[0] = ', - '0x12345678']) - - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['list has 4 items', - '[0] = ', - '0x12345678', - '[1] =', - '0x11223344', - '[2] =', - '0xbeeffeed', - '[3] =', - '0x00abba00']) - - self.runCmd("n") - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['list has 6 items', - '[0] = ', - '0x12345678', - '0x11223344', - '0xbeeffeed', - '0x00abba00', - '[4] =', - '0x0abcdef0', - '[5] =', - '0x0cab0cab']) - - self.expect("p numbers_list", - substrs=['list has 6 items', - '[0] = ', - '0x12345678', - '0x11223344', - '0xbeeffeed', - '0x00abba00', - '[4] =', - '0x0abcdef0', - '[5] =', - '0x0cab0cab']) - - # check access-by-index - self.expect("frame variable numbers_list[0]", - substrs=['0x12345678']) - self.expect("frame variable numbers_list[1]", - substrs=['0x11223344']) - - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['list has 0 items', - '{}']) - - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['list has 4 items', - '[0] = ', '1', - '[1] = ', '2', - '[2] = ', '3', - '[3] = ', '4']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("numbers_list").MightHaveChildren(), - "numbers_list.MightHaveChildren() says False for non empty!") - - self.runCmd("type format delete int") - - self.runCmd("c") - - self.expect("frame variable text_list", - substrs=['list has 3 items', - '[0]', 'goofy', - '[1]', 'is', - '[2]', 'smart']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("text_list").MightHaveChildren(), - "text_list.MightHaveChildren() says False for non empty!") - - self.expect("p text_list", - substrs=['list has 3 items', - '\"goofy\"', - '\"is\"', - '\"smart\"']) - - self.runCmd("n") # This gets us past the printf - self.runCmd("n") - self.runCmd("n") - - # check access-by-index - self.expect("frame variable text_list[0]", - substrs=['goofy']) - self.expect("frame variable text_list[3]", - substrs=['!!!']) - - self.runCmd("continue") - - # check that the list provider correctly updates if elements move - countingList = self.frame().FindVariable("countingList") - countingList.SetPreferDynamicValue(True) - countingList.SetPreferSyntheticValue(True) - - self.assertTrue(countingList.GetChildAtIndex( - 0).GetValueAsUnsigned(0) == 3141, "list[0] == 3141") - self.assertTrue(countingList.GetChildAtIndex( - 1).GetValueAsUnsigned(0) == 3141, "list[1] == 3141") - - self.runCmd("continue") - - self.assertTrue( - countingList.GetChildAtIndex(0).GetValueAsUnsigned(0) == 3141, - "uniqued list[0] == 3141") - self.assertTrue( - countingList.GetChildAtIndex(1).GetValueAsUnsigned(0) == 3142, - "uniqued list[1] == 3142") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/Makefile deleted file mode 100644 index a5dabdb6349d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py deleted file mode 100644 index f169b448680d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Test that the debugger handles loops in std::list (which can appear as a result of e.g. memory -corruption). -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxListDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @add_test_categories(["libc++"]) - @expectedFailureAndroid(bugnumber="llvm.org/pr32592") - @skipIfDarwin # rdar://25499635 - def test_with_run_command(self): - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target and target.IsValid(), "Target is valid") - - file_spec = lldb.SBFileSpec("main.cpp", False) - breakpoint1 = target.BreakpointCreateBySourceRegex( - '// Set break point at this line.', file_spec) - self.assertTrue(breakpoint1 and breakpoint1.IsValid()) - breakpoint2 = target.BreakpointCreateBySourceRegex( - '// Set second break point at this line.', file_spec) - self.assertTrue(breakpoint2 and breakpoint2.IsValid()) - - # Run the program, it should stop at breakpoint 1. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) - self.assertEqual( - len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint1)), 1) - - # verify our list is displayed correctly - self.expect( - "frame variable *numbers_list", - substrs=[ - '[0] = 1', - '[1] = 2', - '[2] = 3', - '[3] = 4', - '[5] = 6']) - - # Continue to breakpoint 2. - process.Continue() - self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) - self.assertEqual( - len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint2)), 1) - - # The list is now inconsistent. However, we should be able to get the first three - # elements at least (and most importantly, not crash). - self.expect( - "frame variable *numbers_list", - substrs=[ - '[0] = 1', - '[1] = 2', - '[2] = 3']) - - # Run to completion. - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/main.cpp deleted file mode 100644 index 7c623e9a68b5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Evil hack: To simulate memory corruption, we want to fiddle with some internals of std::list. -// Make those accessible to us. -#define private public -#define protected public - -#include <list> -#include <stdio.h> -#include <assert.h> - -typedef std::list<int> int_list; - -int main() -{ -#ifdef LLDB_USING_LIBCPP - int_list *numbers_list = new int_list{1,2,3,4,5,6,7,8,9,10}; - - printf("// Set break point at this line."); - auto *third_elem = numbers_list->__end_.__next_->__next_->__next_; - assert(third_elem->__value_ == 3); - auto *fifth_elem = third_elem->__next_->__next_; - assert(fifth_elem->__value_ == 5); - fifth_elem->__next_ = third_elem; -#endif - - // Any attempt to free the list will probably crash the program. Let's just leak it. - return 0; // Set second break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp deleted file mode 100644 index 56375874f37e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include <string> -#include <list> -#include <stdio.h> - -typedef std::list<int> int_list; -typedef std::list<std::string> string_list; - -int main() -{ - int_list numbers_list; - - printf("// Set break point at this line."); - (numbers_list.push_back(0x12345678)); - (numbers_list.push_back(0x11223344)); - (numbers_list.push_back(0xBEEFFEED)); - (numbers_list.push_back(0x00ABBA00)); - (numbers_list.push_back(0x0ABCDEF0)); - (numbers_list.push_back(0x0CAB0CAB)); - - numbers_list.clear(); - - (numbers_list.push_back(1)); - (numbers_list.push_back(2)); - (numbers_list.push_back(3)); - (numbers_list.push_back(4)); - - string_list text_list; - (text_list.push_back(std::string("goofy"))); - (text_list.push_back(std::string("is"))); - (text_list.push_back(std::string("smart"))); - - printf("// Set second break point at this line."); - (text_list.push_back(std::string("!!!"))); - - std::list<int> countingList = {3141, 3142, 3142,3142,3142, 3142, 3142, 3141}; - countingList.sort(); - printf("// Set third break point at this line."); - countingList.unique(); - printf("// Set fourth break point at this line."); - countingList.size(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile deleted file mode 100644 index 1f609a41d908..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py deleted file mode 100644 index 0f57f0abd9ce..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py +++ /dev/null @@ -1,314 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxMapDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - bkpt = self.target().FindBreakpointByID( - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.")) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - ns = self.namespace - self.expect('frame variable ii', - substrs=['%s::map' % ns, - 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ii', - substrs=['%s::map' % ns, 'size=2', - '[0] = ', - 'first = 0', - 'second = 0', - '[1] = ', - 'first = 1', - 'second = 1']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ii', - substrs=['%s::map' % ns, 'size=4', - '[2] = ', - 'first = 2', - 'second = 0', - '[3] = ', - 'first = 3', - 'second = 1']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable ii", - substrs=['%s::map' % ns, 'size=8', - '[5] = ', - 'first = 5', - 'second = 0', - '[7] = ', - 'first = 7', - 'second = 1']) - - self.expect("p ii", - substrs=['%s::map' % ns, 'size=8', - '[5] = ', - 'first = 5', - 'second = 0', - '[7] = ', - 'first = 7', - 'second = 1']) - - # check access-by-index - self.expect("frame variable ii[0]", - substrs=['first = 0', - 'second = 0']) - self.expect("frame variable ii[3]", - substrs=['first =', - 'second =']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("ii").MightHaveChildren(), - "ii.MightHaveChildren() says False for non empty!") - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression ii[8]", matching=False, error=True, - # substrs = ['1234567']) - - self.runCmd("continue") - - self.expect('frame variable ii', - substrs=['%s::map' % ns, 'size=0', - '{}']) - - self.expect('frame variable si', - substrs=['%s::map' % ns, 'size=0', - '{}']) - - self.runCmd("continue") - - self.expect('frame variable si', - substrs=['%s::map' % ns, 'size=1', - '[0] = ', - 'first = \"zero\"', - 'second = 0']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable si", - substrs=['%s::map' % ns, 'size=4', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3']) - - self.expect("p si", - substrs=['%s::map' % ns, 'size=4', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("si").MightHaveChildren(), - "si.MightHaveChildren() says False for non empty!") - - # check access-by-index - self.expect("frame variable si[0]", - substrs=['first = ', 'one', - 'second = 1']) - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression si[0]", matching=False, error=True, - # substrs = ['first = ', 'zero']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable si', - substrs=['%s::map' % ns, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable is', - substrs=['%s::map' % ns, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable is", - substrs=['%s::map' % ns, 'size=4', - '[0] = ', - 'second = \"goofy\"', - 'first = 85', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - self.expect("p is", - substrs=['%s::map' % ns, 'size=4', - '[0] = ', - 'second = \"goofy\"', - 'first = 85', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("is").MightHaveChildren(), - "is.MightHaveChildren() says False for non empty!") - - # check access-by-index - self.expect("frame variable is[0]", - substrs=['first = ', - 'second =']) - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression is[0]", matching=False, error=True, - # substrs = ['first = ', 'goofy']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable is', - substrs=['%s::map' % ns, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ss', - substrs=['%s::map' % ns, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable ss", - substrs=['%s::map' % ns, 'size=3', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"']) - - self.expect("p ss", - substrs=['%s::map' % ns, 'size=3', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("ss").MightHaveChildren(), - "ss.MightHaveChildren() says False for non empty!") - - # check access-by-index - self.expect("frame variable ss[2]", - substrs=['gatto', 'cat']) - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression ss[3]", matching=False, error=True, - # substrs = ['gatto']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ss', - substrs=['%s::map' % ns, 'size=0', - '{}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp deleted file mode 100644 index da6eca985d20..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include <string> -#include <map> - -#define intint_map std::map<int, int> -#define strint_map std::map<std::string, int> -#define intstr_map std::map<int, std::string> -#define strstr_map std::map<std::string, std::string> - -int g_the_foo = 0; - -int thefoo_rw(int arg = 1) -{ - if (arg < 0) - arg = 0; - if (!arg) - arg = 1; - g_the_foo += arg; - return g_the_foo; -} - -int main() -{ - intint_map ii; - - ii[0] = 0; // Set break point at this line. - ii[1] = 1; - thefoo_rw(1); // Set break point at this line. - ii[2] = 0; - ii[3] = 1; - thefoo_rw(1); // Set break point at this line. - ii[4] = 0; - ii[5] = 1; - ii[6] = 0; - ii[7] = 1; - thefoo_rw(1); // Set break point at this line. - ii[85] = 1234567; - - ii.clear(); - - strint_map si; - thefoo_rw(1); // Set break point at this line. - - si["zero"] = 0; - thefoo_rw(1); // Set break point at this line. - si["one"] = 1; - si["two"] = 2; - si["three"] = 3; - thefoo_rw(1); // Set break point at this line. - si["four"] = 4; - - si.clear(); - thefoo_rw(1); // Set break point at this line. - - intstr_map is; - thefoo_rw(1); // Set break point at this line. - is[85] = "goofy"; - is[1] = "is"; - is[2] = "smart"; - is[3] = "!!!"; - thefoo_rw(1); // Set break point at this line. - - is.clear(); - thefoo_rw(1); // Set break point at this line. - - strstr_map ss; - thefoo_rw(1); // Set break point at this line. - - ss["ciao"] = "hello"; - ss["casa"] = "house"; - ss["gatto"] = "cat"; - thefoo_rw(1); // Set break point at this line. - ss["a Mac.."] = "..is always a Mac!"; - - ss.clear(); - thefoo_rw(1); // Set break point at this line. - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/Makefile deleted file mode 100644 index 1f609a41d908..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py deleted file mode 100644 index cbcce47d364d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py +++ /dev/null @@ -1,314 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxMultiMapDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - bkpt = self.target().FindBreakpointByID( - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.")) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - multimap = self.namespace + "::multimap" - self.expect('frame variable ii', - substrs=[multimap, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ii', - substrs=[multimap, 'size=2', - '[0] = ', - 'first = 0', - 'second = 0', - '[1] = ', - 'first = 1', - 'second = 1']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ii', - substrs=[multimap, 'size=4', - '[2] = ', - 'first = 2', - 'second = 0', - '[3] = ', - 'first = 3', - 'second = 1']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable ii", - substrs=[multimap, 'size=8', - '[5] = ', - 'first = 5', - 'second = 0', - '[7] = ', - 'first = 7', - 'second = 1']) - - self.expect("p ii", - substrs=[multimap, 'size=8', - '[5] = ', - 'first = 5', - 'second = 0', - '[7] = ', - 'first = 7', - 'second = 1']) - - # check access-by-index - self.expect("frame variable ii[0]", - substrs=['first = 0', - 'second = 0']) - self.expect("frame variable ii[3]", - substrs=['first =', - 'second =']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("ii").MightHaveChildren(), - "ii.MightHaveChildren() says False for non empty!") - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression ii[8]", matching=False, error=True, - # substrs = ['1234567']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ii', - substrs=[multimap, 'size=0', - '{}']) - - self.expect('frame variable si', - substrs=[multimap, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable si', - substrs=[multimap, 'size=1', - '[0] = ', - 'first = \"zero\"', - 'second = 0']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable si", - substrs=[multimap, 'size=4', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3']) - - self.expect("p si", - substrs=[multimap, 'size=4', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("si").MightHaveChildren(), - "si.MightHaveChildren() says False for non empty!") - - # check access-by-index - self.expect("frame variable si[0]", - substrs=['first = ', 'one', - 'second = 1']) - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression si[0]", matching=False, error=True, - # substrs = ['first = ', 'zero']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable si', - substrs=[multimap, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable is', - substrs=[multimap, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable is", - substrs=[multimap, 'size=4', - '[0] = ', - 'second = \"goofy\"', - 'first = 85', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - self.expect("p is", - substrs=[multimap, 'size=4', - '[0] = ', - 'second = \"goofy\"', - 'first = 85', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("is").MightHaveChildren(), - "is.MightHaveChildren() says False for non empty!") - - # check access-by-index - self.expect("frame variable is[0]", - substrs=['first = ', - 'second =']) - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression is[0]", matching=False, error=True, - # substrs = ['first = ', 'goofy']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable is', - substrs=[multimap, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ss', - substrs=[multimap, 'size=0', - '{}']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable ss", - substrs=[multimap, 'size=3', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"']) - - self.expect("p ss", - substrs=[multimap, 'size=3', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("ss").MightHaveChildren(), - "ss.MightHaveChildren() says False for non empty!") - - # check access-by-index - self.expect("frame variable ss[2]", - substrs=['gatto', 'cat']) - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression ss[3]", matching=False, error=True, - # substrs = ['gatto']) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect('frame variable ss', - substrs=[multimap, 'size=0', - '{}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/main.cpp deleted file mode 100644 index 27bdc0a57729..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/main.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include <string> -#include <map> - -#define intint_map std::multimap<int, int> -#define strint_map std::multimap<std::string, int> -#define intstr_map std::multimap<int, std::string> -#define strstr_map std::multimap<std::string, std::string> - -int g_the_foo = 0; - -int thefoo_rw(int arg = 1) -{ - if (arg < 0) - arg = 0; - if (!arg) - arg = 1; - g_the_foo += arg; - return g_the_foo; -} - -int main() -{ - intint_map ii; - - ii.emplace(0,0); // Set break point at this line. - ii.emplace(1,1); - thefoo_rw(1); // Set break point at this line. - ii.emplace(2,0); - ii.emplace(3,1); - thefoo_rw(1); // Set break point at this line. - ii.emplace(4,0); - ii.emplace(5,1); - ii.emplace(6,0); - ii.emplace(7,1); - thefoo_rw(1); // Set break point at this line. - ii.emplace(85,1234567); - - ii.clear(); - - strint_map si; - thefoo_rw(1); // Set break point at this line. - - si.emplace("zero",0); - thefoo_rw(1); // Set break point at this line. - si.emplace("one",1); - si.emplace("two",2); - si.emplace("three",3); - thefoo_rw(1); // Set break point at this line. - si.emplace("four",4); - - si.clear(); - thefoo_rw(1); // Set break point at this line. - - intstr_map is; - thefoo_rw(1); // Set break point at this line. - is.emplace(85,"goofy"); - is.emplace(1,"is"); - is.emplace(2,"smart"); - is.emplace(3,"!!!"); - thefoo_rw(1); // Set break point at this line. - - is.clear(); - thefoo_rw(1); // Set break point at this line. - - strstr_map ss; - thefoo_rw(1); // Set break point at this line. - - ss.emplace("ciao","hello"); - ss.emplace("casa","house"); - ss.emplace("gatto","cat"); - thefoo_rw(1); // Set break point at this line. - ss.emplace("a Mac..","..is always a Mac!"); - - ss.clear(); - thefoo_rw(1); // Set break point at this line. - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/Makefile deleted file mode 100644 index 1f609a41d908..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py deleted file mode 100644 index 0732c03de837..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py +++ /dev/null @@ -1,145 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxMultiSetDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - def getVariableType(self, name): - var = self.frame().FindVariable(name) - self.assertTrue(var.IsValid()) - return var.GetType().GetCanonicalType().GetName() - - def check_ii(self, var_name): - """ This checks the value of the bitset stored in ii at the call to by_ref_and_ptr. - We use this to make sure we get the same values for ii when we look at the object - directly, and when we look at a reference to the object. """ - self.expect( - "frame variable " + var_name, - substrs=["size=7", - "[2] = 2", - "[3] = 3", - "[6] = 6"]) - self.expect("frame variable " + var_name + "[2]", substrs=[" = 2"]) - self.expect( - "p " + var_name, - substrs=[ - "size=7", - "[2] = 2", - "[3] = 3", - "[6] = 6"]) - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - (self.target, process, _, bkpt) = lldbutil.run_to_source_breakpoint( - self, "Set break point at this line.", lldb.SBFileSpec("main.cpp", False)) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - ii_type = self.getVariableType("ii") - self.assertTrue(ii_type.startswith(self.namespace + "::multiset"), - "Type: " + ii_type) - - self.expect("frame variable ii", substrs=["size=0", "{}"]) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ii", - substrs=[ - "size=6", - "[0] = 0", - "[1] = 1", - "[2] = 2", - "[3] = 3", - "[4] = 4", - "[5] = 5"]) - lldbutil.continue_to_breakpoint(process, bkpt) - - self.check_ii("ii") - - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect("frame variable ii", substrs=["size=0", "{}"]) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect("frame variable ii", substrs=["size=0", "{}"]) - ss_type = self.getVariableType("ss") - self.assertTrue(ss_type.startswith(self.namespace + "::multiset"), - "Type: " + ss_type) - self.expect("frame variable ss", substrs=["size=0", "{}"]) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ss", - substrs=[ - "size=2", - '[0] = "a"', - '[1] = "a very long string is right here"']) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ss", - substrs=[ - "size=4", - '[2] = "b"', - '[3] = "c"', - '[0] = "a"', - '[1] = "a very long string is right here"']) - self.expect( - "p ss", - substrs=[ - "size=4", - '[2] = "b"', - '[3] = "c"', - '[0] = "a"', - '[1] = "a very long string is right here"']) - self.expect("frame variable ss[2]", substrs=[' = "b"']) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ss", - substrs=[ - "size=3", - '[0] = "a"', - '[1] = "a very long string is right here"', - '[2] = "c"']) - - @add_test_categories(["libc++"]) - def test_ref_and_ptr(self): - """Test that the data formatters work on ref and ptr.""" - self.build() - (self.target, process, _, bkpt) = lldbutil.run_to_source_breakpoint( - self, "Stop here to check by ref and ptr.", - lldb.SBFileSpec("main.cpp", False)) - # The reference should print just like the value: - self.check_ii("ref") - - self.expect("frame variable ptr", - substrs=["ptr =", "size=7"]) - self.expect("expr ptr", - substrs=["size=7"]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/main.cpp deleted file mode 100644 index dd3d8be4ae91..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include <string> -#include <set> - -typedef std::multiset<int> intset; -typedef std::multiset<std::string> stringset; - -int g_the_foo = 0; - -int thefoo_rw(int arg = 1) -{ - if (arg < 0) - arg = 0; - if (!arg) - arg = 1; - g_the_foo += arg; - return g_the_foo; -} - -void by_ref_and_ptr(intset &ref, intset *ptr) -{ - // Stop here to check by ref and ptr - return; -} - -int main() -{ - intset ii; - thefoo_rw(1); // Set break point at this line. - - ii.insert(0); - ii.insert(1); - ii.insert(2); - ii.insert(3); - ii.insert(4); - ii.insert(5); - thefoo_rw(1); // Set break point at this line. - - ii.insert(6); - thefoo_rw(1); // Set break point at this line. - - by_ref_and_ptr(ii, &ii); - - ii.clear(); - thefoo_rw(1); // Set break point at this line. - - stringset ss; - thefoo_rw(1); // Set break point at this line. - - ss.insert("a"); - ss.insert("a very long string is right here"); - thefoo_rw(1); // Set break point at this line. - - ss.insert("b"); - ss.insert("c"); - thefoo_rw(1); // Set break point at this line. - - ss.erase("b"); - thefoo_rw(1); // Set break point at this line. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile deleted file mode 100644 index 19d6fc3e3c25..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -std=c++17 -fno-exceptions diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/TestDataFormatterLibcxxOptional.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/TestDataFormatterLibcxxOptional.py deleted file mode 100644 index 7826305931da..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/TestDataFormatterLibcxxOptional.py +++ /dev/null @@ -1,75 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxOptionalDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(["libc++"]) - ## We are skipping clang version less that 5.0 since this test requires -std=c++17 - @skipIf(oslist=no_match(["macosx"]), compiler="clang", compiler_version=['<', '5.0']) - ## We are skipping gcc version less that 5.1 since this test requires -std=c++17 - @skipIf(compiler="gcc", compiler_version=['<', '5.1']) - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - bkpt = self.target().FindBreakpointByID( - lldbutil.run_break_set_by_source_regexp( - self, "break here")) - - 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']) - - self.runCmd( "frame variable has_optional" ) - - output = self.res.GetOutput() - - ## The variable has_optional tells us if the test program - ## detected we have a sufficient libc++ version to support optional - ## false means we do not and therefore should skip the test - if output.find("(bool) has_optional = false") != -1 : - self.skipTest( "Optional not supported" ) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - self.expect("frame variable number_not_engaged", - substrs=['Has Value=false']) - - self.expect("frame variable number_engaged", - substrs=['Has Value=true', - 'Value = 42', - '}']) - - self.expect("frame var numbers", - substrs=['(optional_int_vect) numbers = Has Value=true {', - 'Value = size=4 {', - '[0] = 1', - '[1] = 2', - '[2] = 3', - '[3] = 4', - '}', - '}']) - - self.expect("frame var ostring", - substrs=['(optional_string) ostring = Has Value=true {', - 'Value = "hello"', - '}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/main.cpp deleted file mode 100644 index 16bb98c61056..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include <cstdio> -#include <string> -#include <vector> - -// If we have libc++ 4.0 or greater we should have <optional> -// According to libc++ C++1z status page https://libcxx.llvm.org/cxx1z_status.html -#if _LIBCPP_VERSION >= 4000 -#include <optional> -#define HAVE_OPTIONAL 1 -#else -#define HAVE_OPTIONAL 0 -#endif - - -int main() -{ - bool has_optional = HAVE_OPTIONAL ; - - printf( "%d\n", has_optional ) ; // break here - -#if HAVE_OPTIONAL == 1 - using int_vect = std::vector<int> ; - using optional_int = std::optional<int> ; - using optional_int_vect = std::optional<int_vect> ; - using optional_string = std::optional<std::string> ; - - optional_int number_not_engaged ; - optional_int number_engaged = 42 ; - - printf( "%d\n", *number_engaged) ; - - optional_int_vect numbers{{1,2,3,4}} ; - - printf( "%d %d\n", numbers.value()[0], numbers.value()[1] ) ; - - optional_string ostring = "hello" ; - - printf( "%s\n", ostring->c_str() ) ; -#endif - - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile deleted file mode 100644 index bf75013f531d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py deleted file mode 100644 index f9eb4d82025e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py +++ /dev/null @@ -1,44 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDataFormatterLibcxxQueue(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - def check_variable(self, name): - var = self.frame().FindVariable(name) - self.assertTrue(var.IsValid()) - - queue = self.namespace + '::queue' - self.assertTrue(queue in var.GetTypeName()) - self.assertEqual(var.GetNumChildren(), 5) - for i in range(5): - ch = var.GetChildAtIndex(i) - self.assertTrue(ch.IsValid()) - self.assertEqual(ch.GetValueAsSigned(), i+1) - - @expectedFailureAll(bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android") - @add_test_categories(["libc++"]) - def test(self): - """Test that std::queue is displayed correctly""" - self.build() - lldbutil.run_to_source_breakpoint(self, '// break here', - lldb.SBFileSpec("main.cpp", False)) - - self.check_variable('q1') - self.check_variable('q2') diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp deleted file mode 100644 index 449be8d99cf6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include <queue> -#include <vector> - -using namespace std; - -int main() { - queue<int> q1{{1,2,3,4,5}}; - queue<int, std::vector<int>> q2{{1,2,3,4,5}}; - int ret = q1.size() + q2.size(); // break here - return ret; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/Makefile deleted file mode 100644 index 1f609a41d908..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py deleted file mode 100644 index 8d83f2b081f8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py +++ /dev/null @@ -1,142 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxSetDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - def getVariableType(self, name): - var = self.frame().FindVariable(name) - self.assertTrue(var.IsValid()) - return var.GetType().GetCanonicalType().GetName() - - def check_ii(self, var_name): - """ This checks the value of the bitset stored in ii at the call to by_ref_and_ptr. - We use this to make sure we get the same values for ii when we look at the object - directly, and when we look at a reference to the object. """ - self.expect( - "frame variable " + var_name, - substrs=["size=7", - "[2] = 2", - "[3] = 3", - "[6] = 6"]) - self.expect("frame variable " + var_name + "[2]", substrs=[" = 2"]) - self.expect( - "p " + var_name, - substrs=[ - "size=7", - "[2] = 2", - "[3] = 3", - "[6] = 6"]) - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - (self.target, process, _, bkpt) = lldbutil.run_to_source_breakpoint( - self, "Set break point at this line.", lldb.SBFileSpec("main.cpp", False)) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - ii_type = self.getVariableType("ii") - self.assertTrue(ii_type.startswith(self.namespace + "::set"), - "Type: " + ii_type) - - self.expect("frame variable ii", substrs=["size=0", "{}"]) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ii", - substrs=["size=6", - "[0] = 0", - "[1] = 1", - "[2] = 2", - "[3] = 3", - "[4] = 4", - "[5] = 5"]) - lldbutil.continue_to_breakpoint(process, bkpt) - self.check_ii("ii") - - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect("frame variable ii", substrs=["size=0", "{}"]) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect("frame variable ii", substrs=["size=0", "{}"]) - - ss_type = self.getVariableType("ss") - self.assertTrue(ii_type.startswith(self.namespace + "::set"), - "Type: " + ss_type) - - self.expect("frame variable ss", substrs=["size=0", "{}"]) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ss", - substrs=["size=2", - '[0] = "a"', - '[1] = "a very long string is right here"']) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ss", - substrs=["size=4", - '[2] = "b"', - '[3] = "c"', - '[0] = "a"', - '[1] = "a very long string is right here"']) - self.expect( - "p ss", - substrs=["size=4", - '[2] = "b"', - '[3] = "c"', - '[0] = "a"', - '[1] = "a very long string is right here"']) - self.expect("frame variable ss[2]", substrs=[' = "b"']) - lldbutil.continue_to_breakpoint(process, bkpt) - self.expect( - "frame variable ss", - substrs=["size=3", - '[0] = "a"', - '[1] = "a very long string is right here"', - '[2] = "c"']) - - @add_test_categories(["libc++"]) - def test_ref_and_ptr(self): - """Test that the data formatters work on ref and ptr.""" - self.build() - (self.target, process, _, bkpt) = lldbutil.run_to_source_breakpoint( - self, "Stop here to check by ref and ptr.", - lldb.SBFileSpec("main.cpp", False)) - # The reference should print just like the value: - self.check_ii("ref") - - self.expect("frame variable ptr", - substrs=["ptr =", "size=7"]) - self.expect("expr ptr", - substrs=["size=7"]) - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/main.cpp deleted file mode 100644 index df39e9746c03..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include <string> -#include <set> - -typedef std::set<int> intset; -typedef std::set<std::string> stringset; - -int g_the_foo = 0; - -int thefoo_rw(int arg = 1) -{ - if (arg < 0) - arg = 0; - if (!arg) - arg = 1; - g_the_foo += arg; - return g_the_foo; -} - -void by_ref_and_ptr(intset &ref, intset *ptr) -{ - // Stop here to check by ref and ptr - return; -} - -int main() -{ - intset ii; - thefoo_rw(1); // Set break point at this line. - - ii.insert(0); - ii.insert(1); - ii.insert(2); - ii.insert(3); - ii.insert(4); - ii.insert(5); - thefoo_rw(1); // Set break point at this line. - - ii.insert(6); - thefoo_rw(1); // Set break point at this line. - - by_ref_and_ptr(ii, &ii); - - ii.clear(); - thefoo_rw(1); // Set break point at this line. - - stringset ss; - thefoo_rw(1); // Set break point at this line. - - ss.insert("a"); - ss.insert("a very long string is right here"); - thefoo_rw(1); // Set break point at this line. - - ss.insert("b"); - ss.insert("c"); - thefoo_rw(1); // Set break point at this line. - - ss.erase("b"); - thefoo_rw(1); // Set break point at this line. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile deleted file mode 100644 index 937b47ea06b0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -std=c++11 -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py deleted file mode 100644 index 63164f78e00e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf8 -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxStringDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - @add_test_categories(["libc++"]) - @expectedFailureAll(bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android") - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), 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) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - ns = self.namespace - self.expect( - "frame variable", - substrs=[ - '(%s::wstring) s = L"hello world! מזל טוב!"'%ns, - '(%s::wstring) S = L"!!!!"'%ns, - '(const wchar_t *) mazeltov = 0x', - 'L"מזל טוב"', - '(%s::string) q = "hello world"'%ns, - '(%s::string) Q = "quite a long std::strin with lots of info inside it"'%ns, - '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns, - '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns, - '(%s::u16string) u16_string = u"ß水氶"'%ns, - '(%s::u32string) u32_string = U"🍄🍅🍆🍌"'%ns]) - - self.runCmd("n") - - TheVeryLongOne = self.frame().FindVariable("TheVeryLongOne") - summaryOptions = lldb.SBTypeSummaryOptions() - summaryOptions.SetCapping(lldb.eTypeSummaryUncapped) - uncappedSummaryStream = lldb.SBStream() - TheVeryLongOne.GetSummary(uncappedSummaryStream, summaryOptions) - uncappedSummary = uncappedSummaryStream.GetData() - self.assertTrue(uncappedSummary.find("someText") > 0, - "uncappedSummary does not include the full string") - summaryOptions.SetCapping(lldb.eTypeSummaryCapped) - cappedSummaryStream = lldb.SBStream() - TheVeryLongOne.GetSummary(cappedSummaryStream, summaryOptions) - cappedSummary = cappedSummaryStream.GetData() - self.assertTrue( - cappedSummary.find("someText") <= 0, - "cappedSummary includes the full string") - - self.expect( - "frame variable", - substrs=[ - '(%s::wstring) s = L"hello world! מזל טוב!"'%ns, - '(%s::wstring) S = L"!!!!!"'%ns, - '(const wchar_t *) mazeltov = 0x', - 'L"מזל טוב"', - '(%s::string) q = "hello world"'%ns, - '(%s::string) Q = "quite a long std::strin with lots of info inside it"'%ns, - '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns, - '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns, - '(%s::u16string) u16_string = u"ß水氶"'%ns, - '(%s::u32string) u32_string = U"🍄🍅🍆🍌"'%ns]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp deleted file mode 100644 index 838a4c71be1a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include <string> - -int main() -{ - std::wstring s(L"hello world! מזל טוב!"); - std::wstring S(L"!!!!"); - const wchar_t *mazeltov = L"מזל טוב"; - std::string q("hello world"); - std::string Q("quite a long std::strin with lots of info inside it"); - std::string TheVeryLongOne("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890someText1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"); - std::string IHaveEmbeddedZeros("a\0b\0c\0d",7); - std::wstring IHaveEmbeddedZerosToo(L"hello world!\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監", 38); - std::u16string u16_string(u"ß水氶"); - std::u32string u32_string(U"🍄🍅🍆🍌"); - S.assign(L"!!!!!"); // Set break point at this line. - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile deleted file mode 100644 index bf75013f531d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py deleted file mode 100644 index b25540056a24..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestDataFormatterLibcxxTuple(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - self.line = line_number('main.cpp', '// break here') - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - @add_test_categories(["libc++"]) - def test(self): - """Test that std::tuple is displayed correctly""" - self.build() - lldbutil.run_to_source_breakpoint(self, '// break here', - lldb.SBFileSpec("main.cpp", False)) - - tuple_name = self.namespace + '::tuple' - self.expect("frame variable empty", - substrs=[tuple_name, - 'size=0', - '{}']) - - self.expect("frame variable one_elt", - substrs=[tuple_name, - 'size=1', - '{', - '[0] = 47', - '}']) - - self.expect("frame variable three_elts", - substrs=[tuple_name, - 'size=3', - '{', - '[0] = 1', - '[1] = 47', - '[2] = "foo"', - '}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp deleted file mode 100644 index 1c0d0f2ae774..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include <tuple> -#include <string> - -using namespace std; - -int main() { - tuple<> empty; - tuple<int> one_elt{47}; - tuple<int, long, string> three_elts{1, 47l, "foo"}; - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/Makefile deleted file mode 100644 index 24d7c220d075..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -# Work around "exception specification in declaration does not match previous -# declaration" errors present in older libc++ releases. This error was fixed in -# the 3.8 release. -CFLAGS_EXTRAS += -fno-exceptions - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py deleted file mode 100644 index 4c60e403f6b0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py +++ /dev/null @@ -1,82 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxUnorderedDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - ns = 'ndk' if lldbplatformutil.target_is_android() else '' - self.namespace = 'std::__' + ns + '1' - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.") - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - ns = self.namespace - self.look_for_content_and_continue( - "map", ['%s::unordered_map' % - ns, 'size=5 {', 'hello', 'world', 'this', 'is', 'me']) - - self.look_for_content_and_continue( - "mmap", ['%s::unordered_multimap' % ns, 'size=6 {', 'first = 3', 'second = "this"', - 'first = 2', 'second = "hello"']) - - self.look_for_content_and_continue( - "iset", ['%s::unordered_set' % - ns, 'size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2']) - - self.look_for_content_and_continue( - "sset", ['%s::unordered_set' % ns, 'size=5 {', '\[\d\] = "is"', '\[\d\] = "world"', - '\[\d\] = "hello"']) - - self.look_for_content_and_continue( - "imset", ['%s::unordered_multiset' % ns, 'size=6 {', '(\[\d\] = 3(\\n|.)+){3}', - '\[\d\] = 2', '\[\d\] = 1']) - - self.look_for_content_and_continue( - "smset", ['%s::unordered_multiset' % ns, 'size=5 {', '(\[\d\] = "is"(\\n|.)+){2}', - '(\[\d\] = "world"(\\n|.)+){2}']) - - def look_for_content_and_continue(self, var_name, patterns): - self.expect(("frame variable %s" % var_name), patterns=patterns) - self.expect(("frame variable %s" % var_name), patterns=patterns) - self.runCmd("continue") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/main.cpp deleted file mode 100644 index 81a5763559d3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/main.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include <string> -#include <unordered_map> -#include <unordered_set> - -using std::string; - -#define intstr_map std::unordered_map<int, string> -#define intstr_mmap std::unordered_multimap<int, string> - -#define int_set std::unordered_set<int> -#define str_set std::unordered_set<string> -#define int_mset std::unordered_multiset<int> -#define str_mset std::unordered_multiset<string> - -int g_the_foo = 0; - -int thefoo_rw(int arg = 1) -{ - if (arg < 0) - arg = 0; - if (!arg) - arg = 1; - g_the_foo += arg; - return g_the_foo; -} - -int main() -{ - intstr_map map; - map.emplace(1,"hello"); - map.emplace(2,"world"); - map.emplace(3,"this"); - map.emplace(4,"is"); - map.emplace(5,"me"); - thefoo_rw(); // Set break point at this line. - - intstr_mmap mmap; - mmap.emplace(1,"hello"); - mmap.emplace(2,"hello"); - mmap.emplace(2,"world"); - mmap.emplace(3,"this"); - mmap.emplace(3,"this"); - mmap.emplace(3,"this"); - thefoo_rw(); // Set break point at this line. - - int_set iset; - iset.emplace(1); - iset.emplace(2); - iset.emplace(3); - iset.emplace(4); - iset.emplace(5); - thefoo_rw(); // Set break point at this line. - - str_set sset; - sset.emplace("hello"); - sset.emplace("world"); - sset.emplace("this"); - sset.emplace("is"); - sset.emplace("me"); - thefoo_rw(); // Set break point at this line. - - int_mset imset; - imset.emplace(1); - imset.emplace(2); - imset.emplace(2); - imset.emplace(3); - imset.emplace(3); - imset.emplace(3); - thefoo_rw(); // Set break point at this line. - - str_mset smset; - smset.emplace("hello"); - smset.emplace("world"); - smset.emplace("world"); - smset.emplace("is"); - smset.emplace("is"); - thefoo_rw(); // Set break point at this line. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile deleted file mode 100644 index a6ea665ef63c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -std=c++17 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py deleted file mode 100644 index e1f6961b465d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class LibcxxVariantDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(["libc++"]) - ## We are skipping clang version less that 5.0 since this test requires -std=c++17 - @skipIf(oslist=no_match(["macosx"]), compiler="clang", compiler_version=['<', '5.0']) - ## We are skipping gcc version less that 5.1 since this test requires -std=c++17 - @skipIf(compiler="gcc", compiler_version=['<', '5.1']) - ## std::get is unavailable for std::variant before macOS 10.14 - @skipIf(macos_version=["<", "10.14"]) - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - - (self.target, self.process, _, bkpt) = lldbutil.run_to_source_breakpoint(self, '// break here', - lldb.SBFileSpec("main.cpp", False)) - - self.runCmd( "frame variable has_variant" ) - - output = self.res.GetOutput() - - ## The variable has_variant tells us if the test program - ## detected we have a sufficient libc++ version to support variant - ## false means we do not and therefore should skip the test - if output.find("(bool) has_variant = false") != -1 : - self.skipTest( "std::variant not supported" ) - - lldbutil.continue_to_breakpoint(self.process, bkpt) - - self.expect("frame variable v1", - substrs=['v1 = Active Type = int {', - 'Value = 12', - '}']) - - self.expect("frame variable v1_ref", - substrs=['v1_ref = Active Type = int : {', - 'Value = 12', - '}']) - - self.expect("frame variable v_v1", - substrs=['v_v1 = Active Type = std::__1::variant<int, double, char> {', - 'Value = Active Type = int {', - 'Value = 12', - '}', - '}']) - - lldbutil.continue_to_breakpoint(self.process, bkpt) - - self.expect("frame variable v1", - substrs=['v1 = Active Type = double {', - 'Value = 2', - '}']) - - lldbutil.continue_to_breakpoint(self.process, bkpt) - - self.expect("frame variable v2", - substrs=['v2 = Active Type = double {', - 'Value = 2', - '}']) - - self.expect("frame variable v3", - substrs=['v3 = Active Type = char {', - 'Value = \'A\'', - '}']) - - self.expect("frame variable v_no_value", - substrs=['v_no_value = No Value']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp deleted file mode 100644 index c0bc4ae12c1a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include <cstdio> -#include <string> -#include <vector> - -// If we have libc++ 4.0 or greater we should have <variant> -// According to libc++ C++1z status page https://libcxx.llvm.org/cxx1z_status.html -#if _LIBCPP_VERSION >= 4000 -#include <variant> -#define HAVE_VARIANT 1 -#else -#define HAVE_VARIANT 0 -#endif - -struct S { - operator int() { throw 42; } -} ; - - -int main() -{ - bool has_variant = HAVE_VARIANT ; - - printf( "%d\n", has_variant ) ; // break here - -#if HAVE_VARIANT == 1 - std::variant<int, double, char> v1; - std::variant<int, double, char> &v1_ref = v1; - std::variant<int, double, char> v2; - std::variant<int, double, char> v3; - std::variant<std::variant<int,double,char>> v_v1 ; - std::variant<int, double, char> v_no_value; - - v1 = 12; // v contains int - v_v1 = v1 ; - int i = std::get<int>(v1); - printf( "%d\n", i ); // break here - - v2 = 2.0 ; - double d = std::get<double>(v2) ; - printf( "%f\n", d ); - - v3 = 'A' ; - char c = std::get<char>(v3) ; - printf( "%d\n", c ); - - // Checking v1 above and here to make sure we done maintain the incorrect - // state when we change its value. - v1 = 2.0; - d = std::get<double>(v1) ; - printf( "%f\n", d ); // break here - - try { - v_no_value.emplace<0>(S()); - } catch( ... ) {} - - printf( "%zu\n", v_no_value.index() ) ; -#endif - - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile deleted file mode 100644 index 637fa7e80bfd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py deleted file mode 100644 index 1aa93d718fc9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxVBoolDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), 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) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect( - "frame variable vBool", - substrs=[ - 'size=49', - '[0] = false', - '[1] = true', - '[18] = false', - '[27] = true', - '[36] = false', - '[47] = true', - '[48] = true']) - - self.expect( - "expr vBool", - substrs=[ - 'size=49', - '[0] = false', - '[1] = true', - '[18] = false', - '[27] = true', - '[36] = false', - '[47] = true', - '[48] = true']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp deleted file mode 100644 index 026cfc863f2c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include <string> -#include <vector> - -int main() -{ - std::vector<bool> vBool; - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(true); - - printf ("size: %d", (int) vBool.size()); // Set break point at this line. - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile deleted file mode 100644 index 1f609a41d908..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 -include $(LEVEL)/Makefile.rules -CXXFLAGS += -O0 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py deleted file mode 100644 index 06d3cda61be2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py +++ /dev/null @@ -1,194 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LibcxxVectorDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def check_numbers(self, var_name): - self.expect("frame variable " + var_name, - substrs=[var_name + ' = size=7', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '[4] = 12345', - '[5] = 123456', - '[6] = 1234567', - '}']) - - self.expect("p " + var_name, - substrs=['$', 'size=7', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '[4] = 12345', - '[5] = 123456', - '[6] = 1234567', - '}']) - - # check access-by-index - self.expect("frame variable " + var_name + "[0]", - substrs=['1']) - self.expect("frame variable " + var_name + "[1]", - substrs=['12']) - self.expect("frame variable " + var_name + "[2]", - substrs=['123']) - self.expect("frame variable " + var_name + "[3]", - substrs=['1234']) - - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( - self, "break here", lldb.SBFileSpec("main.cpp", False)) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # empty vectors (and storage pointers SHOULD BOTH BE NULL..) - self.expect("frame variable numbers", - substrs=['numbers = size=0']) - - lldbutil.continue_to_breakpoint(process, bkpt) - - # first value added - self.expect("frame variable numbers", - substrs=['numbers = size=1', - '[0] = 1', - '}']) - - # add some more data - lldbutil.continue_to_breakpoint(process, bkpt) - - self.expect("frame variable numbers", - substrs=['numbers = size=4', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '}']) - - self.expect("p numbers", - substrs=['$', 'size=4', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '}']) - - # check access to synthetic children - self.runCmd( - "type summary add --summary-string \"item 0 is ${var[0]}\" std::int_vect int_vect") - self.expect('frame variable numbers', - substrs=['item 0 is 1']) - - self.runCmd( - "type summary add --summary-string \"item 0 is ${svar[0]}\" std::int_vect int_vect") - self.expect('frame variable numbers', - substrs=['item 0 is 1']) - # move on with synths - self.runCmd("type summary delete std::int_vect") - self.runCmd("type summary delete int_vect") - - # add some more data - lldbutil.continue_to_breakpoint(process, bkpt) - - self.check_numbers("numbers") - - # clear out the vector and see that we do the right thing once again - lldbutil.continue_to_breakpoint(process, bkpt) - - self.expect("frame variable numbers", - substrs=['numbers = size=0']) - - lldbutil.continue_to_breakpoint(process, bkpt) - - # first value added - self.expect("frame variable numbers", - substrs=['numbers = size=1', - '[0] = 7', - '}']) - - # check if we can display strings - self.expect("frame variable strings", - substrs=['goofy', - 'is', - 'smart']) - - self.expect("p strings", - substrs=['goofy', - 'is', - 'smart']) - - # test summaries based on synthetic children - self.runCmd( - "type summary add std::string_vect string_vect --summary-string \"vector has ${svar%#} items\" -e") - self.expect("frame variable strings", - substrs=['vector has 3 items', - 'goofy', - 'is', - 'smart']) - - self.expect("p strings", - substrs=['vector has 3 items', - 'goofy', - 'is', - 'smart']) - - lldbutil.continue_to_breakpoint(process, bkpt) - - self.expect("frame variable strings", - substrs=['vector has 4 items']) - - # check access-by-index - self.expect("frame variable strings[0]", - substrs=['goofy']) - self.expect("frame variable strings[1]", - substrs=['is']) - - lldbutil.continue_to_breakpoint(process, bkpt) - - self.expect("frame variable strings", - substrs=['vector has 0 items']) - - @add_test_categories(["libc++"]) - def test_ref_and_ptr(self): - """Test that that file and class static variables display correctly.""" - self.build() - (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( - self, "Stop here to check by ref", lldb.SBFileSpec("main.cpp", False)) - - # The reference should display the same was as the value did - self.check_numbers("ref") - - # The pointer should just show the right number of elements: - - self.expect("frame variable ptr", substrs=['ptr =', ' size=7']) - - self.expect("p ptr", substrs=['$', 'size=7']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/main.cpp deleted file mode 100644 index 0e1dbe4f03e2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include <stdio.h> -#include <string> -#include <vector> -typedef std::vector<int> int_vect; -typedef std::vector<std::string> string_vect; - -template <class T> -void by_ref_and_ptr(std::vector<T> &ref, std::vector<T> *ptr) { - // Stop here to check by ref - return; -} - -int main() -{ - int_vect numbers; - (numbers.push_back(1)); // break here - (numbers.push_back(12)); // break here - (numbers.push_back(123)); - (numbers.push_back(1234)); - (numbers.push_back(12345)); // break here - (numbers.push_back(123456)); - (numbers.push_back(1234567)); - by_ref_and_ptr(numbers, &numbers); - - printf("break here"); - numbers.clear(); - - (numbers.push_back(7)); // break here - - string_vect strings; - (strings.push_back(std::string("goofy"))); - (strings.push_back(std::string("is"))); - (strings.push_back(std::string("smart"))); - printf("break here"); - (strings.push_back(std::string("!!!"))); - - printf("break here"); - strings.clear(); - - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile deleted file mode 100644 index 2e8bcb9079bd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -CFLAGS_EXTRAS += -O0 -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py deleted file mode 100644 index 463e2a9f190d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdIteratorDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - """Test that libstdcpp iterators format properly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), 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) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect('frame variable ivI', substrs=['item = 3']) - self.expect('expr ivI', substrs=['item = 3']) - - self.expect( - 'frame variable iimI', - substrs=[ - 'first = 0', - 'second = 12']) - self.expect('expr iimI', substrs=['first = 0', 'second = 12']) - - self.expect( - 'frame variable simI', - substrs=[ - 'first = "world"', - 'second = 42']) - self.expect('expr simI', substrs=['first = "world"', 'second = 42']) - - self.expect('frame variable svI', substrs=['item = "hello"']) - self.expect('expr svI', substrs=['item = "hello"']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/main.cpp deleted file mode 100644 index 7ddffd19012e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <string> -#include <map> -#include <vector> - -typedef std::map<int, int> intint_map; -typedef std::map<std::string, int> strint_map; - -typedef std::vector<int> int_vector; -typedef std::vector<std::string> string_vector; - -typedef intint_map::iterator iimter; -typedef strint_map::iterator simter; - -typedef int_vector::iterator ivter; -typedef string_vector::iterator svter; - -int main() -{ - intint_map iim; - iim[0] = 12; - - strint_map sim; - sim["world"] = 42; - - int_vector iv; - iv.push_back(3); - - string_vector sv; - sv.push_back("hello"); - - iimter iimI = iim.begin(); - simter simI = sim.begin(); - - ivter ivI = iv.begin(); - svter svI = sv.begin(); - - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile deleted file mode 100644 index 2e8bcb9079bd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -CFLAGS_EXTRAS += -O0 -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py deleted file mode 100644 index 7f3755660543..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py +++ /dev/null @@ -1,209 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdListDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break at for the different tests. - self.line = line_number('main.cpp', '// Set break point at this line.') - self.optional_line = line_number( - 'main.cpp', '// Optional break point at this line.') - self.final_line = line_number( - 'main.cpp', '// Set final break point at this line.') - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), 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) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("frame variable numbers_list --show-types") - - self.runCmd("type format add -f hex int") - - self.expect("frame variable numbers_list --raw", matching=False, - substrs=['size=0', - '{}']) - self.expect( - "frame variable &numbers_list._M_impl._M_node --raw", - matching=False, - substrs=[ - 'size=0', - '{}']) - - self.expect("frame variable numbers_list", - substrs=['size=0', - '{}']) - - self.expect("p numbers_list", - substrs=['size=0', - '{}']) - - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['size=1', - '[0] = ', - '0x12345678']) - - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['size=4', - '[0] = ', - '0x12345678', - '[1] =', - '0x11223344', - '[2] =', - '0xbeeffeed', - '[3] =', - '0x00abba00']) - - self.runCmd("n") - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['size=6', - '[0] = ', - '0x12345678', - '0x11223344', - '0xbeeffeed', - '0x00abba00', - '[4] =', - '0x0abcdef0', - '[5] =', - '0x0cab0cab']) - - self.expect("p numbers_list", - substrs=['size=6', - '[0] = ', - '0x12345678', - '0x11223344', - '0xbeeffeed', - '0x00abba00', - '[4] =', - '0x0abcdef0', - '[5] =', - '0x0cab0cab']) - - # check access-by-index - self.expect("frame variable numbers_list[0]", - substrs=['0x12345678']) - self.expect("frame variable numbers_list[1]", - substrs=['0x11223344']) - - # but check that expression does not rely on us - self.expect("expression numbers_list[0]", matching=False, error=True, - substrs=['0x12345678']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("numbers_list").MightHaveChildren(), - "numbers_list.MightHaveChildren() says False for non empty!") - - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['size=0', - '{}']) - - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs=['size=4', - '[0] = ', '1', - '[1] = ', '2', - '[2] = ', '3', - '[3] = ', '4']) - - self.runCmd("type format delete int") - - self.runCmd("n") - - self.expect("frame variable text_list", - substrs=['size=0', - '{}']) - - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.final_line, num_expected_locations=-1) - - self.runCmd("c", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - self.expect("frame variable text_list", - substrs=['size=4', - '[0]', 'goofy', - '[1]', 'is', - '[2]', 'smart', - '[3]', '!!!']) - - self.expect("p text_list", - substrs=['size=4', - '\"goofy\"', - '\"is\"', - '\"smart\"', - '\"!!!\"']) - - # check access-by-index - self.expect("frame variable text_list[0]", - substrs=['goofy']) - self.expect("frame variable text_list[3]", - substrs=['!!!']) - - # but check that expression does not rely on us - self.expect("expression text_list[0]", matching=False, error=True, - substrs=['goofy']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("text_list").MightHaveChildren(), - "text_list.MightHaveChildren() says False for non empty!") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp deleted file mode 100644 index 191acdcc97be..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include <list> -#include <string> - -typedef std::list<int> int_list; -typedef std::list<std::string> string_list; - -int main() -{ - int_list numbers_list; - - numbers_list.push_back(0x12345678); // Set break point at this line. - numbers_list.push_back(0x11223344); - numbers_list.push_back(0xBEEFFEED); - numbers_list.push_back(0x00ABBA00); - numbers_list.push_back(0x0ABCDEF0); - numbers_list.push_back(0x0CAB0CAB); - - numbers_list.clear(); - - numbers_list.push_back(1); - numbers_list.push_back(2); - numbers_list.push_back(3); - numbers_list.push_back(4); - - string_list text_list; - text_list.push_back(std::string("goofy")); // Optional break point at this line. - text_list.push_back(std::string("is")); - text_list.push_back(std::string("smart")); - - text_list.push_back(std::string("!!!")); - - return 0; // Set final break point at this line. -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile deleted file mode 100644 index 17868d8a95fc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py deleted file mode 100644 index 267e3beedb4c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py +++ /dev/null @@ -1,334 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdMapDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.") - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("frame variable ii --show-types") - - self.runCmd( - "type summary add -x \"std::map<\" --summary-string \"map has ${svar%#} items\" -e") - - self.expect('frame variable ii', - substrs=['map has 0 items', - '{}']) - - self.runCmd("c") - - self.expect('frame variable ii', - substrs=['map has 2 items', - '[0] = ', - 'first = 0', - 'second = 0', - '[1] = ', - 'first = 1', - 'second = 1']) - - self.runCmd("c") - - self.expect('frame variable ii', - substrs=['map has 4 items', - '[2] = ', - 'first = 2', - 'second = 0', - '[3] = ', - 'first = 3', - 'second = 1']) - - self.runCmd("c") - - self.expect("frame variable ii", - substrs=['map has 9 items', - '[5] = ', - 'first = 5', - 'second = 0', - '[7] = ', - 'first = 7', - 'second = 1']) - - self.expect("p ii", - substrs=['map has 9 items', - '[5] = ', - 'first = 5', - 'second = 0', - '[7] = ', - 'first = 7', - 'second = 1']) - - # check access-by-index - self.expect("frame variable ii[0]", - substrs=['first = 0', - 'second = 0']) - self.expect("frame variable ii[3]", - substrs=['first =', - 'second =']) - - self.expect("frame variable ii[8]", matching=True, - substrs=['1234567']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("ii").MightHaveChildren(), - "ii.MightHaveChildren() says False for non empty!") - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression ii[8]", matching=False, error=True, - # substrs = ['1234567']) - - self.runCmd("c") - - self.expect('frame variable ii', - substrs=['map has 0 items', - '{}']) - - self.runCmd("frame variable si --show-types") - - self.expect('frame variable si', - substrs=['map has 0 items', - '{}']) - - self.runCmd("c") - - self.expect('frame variable si', - substrs=['map has 1 items', - '[0] = ', - 'first = \"zero\"', - 'second = 0']) - - self.runCmd("c") - - self.expect("frame variable si", - substrs=['map has 5 items', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3', - '[4] = ', - 'first = \"four\"', - 'second = 4']) - - self.expect("p si", - substrs=['map has 5 items', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3', - '[4] = ', - 'first = \"four\"', - 'second = 4']) - - # check access-by-index - self.expect("frame variable si[0]", - substrs=['first = ', 'four', - 'second = 4']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("si").MightHaveChildren(), - "si.MightHaveChildren() says False for non empty!") - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression si[0]", matching=False, error=True, - # substrs = ['first = ', 'zero']) - - self.runCmd("c") - - self.expect('frame variable si', - substrs=['map has 0 items', - '{}']) - - self.runCmd("frame variable is --show-types") - - self.expect('frame variable is', - substrs=['map has 0 items', - '{}']) - - self.runCmd("c") - - self.expect("frame variable is", - substrs=['map has 4 items', - '[0] = ', - 'second = \"goofy\"', - 'first = 85', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - self.expect("p is", - substrs=['map has 4 items', - '[0] = ', - 'second = \"goofy\"', - 'first = 85', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - # check access-by-index - self.expect("frame variable is[0]", - substrs=['first = ', - 'second =']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("is").MightHaveChildren(), - "is.MightHaveChildren() says False for non empty!") - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression is[0]", matching=False, error=True, - # substrs = ['first = ', 'goofy']) - - self.runCmd("c") - - self.expect('frame variable is', - substrs=['map has 0 items', - '{}']) - - self.runCmd("frame variable ss --show-types") - - self.expect('frame variable ss', - substrs=['map has 0 items', - '{}']) - - self.runCmd("c") - - self.expect("frame variable ss", - substrs=['map has 4 items', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"', - '[3] = ', - 'second = \"..is always a Mac!\"', - 'first = \"a Mac..\"']) - - self.expect("p ss", - substrs=['map has 4 items', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"', - '[3] = ', - 'second = \"..is always a Mac!\"', - 'first = \"a Mac..\"']) - - # check access-by-index - self.expect("frame variable ss[3]", - substrs=['gatto', 'cat']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("ss").MightHaveChildren(), - "ss.MightHaveChildren() says False for non empty!") - - # check that the expression parser does not make use of - # synthetic children instead of running code - # TOT clang has a fix for this, which makes the expression command here succeed - # since this would make the test fail or succeed depending on clang version in use - # this is safer commented for the time being - # self.expect("expression ss[3]", matching=False, error=True, - # substrs = ['gatto']) - - self.runCmd("c") - - self.expect('frame variable ss', - substrs=['map has 0 items', - '{}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp deleted file mode 100644 index d5e5b212782d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include <map> -#include <string> - -#define intint_map std::map<int, int> -#define strint_map std::map<std::string, int> -#define intstr_map std::map<int, std::string> -#define strstr_map std::map<std::string, std::string> - - -int main() -{ - intint_map ii; - - ii[0] = 0; // Set break point at this line. - ii[1] = 1; - ii[2] = 0;// Set break point at this line. - ii[3] = 1; - ii[4] = 0;// Set break point at this line. - ii[5] = 1; - ii[6] = 0; - ii[7] = 1; - ii[85] = 1234567; - - ii.clear();// Set break point at this line. - - strint_map si; - - si["zero"] = 0;// Set break point at this line. - si["one"] = 1;// Set break point at this line. - si["two"] = 2; - si["three"] = 3; - si["four"] = 4; - - si.clear();// Set break point at this line. - - intstr_map is; - - is[85] = "goofy";// Set break point at this line. - is[1] = "is"; - is[2] = "smart"; - is[3] = "!!!"; - - is.clear();// Set break point at this line. - - strstr_map ss; - - ss["ciao"] = "hello";// Set break point at this line. - ss["casa"] = "house"; - ss["gatto"] = "cat"; - ss["a Mac.."] = "..is always a Mac!"; - - ss.clear();// Set break point at this line. - - return 0;// Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile deleted file mode 100644 index 63f2aaf9c75a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -CXXFLAGS := -O0 -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py deleted file mode 100644 index 1ca4a15d85cc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdSmartPtrDataFormatterTestCase(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.") - 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']) - - self.expect("frame variable nsp", substrs=['nsp = nullptr']) - self.expect("frame variable isp", substrs=['isp = 123']) - self.expect("frame variable ssp", substrs=['ssp = "foobar"']) - - self.expect("frame variable nwp", substrs=['nwp = nullptr']) - self.expect("frame variable iwp", substrs=['iwp = 123']) - self.expect("frame variable swp", substrs=['swp = "foobar"']) - - self.runCmd("continue") - - self.expect("frame variable nsp", substrs=['nsp = nullptr']) - self.expect("frame variable isp", substrs=['isp = nullptr']) - self.expect("frame variable ssp", substrs=['ssp = nullptr']) - - self.expect("frame variable nwp", substrs=['nwp = nullptr']) - self.expect("frame variable iwp", substrs=['iwp = nullptr']) - self.expect("frame variable swp", substrs=['swp = nullptr']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp deleted file mode 100644 index 7ba50875a6db..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include <memory> -#include <string> - -int -main() -{ - std::shared_ptr<char> nsp; - std::shared_ptr<int> isp(new int{123}); - std::shared_ptr<std::string> ssp = std::make_shared<std::string>("foobar"); - - std::weak_ptr<char> nwp; - std::weak_ptr<int> iwp = isp; - std::weak_ptr<std::string> swp = ssp; - - nsp.reset(); // Set break point at this line. - isp.reset(); - ssp.reset(); - - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile deleted file mode 100644 index 2e8bcb9079bd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -CFLAGS_EXTRAS += -O0 -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py deleted file mode 100644 index 042d9fbcd6a0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py +++ /dev/null @@ -1,81 +0,0 @@ -# coding=utf8 -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdStringDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), 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) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - var_s = self.frame().FindVariable('s') - var_S = self.frame().FindVariable('S') - var_mazeltov = self.frame().FindVariable('mazeltov') - var_q = self.frame().FindVariable('q') - var_Q = self.frame().FindVariable('Q') - - self.assertTrue( - var_s.GetSummary() == 'L"hello world! מזל טוב!"', - "s summary wrong") - self.assertTrue(var_S.GetSummary() == 'L"!!!!"', "S summary wrong") - self.assertTrue( - var_mazeltov.GetSummary() == 'L"מזל טוב"', - "mazeltov summary wrong") - self.assertTrue( - var_q.GetSummary() == '"hello world"', - "q summary wrong") - self.assertTrue( - var_Q.GetSummary() == '"quite a long std::strin with lots of info inside it"', - "Q summary wrong") - - self.runCmd("next") - - self.assertTrue( - var_S.GetSummary() == 'L"!!!!!"', - "new S summary wrong") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp deleted file mode 100644 index f6e56cf12456..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include <string> - -int main() -{ - std::wstring s(L"hello world! מזל טוב!"); - std::wstring S(L"!!!!"); - const wchar_t *mazeltov = L"מזל טוב"; - std::string q("hello world"); - std::string Q("quite a long std::strin with lots of info inside it"); - S.assign(L"!!!!!"); // Set break point at this line. - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile deleted file mode 100644 index 17868d8a95fc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py deleted file mode 100644 index 4f9047b84d0f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdTupleDataFormatterTestCase(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.") - 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']) - - frame = self.frame() - self.assertTrue(frame.IsValid()) - - self.expect("frame variable ti", substrs=['[0] = 1']) - self.expect("frame variable ts", substrs=['[0] = "foobar"']) - self.expect("frame variable tt", substrs=['[0] = 1', '[1] = "baz"', '[2] = 2']) - - self.assertEqual(1, frame.GetValueForVariablePath("ti[0]").GetValueAsUnsigned()) - self.assertFalse(frame.GetValueForVariablePath("ti[1]").IsValid()) - - self.assertEqual('"foobar"', frame.GetValueForVariablePath("ts[0]").GetSummary()) - self.assertFalse(frame.GetValueForVariablePath("ts[1]").IsValid()) - - self.assertEqual(1, frame.GetValueForVariablePath("tt[0]").GetValueAsUnsigned()) - self.assertEqual('"baz"', frame.GetValueForVariablePath("tt[1]").GetSummary()) - self.assertEqual(2, frame.GetValueForVariablePath("tt[2]").GetValueAsUnsigned()) - self.assertFalse(frame.GetValueForVariablePath("tt[3]").IsValid()) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp deleted file mode 100644 index 7247742ee6bb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include <memory> -#include <string> - -int main() { - std::tuple<int> ti{1}; - std::tuple<std::string> ts{"foobar"}; - std::tuple<int, std::string, int> tt{1, "baz", 2}; - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile deleted file mode 100644 index 17868d8a95fc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py deleted file mode 100644 index f782a2a8baea..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdUniquePtrDataFormatterTestCase(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.") - 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']) - - frame = self.frame() - self.assertTrue(frame.IsValid()) - - self.expect("frame variable nup", substrs=['nup = nullptr']) - self.expect("frame variable iup", substrs=['iup = 0x']) - self.expect("frame variable sup", substrs=['sup = 0x']) - - self.expect("frame variable ndp", substrs=['ndp = nullptr']) - self.expect("frame variable idp", substrs=['idp = 0x', 'deleter = ', 'a = 1', 'b = 2']) - self.expect("frame variable sdp", substrs=['sdp = 0x', 'deleter = ', 'a = 3', 'b = 4']) - - self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned()) - self.assertEqual(123, frame.GetValueForVariablePath("*iup").GetValueAsUnsigned()) - self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid()) - - self.assertEqual('"foobar"', frame.GetValueForVariablePath("sup.object").GetSummary()) - self.assertEqual('"foobar"', frame.GetValueForVariablePath("*sup").GetSummary()) - self.assertFalse(frame.GetValueForVariablePath("sup.deleter").IsValid()) - - self.assertEqual(456, frame.GetValueForVariablePath("idp.object").GetValueAsUnsigned()) - self.assertEqual(456, frame.GetValueForVariablePath("*idp").GetValueAsUnsigned()) - self.assertEqual('"baz"', frame.GetValueForVariablePath("sdp.object").GetSummary()) - self.assertEqual('"baz"', frame.GetValueForVariablePath("*sdp").GetSummary()) - - idp_deleter = frame.GetValueForVariablePath("idp.deleter") - self.assertTrue(idp_deleter.IsValid()) - self.assertEqual(1, idp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned()) - self.assertEqual(2, idp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned()) - - sdp_deleter = frame.GetValueForVariablePath("sdp.deleter") - self.assertTrue(sdp_deleter.IsValid()) - self.assertEqual(3, sdp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned()) - self.assertEqual(4, sdp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned()) - - @skipIfFreeBSD - @skipIfWindows # libstdcpp not ported to Windows - @skipIfDarwin # doesn't compile on Darwin - @skipIfwatchOS # libstdcpp not ported to watchos - @add_test_categories(["libstdcxx"]) - def test_recursive_unique_ptr(self): - # Tests that LLDB can handle when we have a loop in the unique_ptr - # reference chain and that it correctly handles the different options - # for the frame variable command in this case. - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.") - self.runCmd("run", RUN_SUCCEEDED) - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - self.expect("frame variable f1->fp", - substrs=['fp = 0x']) - self.expect("frame variable --ptr-depth=1 f1->fp", - substrs=['data = 2', 'fp = 0x']) - self.expect("frame variable --ptr-depth=2 f1->fp", - substrs=['data = 2', 'fp = 0x', 'data = 1']) - - frame = self.frame() - self.assertTrue(frame.IsValid()) - self.assertEqual(2, frame.GetValueForVariablePath("f1->fp.object.data").GetValueAsUnsigned()) - self.assertEqual(2, frame.GetValueForVariablePath("f1->fp->data").GetValueAsUnsigned()) - self.assertEqual(1, frame.GetValueForVariablePath("f1->fp.object.fp.object.data").GetValueAsUnsigned()) - self.assertEqual(1, frame.GetValueForVariablePath("f1->fp->fp->data").GetValueAsUnsigned()) - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/invalid/TestDataFormatterInvalidStdUniquePtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/invalid/TestDataFormatterInvalidStdUniquePtr.py deleted file mode 100644 index 190cf78a3b43..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/invalid/TestDataFormatterInvalidStdUniquePtr.py +++ /dev/null @@ -1,5 +0,0 @@ -import lldbsuite.test.lldbinline as lldbinline -from lldbsuite.test.decorators import * - -lldbinline.MakeInlineTest(__file__, globals(), [no_debug_info_test]) - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/invalid/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/invalid/main.cpp deleted file mode 100644 index b12cab231695..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/invalid/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// Test that we don't crash when trying to pretty-print structures that don't -// have the layout our data formatters expect. -namespace std { -template<typename T, typename Deleter = void> -class unique_ptr {}; -} - -int main() { - std::unique_ptr<int> U; - return 0; //% self.expect("frame variable U", substrs=["unique_ptr", "{}"]) -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp deleted file mode 100644 index dd0072764d4e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include <memory> -#include <string> - -struct Deleter { - void operator()(void *) {} - - int a; - int b; -}; - -struct Foo { - int data; - std::unique_ptr<Foo> fp; -}; - -int main() { - std::unique_ptr<char> nup; - std::unique_ptr<int> iup(new int{123}); - std::unique_ptr<std::string> sup(new std::string("foobar")); - - std::unique_ptr<char, Deleter> ndp; - std::unique_ptr<int, Deleter> idp(new int{456}, Deleter{1, 2}); - std::unique_ptr<std::string, Deleter> sdp(new std::string("baz"), - Deleter{3, 4}); - - std::unique_ptr<Foo> fp(new Foo{3}); - - // Set up a structure where we have a loop in the unique_ptr chain. - Foo* f1 = new Foo{1}; - Foo* f2 = new Foo{2}; - f1->fp.reset(f2); - f2->fp.reset(f1); - - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/Makefile deleted file mode 100644 index 2e8bcb9079bd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -CFLAGS_EXTRAS += -O0 -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py deleted file mode 100644 index fb37838bdaff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdVBoolDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), 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) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect( - "frame variable vBool", - substrs=[ - 'size=49', - '[0] = false', - '[1] = true', - '[18] = false', - '[27] = true', - '[36] = false', - '[47] = true', - '[48] = true']) - - self.expect( - "expr vBool", - substrs=[ - 'size=49', - '[0] = false', - '[1] = true', - '[18] = false', - '[27] = true', - '[36] = false', - '[47] = true', - '[48] = true']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/main.cpp deleted file mode 100644 index 73956dd3fda3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include <vector> - -int main() -{ - std::vector<bool> vBool; - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(false); - vBool.push_back(true); - vBool.push_back(true); - - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile deleted file mode 100644 index 63f2aaf9c75a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../../../make - -CXX_SOURCES := main.cpp - -CXXFLAGS := -O0 -USE_LIBSTDCPP := 1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py deleted file mode 100644 index 712de3d41f74..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py +++ /dev/null @@ -1,216 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdVectorDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - @add_test_categories(["libstdcxx"]) - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "Set break point at this line.") - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # empty vectors (and storage pointers SHOULD BOTH BE NULL..) - self.expect("frame variable numbers", - substrs=['numbers = size=0']) - - self.runCmd("c") - - # first value added - self.expect("frame variable numbers", - substrs=['numbers = size=1', - '[0] = 1', - '}']) - - # add some more data - self.runCmd("c") - - self.expect("frame variable numbers", - substrs=['numbers = size=4', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '}']) - - self.expect("p numbers", - substrs=['$', 'size=4', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '}']) - - # check access to synthetic children - self.runCmd( - "type summary add --summary-string \"item 0 is ${var[0]}\" std::int_vect int_vect") - self.expect('frame variable numbers', - substrs=['item 0 is 1']) - - self.runCmd( - "type summary add --summary-string \"item 0 is ${svar[0]}\" std::int_vect int_vect") - #import time - # time.sleep(19) - self.expect('frame variable numbers', - substrs=['item 0 is 1']) - # move on with synths - self.runCmd("type summary delete std::int_vect") - self.runCmd("type summary delete int_vect") - - # add some more data - self.runCmd("c") - - self.expect("frame variable numbers", - substrs=['numbers = size=7', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '[4] = 12345', - '[5] = 123456', - '[6] = 1234567', - '}']) - - self.expect("p numbers", - substrs=['$', 'size=7', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '[4] = 12345', - '[5] = 123456', - '[6] = 1234567', - '}']) - - # check access-by-index - self.expect("frame variable numbers[0]", - substrs=['1']) - self.expect("frame variable numbers[1]", - substrs=['12']) - self.expect("frame variable numbers[2]", - substrs=['123']) - self.expect("frame variable numbers[3]", - substrs=['1234']) - - # but check that expression does not rely on us - # (when expression gets to call into STL code correctly, we will have to find - # another way to check this) - self.expect("expression numbers[6]", matching=False, error=True, - substrs=['1234567']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("numbers").MightHaveChildren(), - "numbers.MightHaveChildren() says False for non empty!") - - # clear out the vector and see that we do the right thing once again - self.runCmd("c") - - self.expect("frame variable numbers", - substrs=['numbers = size=0']) - - self.runCmd("c") - - # first value added - self.expect("frame variable numbers", - substrs=['numbers = size=1', - '[0] = 7', - '}']) - - # check if we can display strings - self.runCmd("c") - - self.expect("frame variable strings", - substrs=['goofy', - 'is', - 'smart']) - - self.expect("p strings", - substrs=['goofy', - 'is', - 'smart']) - - # test summaries based on synthetic children - self.runCmd( - "type summary add std::string_vect string_vect --summary-string \"vector has ${svar%#} items\" -e") - self.expect("frame variable strings", - substrs=['vector has 3 items', - 'goofy', - 'is', - 'smart']) - - self.expect("p strings", - substrs=['vector has 3 items', - 'goofy', - 'is', - 'smart']) - - self.runCmd("c") - - self.expect("frame variable strings", - substrs=['vector has 4 items']) - - # check access-by-index - self.expect("frame variable strings[0]", - substrs=['goofy']) - self.expect("frame variable strings[1]", - substrs=['is']) - - # but check that expression does not rely on us - # (when expression gets to call into STL code correctly, we will have to find - # another way to check this) - self.expect("expression strings[0]", matching=False, error=True, - substrs=['goofy']) - - # check that MightHaveChildren() gets it right - self.assertTrue( - self.frame().FindVariable("strings").MightHaveChildren(), - "strings.MightHaveChildren() says False for non empty!") - - self.runCmd("c") - - self.expect("frame variable strings", - substrs=['vector has 0 items']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp deleted file mode 100644 index 010917995e40..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/main.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <string> -#include <vector> -typedef std::vector<int> int_vect; -typedef std::vector<std::string> string_vect; - -int main() -{ - int_vect numbers; - numbers.push_back(1); // Set break point at this line. - numbers.push_back(12); // Set break point at this line. - numbers.push_back(123); - numbers.push_back(1234); - numbers.push_back(12345); // Set break point at this line. - numbers.push_back(123456); - numbers.push_back(1234567); - - numbers.clear(); // Set break point at this line. - - numbers.push_back(7); // Set break point at this line. - - string_vect strings; // Set break point at this line. - strings.push_back(std::string("goofy")); - strings.push_back(std::string("is")); - strings.push_back(std::string("smart")); - - strings.push_back(std::string("!!!")); // Set break point at this line. - - strings.clear(); // Set break point at this line. - - return 0;// Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py deleted file mode 100644 index 0e3bcc0e7398..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py +++ /dev/null @@ -1,220 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class SynthDataFormatterTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Pick some values and check that the basics work - self.runCmd("type filter add BagOfInts --child x --child z") - self.expect("frame variable int_bag", - substrs=['x = 6', - 'z = 8']) - - # Check we can still access the missing child by summary - self.runCmd( - "type summary add BagOfInts --summary-string \"y=${var.y}\"") - self.expect('frame variable int_bag', - substrs=['y=7']) - - # Even if we have synth children, the summary prevails - self.expect("frame variable int_bag", matching=False, - substrs=['x = 6', - 'z = 8']) - - # if we skip synth and summary show y - self.expect( - "frame variable int_bag --synthetic-type false --no-summary-depth=1", - substrs=[ - 'x = 6', - 'y = 7', - 'z = 8']) - - # if we ask for raw output same happens - self.expect("frame variable int_bag --raw-output", - substrs=['x = 6', - 'y = 7', - 'z = 8']) - - # Summary+Synth must work together - self.runCmd( - "type summary add BagOfInts --summary-string \"x=${var.x}\" -e") - self.expect('frame variable int_bag', - substrs=['x=6', - 'x = 6', - 'z = 8']) - - # Same output, but using Python - self.runCmd( - "type summary add BagOfInts --python-script \"return 'x=%s' % valobj.GetChildMemberWithName('x').GetValue()\" -e") - self.expect('frame variable int_bag', - substrs=['x=6', - 'x = 6', - 'z = 8']) - - # If I skip summaries, still give me the artificial children - self.expect("frame variable int_bag --no-summary-depth=1", - substrs=['x = 6', - 'z = 8']) - - # Delete synth and check that the view reflects it immediately - self.runCmd("type filter delete BagOfInts") - self.expect("frame variable int_bag", - substrs=['x = 6', - 'y = 7', - 'z = 8']) - - # Add the synth again and check that it's honored deeper in the - # hierarchy - self.runCmd("type filter add BagOfInts --child x --child z") - self.expect('frame variable bag_bag', - substrs=['x = x=69 {', - 'x = 69', - 'z = 71', - 'y = x=66 {', - 'x = 66', - 'z = 68']) - self.expect('frame variable bag_bag', matching=False, - substrs=['y = 70', - 'y = 67']) - - # Check that a synth can expand nested stuff - self.runCmd("type filter add BagOfBags --child x.y --child y.z") - self.expect('frame variable bag_bag', - substrs=['x.y = 70', - 'y.z = 68']) - - # ...even if we get -> and . wrong - self.runCmd("type filter add BagOfBags --child x.y --child \"y->z\"") - self.expect('frame variable bag_bag', - substrs=['x.y = 70', - 'y->z = 68']) - - # ...even bitfields - self.runCmd( - "type filter add BagOfBags --child x.y --child \"y->z[1-2]\"") - self.expect('frame variable bag_bag --show-types', - substrs=['x.y = 70', - '(int:2) y->z[1-2] = 2']) - - # ...even if we format the bitfields - self.runCmd( - "type filter add BagOfBags --child x.y --child \"y->y[0-0]\"") - self.runCmd("type format add \"int:1\" -f bool") - self.expect('frame variable bag_bag --show-types', - substrs=['x.y = 70', - '(int:1) y->y[0-0] = true']) - - # ...even if we use one-liner summaries - self.runCmd("type summary add -c BagOfBags") - self.expect('frame variable bag_bag', substrs=[ - '(BagOfBags) bag_bag = (x.y = 70, y->y[0-0] = true)']) - - self.runCmd("type summary delete BagOfBags") - - # now check we are dynamic (and arrays work) - self.runCmd( - "type filter add Plenty --child bitfield --child array[0] --child array[2]") - self.expect('frame variable plenty_of_stuff', - substrs=['bitfield = 1', - 'array[0] = 5', - 'array[2] = 3']) - - self.runCmd("n") - self.expect('frame variable plenty_of_stuff', - substrs=['bitfield = 17', - 'array[0] = 5', - 'array[2] = 3']) - - # skip synthetic children - self.expect('frame variable plenty_of_stuff --synthetic-type no', - substrs=['some_values = 0x', - 'array = 0x', - 'array_size = 5']) - - # check flat printing with synthetic children - self.expect('frame variable plenty_of_stuff --flat', - substrs=['plenty_of_stuff.bitfield = 17', - '*(plenty_of_stuff.array) = 5', - '*(plenty_of_stuff.array) = 3']) - - # check that we do not lose location information for our children - self.expect('frame variable plenty_of_stuff --location', - substrs=['0x', - ': bitfield = 17']) - - # check we work across pointer boundaries - self.expect('frame variable plenty_of_stuff.some_values --ptr-depth=1', - substrs=['(BagOfInts *) plenty_of_stuff.some_values', - 'x = 5', - 'z = 7']) - - # but not if we don't want to - self.runCmd("type filter add BagOfInts --child x --child z -p") - self.expect('frame variable plenty_of_stuff.some_values --ptr-depth=1', - substrs=['(BagOfInts *) plenty_of_stuff.some_values', - 'x = 5', - 'y = 6', - 'z = 7']) - - # check we're dynamic even if nested - self.runCmd("type filter add BagOfBags --child x.z") - self.expect('frame variable bag_bag', - substrs=['x.z = 71']) - - self.runCmd("n") - self.expect('frame variable bag_bag', - substrs=['x.z = 12']) - - self.runCmd( - 'type summary add -e -s "I am always empty but have" EmptyStruct') - self.expect('frame variable es', substrs=[ - "I am always empty but have {}"]) - self.runCmd('type summary add -e -h -s "I am really empty" EmptyStruct') - self.expect('frame variable es', substrs=["I am really empty"]) - self.expect( - 'frame variable es', - substrs=["I am really empty {}"], - matching=False) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/main.cpp deleted file mode 100644 index bac38d84fae3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/main.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -struct BagOfInts -{ - int x; - int y; - int z; - BagOfInts(int X) : - x(X), - y(X+1), - z(X+2) {} -}; - -struct BagOfFloats -{ - float x; - float y; - float z; - BagOfFloats(float X) : - x(X+0.334), - y(X+0.500), - z(X+0.667) {} -}; - -struct BagOfBags -{ - BagOfInts x; - BagOfInts y; - BagOfFloats z; - BagOfFloats q; - BagOfBags() : - x('E'), - y('B'), - z(1.1), - q(20.11) {} -}; - -struct EmptyStruct {}; - -struct Plenty -{ - BagOfInts *some_values; - int* array; - int array_size; - int bitfield; - - Plenty(int N, bool flagA, bool flagB) : - some_values(new BagOfInts(N)), - array(new int[N]), - array_size(N), - bitfield( (flagA ? 0x01 : 0x00) | (flagB ? 0x10 : 0x00) ) - { - for (int j = 0; j < N; j++) - array[j] = N-j; - } -}; - -int main (int argc, const char * argv[]) -{ - BagOfInts int_bag(6); - BagOfFloats float_bag(2.71); - - BagOfBags bag_bag; - EmptyStruct es; - - Plenty plenty_of_stuff(5,true,false); - - plenty_of_stuff.bitfield = 0x11; // Set break point at this line. - - bag_bag.x.z = 12; - - return 0; - -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py deleted file mode 100644 index 8bb60b8d679a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DataFormatterSynthTypeTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', 'break here') - - @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser - def test_with_run_command(self): - """Test using Python synthetic children provider to provide a typename.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("script from myIntSynthProvider import *") - self.runCmd("type synth add -l myIntSynthProvider myInt") - - self.expect('frame variable x', substrs=['ThisTestPasses']) - self.expect('frame variable y', substrs=['ThisTestPasses']) - self.expect('frame variable z', substrs=['ThisTestPasses']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/main.cpp deleted file mode 100644 index accbf0a5a578..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -class myInt { - private: int theValue; - public: myInt() : theValue(0) {} - public: myInt(int _x) : theValue(_x) {} - int val() { return theValue; } -}; - -class myArray { -public: - int array[16]; -}; - -class hasAnInt { - public: - myInt theInt; - hasAnInt() : theInt(42) {} -}; - -myInt operator + (myInt x, myInt y) { return myInt(x.val() + y.val()); } - -int main() { - myInt x{3}; - myInt y{4}; - myInt z {x+y}; - hasAnInt hi; - myArray ma; - - return z.val(); // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py deleted file mode 100644 index fa47ca2cfe69..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py +++ /dev/null @@ -1,44 +0,0 @@ -class myIntSynthProvider(object): - - def __init__(self, valobj, dict): - self.valobj = valobj - self.val = self.valobj.GetChildMemberWithName("theValue") - - def num_children(self): - return 0 - - def get_child_at_index(self, index): - return None - - def get_child_index(self, name): - return None - - def update(self): - return False - - def has_children(self): - return False - - def get_type_name(self): - return "ThisTestPasses" - - -class myArraySynthProvider(object): - - def __init__(self, valobj, dict): - self.valobj = valobj - self.array = self.valobj.GetChildMemberWithName("array") - - def num_children(self, max_count): - if 16 < max_count: - return 16 - return max_count - - def get_child_at_index(self, index): - return None # Keep it simple when this is not tested here. - - def get_child_index(self, name): - return None # Keep it simple when this is not tested here. - - def has_children(self): - return True diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py deleted file mode 100644 index 138b32802951..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py +++ /dev/null @@ -1,119 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DataFormatterSynthValueTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', 'break here') - - @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser - def test_with_run_command(self): - """Test using Python synthetic children provider to provide a value.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - x = self.frame().FindVariable("x") - x.SetPreferSyntheticValue(True) - y = self.frame().FindVariable("y") - y.SetPreferSyntheticValue(True) - z = self.frame().FindVariable("z") - z.SetPreferSyntheticValue(True) - q = self.frame().FindVariable("q") - z.SetPreferSyntheticValue(True) - - x_val = x.GetValueAsUnsigned - y_val = y.GetValueAsUnsigned - z_val = z.GetValueAsUnsigned - q_val = q.GetValueAsUnsigned - - if self.TraceOn(): - print( - "x_val = %s; y_val = %s; z_val = %s; q_val = %s" % - (x_val(), y_val(), z_val(), q_val())) - - self.assertFalse(x_val() == 3, "x == 3 before synthetics") - self.assertFalse(y_val() == 4, "y == 4 before synthetics") - self.assertFalse(z_val() == 7, "z == 7 before synthetics") - self.assertFalse(q_val() == 8, "q == 8 before synthetics") - - # now set up the synth - self.runCmd("script from myIntSynthProvider import *") - self.runCmd("type synth add -l myIntSynthProvider myInt") - self.runCmd("type synth add -l myArraySynthProvider myArray") - self.runCmd("type synth add -l myIntSynthProvider myIntAndStuff") - - if self.TraceOn(): - print( - "x_val = %s; y_val = %s; z_val = %s; q_val = %s" % - (x_val(), y_val(), z_val(), q_val())) - - self.assertTrue(x_val() == 3, "x != 3 after synthetics") - self.assertTrue(y_val() == 4, "y != 4 after synthetics") - self.assertTrue(z_val() == 7, "z != 7 after synthetics") - self.assertTrue(q_val() == 8, "q != 8 after synthetics") - - self.expect("frame variable x", substrs=['3']) - self.expect( - "frame variable x", - substrs=['theValue = 3'], - matching=False) - self.expect("frame variable q", substrs=['8']) - self.expect( - "frame variable q", - substrs=['theValue = 8'], - matching=False) - - # check that an aptly defined synthetic provider does not affect - # one-lining - self.expect( - "expression struct Struct { myInt theInt{12}; }; Struct()", - substrs=['(theInt = 12)']) - - # check that we can use a synthetic value in a summary - self.runCmd("type summary add hasAnInt -s ${var.theInt}") - hi = self.frame().FindVariable("hi") - self.assertEqual(hi.GetSummary(), "42") - - ma = self.frame().FindVariable("ma") - self.assertTrue(ma.IsValid()) - self.assertEqual(ma.GetNumChildren(15), 15) - self.assertEqual(ma.GetNumChildren(16), 16) - self.assertEqual(ma.GetNumChildren(17), 16) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp deleted file mode 100644 index 1a5925a05a65..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -class myInt { - private: int theValue; - public: myInt() : theValue(0) {} - public: myInt(int _x) : theValue(_x) {} - int val() { return theValue; } -}; - -class myIntAndStuff { -private: - int theValue; - double theExtraFluff; -public: - myIntAndStuff() : theValue(0), theExtraFluff(1.25) {} - myIntAndStuff(int _x) : theValue(_x), theExtraFluff(1.25) {} - int val() { return theValue; } -}; - -class myArray { -public: - int array[16]; -}; - -class hasAnInt { - public: - myInt theInt; - hasAnInt() : theInt(42) {} -}; - -myInt operator + (myInt x, myInt y) { return myInt(x.val() + y.val()); } -myInt operator + (myInt x, myIntAndStuff y) { return myInt(x.val() + y.val()); } - -int main() { - myInt x{3}; - myInt y{4}; - myInt z {x+y}; - myIntAndStuff q {z.val()+1}; - hasAnInt hi; - myArray ma; - - return z.val(); // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py deleted file mode 100644 index 82da6f9da928..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py +++ /dev/null @@ -1,44 +0,0 @@ -class myIntSynthProvider(object): - - def __init__(self, valobj, dict): - self.valobj = valobj - self.val = self.valobj.GetChildMemberWithName("theValue") - - def num_children(self): - return 0 - - def get_child_at_index(self, index): - return None - - def get_child_index(self, name): - return None - - def update(self): - return False - - def has_children(self): - return False - - def get_value(self): - return self.val - - -class myArraySynthProvider(object): - - def __init__(self, valobj, dict): - self.valobj = valobj - self.array = self.valobj.GetChildMemberWithName("array") - - def num_children(self, max_count): - if 16 < max_count: - return 16 - return max_count - - def get_child_at_index(self, index): - return None # Keep it simple when this is not tested here. - - def get_child_index(self, name): - return None # Keep it simple when this is not tested here. - - def has_children(self): - return True diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile deleted file mode 100644 index 872bf6d20877..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -CXXFLAGS += -std=c++11 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py deleted file mode 100644 index 734e711fb7fc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py +++ /dev/null @@ -1,8 +0,0 @@ -from __future__ import absolute_import - -from lldbsuite.test import lldbinline - -lldbinline.MakeInlineTest( - __file__, globals(), [ - lldbinline.expectedFailureAll( - oslist=["windows"], bugnumber="llvm.org/pr24663")]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/main.cpp deleted file mode 100644 index bc8e05829316..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -class Base { -public: - Base () = default; - virtual int func() { return 1; } - virtual ~Base() = default; -}; - -class Derived : public Base { -private: - int m_derived_data; -public: - Derived () : Base(), m_derived_data(0x0fedbeef) {} - virtual ~Derived() = default; - virtual int func() { return m_derived_data; } -}; - -int main (int argc, char const *argv[]) -{ - Base *base = new Derived(); - return 0; //% stream = lldb.SBStream() - //% base = self.frame().FindVariable("base") - //% base.SetPreferDynamicValue(lldb.eDynamicDontRunTarget) - //% base.GetDescription(stream) - //% if self.TraceOn(): print(stream.GetData()) - //% self.assertTrue(stream.GetData().startswith("(Derived *")) -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py deleted file mode 100644 index 00eb3d00f783..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py +++ /dev/null @@ -1,85 +0,0 @@ -""" -Check if changing Format on an SBValue correctly propagates that new format to children as it should -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class FormatPropagationTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - # rdar://problem/14035604 - def test_with_run_command(self): - """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - pass - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # extract the parent and the children - frame = self.frame() - parent = self.frame().FindVariable("f") - self.assertTrue( - parent is not None and parent.IsValid(), - "could not find f") - X = parent.GetChildMemberWithName("X") - self.assertTrue(X is not None and X.IsValid(), "could not find X") - Y = parent.GetChildMemberWithName("Y") - self.assertTrue(Y is not None and Y.IsValid(), "could not find Y") - # check their values now - self.assertTrue(X.GetValue() == "1", "X has an invalid value") - self.assertTrue(Y.GetValue() == "2", "Y has an invalid value") - # set the format on the parent - parent.SetFormat(lldb.eFormatHex) - self.assertTrue( - X.GetValue() == "0x00000001", - "X has not changed format") - self.assertTrue( - Y.GetValue() == "0x00000002", - "Y has not changed format") - # Step and check if the values make sense still - self.runCmd("next") - self.assertTrue(X.GetValue() == "0x00000004", "X has not become 4") - self.assertTrue(Y.GetValue() == "0x00000002", "Y has not stuck as hex") - # Check that children can still make their own choices - Y.SetFormat(lldb.eFormatDecimal) - self.assertTrue(X.GetValue() == "0x00000004", "X is still hex") - self.assertTrue(Y.GetValue() == "2", "Y has not been reset") - # Make a few more changes - parent.SetFormat(lldb.eFormatDefault) - X.SetFormat(lldb.eFormatHex) - Y.SetFormat(lldb.eFormatDefault) - self.assertTrue( - X.GetValue() == "0x00000004", - "X is not hex as it asked") - self.assertTrue(Y.GetValue() == "2", "Y is not defaulted") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/main.cpp deleted file mode 100644 index 5822fbc2a710..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -struct foo -{ - int X; - int Y; - foo(int a, int b) : X(a), Y(b) {} -}; - -int main() -{ - foo f(1,2); - f.X = 4; // Set break point at this line. - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py deleted file mode 100644 index d7507626e145..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Test that the user can input a format but it will not prevail over summary format's choices. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class FrameFormatSmallStructTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that the user can input a format but it will not prevail over summary format's choices.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - self.expect("thread list", substrs=['addPair(p=(x = 3, y = -3))']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/main.cpp deleted file mode 100644 index 120ef0ea0910..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -struct Pair { - int x; - int y; - - Pair(int _x, int _y) : x(_x), y(_y) {} -}; - -int addPair(Pair p) -{ - return p.x + p.y; // Set break point at this line. -} - -int main() { - Pair p1(3,-3); - return addPair(p1); -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py deleted file mode 100644 index cc22eca993e2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class DataFormatterHexCapsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format delete hex', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("type format add -f uppercase int") - - self.expect('frame variable mine', - substrs=['mine = ', - 'first = 0x001122AA', 'second = 0x1122BB44']) - - self.runCmd("type format add -f hex int") - - self.expect('frame variable mine', - substrs=['mine = ', - 'first = 0x001122aa', 'second = 0x1122bb44']) - - self.runCmd("type format delete int") - - self.runCmd( - "type summary add -s \"${var.first%X} and ${var.second%x}\" foo") - - self.expect('frame variable mine', - substrs=['(foo) mine = 0x001122AA and 0x1122bb44']) - - self.runCmd( - "type summary add -s \"${var.first%X} and ${var.second%X}\" foo") - self.runCmd("next") - self.runCmd("next") - self.expect('frame variable mine', - substrs=['(foo) mine = 0xAABBCCDD and 0x1122BB44']) - - self.runCmd( - "type summary add -s \"${var.first%x} and ${var.second%X}\" foo") - self.expect('frame variable mine', - substrs=['(foo) mine = 0xaabbccdd and 0x1122BB44']) - self.runCmd("next") - self.runCmd("next") - self.runCmd( - "type summary add -s \"${var.first%x} and ${var.second%x}\" foo") - self.expect('frame variable mine', - substrs=['(foo) mine = 0xaabbccdd and 0xff00ff00']) - self.runCmd( - "type summary add -s \"${var.first%X} and ${var.second%X}\" foo") - self.expect('frame variable mine', - substrs=['(foo) mine = 0xAABBCCDD and 0xFF00FF00']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/main.cpp deleted file mode 100644 index 5ee113c17b28..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> - -struct foo -{ - int first; - int second; -}; - -int main () -{ - struct foo mine = {0x001122AA, 0x1122BB44}; - printf("main.first = 0x%8.8x, main.second = 0x%8.8x\n", mine.first, mine.second); - mine.first = 0xAABBCCDD; // Set break point at this line. - printf("main.first = 0x%8.8x, main.second = 0x%8.8x\n", mine.first, mine.second); - mine.second = 0xFF00FF00; - printf("main.first = 0x%8.8x, main.second = 0x%8.8x\n", mine.first, mine.second); - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py deleted file mode 100644 index 55855dc8432b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class LanguageCategoryUpdatesTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// break here') - - def test_with_run_command(self): - """Test that LLDB correctly cleans caches when language categories change.""" - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - if hasattr( - self, - 'type_category') and hasattr( - self, - 'type_specifier'): - self.type_category.DeleteTypeSummary(self.type_specifier) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - self.expect( - "frame variable", - substrs=[ - '(S)', - 'object', - '123', - '456'], - matching=True) - - self.type_category = self.dbg.GetCategory( - lldb.eLanguageTypeC_plus_plus) - type_summary = lldb.SBTypeSummary.CreateWithSummaryString( - "this is an object of type S") - self.type_specifier = lldb.SBTypeNameSpecifier('S') - self.type_category.AddTypeSummary(self.type_specifier, type_summary) - - self.expect( - "frame variable", - substrs=['this is an object of type S'], - matching=True) - - self.type_category.DeleteTypeSummary(self.type_specifier) - self.expect( - "frame variable", - substrs=['this is an object of type S'], - matching=False) - self.expect( - "frame variable", - substrs=[ - '(S)', - 'object', - '123', - '456'], - matching=True) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp deleted file mode 100644 index ac77e537b80a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -struct S { - int x; - int y; - - S() : x(123), y(456) {} -}; - -int main() { - S object; - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/Makefile deleted file mode 100644 index 9f7fb1ca6231..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py deleted file mode 100644 index 1ae5e40f9780..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py +++ /dev/null @@ -1,110 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class NSArraySyntheticTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// Set break point at this line.') - - @skipUnlessDarwin - def test_rdar11086338_with_run_command(self): - """Test that NSArray reports its synthetic children properly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Now check that we are displaying Cocoa classes correctly - self.expect('frame variable arr', - substrs=['@"6 elements"']) - self.expect('frame variable other_arr', - substrs=['@"4 elements"']) - self.expect( - 'frame variable arr --ptr-depth 1', - substrs=[ - '@"6 elements"', - '[0] = 0x', - '[1] = 0x', - '[2] = 0x', - '[3] = 0x', - '[4] = 0x', - '[5] = 0x']) - self.expect( - 'frame variable other_arr --ptr-depth 1', - substrs=[ - '@"4 elements"', - '[0] = 0x', - '[1] = 0x', - '[2] = 0x', - '[3] = 0x']) - self.expect( - 'frame variable arr --ptr-depth 1 -d no-run-target', - substrs=[ - '@"6 elements"', - '@"hello"', - '@"world"', - '@"this"', - '@"is"', - '@"me"', - '@"http://www.apple.com']) - self.expect( - 'frame variable other_arr --ptr-depth 1 -d no-run-target', - substrs=[ - '@"4 elements"', - '(int)5', - '@"a string"', - '@"6 elements"']) - self.expect( - 'frame variable other_arr --ptr-depth 2 -d no-run-target', - substrs=[ - '@"4 elements"', - '@"6 elements" {', - '@"hello"', - '@"world"', - '@"this"', - '@"is"', - '@"me"', - '@"http://www.apple.com']) - - self.assertTrue( - self.frame().FindVariable("arr").MightHaveChildren(), - "arr says it does not have children!") - self.assertTrue( - self.frame().FindVariable("other_arr").MightHaveChildren(), - "arr says it does not have children!") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/main.m deleted file mode 100644 index 1b4a6e03857a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/main.m +++ /dev/null @@ -1,35 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main (int argc, const char * argv[]) -{ - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - - NSMutableArray* arr = [[NSMutableArray alloc] init]; - [arr addObject:@"hello"]; - [arr addObject:@"world"]; - [arr addObject:@"this"]; - [arr addObject:@"is"]; - [arr addObject:@"me"]; - [arr addObject:[NSURL URLWithString:@"http://www.apple.com/"]]; - - NSDate *aDate = [NSDate distantFuture]; - NSValue *aValue = [NSNumber numberWithInt:5]; - NSString *aString = @"a string"; - - NSArray *other_arr = [NSArray arrayWithObjects:aDate, aValue, aString, arr, nil]; - - [pool drain];// Set break point at this line. - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/Makefile deleted file mode 100644 index 9f7fb1ca6231..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py deleted file mode 100644 index 65e32643dde3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py +++ /dev/null @@ -1,124 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class NSDictionarySyntheticTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// Set break point at this line.') - - @skipUnlessDarwin - def test_rdar11988289_with_run_command(self): - """Test that NSDictionary reports its synthetic children properly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Now check that we are displaying Cocoa classes correctly - self.expect('frame variable dictionary', - substrs=['3 key/value pairs']) - self.expect('frame variable mutabledict', - substrs=['4 key/value pairs']) - self.expect( - 'frame variable dictionary --ptr-depth 1', - substrs=[ - '3 key/value pairs', - '[0] = ', - 'key = 0x', - 'value = 0x', - '[1] = ', - '[2] = ']) - self.expect( - 'frame variable mutabledict --ptr-depth 1', - substrs=[ - '4 key/value pairs', - '[0] = ', - 'key = 0x', - 'value = 0x', - '[1] = ', - '[2] = ', - '[3] = ']) - self.expect( - 'frame variable dictionary --ptr-depth 1 --dynamic-type no-run-target', - substrs=[ - '3 key/value pairs', - '@"bar"', - '@"2 elements"', - '@"baz"', - '2 key/value pairs']) - self.expect( - 'frame variable mutabledict --ptr-depth 1 --dynamic-type no-run-target', - substrs=[ - '4 key/value pairs', - '(int)23', - '@"123"', - '@"http://www.apple.com"', - '@"sourceofstuff"', - '3 key/value pairs']) - self.expect( - 'frame variable mutabledict --ptr-depth 2 --dynamic-type no-run-target', - substrs=[ - '4 key/value pairs', - '(int)23', - '@"123"', - '@"http://www.apple.com"', - '@"sourceofstuff"', - '3 key/value pairs', - '@"bar"', - '@"2 elements"']) - self.expect( - 'frame variable mutabledict --ptr-depth 3 --dynamic-type no-run-target', - substrs=[ - '4 key/value pairs', - '(int)23', - '@"123"', - '@"http://www.apple.com"', - '@"sourceofstuff"', - '3 key/value pairs', - '@"bar"', - '@"2 elements"', - '(int)1', - '@"two"']) - - self.assertTrue( - self.frame().FindVariable("dictionary").MightHaveChildren(), - "dictionary says it does not have children!") - self.assertTrue( - self.frame().FindVariable("mutabledict").MightHaveChildren(), - "mutable says it does not have children!") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/main.m deleted file mode 100644 index fdc533aeaf24..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/main.m +++ /dev/null @@ -1,30 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main (int argc, const char * argv[]) -{ - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - - NSArray* keys = @[@"foo",@"bar",@"baz"]; - NSArray* values = @[@"hello",@[@"X",@"Y"],@{@1 : @"one",@2 : @"two"}]; - NSDictionary* dictionary = [NSDictionary dictionaryWithObjects:values forKeys:keys]; - NSMutableDictionary* mutabledict = [NSMutableDictionary dictionaryWithCapacity:5]; - [mutabledict setObject:@"123" forKey:@23]; - [mutabledict setObject:[NSURL URLWithString:@"http://www.apple.com"] forKey:@"foobar"]; - [mutabledict setObject:@[@"a",@12] forKey:@57]; - [mutabledict setObject:dictionary forKey:@"sourceofstuff"]; - - [pool drain];// Set break point at this line. - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/Makefile deleted file mode 100644 index 9f7fb1ca6231..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py deleted file mode 100644 index a3657026faef..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py +++ /dev/null @@ -1,115 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class NSSetSyntheticTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// Set break point at this line.') - - @skipUnlessDarwin - def test_rdar12529957_with_run_command(self): - """Test that NSSet reports its synthetic children properly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Now check that we are displaying Cocoa classes correctly - self.expect('frame variable set', - substrs=['4 elements']) - self.expect('frame variable mutable', - substrs=['9 elements']) - self.expect( - 'frame variable set --ptr-depth 1 -d run -T', - substrs=[ - '4 elements', - '[0]', - '[1]', - '[2]', - '[3]', - 'hello', - 'world', - '(int)1', - '(int)2']) - self.expect( - 'frame variable mutable --ptr-depth 1 -d run -T', - substrs=[ - '9 elements', - '(int)5', - '@"3 elements"', - '@"www.apple.com"', - '(int)3', - '@"world"', - '(int)4']) - - self.runCmd("next") - self.expect('frame variable mutable', - substrs=['0 elements']) - - self.runCmd("next") - self.expect('frame variable mutable', - substrs=['4 elements']) - self.expect( - 'frame variable mutable --ptr-depth 1 -d run -T', - substrs=[ - '4 elements', - '[0]', - '[1]', - '[2]', - '[3]', - 'hello', - 'world', - '(int)1', - '(int)2']) - - self.runCmd("next") - self.expect('frame variable mutable', - substrs=['4 elements']) - self.expect( - 'frame variable mutable --ptr-depth 1 -d run -T', - substrs=[ - '4 elements', - '[0]', - '[1]', - '[2]', - '[3]', - 'hello', - 'world', - '(int)1', - '(int)2']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/main.m deleted file mode 100644 index 7bc49583606f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/main.m +++ /dev/null @@ -1,34 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main (int argc, const char * argv[]) -{ - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - NSSet* set = [NSSet setWithArray:@[@1,@"hello",@2,@"world"]]; - NSMutableSet* mutable = [NSMutableSet setWithCapacity:5]; - [mutable addObject:@1]; - [mutable addObject:@2]; - [mutable addObject:@3]; - [mutable addObject:@4]; - [mutable addObject:@5]; - [mutable addObject:[NSURL URLWithString:@"www.apple.com"]]; - [mutable addObject:@[@1,@2,@3]]; - [mutable unionSet:set]; - [mutable removeAllObjects]; // Set break point at this line. - [mutable unionSet:set]; - [mutable addObject:@1]; - - [pool drain]; - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/Makefile deleted file mode 100644 index 261658b10ae8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJCXX_SOURCES := main.mm - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py deleted file mode 100644 index 87265087744c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DataFormatterOSTypeTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.mm', '// Set break point at this line.') - - @skipUnlessDarwin - def test_ostype_with_run_command(self): - """Test the formatters we use for OSType.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.mm", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Now check that we use the right summary for OSType - self.expect('frame variable', - substrs=["'test'", "'best'"]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/main.mm b/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/main.mm deleted file mode 100644 index 8d22659374a7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/main.mm +++ /dev/null @@ -1,23 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main (int argc, const char * argv[]) -{ - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - OSType a = 'test'; - OSType b = 'best'; - - [pool drain];// Set break point at this line. - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py deleted file mode 100644 index 0bfd8df7b44e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py +++ /dev/null @@ -1,136 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class PrintArrayTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_print_array(self): - """Test that expr -Z works""" - self.build() - self.printarray_data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', 'break here') - - def printarray_data_formatter_commands(self): - """Test that expr -Z works""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect( - 'expr --element-count 3 -- data', - substrs=[ - '[0] = 1', - '[1] = 3', - '[2] = 5']) - self.expect('expr data', substrs=['int *', '$', '0x']) - self.expect( - 'expr -f binary --element-count 0 -- data', - substrs=[ - 'int *', - '$', - '0b']) - self.expect( - 'expr -f hex --element-count 3 -- data', - substrs=[ - '[0] = 0x', - '1', - '[1] = 0x', - '3', - '[2] = 0x', - '5']) - self.expect( - 'expr -f binary --element-count 2 -- data', - substrs=[ - 'int *', - '$', - '0x', - '[0] = 0b', - '1', - '[1] = 0b', - '11']) - self.expect('parray 3 data', substrs=['[0] = 1', '[1] = 3', '[2] = 5']) - self.expect( - 'parray `1 + 1 + 1` data', - substrs=[ - '[0] = 1', - '[1] = 3', - '[2] = 5']) - self.expect( - 'parray `data[1]` data', - substrs=[ - '[0] = 1', - '[1] = 3', - '[2] = 5']) - self.expect( - 'parray/x 3 data', - substrs=[ - '[0] = 0x', - '1', - '[1] = 0x', - '3', - '[2] = 0x', - '5']) - self.expect( - 'parray/x `data[1]` data', - substrs=[ - '[0] = 0x', - '1', - '[1] = 0x', - '3', - '[2] = 0x', - '5']) - - # check error conditions - self.expect( - 'expr --element-count 10 -- 123', - error=True, - substrs=['expression cannot be used with --element-count as it does not refer to a pointer']) - self.expect( - 'expr --element-count 10 -- (void*)123', - error=True, - substrs=['expression cannot be used with --element-count as it refers to a pointer to void']) - self.expect('parray data', error=True, substrs=[ - "invalid element count 'data'"]) - self.expect( - 'parray data data', - error=True, - substrs=["invalid element count 'data'"]) - self.expect('parray', error=True, substrs=[ - 'Not enough arguments provided']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/main.cpp deleted file mode 100644 index b2d6309947ad..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===-- main.cpp -------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <functional> -#include <stdlib.h> - -template<typename ElemType> -ElemType* alloc(size_t count, std::function<ElemType(size_t)> get) -{ - ElemType *elems = new ElemType[count]; - for(size_t i = 0; i < count; i++) - elems[i] = get(i); - return elems; -} - -int main (int argc, const char * argv[]) -{ - int* data = alloc<int>(5, [] (size_t idx) -> int { - return 2 * idx + 1; - }); - return 0; // break here -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/Makefile deleted file mode 100644 index 261658b10ae8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -OBJCXX_SOURCES := main.mm - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py deleted file mode 100644 index 4326574c254c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py +++ /dev/null @@ -1,112 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class PrintObjectArrayTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - def test_print_array(self): - """Test that expr -O -Z works""" - self.build() - self.printarray_data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.mm', 'break here') - - def printarray_data_formatter_commands(self): - """Test that expr -O -Z works""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.mm", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.expect( - 'expr --element-count 3 --object-description -- objects', - substrs=[ - '3735928559', - '4276993775', - '3203398366', - 'Hello', - 'World', - 'Two =', - '1 =']) - self.expect( - 'poarray 3 objects', - substrs=[ - '3735928559', - '4276993775', - '3203398366', - 'Hello', - 'World', - 'Two =', - '1 =']) - self.expect( - 'expr --element-count 3 --object-description --description-verbosity=full -- objects', - substrs=[ - '[0] =', - '3735928559', - '4276993775', - '3203398366', - '[1] =', - 'Hello', - 'World', - '[2] =', - 'Two =', - '1 =']) - self.expect( - 'parray 3 objects', - substrs=[ - '[0] = 0x', - '[1] = 0x', - '[2] = 0x']) - self.expect( - 'expr --element-count 3 -d run -- objects', - substrs=[ - '3 elements', - '2 elements', - '2 key/value pairs']) - self.expect( - 'expr --element-count 3 -d run --ptr-depth=1 -- objects', - substrs=[ - '3 elements', - '2 elements', - '2 key/value pairs', - '3735928559', - '4276993775', - '3203398366', - '"Hello"', - '"World"']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/main.mm b/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/main.mm deleted file mode 100644 index 9ef61e6a73f2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/main.mm +++ /dev/null @@ -1,30 +0,0 @@ -//===-- main.cpp -------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -struct ThreeObjects -{ - id one; - id two; - id three; -}; - -int main() -{ - NSArray *array1 = @[@0xDEADBEEF, @0xFEEDBEEF, @0xBEEFFADE]; - NSArray *array2 = @[@"Hello", @"World"]; - NSDictionary *dictionary = @{@1: array2, @"Two": array2}; - ThreeObjects *tobjects = new ThreeObjects(); - tobjects->one = array1; - tobjects->two = array2; - tobjects->three = dictionary; - id* objects = (id*)tobjects; - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/Makefile deleted file mode 100644 index d85e665333ea..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -CFLAGS_EXTRAS += -std=c++11 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py deleted file mode 100644 index 862e2b57342d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class PtrRef2TypedefTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set breakpoint here') - - def test_with_run_command(self): - """Test that a pointer/reference to a typedef is formatted as we want.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd('type summary add --cascade true -s "IntPointer" "int *"') - self.runCmd('type summary add --cascade true -s "IntLRef" "int &"') - self.runCmd('type summary add --cascade true -s "IntRRef" "int &&"') - - self.expect( - "frame variable x", - substrs=[ - '(Foo *) x = 0x', - 'IntPointer']) - # note: Ubuntu 12.04 x86_64 build with gcc 4.8.2 is getting a - # const after the ref that isn't showing up on FreeBSD. This - # tweak changes the behavior so that the const is not part of - # the match. - self.expect( - "frame variable y", substrs=[ - '(Foo &', ') y = 0x', 'IntLRef']) - self.expect( - "frame variable z", substrs=[ - '(Foo &&', ') z = 0x', 'IntRRef']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/main.cpp deleted file mode 100644 index 219f398da3f5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/main.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -typedef int Foo; - -int main() { - int lval = 1; - Foo* x = &lval; - Foo& y = lval; - Foo&& z = 1; - return 0; // Set breakpoint here -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/TestPyObjSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/TestPyObjSynthProvider.py deleted file mode 100644 index ba50ccd0ae5e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/TestPyObjSynthProvider.py +++ /dev/null @@ -1,73 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class PyObjectSynthProviderTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @expectedFailureAll(oslist=["windows"]) - def test_print_array(self): - """Test that expr -Z works""" - self.build() - self.provider_data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', 'break here') - - def provider_data_formatter_commands(self): - """Test that the PythonObjectSyntheticChildProvider helper class works""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd('command script import provider.py') - self.runCmd( - 'type synthetic add Foo --python-class provider.SyntheticChildrenProvider') - self.expect('frame variable f.Name', substrs=['"Enrico"']) - self.expect( - 'frame variable f', - substrs=[ - 'ID = 123456', - 'Name = "Enrico"', - 'Rate = 1.25']) - self.expect( - 'expression f', - substrs=[ - 'ID = 123456', - 'Name = "Enrico"', - 'Rate = 1.25']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/main.cpp deleted file mode 100644 index 6745366fb121..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===-- main.cpp -------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -struct Foo -{ - double x; - int y; - Foo() : x(3.1415), y(1234) {} -}; - -int main() { - Foo f; - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/provider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/provider.py deleted file mode 100644 index c263190c1028..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/provider.py +++ /dev/null @@ -1,16 +0,0 @@ -import lldb -import lldb.formatters -import lldb.formatters.synth - - -class SyntheticChildrenProvider( - lldb.formatters.synth.PythonObjectSyntheticChildProvider): - - def __init__(self, value, internal_dict): - lldb.formatters.synth.PythonObjectSyntheticChildProvider.__init__( - self, value, internal_dict) - - def make_children(self): - return [("ID", 123456), - ("Name", "Enrico"), - ("Rate", 1.25)] diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py deleted file mode 100644 index 09888e1b469b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py +++ /dev/null @@ -1,43 +0,0 @@ -""" -Test that ValueObjectPrinter does not cause an infinite loop when a reference to a struct that contains a pointer to itself is printed. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class DataFormatterRefPtrRecursionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that ValueObjectPrinter does not cause an infinite loop when a reference to a struct that contains a pointer to itself is printed.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - self.expect("frame variable foo", substrs=[]) - self.expect("frame variable foo --ptr-depth=1", substrs=['ID = 1']) - self.expect("frame variable foo --ptr-depth=2", substrs=['ID = 1']) - self.expect("frame variable foo --ptr-depth=3", substrs=['ID = 1']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/main.cpp deleted file mode 100644 index 4b576bd266dd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -int _ID = 0; - -class Foo { - public: - Foo *next; - int ID; - - Foo () : next(0), ID(++_ID) {} -}; - -int evalFoo(Foo& foo) -{ - return foo.ID; // Set break point at this line. -} - -int main() { - Foo f; - f.next = &f; - return evalFoo(f); -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile deleted file mode 100644 index 62a57f6cd9be..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -OBJC_SOURCES := main.m -include $(LEVEL)/Makefile.rules -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py deleted file mode 100644 index 804905106dfc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py +++ /dev/null @@ -1,6 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest( - __file__, globals(), [ - decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/main.m deleted file mode 100644 index 3dd455081007..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/main.m +++ /dev/null @@ -1,19 +0,0 @@ -//===-- main.m ---------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#import <Foundation/Foundation.h> - -int main() { - NSDictionary* dic = @{@1 : @2}; - NSLog(@"hello world"); //% dic = self.frame().FindVariable("dic") - //% dic.SetPreferSyntheticValue(True) - //% dic.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) - //% dic.SetValueFromCString("12") - return 0; //% dic = self.frame().FindVariable("dic") - //% self.assertTrue(dic.GetValueAsUnsigned() == 0xC, "failed to read what I wrote") -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile deleted file mode 100644 index 872bf6d20877..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -CXXFLAGS += -std=c++11 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py deleted file mode 100644 index c76b421a1ea8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py +++ /dev/null @@ -1,7 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest( - __file__, globals(), [ - decorators.expectedFailureAll( - oslist=["windows"], bugnumber="llvm.org/pr24772")]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/main.cpp deleted file mode 100644 index 4a449e9716c3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/main.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <string> - -int main (int argc, char const *argv[]) -{ - std::string stdstring("Hello\t\tWorld\nI am here\t\tto say hello\n"); //%self.addTearDownHook(lambda x: x.runCmd("setting set escape-non-printables true")) - const char* constcharstar = stdstring.c_str(); - std::string longstring( -"I am a very long string; in fact I am longer than any reasonable length that a string should be; quite long indeed; oh my, so many words; so many letters; this is kind of like writing a poem; except in real life all that is happening" -" is just me producing a very very long set of words; there is text here, text there, text everywhere; it fills me with glee to see so much text; all around me it's just letters, and symbols, and other pleasant drawings that cause me" -" a large amount of joy upon visually seeing them with my eyes; well, this is now a lot of letters, but it is still not enough for the purpose of the test I want to test, so maybe I should copy and paste this a few times, you know.." -" for science, or something" - "I am a very long string; in fact I am longer than any reasonable length that a string should be; quite long indeed; oh my, so many words; so many letters; this is kind of like writing a poem; except in real life all that is happening" - " is just me producing a very very long set of words; there is text here, text there, text everywhere; it fills me with glee to see so much text; all around me it's just letters, and symbols, and other pleasant drawings that cause me" - " a large amount of joy upon visually seeing them with my eyes; well, this is now a lot of letters, but it is still not enough for the purpose of the test I want to test, so maybe I should copy and paste this a few times, you know.." - " for science, or something" - "I am a very long string; in fact I am longer than any reasonable length that a string should be; quite long indeed; oh my, so many words; so many letters; this is kind of like writing a poem; except in real life all that is happening" - " is just me producing a very very long set of words; there is text here, text there, text everywhere; it fills me with glee to see so much text; all around me it's just letters, and symbols, and other pleasant drawings that cause me" - " a large amount of joy upon visually seeing them with my eyes; well, this is now a lot of letters, but it is still not enough for the purpose of the test I want to test, so maybe I should copy and paste this a few times, you know.." - " for science, or something" - ); - const char* longconstcharstar = longstring.c_str(); - return 0; //% if self.TraceOn(): self.runCmd('frame variable') - //% self.assertTrue(self.frame().FindVariable('stdstring').GetSummary() == '"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"') - //% self.assertTrue(self.frame().FindVariable('constcharstar').GetSummary() == '"Hello\\t\\tWorld\\nI am here\\t\\tto say hello\\n"') - //% self.runCmd("setting set escape-non-printables false") - //% self.assertTrue(self.frame().FindVariable('stdstring').GetSummary() == '"Hello\t\tWorld\nI am here\t\tto say hello\n"') - //% self.assertTrue(self.frame().FindVariable('constcharstar').GetSummary() == '"Hello\t\tWorld\nI am here\t\tto say hello\n"') - //% self.assertTrue(self.frame().FindVariable('longstring').GetSummary().endswith('"...')) - //% self.assertTrue(self.frame().FindVariable('longconstcharstar').GetSummary().endswith('"...')) -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py deleted file mode 100644 index f766699bd852..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py +++ /dev/null @@ -1,147 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class Radar9974002DataFormatterTestCase(TestBase): - - # test for rdar://problem/9974002 () - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion(): - self.skipTest( - "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef") - - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer.first}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '<parent is NULL>']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '0x000000']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer%S}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '0x000000']) - - self.runCmd("type summary add -s foo contained") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', 'foo']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', 'foo']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer%V}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '0x000000']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer.first}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '<parent is NULL>']) - - self.runCmd("type summary delete contained") - self.runCmd("n") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '<parent is NULL>']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '0x000000']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer%S}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '0x000000']) - - self.runCmd("type summary add -s foo contained") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', 'foo']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', 'foo']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer%V}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '0x000000']) - - self.runCmd( - "type summary add -s \"${var.scalar} and ${var.pointer.first}\" container") - - self.expect('frame variable mine', - substrs=['mine = ', - '1', '<parent is NULL>']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/main.cpp deleted file mode 100644 index 03a9f278b7ec..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/main.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> - -struct contained -{ - int first; - int second; -}; - -struct container -{ - int scalar; - struct contained *pointer; -}; - -int main () -{ - struct container mine = {1, 0}; - printf ("Mine's scalar is the only thing that is good: %d.\n", mine.scalar); // Set break point at this line. - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py deleted file mode 100644 index e94f6c4cc407..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py +++ /dev/null @@ -1,88 +0,0 @@ -""" -Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class SyntheticCappingTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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) - - process = self.dbg.GetSelectedTarget().GetProcess() - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - self.runCmd( - "settings set target.max-children-count 256", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # set up the synthetic children provider - self.runCmd("script from fooSynthProvider import *") - self.runCmd("type synth add -l fooSynthProvider foo") - - # note that the value of fake_a depends on target byte order - if process.GetByteOrder() == lldb.eByteOrderLittle: - fake_a_val = 0x02000000 - else: - fake_a_val = 0x00000100 - - # check that the synthetic children work, so we know we are doing the - # right thing - self.expect("frame variable f00_1", - substrs=['r = 34', - 'fake_a = %d' % fake_a_val, - 'a = 1']) - - # check that capping works - self.runCmd("settings set target.max-children-count 2", check=False) - - self.expect("frame variable f00_1", - substrs=['...', - 'fake_a = %d' % fake_a_val, - 'a = 1']) - - self.expect("frame variable f00_1", matching=False, - substrs=['r = 34']) - - self.runCmd("settings set target.max-children-count 256", check=False) - - self.expect("frame variable f00_1", matching=True, - substrs=['r = 34']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py deleted file mode 100644 index 124eb5d31bac..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py +++ /dev/null @@ -1,27 +0,0 @@ -import lldb - - -class fooSynthProvider: - - def __init__(self, valobj, dict): - self.valobj = valobj - self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt) - - def num_children(self): - return 3 - - def get_child_at_index(self, index): - if index == 0: - child = self.valobj.GetChildMemberWithName('a') - if index == 1: - child = self.valobj.CreateChildAtOffset('fake_a', 1, self.int_type) - if index == 2: - child = self.valobj.GetChildMemberWithName('r') - return child - - def get_child_index(self, name): - if name == 'a': - return 0 - if name == 'fake_a': - return 1 - return 2 diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp deleted file mode 100644 index 90571b59f81e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -struct foo -{ - int a; - int b; - int c; - int d; - int e; - int f; - int g; - int h; - int i; - int j; - int k; - int l; - int m; - int n; - int o; - int p; - int q; - int r; - - foo(int X) : - a(X), - b(X+1), - c(X+3), - d(X+5), - e(X+7), - f(X+9), - g(X+11), - h(X+13), - i(X+15), - j(X+17), - k(X+19), - l(X+21), - m(X+23), - n(X+25), - o(X+27), - p(X+29), - q(X+31), - r(X+33) {} -}; - -struct wrapint -{ - int x; - wrapint(int X) : x(X) {} -}; - -int main() -{ - foo f00_1(1); - foo *f00_ptr = new foo(12); - - f00_1.a++; // Set break point at this line. - - wrapint test_cast('A' + - 256*'B' + - 256*256*'C'+ - 256*256*256*'D'); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/Makefile deleted file mode 100644 index a8e1853a1290..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation - -clean:: - rm -rf $(wildcard *.o *.d *.dSYM *.log) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py deleted file mode 100644 index 54e9a3215777..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class SyntheticFilterRecomputingTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.m', '// Set break point at this line.') - - @skipUnlessDarwin - def test_rdar12437442_with_run_command(self): - """Test that we update SBValues correctly as dynamic types change.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.m", 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Now run the bulk of the test - id_x = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable("x") - id_x.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) - id_x.SetPreferSyntheticValue(True) - - if self.TraceOn(): - self.runCmd("expr --dynamic-type run-target --ptr-depth 1 -- x") - - self.assertTrue( - id_x.GetSummary() == '@"5 elements"', - "array does not get correct summary") - - self.runCmd("next") - self.runCmd("frame select 0") - - id_x = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable("x") - id_x.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) - id_x.SetPreferSyntheticValue(True) - - if self.TraceOn(): - self.runCmd("expr --dynamic-type run-target --ptr-depth 1 -- x") - - self.assertTrue( - id_x.GetNumChildren() == 7, - "dictionary does not have 7 children") - id_x.SetPreferSyntheticValue(False) - self.assertFalse( - id_x.GetNumChildren() == 7, - "dictionary still looks synthetic") - id_x.SetPreferSyntheticValue(True) - self.assertTrue( - id_x.GetSummary() == "7 key/value pairs", - "dictionary does not get correct summary") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/main.m deleted file mode 100644 index a7e94d29d469..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/main.m +++ /dev/null @@ -1,25 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -int main (int argc, const char * argv[]) -{ - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - NSArray* foo = [NSArray arrayWithObjects:@1,@2,@3,@4,@5, nil]; - NSDictionary *bar = @{@1 : @"one",@2 : @"two", @3 : @"three", @4 : @"four", @5 : @"five", @6 : @"six", @7 : @"seven"}; - id x = foo; - x = bar; // Set break point at this line. - - [pool drain]; - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py deleted file mode 100644 index 1cc2a0e431ad..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TypeSummaryListArgumentTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - @no_debug_info_test - def test_type_summary_list_with_arg(self): - """Test that the 'type summary list' command handles command line arguments properly""" - self.expect( - 'type summary list Foo', - substrs=[ - 'Category: default', - 'Category: system']) - self.expect( - 'type summary list char', - substrs=[ - 'char *', - 'unsigned char']) - - self.expect( - 'type summary list -w default', - substrs=['system'], - matching=False) - self.expect( - 'type summary list -w system unsigned', - substrs=[ - 'default', - '0-9'], - matching=False) - self.expect( - 'type summary list -w system char', - substrs=['unsigned char *'], - matching=True) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py deleted file mode 100644 index 9435e80573e1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TypeSummaryListScriptTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_typesummarylist_script(self): - """Test data formatter commands.""" - self.build() - self.data_formatter_commands() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', 'Break here') - - def data_formatter_commands(self): - """Test printing out Python summary formatters.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type category delete TSLSFormatters', check=False) - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - - self.addTearDownHook(cleanup) - - self.runCmd("command script import tslsformatters.py") - - self.expect( - "frame variable myStruct", - substrs=['A data formatter at work']) - - self.expect('type summary list', substrs=['Struct_SummaryFormatter']) - self.expect( - 'type summary list Struct', - substrs=['Struct_SummaryFormatter']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/main.cpp deleted file mode 100644 index 2de37041f263..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include <stdio.h> - -typedef struct Struct -{ - int one; - int two; -} Struct; - -int -main() -{ - Struct myStruct = {10, 20}; - printf ("Break here: %d\n.", myStruct.one); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py deleted file mode 100644 index 03fe17bfe761..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py +++ /dev/null @@ -1,12 +0,0 @@ -import lldb - - -def Struct_SummaryFormatter(valobj, internal_dict): - return 'A data formatter at work' - -category = lldb.debugger.CreateCategory("TSLSFormatters") -category.SetEnabled(True) -summary = lldb.SBTypeSummary.CreateWithFunctionName( - "tslsformatters.Struct_SummaryFormatter", lldb.eTypeOptionCascade) -spec = lldb.SBTypeNameSpecifier("Struct", False) -category.AddTypeSummary(spec, summary) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile deleted file mode 100644 index 3e2b0187b954..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -CXXFLAGS += -std=c++11 -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py deleted file mode 100644 index 7e67f73b7092..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py +++ /dev/null @@ -1,7 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest( - __file__, globals(), [ - decorators.expectedFailureAll( - compiler="gcc")]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/main.cpp deleted file mode 100644 index 5b43102c268c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/main.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===-- main.cpp --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -typedef int Foo; - -int main() { - // CHECK: (Foo [3]) array = { - // CHECK-NEXT: (Foo) [0] = 1 - // CHECK-NEXT: (Foo) [1] = 2 - // CHECK-NEXT: (Foo) [2] = 3 - // CHECK-NEXT: } - Foo array[3] = {1,2,3}; - return 0; //% self.filecheck("frame variable array --show-types --", 'main.cpp') -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py deleted file mode 100644 index d3cc4d98aff7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Test that the user can input a format but it will not prevail over summary format's choices. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class UserFormatVSSummaryTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that the user can input a format but it will not prevail over summary format's choices.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - self.expect("frame variable p1", substrs=[ - '(Pair) p1 = (x = 3, y = -3)']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd('type summary add Pair -s "x=${var.x%d},y=${var.y%u}"') - - self.expect("frame variable p1", substrs=[ - '(Pair) p1 = x=3,y=4294967293']) - self.expect( - "frame variable -f x p1", - substrs=['(Pair) p1 = x=0x00000003,y=0xfffffffd'], - matching=False) - self.expect( - "frame variable -f d p1", - substrs=['(Pair) p1 = x=3,y=-3'], - matching=False) - self.expect("frame variable p1", substrs=[ - '(Pair) p1 = x=3,y=4294967293']) - - self.runCmd('type summary add Pair -s "x=${var.x%x},y=${var.y%u}"') - - self.expect("frame variable p1", substrs=[ - '(Pair) p1 = x=0x00000003,y=4294967293']) - self.expect( - "frame variable -f d p1", - substrs=['(Pair) p1 = x=3,y=-3'], - matching=False) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/main.cpp deleted file mode 100644 index 41c934aec0c3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -struct Pair { - int x; - int y; - - Pair(int _x, int _y) : x(_x), y(_y) {} -}; - -int main() { - Pair p1(3,-3); - return p1.x + p1.y; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py deleted file mode 100644 index f6dc47f35869..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py +++ /dev/null @@ -1,80 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class VarInAggregateMisuseTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd( - "type summary add --summary-string \"SUMMARY SUCCESS ${var}\" Summarize") - - self.expect('frame variable mine_ptr', - substrs=['SUMMARY SUCCESS summarize_ptr_t @ ']) - - self.expect('frame variable *mine_ptr', - substrs=['SUMMARY SUCCESS summarize_t @']) - - self.runCmd( - "type summary add --summary-string \"SUMMARY SUCCESS ${var.first}\" Summarize") - - self.expect('frame variable mine_ptr', - substrs=['SUMMARY SUCCESS 10']) - - self.expect('frame variable *mine_ptr', - substrs=['SUMMARY SUCCESS 10']) - - self.runCmd("type summary add --summary-string \"${var}\" Summarize") - self.runCmd( - "type summary add --summary-string \"${var}\" -e TwoSummarizes") - - self.expect('frame variable', - substrs=['(TwoSummarizes) twos = TwoSummarizes @ ', - 'first = summarize_t @ ', - 'second = summarize_t @ ']) - - self.runCmd( - "type summary add --summary-string \"SUMMARY SUCCESS ${var.first}\" Summarize") - self.expect('frame variable', - substrs=['(TwoSummarizes) twos = TwoSummarizes @ ', - 'first = SUMMARY SUCCESS 1', - 'second = SUMMARY SUCCESS 3']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/main.cpp deleted file mode 100644 index 72c7e138205d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -struct Summarize -{ - int first; - int second; -}; - -typedef struct Summarize summarize_t; -typedef summarize_t *summarize_ptr_t; - -summarize_t global_mine = {30, 40}; - -struct TwoSummarizes -{ - summarize_t first; - summarize_t second; -}; - -int -main() -{ - summarize_t mine = {10, 20}; - summarize_ptr_t mine_ptr = &mine; - - TwoSummarizes twos = { {1,2}, {3,4} }; - - printf ("Summarize: first: %d second: %d and address: 0x%p\n", mine.first, mine.second, mine_ptr); // Set break point at this line. - printf ("Global summarize: first: %d second: %d.\n", global_mine.first, global_mine.second); - return 0; -} - - diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py deleted file mode 100644 index 670edad37f9e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import os.path -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DataFormatterVarScriptFormatting(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', ' // Set breakpoint here.') - - @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser - def test_with_run_command(self): - """Test using Python synthetic children provider.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - self.runCmd('type filter clear', check=False) - self.runCmd('type synth clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - self.runCmd("command script import helperfunc.py") - self.runCmd( - 'type summary add -x "^something<.*>$" -s "T is a ${script.var:helperfunc.f}"') - - self.expect("frame variable x", substrs=['T is a non-pointer type']) - - self.expect("frame variable y", substrs=['T is a pointer type']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py deleted file mode 100644 index 75654e4b4ed7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py +++ /dev/null @@ -1,6 +0,0 @@ -import lldb - - -def f(value, d): - return "pointer type" if value.GetType().GetTemplateArgumentType( - 0).IsPointerType() else "non-pointer type" diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/main.cpp deleted file mode 100644 index e9a36f911964..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ -template <typename T> -struct something {}; - -int main() { - something<int> x; - something<void*> y; - return 0; // Set breakpoint here. -} diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py deleted file mode 100644 index c1dc15224b1e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py +++ /dev/null @@ -1,90 +0,0 @@ -""" -Check that vector types format properly -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class VectorTypesFormattingTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// break here') - - # rdar://problem/14035604 - @skipIf(compiler='gcc') # gcc don't have ext_vector_type extension - def test_with_run_command(self): - """Check that vector types format properly""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - pass - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - pass # my code never fails - - v = self.frame().FindVariable("v") - v.SetPreferSyntheticValue(True) - v.SetFormat(lldb.eFormatVectorOfFloat32) - - if self.TraceOn(): - print(v) - - self.assertTrue( - v.GetNumChildren() == 4, - "v as float32[] has 4 children") - self.assertTrue(v.GetChildAtIndex(0).GetData().float[ - 0] == 1.25, "child 0 == 1.25") - self.assertTrue(v.GetChildAtIndex(1).GetData().float[ - 0] == 1.25, "child 1 == 1.25") - self.assertTrue(v.GetChildAtIndex(2).GetData().float[ - 0] == 2.50, "child 2 == 2.50") - self.assertTrue(v.GetChildAtIndex(3).GetData().float[ - 0] == 2.50, "child 3 == 2.50") - - self.expect("expr -f int16_t[] -- v", - substrs=['(0, 16288, 0, 16288, 0, 16416, 0, 16416)']) - self.expect("expr -f uint128_t[] -- v", - substrs=['(85236745249553456609335044694184296448)']) - self.expect( - "expr -f float32[] -- v", - substrs=['(1.25, 1.25, 2.5, 2.5)']) - - oldValue = v.GetChildAtIndex(0).GetValue() - v.SetFormat(lldb.eFormatHex) - newValue = v.GetChildAtIndex(0).GetValue() - self.assertFalse(oldValue == newValue, - "values did not change along with format") - - v.SetFormat(lldb.eFormatVectorOfFloat32) - oldValueAgain = v.GetChildAtIndex(0).GetValue() - self.assertTrue( - oldValue == oldValueAgain, - "same format but different values") diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/main.cpp deleted file mode 100644 index b9d67ad20ab2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -typedef float float4 __attribute__((ext_vector_type(4))); -typedef unsigned char vec __attribute__((ext_vector_type(16))); - -int main() { - float4 f4 = {1.25, 1.25, 2.50, 2.50}; - vec v = (vec)f4; - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile b/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile deleted file mode 100644 index c60ecd414635..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/dead-strip/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif - -ifeq "$(OS)" "Darwin" - LDFLAGS = $(CFLAGS) -Xlinker -dead_strip -else - CFLAGS += -fdata-sections -ffunction-sections - LDFLAGS = $(CFLAGS) -Wl,--gc-sections -endif - -MAKE_DSYM := NO - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py b/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py deleted file mode 100644 index 9ba3d2d0ac75..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -Test that breakpoint works correctly in the presence of dead-code stripping. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DeadStripTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - @expectedFailureAll(debug_info="dwo", bugnumber="llvm.org/pr25087") - @expectedFailureAll( - oslist=["linux"], - debug_info="gmodules", - bugnumber="llvm.org/pr27865") - # The -dead_strip linker option isn't supported on FreeBSD versions of ld. - @skipIfFreeBSD - def test(self): - """Test breakpoint works correctly with dead-code stripping.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break by function name f1 (live code). - lldbutil.run_break_set_by_symbol( - self, "f1", num_expected_locations=1, module_name="a.out") - - # Break by function name f2 (dead code). - lldbutil.run_break_set_by_symbol( - self, "f2", num_expected_locations=0, module_name="a.out") - - # Break by function name f3 (live code). - lldbutil.run_break_set_by_symbol( - self, "f3", num_expected_locations=1, module_name="a.out") - - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint (breakpoint #1). - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'a.out`f1', - 'stop reason = breakpoint']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f 1", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - self.runCmd("continue") - - # The stop reason of the thread should be breakpoint (breakpoint #3). - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'a.out`f3', - 'stop reason = breakpoint']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f 3", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) diff --git a/packages/Python/lldbsuite/test/functionalities/dead-strip/cmds.txt b/packages/Python/lldbsuite/test/functionalities/dead-strip/cmds.txt deleted file mode 100644 index f6fd04502888..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/dead-strip/cmds.txt +++ /dev/null @@ -1,4 +0,0 @@ -b main.c:21 -b main.c:41 -lines -shlib a.out main.c -c diff --git a/packages/Python/lldbsuite/test/functionalities/dead-strip/main.c b/packages/Python/lldbsuite/test/functionalities/dead-strip/main.c deleted file mode 100644 index fe8e7c7de582..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/dead-strip/main.c +++ /dev/null @@ -1,53 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - - -int f1 (char *s); -int f2 (char *s); -int f3 (char *s); - - -// We want f1 to start on line 20 -int f1 (char *s) -{ - return printf("f1: %s\n", s); -} - - - - - -// We want f2 to start on line 30, this should get stripped -int f2 (char *s) -{ - return printf("f2: %s\n", s); -} - - - - - -// We want f3 to start on line 40 -int f3 (char *s) -{ - return printf("f3: %s\n", s); -} - - - - - -// We want main to start on line 50 -int main (int argc, const char * argv[]) -{ - f1("carp"); - f3("dong"); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/deleted-executable/Makefile b/packages/Python/lldbsuite/test/functionalities/deleted-executable/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/deleted-executable/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/deleted-executable/TestDeletedExecutable.py b/packages/Python/lldbsuite/test/functionalities/deleted-executable/TestDeletedExecutable.py deleted file mode 100644 index 1eeaeeffa87b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/deleted-executable/TestDeletedExecutable.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Test process attach/resume. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class TestDeletedExecutable(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @skipIfWindows # cannot delete a running executable - @expectedFailureAll(oslist=["linux"]) # determining the architecture of the process fails - def test(self): - self.build() - exe = self.getBuildArtifact("a.out") - - popen = self.spawnSubprocess(exe) - self.addTearDownHook(self.cleanupSubprocesses) - os.remove(exe) - - self.runCmd("process attach -p " + str(popen.pid)) - self.runCmd("kill") diff --git a/packages/Python/lldbsuite/test/functionalities/deleted-executable/main.cpp b/packages/Python/lldbsuite/test/functionalities/deleted-executable/main.cpp deleted file mode 100644 index ad5d18732eac..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/deleted-executable/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include <chrono> -#include <thread> - -int main(int argc, char const *argv[]) -{ - lldb_enable_attach(); - - std::this_thread::sleep_for(std::chrono::seconds(30)); -} diff --git a/packages/Python/lldbsuite/test/functionalities/disassembly/Makefile b/packages/Python/lldbsuite/test/functionalities/disassembly/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py deleted file mode 100644 index 91b858b4665a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -Test some lldb command abbreviations. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py b/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py deleted file mode 100644 index c5fec5b02d6b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -Test to ensure SBFrame::Disassemble produces SOME output -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class FrameDisassembleTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def test_frame_disassemble(self): - """Sample test to ensure SBFrame::Disassemble produces SOME output.""" - self.build() - self.frame_disassemble_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def frame_disassemble_test(self): - """Sample test to ensure SBFrame::Disassemble produces SOME output""" - exe = 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/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp b/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp deleted file mode 100644 index c68e3f1b3212..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -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/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/Makefile b/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/Makefile deleted file mode 100644 index ceb406ee2eab..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := pass-to-base.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py b/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py deleted file mode 100644 index aaba15653763..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -Test that dynamic values update their child count correctly -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class DynamicValueChildCountTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - # Find the line number to break for main.c. - - self.main_third_call_line = line_number( - 'pass-to-base.cpp', '// Break here and check b has 0 children') - self.main_fourth_call_line = line_number( - 'pass-to-base.cpp', '// Break here and check b still has 0 children') - self.main_fifth_call_line = line_number( - 'pass-to-base.cpp', '// Break here and check b has one child now') - self.main_sixth_call_line = line_number( - 'pass-to-base.cpp', '// Break here and check b has 0 children again') - - @add_test_categories(['pyapi']) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663") - def test_get_dynamic_vals(self): - """Test fetching C++ dynamic values from pointers & references.""" - """Get argument vals for the call stack when stopped on a breakpoint.""" - self.build(dictionary=self.getBuildFlags()) - exe = self.getBuildArtifact("a.out") - - # Create a target from the debugger. - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Set up our breakpoints: - - third_call_bpt = target.BreakpointCreateByLocation( - 'pass-to-base.cpp', self.main_third_call_line) - self.assertTrue(third_call_bpt, - VALID_BREAKPOINT) - fourth_call_bpt = target.BreakpointCreateByLocation( - 'pass-to-base.cpp', self.main_fourth_call_line) - self.assertTrue(fourth_call_bpt, - VALID_BREAKPOINT) - fifth_call_bpt = target.BreakpointCreateByLocation( - 'pass-to-base.cpp', self.main_fifth_call_line) - self.assertTrue(fifth_call_bpt, - VALID_BREAKPOINT) - sixth_call_bpt = target.BreakpointCreateByLocation( - 'pass-to-base.cpp', self.main_sixth_call_line) - self.assertTrue(sixth_call_bpt, - VALID_BREAKPOINT) - - # Now launch the process, and do not stop at the entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - - b = self.frame().FindVariable("b").GetDynamicValue(lldb.eDynamicCanRunTarget) - self.assertTrue(b.GetNumChildren() == 0, "b has 0 children") - self.runCmd("continue") - self.assertTrue(b.GetNumChildren() == 0, "b still has 0 children") - self.runCmd("continue") - self.assertTrue(b.GetNumChildren() != 0, "b now has 1 child") - self.runCmd("continue") - self.assertTrue( - b.GetNumChildren() == 0, - "b didn't go back to 0 children") diff --git a/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/pass-to-base.cpp b/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/pass-to-base.cpp deleted file mode 100644 index d9dd3529821e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/pass-to-base.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include <stdio.h> -#include <memory> - -class BaseClass -{ -public: - BaseClass(); - virtual ~BaseClass() { } -}; - -class DerivedClass : public BaseClass -{ -public: - DerivedClass(); - virtual ~DerivedClass() { } -protected: - int mem; -}; - -BaseClass::BaseClass() -{ -} - -DerivedClass::DerivedClass() : BaseClass() -{ - mem = 101; -} - -int -main (int argc, char **argv) -{ - BaseClass *b = nullptr; // Break here and check b has 0 children - b = new DerivedClass(); // Break here and check b still has 0 children - b = nullptr; // Break here and check b has one child now - return 0; // Break here and check b has 0 children again -} diff --git a/packages/Python/lldbsuite/test/functionalities/exec/Makefile b/packages/Python/lldbsuite/test/functionalities/exec/Makefile deleted file mode 100644 index 784a53da4776..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/exec/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -all: a.out secondprog - -include $(LEVEL)/Makefile.rules - -secondprog: - $(MAKE) VPATH=$(VPATH) -f $(SRCDIR)/secondprog.mk - -clean:: - $(MAKE) -f $(SRCDIR)/secondprog.mk clean diff --git a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py b/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py deleted file mode 100644 index 2cec254acc0c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py +++ /dev/null @@ -1,123 +0,0 @@ -""" -Test some lldb command abbreviations. -""" -from __future__ import print_function - - -import lldb -import os -import time -from lldbsuite.support import seven -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -def execute_command(command): - #print('%% %s' % (command)) - (exit_status, output) = seven.get_command_status_output(command) - # if output: - # print(output) - #print('status = %u' % (exit_status)) - return exit_status - - -class ExecTestCase(TestBase): - - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532") - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems - @skipIfSanitized # rdar://problem/43756823 - def test_hitting_exec (self): - self.do_test(False) - - @skipUnlessDarwin - @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532") - @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems - @skipIfSanitized # rdar://problem/43756823 - def test_skipping_exec (self): - self.do_test(True) - - def do_test(self, skip_exec): - self.build() - exe = self.getBuildArtifact("a.out") - secondprog = self.getBuildArtifact("secondprog") - - # Create the target - target = self.dbg.CreateTarget(exe) - - # Create any breakpoints we need - breakpoint1 = target.BreakpointCreateBySourceRegex( - 'Set breakpoint 1 here', lldb.SBFileSpec("main.cpp", False)) - self.assertTrue(breakpoint1, VALID_BREAKPOINT) - breakpoint2 = target.BreakpointCreateBySourceRegex( - 'Set breakpoint 2 here', lldb.SBFileSpec("secondprog.cpp", False)) - self.assertTrue(breakpoint2, VALID_BREAKPOINT) - - # Launch the process - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - if self.TraceOn(): - self.runCmd("settings show target.process.stop-on-exec", check=False) - if skip_exec: - self.dbg.HandleCommand("settings set target.process.stop-on-exec false") - def cleanup(): - self.runCmd("settings set target.process.stop-on-exec false", - check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # The stop reason of the thread should be breakpoint. - self.assertTrue(process.GetState() == lldb.eStateStopped, - STOPPED_DUE_TO_BREAKPOINT) - - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, breakpoint1) - self.assertTrue(len(threads) == 1) - - # We had a deadlock tearing down the TypeSystemMap on exec, but only if some - # expression had been evaluated. So make sure we do that here so the teardown - # is not trivial. - - thread = threads[0] - value = thread.frames[0].EvaluateExpression("1 + 2") - self.assertTrue( - value.IsValid(), - "Expression evaluated successfully") - int_value = value.GetValueAsSigned() - self.assertTrue(int_value == 3, "Expression got the right result.") - - # Run and we should stop due to exec - process.Continue() - - if not skip_exec: - self.assertFalse(process.GetState() == lldb.eStateExited, - "Process should not have exited!") - self.assertTrue(process.GetState() == lldb.eStateStopped, - "Process should be stopped at __dyld_start") - - threads = lldbutil.get_stopped_threads( - process, lldb.eStopReasonExec) - self.assertTrue( - len(threads) == 1, - "We got a thread stopped for exec.") - - # Run and we should stop at breakpoint in main after exec - process.Continue() - - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, breakpoint2) - if self.TraceOn(): - for t in process.threads: - print(t) - if t.GetStopReason() != lldb.eStopReasonBreakpoint: - self.runCmd("bt") - self.assertTrue(len(threads) == 1, - "Stopped at breakpoint in exec'ed process.") diff --git a/packages/Python/lldbsuite/test/functionalities/exec/main.cpp b/packages/Python/lldbsuite/test/functionalities/exec/main.cpp deleted file mode 100644 index 92206b2d88ef..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/exec/main.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include <errno.h> -#include <mach/mach.h> -#include <signal.h> -#include <stdio.h> -#include <stdint.h> -#include <stdlib.h> -#include <spawn.h> -#include <unistd.h> -#include <libgen.h> -#include <string> - -static void -exit_with_errno (int err, const char *prefix) -{ - if (err) - { - fprintf (stderr, - "%s%s", - prefix ? prefix : "", - strerror(err)); - exit (err); - } -} - -static pid_t -spawn_process (const char *progname, - const char **argv, - const char **envp, - int &err) -{ - pid_t pid = 0; - - const posix_spawn_file_actions_t *file_actions = NULL; - posix_spawnattr_t attr; - err = posix_spawnattr_init (&attr); - if (err) - return pid; - - short flags = POSIX_SPAWN_SETEXEC | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK; - err = posix_spawnattr_setflags (&attr, flags); - if (err == 0) - { - // Use the default signal masks - sigset_t no_signals; - sigset_t all_signals; - sigemptyset (&no_signals); - sigfillset (&all_signals); - posix_spawnattr_setsigmask(&attr, &no_signals); - posix_spawnattr_setsigdefault(&attr, &all_signals); - - err = posix_spawn (&pid, - progname, - file_actions, - &attr, - (char * const *)argv, - (char * const *)envp); - - posix_spawnattr_destroy(&attr); - } - return pid; -} - -int -main (int argc, char const **argv) -{ - char *buf = (char*) malloc (strlen (argv[0]) + 12); - strlcpy (buf, argv[0], strlen (argv[0]) + 1); - std::string directory_name (::dirname (buf)); - - std::string other_program = directory_name + "/secondprog"; - int err = 0; // Set breakpoint 1 here - spawn_process (other_program.c_str(), argv, NULL, err); - if (err) - exit_with_errno (err, "posix_spawn x86_64 error"); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/exec/secondprog.cpp b/packages/Python/lldbsuite/test/functionalities/exec/secondprog.cpp deleted file mode 100644 index 5653471c1530..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/exec/secondprog.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include <stdio.h> -int main () -{ - puts ("I am the second program."); // Set breakpoint 2 here -} diff --git a/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk b/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk deleted file mode 100644 index 88f76b5113b4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := secondprog.cpp -EXE = secondprog - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/.categories b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/.categories deleted file mode 100644 index 897e40a99dda..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/.categories +++ /dev/null @@ -1 +0,0 @@ -expression diff --git a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/Makefile b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/Makefile deleted file mode 100644 index a10791d58907..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py deleted file mode 100644 index a498f0a360ee..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Test that expr will time out and allow other threads to run if it blocks. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -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/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/locking.c b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/locking.c deleted file mode 100644 index fae9979611d5..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile b/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py b/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/TestExprEntryBP.py deleted file mode 100644 index 56abc19f4f30..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/main.c b/packages/Python/lldbsuite/test/functionalities/expr-entry-bp/main.c deleted file mode 100644 index 168fc9c8ccbf..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile b/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile deleted file mode 100644 index c7c5ef405459..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ - -all: a.c clean - $(CC) -arch i386 -g -c $(SRCDIR)/a.c - ar -q liba-i386.a a.o - ranlib liba-i386.a - $(CC) -arch x86_64 -g -c $(SRCDIR)/a.c - ar -q liba-x86_64.a a.o - ranlib liba-x86_64.a - lipo -create -output liba.a liba-i386.a liba-x86_64.a - $(CC) -g -c $(SRCDIR)/main.c - $(CC) -o a.out main.o -L. -la - -clean: - rm -rf a.o a.out liba-i386.a liba-x86_64.a liba.a $(wildcard *un~ .*un~ main.o *.pyc) - diff --git a/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py b/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py deleted file mode 100644 index 80240534c368..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Test some lldb command abbreviations. -""" -from __future__ import print_function - - -import lldb -import os -import time -import lldbsuite.support.seven as seven -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class FatArchiveTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - @skipUnlessDarwin - def test_breakpoint_resolution_dwarf(self): - if self.getArchitecture() == 'x86_64': - self.build() - self.main() - else: - self.skipTest( - "This test requires x86_64 as the architecture for the inferior") - - def main(self): - '''This test compiles a quick example by making a fat file (universal) full of - skinny .o files and makes sure we can use them to resolve breakpoints when doing - DWARF in .o file debugging. The only thing this test needs to do is to compile and - set a breakpoint in the target and verify any breakpoint locations have valid debug - info for the function, and source file and line.''' - exe = self.getBuildArtifact("a.out") - - # Create the target - target = self.dbg.CreateTarget(exe) - - # Create a breakpoint by name - breakpoint = target.BreakpointCreateByName('foo', exe) - self.assertTrue(breakpoint, VALID_BREAKPOINT) - - # Make sure the breakpoint resolves to a function, file and line - for bp_loc in breakpoint: - # Get a section offset address (lldb.SBAddress) from the breakpoint - # location - bp_loc_addr = bp_loc.GetAddress() - line_entry = bp_loc_addr.GetLineEntry() - function = bp_loc_addr.GetFunction() - self.assertTrue( - function.IsValid(), - "Verify breakpoint in fat BSD archive has valid function debug info") - self.assertTrue( - line_entry.GetFileSpec(), - "Verify breakpoint in fat BSD archive has source file information") - self.assertTrue( - line_entry.GetLine() != 0, - "Verify breakpoint in fat BSD archive has source line information") diff --git a/packages/Python/lldbsuite/test/functionalities/fat_archives/a.c b/packages/Python/lldbsuite/test/functionalities/fat_archives/a.c deleted file mode 100644 index c100f9a2c075..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/fat_archives/a.c +++ /dev/null @@ -1,4 +0,0 @@ -int foo () -{ - return 5; -} diff --git a/packages/Python/lldbsuite/test/functionalities/fat_archives/a.h b/packages/Python/lldbsuite/test/functionalities/fat_archives/a.h deleted file mode 100644 index a4536647cfc9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/fat_archives/a.h +++ /dev/null @@ -1 +0,0 @@ -int foo (); diff --git a/packages/Python/lldbsuite/test/functionalities/fat_archives/main.c b/packages/Python/lldbsuite/test/functionalities/fat_archives/main.c deleted file mode 100644 index 328319d4fb8f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/fat_archives/main.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "a.h" -#include <stdio.h> -int main() -{ - printf ("%d\n", foo()); -} diff --git a/packages/Python/lldbsuite/test/functionalities/format/Makefile b/packages/Python/lldbsuite/test/functionalities/format/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/format/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py b/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py deleted file mode 100644 index f311fac4c0f7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Test the command history mechanism -""" - -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 TestFormats(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - hostoslist=["windows"], - bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") - def test_formats(self): - """Test format string functionality.""" - self.build() - exe = self.getBuildArtifact("a.out") - import pexpect - prompt = "(lldb) " - child = pexpect.spawn( - '%s %s -x -o "b main" -o r %s' % - (lldbtest_config.lldbExec, self.lldbOption, exe)) - # Turn on logging for what the child sends back. - if self.TraceOn(): - child.logfile_read = sys.stdout - # So that the spawned lldb session gets shutdown durng teardown. - self.child = child - - # Substitute 'Help!' for 'help' using the 'commands regex' mechanism. - child.expect_exact(prompt + 'target create "%s"' % exe) - child.expect_exact(prompt + 'b main') - child.expect_exact(prompt + 'r') - child.expect_exact(prompt) - child.sendline() - # child.expect_exact(prompt + "target create") - # - # child.sendline("command regex 'Help__'") - # child.expect_exact(regex_prompt) - # child.sendline('s/^$/help/') - # child.expect_exact(regex_prompt1) - # child.sendline('') - # child.expect_exact(prompt) - # # Help! - # child.sendline('Help__') - # # If we see the familiar 'help' output, the test is done. - # child.expect('Debugger commands:') - # # Try and incorrectly remove "Help__" using "command unalias" and verify we fail - # child.sendline('command unalias Help__') - # child.expect_exact("error: 'Help__' is not an alias, it is a debugger command which can be removed using the 'command delete' command") - # child.expect_exact(prompt) - # - # # Delete the regex command using "command delete" - # child.sendline('command delete Help__') - # child.expect_exact(prompt) - # # Verify the command was removed - # child.sendline('Help__') - # child.expect_exact("error: 'Help__' is not a valid command") - # child.expect_exact(prompt) diff --git a/packages/Python/lldbsuite/test/functionalities/format/main.c b/packages/Python/lldbsuite/test/functionalities/format/main.c deleted file mode 100644 index 1dfc8ef1f3aa..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/format/main.c +++ /dev/null @@ -1,15 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -int main (int argc, char const *argv[]) -{ - printf("testing\n"); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py deleted file mode 100644 index 4abf1a812963..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -Test the output of `frame diagnose` for an array access -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c deleted file mode 100644 index 95c6515e5f54..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py deleted file mode 100644 index e198720db57d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a bad reference -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp deleted file mode 100644 index 2f61152e3985..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py deleted file mode 100644 index 7823c639572c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Test the output of `frame diagnose` for a subexpression of a complicated expression -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c deleted file mode 100644 index 147aae946140..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py deleted file mode 100644 index 335d61767cd8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a function argument -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c deleted file mode 100644 index 0ec23b13be16..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py deleted file mode 100644 index 0398a161dcd8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a function's return value -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c deleted file mode 100644 index 420e6f21de6b..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py deleted file mode 100644 index 272a64e117b9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing `this` -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp deleted file mode 100644 index 1f177230ed90..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py deleted file mode 100644 index 3d9c893bbd40..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Test the output of `frame diagnose` for calling virtual methods -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp deleted file mode 100644 index 78cac2c89653..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py deleted file mode 100644 index da1fd187d142..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Test the output of `frame diagnose` for dereferencing a local variable -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c deleted file mode 100644 index 33307beb0703..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py deleted file mode 100644 index 437cdbbc93b7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Test the output of `frame diagnose` for calling virtual methods -""" - -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 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/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp deleted file mode 100644 index 2a03dc11bf29..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile deleted file mode 100644 index cb1af719ac35..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py b/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py deleted file mode 100644 index 959b621521e9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-language/TestGuessLanguage.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -Test the SB API SBFrame::GuessLanguage. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.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/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-language/main.cpp deleted file mode 100644 index f5449f217908..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp b/packages/Python/lldbsuite/test/functionalities/frame-language/other-2.cpp deleted file mode 100644 index 77632de3ceb0..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp b/packages/Python/lldbsuite/test/functionalities/frame-language/other.cpp deleted file mode 100644 index 41f4f26079ad..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-language/other.h b/packages/Python/lldbsuite/test/functionalities/frame-language/other.h deleted file mode 100644 index 0a2c125e6b42..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c b/packages/Python/lldbsuite/test/functionalities/frame-language/somefunc.c deleted file mode 100644 index a4b4f47f32ec..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile deleted file mode 100644 index 45f00b3e9861..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py b/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py deleted file mode 100644 index 1162157bad57..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py +++ /dev/null @@ -1,117 +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(1).name, "b") - self.assertEqual(variables.GetValueAtIndex(1).signed, 56) - - 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/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m b/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m deleted file mode 100644 index 51103ae038ac..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#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/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py b/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py deleted file mode 100644 index a8a506745118..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame_var/Makefile b/packages/Python/lldbsuite/test/functionalities/frame_var/Makefile deleted file mode 100644 index 50d4ab65a6ec..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py b/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py deleted file mode 100644 index b4e1b9c07634..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame_var/TestFrameVar.py +++ /dev/null @@ -1,99 +0,0 @@ -""" -Make sure the frame variable -g, -a, and -l flags work. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class 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/packages/Python/lldbsuite/test/functionalities/frame_var/main.c b/packages/Python/lldbsuite/test/functionalities/frame_var/main.c deleted file mode 100644 index da23af2ac550..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile deleted file mode 100644 index f5a47fcc46cc..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py deleted file mode 100644 index 48e49ed009ba..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c deleted file mode 100644 index 80beb29cf34f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c +++ /dev/null @@ -1,21 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -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/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py deleted file mode 100644 index 6e28d5b54052..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestArmRegisterDefinition.py +++ /dev/null @@ -1,130 +0,0 @@ -from __future__ import print_function -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - -class TestArmRegisterDefinition(GDBRemoteTestBase): - - @skipIfXmlSupportMissing - @skipIfRemote - def test(self): - """ - Test lldb's parsing of the <architecture> tag in the target.xml register - description packet. - """ - class MyResponder(MockGDBServerResponder): - - def qXferRead(self, obj, annex, offset, length): - if annex == "target.xml": - return """<?xml version="1.0"?> - <!DOCTYPE feature SYSTEM "gdb-target.dtd"> - <target> - <architecture>arm</architecture> - <feature name="org.gnu.gdb.arm.m-profile"> - <reg name="r0" bitsize="32" type="uint32" group="general"/> - <reg name="r1" bitsize="32" type="uint32" group="general"/> - <reg name="r2" bitsize="32" type="uint32" group="general"/> - <reg name="r3" bitsize="32" type="uint32" group="general"/> - <reg name="r4" bitsize="32" type="uint32" group="general"/> - <reg name="r5" bitsize="32" type="uint32" group="general"/> - <reg name="r6" bitsize="32" type="uint32" group="general"/> - <reg name="r7" bitsize="32" type="uint32" group="general"/> - <reg name="r8" bitsize="32" type="uint32" group="general"/> - <reg name="r9" bitsize="32" type="uint32" group="general"/> - <reg name="r10" bitsize="32" type="uint32" group="general"/> - <reg name="r11" bitsize="32" type="uint32" group="general"/> - <reg name="r12" bitsize="32" type="uint32" group="general"/> - <reg name="sp" bitsize="32" type="data_ptr" group="general"/> - <reg name="lr" bitsize="32" type="uint32" group="general"/> - <reg name="pc" bitsize="32" type="code_ptr" group="general"/> - <reg name="xpsr" bitsize="32" regnum="25" type="uint32" group="general"/> - <reg name="MSP" bitsize="32" regnum="26" type="uint32" group="general"/> - <reg name="PSP" bitsize="32" regnum="27" type="uint32" group="general"/> - <reg name="PRIMASK" bitsize="32" regnum="28" type="uint32" group="general"/> - <reg name="BASEPRI" bitsize="32" regnum="29" type="uint32" group="general"/> - <reg name="FAULTMASK" bitsize="32" regnum="30" type="uint32" group="general"/> - <reg name="CONTROL" bitsize="32" regnum="31" type="uint32" group="general"/> - <reg name="FPSCR" bitsize="32" type="uint32" group="float"/> - <reg name="s0" bitsize="32" type="float" group="float"/> - <reg name="s1" bitsize="32" type="float" group="float"/> - <reg name="s2" bitsize="32" type="float" group="float"/> - <reg name="s3" bitsize="32" type="float" group="float"/> - <reg name="s4" bitsize="32" type="float" group="float"/> - <reg name="s5" bitsize="32" type="float" group="float"/> - <reg name="s6" bitsize="32" type="float" group="float"/> - <reg name="s7" bitsize="32" type="float" group="float"/> - <reg name="s8" bitsize="32" type="float" group="float"/> - <reg name="s9" bitsize="32" type="float" group="float"/> - <reg name="s10" bitsize="32" type="float" group="float"/> - <reg name="s11" bitsize="32" type="float" group="float"/> - <reg name="s12" bitsize="32" type="float" group="float"/> - <reg name="s13" bitsize="32" type="float" group="float"/> - <reg name="s14" bitsize="32" type="float" group="float"/> - <reg name="s15" bitsize="32" type="float" group="float"/> - <reg name="s16" bitsize="32" type="float" group="float"/> - <reg name="s17" bitsize="32" type="float" group="float"/> - <reg name="s18" bitsize="32" type="float" group="float"/> - <reg name="s19" bitsize="32" type="float" group="float"/> - <reg name="s20" bitsize="32" type="float" group="float"/> - <reg name="s21" bitsize="32" type="float" group="float"/> - <reg name="s22" bitsize="32" type="float" group="float"/> - <reg name="s23" bitsize="32" type="float" group="float"/> - <reg name="s24" bitsize="32" type="float" group="float"/> - <reg name="s25" bitsize="32" type="float" group="float"/> - <reg name="s26" bitsize="32" type="float" group="float"/> - <reg name="s27" bitsize="32" type="float" group="float"/> - <reg name="s28" bitsize="32" type="float" group="float"/> - <reg name="s29" bitsize="32" type="float" group="float"/> - <reg name="s30" bitsize="32" type="float" group="float"/> - <reg name="s31" bitsize="32" type="float" group="float"/> - </feature> - </target>""", False - else: - return None, False - - def readRegister(self, regnum): - return "E01" - - def readRegisters(self): - return "20000000f8360020001000002fcb0008f8360020a0360020200c0020000000000000000000000000000000000000000000000000b87f0120b7d100082ed2000800000001b87f01200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - - def haltReason(self): - return "S05" - - def qfThreadInfo(self): - return "mdead" - - def qC(self): - return "" - - def qSupported(self, client_supported): - return "PacketSize=4000;qXfer:memory-map:read-;QStartNoAckMode+;qXfer:threads:read+;hwbreak+;qXfer:features:read+" - - def QThreadSuffixSupported(self): - return "OK" - - def QListThreadsInStopReply(self): - return "OK" - - self.server.responder = MyResponder() - if self.TraceOn(): - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - interp.HandleCommand("log enable gdb-remote packets", result) - self.dbg.SetDefaultArchitecture("armv7em") - target = self.dbg.CreateTargetWithFileAndArch(None, None) - - process = self.connect(target) - - if self.TraceOn(): - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - interp.HandleCommand("target list", result) - print(result.GetOutput()) - - r0_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("r0") - self.assertEqual(r0_valobj.GetValueAsUnsigned(), 0x20) - - pc_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("pc") - self.assertEqual(pc_valobj.GetValueAsUnsigned(), 0x0800d22e) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py deleted file mode 100644 index 3bf0c52edaed..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py +++ /dev/null @@ -1,39 +0,0 @@ -import lldb -import binascii -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - - -class TestGDBRemoteClient(GDBRemoteTestBase): - - def test_connect(self): - """Test connecting to a remote gdb server""" - target = self.createTarget("a.yaml") - process = self.connect(target) - self.assertPacketLogContains(["qProcessInfo", "qfThreadInfo"]) - - def test_attach_fail(self): - error_msg = "mock-error-msg" - - class MyResponder(MockGDBServerResponder): - # Pretend we don't have any process during the initial queries. - def qC(self): - return "E42" - - def qfThreadInfo(self): - return "OK" # No threads. - - # Then, when we are asked to attach, error out. - def vAttach(self, pid): - return "E42;" + binascii.hexlify(error_msg.encode()).decode() - - self.server.responder = MyResponder() - - target = self.dbg.CreateTarget("") - process = self.connect(target) - lldbutil.expect_state_changes(self, self.dbg.GetListener(), process, [lldb.eStateConnected]) - - error = lldb.SBError() - target.AttachToProcessWithID(lldb.SBListener(), 47, error) - self.assertEquals(error_msg, error.GetCString()) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py deleted file mode 100644 index f70c854ed6d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteLoad.py +++ /dev/null @@ -1,80 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - - -class TestGDBRemoteLoad(GDBRemoteTestBase): - - def setUp(self): - super(TestGDBRemoteLoad, self).setUp() - self._initial_platform = lldb.DBG.GetSelectedPlatform() - - def tearDown(self): - lldb.DBG.SetSelectedPlatform(self._initial_platform) - super(TestGDBRemoteLoad, self).tearDown() - - def test_module_load_address(self): - """Test that setting the load address of a module uses virtual addresses""" - target = self.createTarget("a.yaml") - process = self.connect(target) - module = target.GetModuleAtIndex(0) - self.assertTrue(module.IsValid()) - self.assertTrue(target.SetModuleLoadAddress(module, 0).Success()) - address = target.ResolveLoadAddress(0x2001) - self.assertTrue(address.IsValid()) - self.assertEqual(".data", address.GetSection().GetName()) - - def test_ram_load(self): - """Test loading an object file to a target's ram""" - target = self.createTarget("a.yaml") - process = self.connect(target) - self.dbg.HandleCommand("target modules load -l -s0") - self.assertPacketLogContains([ - "M1000,4:c3c3c3c3", - "M1004,2:3232" - ]) - - @skipIfXmlSupportMissing - def test_flash_load(self): - """Test loading an object file to a target's flash memory""" - - class Responder(MockGDBServerResponder): - def qSupported(self, client_supported): - return "PacketSize=3fff;QStartNoAckMode+;qXfer:memory-map:read+" - - def qXferRead(self, obj, annex, offset, length): - if obj == "memory-map": - return (self.MEMORY_MAP[offset:offset + length], - offset + length < len(self.MEMORY_MAP)) - return None, False - - def other(self, packet): - if packet[0:11] == "vFlashErase": - return "OK" - if packet[0:11] == "vFlashWrite": - return "OK" - if packet == "vFlashDone": - return "OK" - return "" - - MEMORY_MAP = """<?xml version="1.0"?> -<memory-map> - <memory type="ram" start="0x0" length="0x1000"/> - <memory type="flash" start="0x1000" length="0x1000"> - <property name="blocksize">0x100</property> - </memory> - <memory type="ram" start="0x2000" length="0x1D400"/> -</memory-map> -""" - - self.server.responder = Responder() - target = self.createTarget("a.yaml") - process = self.connect(target) - self.dbg.HandleCommand("target modules load -l -s0") - self.assertPacketLogContains([ - "vFlashErase:1000,100", - "vFlashWrite:1000:\xc3\xc3\xc3\xc3", - "vFlashWrite:1004:\x32\x32", - "vFlashDone" - ]) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py deleted file mode 100644 index 66a271e126dc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py +++ /dev/null @@ -1,64 +0,0 @@ -from __future__ import print_function -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - -class TestNoWatchpointSupportInfo(GDBRemoteTestBase): - - @skipIfXmlSupportMissing - @skipIfRemote - def test(self): - """ - Test lldb's parsing of the <architecture> tag in the target.xml register - description packet. - """ - class MyResponder(MockGDBServerResponder): - - def haltReason(self): - return "T02thread:1ff0d;thread-pcs:10001bc00;" - - def threadStopInfo(self, threadnum): - if threadnum == 0x1ff0d: - return "T02thread:1ff0d;thread-pcs:10001bc00;" - - def setBreakpoint(self, packet): - if packet.startswith("Z2,"): - return "OK" - - def qXferRead(self, obj, annex, offset, length): - if annex == "target.xml": - return """<?xml version="1.0"?> - <target version="1.0"> - <architecture>i386:x86-64</architecture> - <feature name="org.gnu.gdb.i386.core"> - <reg name="rip" bitsize="64" regnum="0" type="code_ptr" group="general"/> - </feature> - </target>""", False - else: - return None, False - - self.server.responder = MyResponder() - if self.TraceOn(): - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - interp.HandleCommand("log enable gdb-remote packets", result) - self.dbg.SetDefaultArchitecture("x86_64") - target = self.dbg.CreateTargetWithFileAndArch(None, None) - - process = self.connect(target) - - if self.TraceOn(): - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - interp.HandleCommand("target list", result) - print(result.GetOutput()) - - - err = lldb.SBError() - wp = target.WatchAddress(0x100, 8, False, True, err) - if self.TraceOn() and (err.Fail() or wp.IsValid == False): - strm = lldb.SBStream() - err.GetDescription(strm) - print("watchpoint failed: %s" % strm.GetData()) - self.assertTrue(wp.IsValid()) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestRestartBug.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestRestartBug.py deleted file mode 100644 index 142861a37dff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestRestartBug.py +++ /dev/null @@ -1,62 +0,0 @@ -from __future__ import print_function -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - - -class TestRestartBug(GDBRemoteTestBase): - - @expectedFailureAll(bugnumber="llvm.org/pr24530") - def test(self): - """ - Test auto-continue behavior when a process is interrupted to deliver - an "asynchronous" packet. This simulates the situation when a process - stops on its own just as lldb client is about to interrupt it. The - client should not auto-continue in this case, unless the user has - explicitly requested that we ignore signals of this type. - """ - class MyResponder(MockGDBServerResponder): - continueCount = 0 - - def setBreakpoint(self, packet): - return "OK" - - def interrupt(self): - # Simulate process stopping due to a raise(SIGINT) just as lldb - # is about to interrupt it. - return "T02reason:signal" - - def cont(self): - self.continueCount += 1 - if self.continueCount == 1: - # No response, wait for the client to interrupt us. - return None - return "W00" # Exit - - self.server.responder = MyResponder() - target = self.createTarget("a.yaml") - process = self.connect(target) - self.dbg.SetAsync(True) - process.Continue() - - # resume the process and immediately try to set another breakpoint. When using the remote - # stub, this will trigger a request to stop the process. Make sure we - # do not lose this signal. - bkpt = target.BreakpointCreateByAddress(0x1234) - self.assertTrue(bkpt.IsValid()) - self.assertEqual(bkpt.GetNumLocations(), 1) - - event = lldb.SBEvent() - while self.dbg.GetListener().WaitForEvent(2, event): - if self.TraceOn(): - print("Process changing state to:", - self.dbg.StateAsCString(process.GetStateFromEvent(event))) - if process.GetStateFromEvent(event) == lldb.eStateExited: - break - - # We should get only one continue packet as the client should not - # auto-continue after setting the breakpoint. - self.assertEqual(self.server.responder.continueCount, 1) - # And the process should end up in the stopped state. - self.assertEqual(process.GetState(), lldb.eStateStopped) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py deleted file mode 100644 index 7b733e77e679..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestStopPCs.py +++ /dev/null @@ -1,46 +0,0 @@ -from __future__ import print_function -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - - -class TestStopPCs(GDBRemoteTestBase): - - @skipIfXmlSupportMissing - def test(self): - class MyResponder(MockGDBServerResponder): - def haltReason(self): - return "T02thread:1ff0d;threads:1ff0d,2ff0d;thread-pcs:10001bc00,10002bc00;" - - def threadStopInfo(self, threadnum): - if threadnum == 0x1ff0d: - return "T02thread:1ff0d;threads:1ff0d,2ff0d;thread-pcs:10001bc00,10002bc00;" - if threadnum == 0x2ff0d: - return "T00thread:2ff0d;threads:1ff0d,2ff0d;thread-pcs:10001bc00,10002bc00;" - - def qXferRead(self, obj, annex, offset, length): - if annex == "target.xml": - return """<?xml version="1.0"?> - <target version="1.0"> - <architecture>i386:x86-64</architecture> - <feature name="org.gnu.gdb.i386.core"> - <reg name="rip" bitsize="64" regnum="0" type="code_ptr" group="general"/> - </feature> - </target>""", False - else: - return None, False - - self.server.responder = MyResponder() - target = self.dbg.CreateTarget('') - if self.TraceOn(): - self.runCmd("log enable gdb-remote packets") - process = self.connect(target) - - self.assertEqual(process.GetNumThreads(), 2) - th0 = process.GetThreadAtIndex(0) - th1 = process.GetThreadAtIndex(1) - self.assertEqual(th0.GetThreadID(), 0x1ff0d) - self.assertEqual(th1.GetThreadID(), 0x2ff0d) - self.assertEqual(th0.GetFrameAtIndex(0).GetPC(), 0x10001bc00) - self.assertEqual(th1.GetFrameAtIndex(0).GetPC(), 0x10002bc00) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py deleted file mode 100644 index 57c5ff0aac25..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py +++ /dev/null @@ -1,124 +0,0 @@ -from __future__ import print_function -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - -class TestTargetXMLArch(GDBRemoteTestBase): - - @skipIfXmlSupportMissing - @expectedFailureAll(archs=["i386"]) - @skipIfRemote - def test(self): - """ - Test lldb's parsing of the <architecture> tag in the target.xml register - description packet. - """ - class MyResponder(MockGDBServerResponder): - - def qXferRead(self, obj, annex, offset, length): - if annex == "target.xml": - return """<?xml version="1.0"?> - <target version="1.0"> - <architecture>i386:x86-64</architecture> - <feature name="org.gnu.gdb.i386.core"> - - <flags id="i386_eflags" size="4"> - <field name="CF" start="0" end="0"/> - <field name="" start="1" end="1"/> - <field name="PF" start="2" end="2"/> - <field name="AF" start="4" end="4"/> - <field name="ZF" start="6" end="6"/> - <field name="SF" start="7" end="7"/> - <field name="TF" start="8" end="8"/> - <field name="IF" start="9" end="9"/> - <field name="DF" start="10" end="10"/> - <field name="OF" start="11" end="11"/> - <field name="NT" start="14" end="14"/> - <field name="RF" start="16" end="16"/> - <field name="VM" start="17" end="17"/> - <field name="AC" start="18" end="18"/> - <field name="VIF" start="19" end="19"/> - <field name="VIP" start="20" end="20"/> - <field name="ID" start="21" end="21"/> - </flags> - - <reg name="rax" bitsize="64" regnum="0" type="int" group="general"/> - <reg name="rbx" bitsize="64" regnum="1" type="int" group="general"/> - <reg name="rcx" bitsize="64" regnum="2" type="int" group="general"/> - <reg name="rdx" bitsize="64" regnum="3" type="int" group="general"/> - <reg name="rsi" bitsize="64" regnum="4" type="int" group="general"/> - <reg name="rdi" bitsize="64" regnum="5" type="int" group="general"/> - <reg name="rbp" bitsize="64" regnum="6" type="data_ptr" group="general"/> - <reg name="rsp" bitsize="64" regnum="7" type="data_ptr" group="general"/> - <reg name="r8" bitsize="64" regnum="8" type="int" group="general"/> - <reg name="r9" bitsize="64" regnum="9" type="int" group="general"/> - <reg name="r10" bitsize="64" regnum="10" type="int" group="general"/> - <reg name="r11" bitsize="64" regnum="11" type="int" group="general"/> - <reg name="r12" bitsize="64" regnum="12" type="int" group="general"/> - <reg name="r13" bitsize="64" regnum="13" type="int" group="general"/> - <reg name="r14" bitsize="64" regnum="14" type="int" group="general"/> - <reg name="r15" bitsize="64" regnum="15" type="int" group="general"/> - <reg name="rip" bitsize="64" regnum="16" type="code_ptr" group="general"/> - <reg name="eflags" bitsize="32" regnum="17" type="i386_eflags" group="general"/> - - <reg name="cs" bitsize="32" regnum="18" type="int" group="general"/> - <reg name="ss" bitsize="32" regnum="19" type="int" group="general"/> - <reg name="ds" bitsize="32" regnum="20" type="int" group="general"/> - <reg name="es" bitsize="32" regnum="21" type="int" group="general"/> - <reg name="fs" bitsize="32" regnum="22" type="int" group="general"/> - <reg name="gs" bitsize="32" regnum="23" type="int" group="general"/> - - <reg name="st0" bitsize="80" regnum="24" type="i387_ext" group="float"/> - <reg name="st1" bitsize="80" regnum="25" type="i387_ext" group="float"/> - <reg name="st2" bitsize="80" regnum="26" type="i387_ext" group="float"/> - <reg name="st3" bitsize="80" regnum="27" type="i387_ext" group="float"/> - <reg name="st4" bitsize="80" regnum="28" type="i387_ext" group="float"/> - <reg name="st5" bitsize="80" regnum="29" type="i387_ext" group="float"/> - <reg name="st6" bitsize="80" regnum="30" type="i387_ext" group="float"/> - <reg name="st7" bitsize="80" regnum="31" type="i387_ext" group="float"/> - - <reg name="fctrl" bitsize="32" regnum="32" type="int" group="float"/> - <reg name="fstat" bitsize="32" regnum="33" type="int" group="float"/> - <reg name="ftag" bitsize="32" regnum="34" type="int" group="float"/> - <reg name="fiseg" bitsize="32" regnum="35" type="int" group="float"/> - <reg name="fioff" bitsize="32" regnum="36" type="int" group="float"/> - <reg name="foseg" bitsize="32" regnum="37" type="int" group="float"/> - <reg name="fooff" bitsize="32" regnum="38" type="int" group="float"/> - <reg name="fop" bitsize="32" regnum="39" type="int" group="float"/> - </feature> - </target>""", False - else: - return None, False - - def qC(self): - return "QC1" - - def haltReason(self): - return "T05thread:00000001;06:9038d60f00700000;07:98b4062680ffffff;10:c0d7bf1b80ffffff;" - - def readRegister(self, register): - regs = {0x0: "00b0060000610000", - 0xa: "68fe471c80ffffff", - 0xc: "60574a1c80ffffff", - 0xd: "18f3042680ffffff", - 0xe: "be8a4d7142000000", - 0xf: "50df471c80ffffff", - 0x10: "c0d7bf1b80ffffff" } - if register in regs: - return regs[register] - else: - return "0000000000000000" - - self.server.responder = MyResponder() - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - if self.TraceOn(): - interp.HandleCommand("log enable gdb-remote packets", result) - target = self.dbg.CreateTarget('') - self.assertEqual('', target.GetTriple()) - process = self.connect(target) - if self.TraceOn(): - interp.HandleCommand("target list", result) - print(result.GetOutput()) - self.assertTrue(target.GetTriple().startswith('x86_64-unknown-unknown')) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestThreadSelectionBug.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestThreadSelectionBug.py deleted file mode 100644 index 400a93661033..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestThreadSelectionBug.py +++ /dev/null @@ -1,50 +0,0 @@ -from __future__ import print_function -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -from gdbclientutils import * - - -class TestThreadSelectionBug(GDBRemoteTestBase): - def test(self): - class MyResponder(MockGDBServerResponder): - def cont(self): - # Simulate process stopping due to a raise(SIGINT) - return "T01reason:signal" - - self.server.responder = MyResponder() - target = self.createTarget("a.yaml") - process = self.connect(target) - python_os_plugin_path = os.path.join(self.getSourceDir(), - 'operating_system.py') - command = "settings set target.process.python-os-plugin-path '{}'".format( - python_os_plugin_path) - self.dbg.HandleCommand(command) - - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetNumThreads(), 3) - - # Verify our OS plug-in threads showed up - thread = process.GetThreadByID(0x1) - self.assertTrue( - thread.IsValid(), - "Make sure there is a thread 0x1 after we load the python OS plug-in") - thread = process.GetThreadByID(0x2) - self.assertTrue( - thread.IsValid(), - "Make sure there is a thread 0x2 after we load the python OS plug-in") - thread = process.GetThreadByID(0x3) - self.assertTrue( - thread.IsValid(), - "Make sure there is a thread 0x3 after we load the python OS plug-in") - - # Verify that a thread other than 3 is selected. - thread = process.GetSelectedThread() - self.assertNotEqual(thread.GetThreadID(), 0x3) - - # Verify that we select the thread backed by physical thread 1, rather - # than virtual thread 1. The mapping comes from the OS plugin, where we - # specified that thread 3 is backed by real thread 1. - process.Continue() - thread = process.GetSelectedThread() - self.assertEqual(thread.GetThreadID(), 0x3) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/a.yaml b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/a.yaml deleted file mode 100644 index f4e9ff5d8722..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/a.yaml +++ /dev/null @@ -1,34 +0,0 @@ -!ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_ARM -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1000 - AddressAlign: 0x4 - Content: "c3c3c3c3" - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2000 - AddressAlign: 0x4 - Content: "3232" -ProgramHeaders: - - Type: PT_LOAD - Flags: [ PF_X, PF_R ] - VAddr: 0x1000 - PAddr: 0x1000 - Align: 0x4 - Sections: - - Section: .text - - Type: PT_LOAD - Flags: [ PF_R, PF_W ] - VAddr: 0x2000 - PAddr: 0x1004 - Align: 0x4 - Sections: - - Section: .data diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py deleted file mode 100644 index a9e553cbb7d5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py +++ /dev/null @@ -1,507 +0,0 @@ -import os -import os.path -import subprocess -import threading -import socket -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbtest_config - - -def checksum(message): - """ - Calculate the GDB server protocol checksum of the message. - - The GDB server protocol uses a simple modulo 256 sum. - """ - check = 0 - for c in message: - check += ord(c) - return check % 256 - - -def frame_packet(message): - """ - Create a framed packet that's ready to send over the GDB connection - channel. - - Framing includes surrounding the message between $ and #, and appending - a two character hex checksum. - """ - return "$%s#%02x" % (message, checksum(message)) - - -def escape_binary(message): - """ - Escape the binary message using the process described in the GDB server - protocol documentation. - - Most bytes are sent through as-is, but $, #, and { are escaped by writing - a { followed by the original byte mod 0x20. - """ - out = "" - for c in message: - d = ord(c) - if d in (0x23, 0x24, 0x7d): - out += chr(0x7d) - out += chr(d ^ 0x20) - else: - out += c - return out - - -def hex_encode_bytes(message): - """ - Encode the binary message by converting each byte into a two-character - hex string. - """ - out = "" - for c in message: - out += "%02x" % ord(c) - return out - - -def hex_decode_bytes(hex_bytes): - """ - Decode the hex string into a binary message by converting each two-character - hex string into a single output byte. - """ - out = "" - hex_len = len(hex_bytes) - while i < hex_len - 1: - out += chr(int(hex_bytes[i:i + 2]), 16) - i += 2 - return out - - -class MockGDBServerResponder: - """ - A base class for handling client packets and issuing server responses for - GDB tests. - - This handles many typical situations, while still allowing subclasses to - completely customize their responses. - - Most subclasses will be interested in overriding the other() method, which - handles any packet not recognized in the common packet handling code. - """ - - registerCount = 40 - packetLog = None - - def __init__(self): - self.packetLog = [] - - def respond(self, packet): - """ - Return the unframed packet data that the server should issue in response - to the given packet received from the client. - """ - self.packetLog.append(packet) - if packet is MockGDBServer.PACKET_INTERRUPT: - return self.interrupt() - if packet == "c": - return self.cont() - if packet[0] == "g": - return self.readRegisters() - if packet[0] == "G": - return self.writeRegisters(packet[1:]) - if packet[0] == "p": - regnum = packet[1:].split(';')[0] - return self.readRegister(int(regnum, 16)) - if packet[0] == "P": - register, value = packet[1:].split("=") - return self.readRegister(int(register, 16), value) - if packet[0] == "m": - addr, length = [int(x, 16) for x in packet[1:].split(',')] - return self.readMemory(addr, length) - if packet[0] == "M": - location, encoded_data = packet[1:].split(":") - addr, length = [int(x, 16) for x in location.split(',')] - return self.writeMemory(addr, encoded_data) - if packet[0:7] == "qSymbol": - return self.qSymbol(packet[8:]) - if packet[0:10] == "qSupported": - return self.qSupported(packet[11:].split(";")) - if packet == "qfThreadInfo": - return self.qfThreadInfo() - if packet == "qsThreadInfo": - return self.qsThreadInfo() - if packet == "qC": - return self.qC() - if packet == "QEnableErrorStrings": - return self.QEnableErrorStrings() - if packet == "?": - return self.haltReason() - if packet == "s": - return self.haltReason() - if packet[0] == "H": - return self.selectThread(packet[1], int(packet[2:], 16)) - if packet[0:6] == "qXfer:": - obj, read, annex, location = packet[6:].split(":") - offset, length = [int(x, 16) for x in location.split(',')] - data, has_more = self.qXferRead(obj, annex, offset, length) - if data is not None: - return self._qXferResponse(data, has_more) - return "" - if packet.startswith("vAttach;"): - pid = packet.partition(';')[2] - return self.vAttach(int(pid, 16)) - if packet[0] == "Z": - return self.setBreakpoint(packet) - if packet.startswith("qThreadStopInfo"): - threadnum = int (packet[15:], 16) - return self.threadStopInfo(threadnum) - if packet == "QThreadSuffixSupported": - return self.QThreadSuffixSupported() - if packet == "QListThreadsInStopReply": - return self.QListThreadsInStopReply() - if packet.startswith("qMemoryRegionInfo:"): - return self.qMemoryRegionInfo() - - return self.other(packet) - - def interrupt(self): - raise self.UnexpectedPacketException() - - def cont(self): - raise self.UnexpectedPacketException() - - def readRegisters(self): - return "00000000" * self.registerCount - - def readRegister(self, register): - return "00000000" - - def writeRegisters(self, registers_hex): - return "OK" - - def writeRegister(self, register, value_hex): - return "OK" - - def readMemory(self, addr, length): - return "00" * length - - def writeMemory(self, addr, data_hex): - return "OK" - - def qSymbol(self, symbol_args): - return "OK" - - def qSupported(self, client_supported): - return "qXfer:features:read+;PacketSize=3fff;QStartNoAckMode+" - - def qfThreadInfo(self): - return "l" - - def qsThreadInfo(self): - return "l" - - def qC(self): - return "QC0" - - def QEnableErrorStrings(self): - return "OK" - - def haltReason(self): - # SIGINT is 2, return type is 2 digit hex string - return "S02" - - def qXferRead(self, obj, annex, offset, length): - return None, False - - def _qXferResponse(self, data, has_more): - return "%s%s" % ("m" if has_more else "l", escape_binary(data)) - - def vAttach(self, pid): - raise self.UnexpectedPacketException() - - def selectThread(self, op, thread_id): - return "OK" - - def setBreakpoint(self, packet): - raise self.UnexpectedPacketException() - - def threadStopInfo(self, threadnum): - return "" - - def other(self, packet): - # empty string means unsupported - return "" - - def QThreadSuffixSupported(self): - return "" - - def QListThreadsInStopReply(self): - return "" - - def qMemoryRegionInfo(self): - return "" - - """ - Raised when we receive a packet for which there is no default action. - Override the responder class to implement behavior suitable for the test at - hand. - """ - class UnexpectedPacketException(Exception): - pass - - -class MockGDBServer: - """ - A simple TCP-based GDB server that can test client behavior by receiving - commands and issuing custom-tailored responses. - - Responses are generated via the .responder property, which should be an - instance of a class based on MockGDBServerResponder. - """ - - responder = None - port = 0 - _socket = None - _client = None - _thread = None - _receivedData = None - _receivedDataOffset = None - _shouldSendAck = True - - def __init__(self, port = 0): - self.responder = MockGDBServerResponder() - self.port = port - self._socket = socket.socket() - - def start(self): - # Block until the socket is up, so self.port is available immediately. - # Then start a thread that waits for a client connection. - addr = ("127.0.0.1", self.port) - self._socket.bind(addr) - self.port = self._socket.getsockname()[1] - self._socket.listen(1) - self._thread = threading.Thread(target=self._run) - self._thread.start() - - def stop(self): - self._socket.close() - self._thread.join() - self._thread = None - - def _run(self): - # For testing purposes, we only need to worry about one client - # connecting just one time. - try: - # accept() is stubborn and won't fail even when the socket is - # shutdown, so we'll use a timeout - self._socket.settimeout(2.0) - client, client_addr = self._socket.accept() - self._client = client - # The connected client inherits its timeout from self._socket, - # but we'll use a blocking socket for the client - self._client.settimeout(None) - except: - return - self._shouldSendAck = True - self._receivedData = "" - self._receivedDataOffset = 0 - data = None - while True: - try: - data = self._client.recv(4096) - if data is None or len(data) == 0: - break - # In Python 2, sockets return byte strings. In Python 3, sockets return bytes. - # If we got bytes (and not a byte string), decode them to a string for later handling. - if isinstance(data, bytes) and not isinstance(data, str): - data = data.decode() - self._receive(data) - except Exception as e: - self._client.close() - break - - def _receive(self, data): - """ - Collects data, parses and responds to as many packets as exist. - Any leftover data is kept for parsing the next time around. - """ - self._receivedData += data - try: - packet = self._parsePacket() - while packet is not None: - self._handlePacket(packet) - packet = self._parsePacket() - except self.InvalidPacketException: - self._client.close() - - def _parsePacket(self): - """ - Reads bytes from self._receivedData, returning: - - a packet's contents if a valid packet is found - - the PACKET_ACK unique object if we got an ack - - None if we only have a partial packet - - Raises an InvalidPacketException if unexpected data is received - or if checksums fail. - - Once a complete packet is found at the front of self._receivedData, - its data is removed form self._receivedData. - """ - data = self._receivedData - i = self._receivedDataOffset - data_len = len(data) - if data_len == 0: - return None - if i == 0: - # If we're looking at the start of the received data, that means - # we're looking for the start of a new packet, denoted by a $. - # It's also possible we'll see an ACK here, denoted by a + - if data[0] == '+': - self._receivedData = data[1:] - return self.PACKET_ACK - if ord(data[0]) == 3: - self._receivedData = data[1:] - return self.PACKET_INTERRUPT - if data[0] == '$': - i += 1 - else: - raise self.InvalidPacketException( - "Unexpected leading byte: %s" % data[0]) - - # If we're looking beyond the start of the received data, then we're - # looking for the end of the packet content, denoted by a #. - # Note that we pick up searching from where we left off last time - while i < data_len and data[i] != '#': - i += 1 - - # If there isn't enough data left for a checksum, just remember where - # we left off so we can pick up there the next time around - if i > data_len - 3: - self._receivedDataOffset = i - return None - - # If we have enough data remaining for the checksum, extract it and - # compare to the packet contents - packet = data[1:i] - i += 1 - try: - check = int(data[i:i + 2], 16) - except ValueError: - raise self.InvalidPacketException("Checksum is not valid hex") - i += 2 - if check != checksum(packet): - raise self.InvalidPacketException( - "Checksum %02x does not match content %02x" % - (check, checksum(packet))) - # remove parsed bytes from _receivedData and reset offset so parsing - # can start on the next packet the next time around - self._receivedData = data[i:] - self._receivedDataOffset = 0 - return packet - - def _handlePacket(self, packet): - if packet is self.PACKET_ACK: - # Ignore ACKs from the client. For the future, we can consider - # adding validation code to make sure the client only sends ACKs - # when it's supposed to. - return - response = "" - # We'll handle the ack stuff here since it's not something any of the - # tests will be concerned about, and it'll get turned off quickly anyway. - if self._shouldSendAck: - self._client.sendall('+'.encode()) - if packet == "QStartNoAckMode": - self._shouldSendAck = False - response = "OK" - elif self.responder is not None: - # Delegate everything else to our responder - response = self.responder.respond(packet) - # Handle packet framing since we don't want to bother tests with it. - if response is not None: - framed = frame_packet(response) - # In Python 2, sockets send byte strings. In Python 3, sockets send bytes. - # If we got a string (and not a byte string), encode it before sending. - if isinstance(framed, str) and not isinstance(framed, bytes): - framed = framed.encode() - self._client.sendall(framed) - - PACKET_ACK = object() - PACKET_INTERRUPT = object() - - class InvalidPacketException(Exception): - pass - - -class GDBRemoteTestBase(TestBase): - """ - Base class for GDB client tests. - - This class will setup and start a mock GDB server for the test to use. - It also provides assertPacketLogContains, which simplifies the checking - of packets sent by the client. - """ - - NO_DEBUG_INFO_TESTCASE = True - mydir = TestBase.compute_mydir(__file__) - server = None - - def setUp(self): - TestBase.setUp(self) - self.server = MockGDBServer() - self.server.start() - - def tearDown(self): - # TestBase.tearDown will kill the process, but we need to kill it early - # so its client connection closes and we can stop the server before - # finally calling the base tearDown. - if self.process() is not None: - self.process().Kill() - self.server.stop() - TestBase.tearDown(self) - - def createTarget(self, yaml_path): - """ - Create a target by auto-generating the object based on the given yaml - instructions. - - This will track the generated object so it can be automatically removed - during tearDown. - """ - yaml_base, ext = os.path.splitext(yaml_path) - obj_path = self.getBuildArtifact(yaml_base) - self.yaml2obj(yaml_path, obj_path) - return self.dbg.CreateTarget(obj_path) - - def connect(self, target): - """ - Create a process by connecting to the mock GDB server. - - Includes assertions that the process was successfully created. - """ - listener = self.dbg.GetListener() - error = lldb.SBError() - url = "connect://localhost:%d" % self.server.port - process = target.ConnectRemote(listener, url, "gdb-remote", error) - self.assertTrue(error.Success(), error.description) - self.assertTrue(process, PROCESS_IS_VALID) - return process - - def assertPacketLogContains(self, packets): - """ - Assert that the mock server's packet log contains the given packets. - - The packet log includes all packets sent by the client and received - by the server. This fuction makes it easy to verify that the client - sent the expected packets to the server. - - The check does not require that the packets be consecutive, but does - require that they are ordered in the log as they ordered in the arg. - """ - i = 0 - j = 0 - log = self.server.responder.packetLog - - while i < len(packets) and j < len(log): - if log[j] == packets[i]: - i += 1 - j += 1 - if i < len(packets): - self.fail(u"Did not receive: %s\nLast 10 packets:\n\t%s" % - (packets[i], u'\n\t'.join(log[-10:]))) diff --git a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/operating_system.py b/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/operating_system.py deleted file mode 100644 index ad9b6fd4e55a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/operating_system.py +++ /dev/null @@ -1,45 +0,0 @@ -import lldb -import struct - - -class OperatingSystemPlugIn(object): - """Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class""" - - def __init__(self, process): - '''Initialization needs a valid.SBProcess object. - - This plug-in will get created after a live process is valid and has stopped for the first time. - ''' - self.process = None - self.registers = None - self.threads = None - if isinstance(process, lldb.SBProcess) and process.IsValid(): - self.process = process - self.threads = None # Will be an dictionary containing info for each thread - - def get_target(self): - return self.process.target - - def get_thread_info(self): - if not self.threads: - self.threads = [{ - 'tid': 0x1, - 'name': 'one', - 'queue': 'queue1', - 'state': 'stopped', - 'stop_reason': 'none' - }, { - 'tid': 0x2, - 'name': 'two', - 'queue': 'queue2', - 'state': 'stopped', - 'stop_reason': 'none' - }, { - 'tid': 0x3, - 'name': 'three', - 'queue': 'queue3', - 'state': 'stopped', - 'stop_reason': 'sigstop', - 'core': 0 - }] - return self.threads diff --git a/packages/Python/lldbsuite/test/functionalities/history/TestHistoryRecall.py b/packages/Python/lldbsuite/test/functionalities/history/TestHistoryRecall.py deleted file mode 100644 index 7956120bad32..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/history/TestHistoryRecall.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Make sure the !N and !-N commands work properly. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - - -class TestHistoryRecall(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_history_recall(self): - """Test the !N and !-N functionality of the command interpreter.""" - self.sample_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def sample_test(self): - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - interp.HandleCommand("command history", result, True) - interp.HandleCommand("platform list", result, True) - - interp.HandleCommand("!0", result, False) - self.assertTrue(result.Succeeded(), "!0 command did not work: %s"%(result.GetError())) - self.assertTrue("command history" in result.GetOutput(), "!0 didn't rerun command history") - - interp.HandleCommand("!-1", result, False) - self.assertTrue(result.Succeeded(), "!-1 command did not work: %s"%(result.GetError())) - self.assertTrue("host:" in result.GetOutput(), "!-1 didn't rerun platform list.") diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-assert/Makefile b/packages/Python/lldbsuite/test/functionalities/inferior-assert/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-assert/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py b/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py deleted file mode 100644 index 75215f89ef0b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py +++ /dev/null @@ -1,314 +0,0 @@ -"""Test that lldb functions correctly after the inferior has asserted.""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test import lldbutil -from lldbsuite.test import lldbplatformutil -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * - - -class AssertingInferiorTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") - @expectedFailureAll( - oslist=["linux"], - archs=["arm"], - bugnumber="llvm.org/pr25338") - @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips') - def test_inferior_asserting(self): - """Test that lldb reliably catches the inferior asserting (command).""" - self.build() - self.inferior_asserting() - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") - @expectedFailureAndroid( - api_levels=list( - range( - 16 + - 1))) # b.android.com/179836 - def test_inferior_asserting_register(self): - """Test that lldb reliably reads registers from the inferior after asserting (command).""" - self.build() - self.inferior_asserting_registers() - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") - @expectedFailureAll( - oslist=["linux"], - archs=[ - "aarch64", - "arm"], - bugnumber="llvm.org/pr25338") - @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips') - def test_inferior_asserting_disassemble(self): - """Test that lldb reliably disassembles frames after asserting (command).""" - self.build() - self.inferior_asserting_disassemble() - - @add_test_categories(['pyapi']) - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") - def test_inferior_asserting_python(self): - """Test that lldb reliably catches the inferior asserting (Python API).""" - self.build() - self.inferior_asserting_python() - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") - @expectedFailureAll( - oslist=["linux"], - archs=[ - "aarch64", - "arm"], - bugnumber="llvm.org/pr25338") - @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips') - def test_inferior_asserting_expr(self): - """Test that the lldb expression interpreter can read from the inferior after asserting (command).""" - self.build() - self.inferior_asserting_expr() - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") - @expectedFailureAll( - oslist=["linux"], - archs=[ - "aarch64", - "arm"], - bugnumber="llvm.org/pr25338") - @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips') - def test_inferior_asserting_step(self): - """Test that lldb functions correctly after stepping through a call to assert().""" - self.build() - self.inferior_asserting_step() - - def set_breakpoint(self, line): - lldbutil.run_break_set_by_file_and_line( - self, "main.c", line, num_expected_locations=1, loc_exact=True) - - def check_stop_reason(self): - matched = lldbplatformutil.match_android_device( - self.getArchitecture(), valid_api_levels=list(range(1, 16 + 1))) - if matched: - # On android until API-16 the abort() call ended in a sigsegv - # instead of in a sigabrt - stop_reason = 'stop reason = signal SIGSEGV' - else: - stop_reason = 'stop reason = signal SIGABRT' - - # The stop reason of the thread should be an abort signal or exception. - self.expect("thread list", STOPPED_DUE_TO_ASSERT, - substrs=['stopped', - stop_reason]) - - return stop_reason - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number of the call to assert. - self.line = line_number('main.c', '// Assert here.') - - def inferior_asserting(self): - """Inferior asserts upon launching; lldb should catch the event and stop.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - stop_reason = self.check_stop_reason() - - # And it should report a backtrace that includes the assert site. - self.expect("thread backtrace all", - substrs=[stop_reason, 'main', 'argc', 'argv']) - - # And it should report the correct line number. - self.expect("thread backtrace all", - substrs=[stop_reason, - 'main.c:%d' % self.line]) - - def inferior_asserting_python(self): - """Inferior asserts upon launching; lldb should catch the event and stop.""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now launch the process, and do not stop at entry point. - # Both argv and envp are null. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - if process.GetState() != lldb.eStateStopped: - self.fail("Process should be in the 'stopped' state, " - "instead the actual state is: '%s'" % - lldbutil.state_type_to_str(process.GetState())) - - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal) - if not thread: - self.fail("Fail to stop the thread upon assert") - - if self.TraceOn(): - lldbutil.print_stacktrace(thread) - - def inferior_asserting_registers(self): - """Test that lldb can read registers after asserting.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - # lldb should be able to read from registers from the inferior after - # asserting. - lldbplatformutil.check_first_register_readable(self) - - def inferior_asserting_disassemble(self): - """Test that lldb can disassemble frames after asserting.""" - 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 do not stop at the entry point. - target.LaunchSimple(None, None, self.get_process_working_directory()) - self.check_stop_reason() - - process = target.GetProcess() - self.assertTrue(process.IsValid(), "current process is valid") - - thread = process.GetThreadAtIndex(0) - self.assertTrue(thread.IsValid(), "current thread is valid") - - lastframeID = thread.GetFrameAtIndex( - thread.GetNumFrames() - 1).GetFrameID() - - isi386Arch = False - if "i386" in self.getArchitecture(): - isi386Arch = True - - # lldb should be able to disassemble frames from the inferior after - # asserting. - for frame in thread: - self.assertTrue(frame.IsValid(), "current frame is valid") - - self.runCmd("frame select " + - str(frame.GetFrameID()), RUN_SUCCEEDED) - - # Don't expect the function name to be in the disassembly as the assert - # function might be a no-return function where the PC is past the end - # of the function and in the next function. We also can't back the PC up - # because we don't know how much to back it up by on targets with opcodes - # that have differing sizes - pc_backup_offset = 1 - if frame.GetFrameID() == 0: - pc_backup_offset = 0 - if isi386Arch: - if lastframeID == frame.GetFrameID(): - pc_backup_offset = 0 - self.expect( - "disassemble -a %s" % - (frame.GetPC() - - pc_backup_offset), - substrs=['<+0>: ']) - - def check_expr_in_main(self, thread): - depth = thread.GetNumFrames() - for i in range(depth): - frame = thread.GetFrameAtIndex(i) - self.assertTrue(frame.IsValid(), "current frame is valid") - if self.TraceOn(): - print( - "Checking if function %s is main" % - frame.GetFunctionName()) - - if 'main' == frame.GetFunctionName(): - frame_id = frame.GetFrameID() - self.runCmd("frame select " + str(frame_id), RUN_SUCCEEDED) - self.expect("p argc", substrs=['(int)', ' = 1']) - self.expect("p hello_world", substrs=['Hello']) - self.expect("p argv[0]", substrs=['a.out']) - self.expect("p null_ptr", substrs=['= 0x0']) - return True - return False - - def inferior_asserting_expr(self): - """Test that the lldb expression interpreter can read symbols after asserting.""" - 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 do not stop at the entry point. - target.LaunchSimple(None, None, self.get_process_working_directory()) - self.check_stop_reason() - - process = target.GetProcess() - self.assertTrue(process.IsValid(), "current process is valid") - - thread = process.GetThreadAtIndex(0) - self.assertTrue(thread.IsValid(), "current thread is valid") - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a call to assert(). - self.assertTrue( - self.check_expr_in_main(thread), - "cannot find 'main' in the backtrace") - - def inferior_asserting_step(self): - """Test that lldb functions correctly after stepping through a call to assert().""" - 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 do not stop at the entry point. - self.set_breakpoint(self.line) - target.LaunchSimple(None, None, self.get_process_working_directory()) - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['main.c:%d' % self.line, - 'stop reason = breakpoint']) - - self.runCmd("next") - stop_reason = self.check_stop_reason() - - # lldb should be able to read from registers from the inferior after - # asserting. - if "x86_64" in self.getArchitecture(): - self.expect("register read rbp", substrs=['rbp = 0x']) - if "i386" in self.getArchitecture(): - self.expect("register read ebp", substrs=['ebp = 0x']) - - process = target.GetProcess() - self.assertTrue(process.IsValid(), "current process is valid") - - thread = process.GetThreadAtIndex(0) - self.assertTrue(thread.IsValid(), "current thread is valid") - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a call to assert(). - self.assertTrue( - self.check_expr_in_main(thread), - "cannot find 'main' in the backtrace") - - # And it should report the correct line number. - self.expect("thread backtrace all", - substrs=[stop_reason, - 'main.c:%d' % self.line]) diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-assert/main.c b/packages/Python/lldbsuite/test/functionalities/inferior-assert/main.c deleted file mode 100644 index 6aec4c1023a9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-assert/main.c +++ /dev/null @@ -1,19 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <assert.h> - -const char *hello_world = "Hello, assertion!"; - -int main(int argc, const char* argv[]) -{ - int *null_ptr = 0; - printf("%s\n", hello_world); - assert(null_ptr); // Assert here. -} diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-changed/Makefile b/packages/Python/lldbsuite/test/functionalities/inferior-changed/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-changed/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py b/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py deleted file mode 100644 index b1b9f4bc04c7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py +++ /dev/null @@ -1,84 +0,0 @@ -"""Test lldb reloads the inferior after it was changed during the session.""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import configuration -from lldbsuite.test import lldbutil - - -class ChangedInferiorTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIf(hostoslist=["windows"]) - @no_debug_info_test - def test_inferior_crashing(self): - """Test lldb reloads the inferior after it was changed during the session.""" - self.build() - self.inferior_crashing() - self.cleanup() - # lldb needs to recognize the inferior has changed. If lldb needs to check the - # new module timestamp, make sure it is not the same as the old one, so add a - # 1 second delay. - time.sleep(1) - d = {'C_SOURCES': 'main2.c'} - self.build(dictionary=d) - self.setTearDownCleanup(dictionary=d) - self.inferior_not_crashing() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number of the crash. - self.line1 = line_number('main.c', '// Crash here.') - self.line2 = line_number('main2.c', '// Not crash here.') - - def inferior_crashing(self): - """Inferior crashes upon launching; lldb should catch the event and stop.""" - self.exe = self.getBuildArtifact("a.out") - self.runCmd("file " + self.exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - - # We should have one crashing thread - self.assertEqual( - len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())), - 1, - STOPPED_DUE_TO_EXC_BAD_ACCESS) - - # And it should report the correct line number. - self.expect("thread backtrace all", substrs=['main.c:%d' % self.line1]) - - def inferior_not_crashing(self): - """Test lldb reloads the inferior after it was changed during the session.""" - self.runCmd("process kill") - self.runCmd("run", RUN_SUCCEEDED) - self.runCmd("process status") - - self.assertNotEqual( - len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())), - 1, - "Inferior changed, but lldb did not perform a reload") - - # Break inside the main. - lldbutil.run_break_set_by_file_and_line( - self, "main2.c", self.line2, 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']) - - self.runCmd("frame variable int_ptr") - self.expect("frame variable *int_ptr", - substrs=['= 7']) - self.expect("expression *int_ptr", - substrs=['= 7']) diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-changed/main.c b/packages/Python/lldbsuite/test/functionalities/inferior-changed/main.c deleted file mode 100644 index 9d0706a0862d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-changed/main.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/inferior-changed/main2.c b/packages/Python/lldbsuite/test/functionalities/inferior-changed/main2.c deleted file mode 100644 index 9173e8c30b59..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-changed/main2.c +++ /dev/null @@ -1,18 +0,0 @@ -//===-- main2.c -------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdlib.h> - -int main(int argc, const char* argv[]) -{ - int *int_ptr = (int *)malloc(sizeof(int)); - *int_ptr = 7; - printf("Hello, world!\n"); - printf("Now not crash %d\n", *int_ptr); // Not crash here. -} diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/Makefile b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py deleted file mode 100644 index 528192519513..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py +++ /dev/null @@ -1,234 +0,0 @@ -"""Test that lldb functions correctly after the inferior has crashed.""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test import lldbutil -from lldbsuite.test import lldbplatformutil -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * - - -class CrashingInferiorTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_inferior_crashing(self): - """Test that lldb reliably catches the inferior crashing (command).""" - self.build() - self.inferior_crashing() - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_inferior_crashing_register(self): - """Test that lldb reliably reads registers from the inferior after crashing (command).""" - self.build() - self.inferior_crashing_registers() - - @add_test_categories(['pyapi']) - def test_inferior_crashing_python(self): - """Test that lldb reliably catches the inferior crashing (Python API).""" - self.build() - self.inferior_crashing_python() - - def test_inferior_crashing_expr(self): - """Test that the lldb expression interpreter can read from the inferior after crashing (command).""" - self.build() - self.inferior_crashing_expr() - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_inferior_crashing_step(self): - """Test that stepping after a crash behaves correctly.""" - self.build() - self.inferior_crashing_step() - - @skipIfTargetAndroid() # debuggerd interferes with this test on Android - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_inferior_crashing_step_after_break(self): - """Test that lldb functions correctly after stepping through a crash.""" - self.build() - self.inferior_crashing_step_after_break() - - # Inferior exits after stepping after a segfault. This is working as - # intended IMHO. - @skipIfLinux - @skipIfFreeBSD - def test_inferior_crashing_expr_step_and_expr(self): - """Test that lldb expressions work before and after stepping after a crash.""" - self.build() - self.inferior_crashing_expr_step_expr() - - def set_breakpoint(self, line): - lldbutil.run_break_set_by_file_and_line( - self, "main.c", line, num_expected_locations=1, loc_exact=True) - - def check_stop_reason(self): - # We should have one crashing thread - self.assertEqual( - len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())), - 1, - STOPPED_DUE_TO_EXC_BAD_ACCESS) - - def get_api_stop_reason(self): - return lldb.eStopReasonException - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number of the crash. - self.line = line_number('main.c', '// Crash here.') - - def inferior_crashing(self): - """Inferior crashes upon launching; lldb should catch the event and stop.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - # The exact stop reason depends on the platform - if self.platformIsDarwin(): - stop_reason = 'stop reason = EXC_BAD_ACCESS' - elif self.getPlatform() == "linux" or self.getPlatform() == "freebsd": - stop_reason = 'stop reason = signal SIGSEGV' - else: - stop_reason = 'stop reason = invalid address' - self.expect("thread list", STOPPED_DUE_TO_EXC_BAD_ACCESS, - substrs=['stopped', - stop_reason]) - - # And it should report the correct line number. - self.expect("thread backtrace all", - substrs=[stop_reason, - 'main.c:%d' % self.line]) - - def inferior_crashing_python(self): - """Inferior crashes upon launching; lldb should catch the event and stop.""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now launch the process, and do not stop at entry point. - # Both argv and envp are null. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - if process.GetState() != lldb.eStateStopped: - self.fail("Process should be in the 'stopped' state, " - "instead the actual state is: '%s'" % - lldbutil.state_type_to_str(process.GetState())) - - threads = lldbutil.get_crashed_threads(self, process) - self.assertEqual( - len(threads), - 1, - "Failed to stop the thread upon bad access exception") - - if self.TraceOn(): - lldbutil.print_stacktrace(threads[0]) - - def inferior_crashing_registers(self): - """Test that lldb can read registers after crashing.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - # lldb should be able to read from registers from the inferior after - # crashing. - lldbplatformutil.check_first_register_readable(self) - - def inferior_crashing_expr(self): - """Test that the lldb expression interpreter can read symbols after crashing.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a crash. - self.expect("p argc", - startstr='(int) $0 = 1') - - self.expect("p hello_world", - substrs=['Hello']) - - def inferior_crashing_step(self): - """Test that lldb functions correctly after stepping through a crash.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.set_breakpoint(self.line) - self.runCmd("run", RUN_SUCCEEDED) - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['main.c:%d' % self.line, - 'stop reason = breakpoint']) - - self.runCmd("next") - self.check_stop_reason() - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a crash. - self.expect("p argv[0]", - substrs=['a.out']) - self.expect("p null_ptr", - substrs=['= 0x0']) - - # lldb should be able to read from registers from the inferior after - # crashing. - lldbplatformutil.check_first_register_readable(self) - - # And it should report the correct line number. - self.expect("thread backtrace all", - substrs=['main.c:%d' % self.line]) - - def inferior_crashing_step_after_break(self): - """Test that lldb behaves correctly when stepping after a crash.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - expected_state = 'exited' # Provide the exit code. - if self.platformIsDarwin(): - # TODO: Determine why 'next' and 'continue' have no effect after a - # crash. - expected_state = 'stopped' - - self.expect("next", - substrs=['Process', expected_state]) - - if expected_state == 'exited': - self.expect( - "thread list", - error=True, - substrs=['Process must be launched']) - else: - self.check_stop_reason() - - def inferior_crashing_expr_step_expr(self): - """Test that lldb expressions work before and after stepping after a crash.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a crash. - self.expect("p argv[0]", - substrs=['a.out']) - - self.runCmd("next") - self.check_stop_reason() - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a crash. - self.expect("p argv[0]", - substrs=['a.out']) diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/main.c b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/main.c deleted file mode 100644 index 3b7cfe4012bd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/main.c +++ /dev/null @@ -1,18 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -const char *hello_world = "Hello, segfault!"; - -int main(int argc, const char* argv[]) -{ - int *null_ptr = 0; - printf("%s\n", hello_world); - printf("Now crash %d\n", *null_ptr); // Crash here. -} diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/Makefile b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/Makefile deleted file mode 100644 index 0f8e92e9193c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -CFLAGS_EXTRAS += -fomit-frame-pointer - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py deleted file mode 100644 index 2cd4d46a7ca8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py +++ /dev/null @@ -1,239 +0,0 @@ -"""Test that lldb functions correctly after the inferior has crashed while in a recursive routine.""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbplatformutil -from lldbsuite.test import lldbutil - - -class CrashingRecursiveInferiorTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_recursive_inferior_crashing(self): - """Test that lldb reliably catches the inferior crashing (command).""" - self.build() - self.recursive_inferior_crashing() - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_recursive_inferior_crashing_register(self): - """Test that lldb reliably reads registers from the inferior after crashing (command).""" - self.build() - self.recursive_inferior_crashing_registers() - - @add_test_categories(['pyapi']) - def test_recursive_inferior_crashing_python(self): - """Test that lldb reliably catches the inferior crashing (Python API).""" - self.build() - self.recursive_inferior_crashing_python() - - def test_recursive_inferior_crashing_expr(self): - """Test that the lldb expression interpreter can read from the inferior after crashing (command).""" - self.build() - self.recursive_inferior_crashing_expr() - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_recursive_inferior_crashing_step(self): - """Test that stepping after a crash behaves correctly.""" - self.build() - self.recursive_inferior_crashing_step() - - @skipIfTargetAndroid() # debuggerd interferes with this test on Android - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_recursive_inferior_crashing_step_after_break(self): - """Test that lldb functions correctly after stepping through a crash.""" - self.build() - self.recursive_inferior_crashing_step_after_break() - - # Inferior exits after stepping after a segfault. This is working as - # intended IMHO. - @skipIfLinux - @skipIfFreeBSD - def test_recursive_inferior_crashing_expr_step_and_expr(self): - """Test that lldb expressions work before and after stepping after a crash.""" - self.build() - self.recursive_inferior_crashing_expr_step_expr() - - def set_breakpoint(self, line): - lldbutil.run_break_set_by_file_and_line( - self, "main.c", line, num_expected_locations=1, loc_exact=True) - - def check_stop_reason(self): - # We should have one crashing thread - self.assertEqual( - len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())), - 1, - STOPPED_DUE_TO_EXC_BAD_ACCESS) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number of the crash. - self.line = line_number('main.c', '// Crash here.') - - def recursive_inferior_crashing(self): - """Inferior crashes upon launching; lldb should catch the event and stop.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - - # The exact stop reason depends on the platform - if self.platformIsDarwin(): - stop_reason = 'stop reason = EXC_BAD_ACCESS' - elif self.getPlatform() == "linux" or self.getPlatform() == "freebsd": - stop_reason = 'stop reason = signal SIGSEGV' - else: - stop_reason = 'stop reason = invalid address' - self.expect("thread list", STOPPED_DUE_TO_EXC_BAD_ACCESS, - substrs=['stopped', - stop_reason]) - - # And it should report a backtrace that includes main and the crash - # site. - self.expect( - "thread backtrace all", - substrs=[ - stop_reason, - 'main', - 'argc', - 'argv', - 'recursive_function']) - - # And it should report the correct line number. - self.expect("thread backtrace all", - substrs=[stop_reason, - 'main.c:%d' % self.line]) - - def recursive_inferior_crashing_python(self): - """Inferior crashes upon launching; lldb should catch the event and stop.""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now launch the process, and do not stop at entry point. - # Both argv and envp are null. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - if process.GetState() != lldb.eStateStopped: - self.fail("Process should be in the 'stopped' state, " - "instead the actual state is: '%s'" % - lldbutil.state_type_to_str(process.GetState())) - - threads = lldbutil.get_crashed_threads(self, process) - self.assertEqual( - len(threads), - 1, - "Failed to stop the thread upon bad access exception") - - if self.TraceOn(): - lldbutil.print_stacktrace(threads[0]) - - def recursive_inferior_crashing_registers(self): - """Test that lldb can read registers after crashing.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - # lldb should be able to read from registers from the inferior after - # crashing. - lldbplatformutil.check_first_register_readable(self) - - def recursive_inferior_crashing_expr(self): - """Test that the lldb expression interpreter can read symbols after crashing.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a crash. - self.expect("p i", - startstr='(int) $0 =') - - def recursive_inferior_crashing_step(self): - """Test that lldb functions correctly after stepping through a crash.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.set_breakpoint(self.line) - self.runCmd("run", RUN_SUCCEEDED) - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['main.c:%d' % self.line, - 'stop reason = breakpoint']) - - self.runCmd("next") - self.check_stop_reason() - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a crash. - self.expect("p i", - substrs=['(int) $0 =']) - - # lldb should be able to read from registers from the inferior after - # crashing. - lldbplatformutil.check_first_register_readable(self) - - # And it should report the correct line number. - self.expect("thread backtrace all", - substrs=['main.c:%d' % self.line]) - - def recursive_inferior_crashing_step_after_break(self): - """Test that lldb behaves correctly when stepping after a crash.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - expected_state = 'exited' # Provide the exit code. - if self.platformIsDarwin(): - # TODO: Determine why 'next' and 'continue' have no effect after a - # crash. - expected_state = 'stopped' - - self.expect("next", - substrs=['Process', expected_state]) - - if expected_state == 'exited': - self.expect( - "thread list", - error=True, - substrs=['Process must be launched']) - else: - self.check_stop_reason() - - def recursive_inferior_crashing_expr_step_expr(self): - """Test that lldb expressions work before and after stepping after a crash.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("run", RUN_SUCCEEDED) - self.check_stop_reason() - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a crash. - self.expect("p null", - startstr='(char *) $0 = 0x0') - - self.runCmd("next") - - # The lldb expression interpreter should be able to read from addresses - # of the inferior after a step. - self.expect("p null", - startstr='(char *) $1 = 0x0') - - self.check_stop_reason() diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/main.c b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/main.c deleted file mode 100644 index 25e6e8df0b9b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/main.c +++ /dev/null @@ -1,19 +0,0 @@ -void recursive_function(int i) -{ - if (i < 10) - { - recursive_function(i + 1); - } - else - { - char *null=0; - *null = 0; // Crash here. - } -} - -int main(int argc, char *argv[]) -{ - recursive_function(0); - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/inline-stepping/Makefile b/packages/Python/lldbsuite/test/functionalities/inline-stepping/Makefile deleted file mode 100644 index 532f49555e5f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inline-stepping/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := calling.cpp - -ifneq (,$(findstring icc,$(CC))) - CXXFLAGS += -debug inline-debug-info -endif - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py b/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py deleted file mode 100644 index 4513db2ccdfc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py +++ /dev/null @@ -1,332 +0,0 @@ -"""Test stepping over and into inlined functions.""" - -from __future__ import print_function - - -import os -import time -import sys -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestInlineStepping(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @expectedFailureAll( - compiler="icc", - bugnumber="# Not really a bug. ICC combines two inlined functions.") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_with_python_api(self): - """Test stepping over and into inlined functions.""" - self.build() - self.inline_stepping() - - @add_test_categories(['pyapi']) - def test_step_over_with_python_api(self): - """Test stepping over and into inlined functions.""" - self.build() - self.inline_stepping_step_over() - - @add_test_categories(['pyapi']) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_step_in_template_with_python_api(self): - """Test stepping in to templated functions.""" - self.build() - self.step_in_template() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers that we will step to in main: - self.main_source = "calling.cpp" - self.source_lines = {} - functions = [ - 'caller_ref_1', - 'caller_ref_2', - 'inline_ref_1', - 'inline_ref_2', - 'called_by_inline_ref', - 'caller_trivial_1', - 'caller_trivial_2', - 'inline_trivial_1', - 'inline_trivial_2', - 'called_by_inline_trivial'] - for name in functions: - self.source_lines[name] = line_number( - self.main_source, "// In " + name + ".") - self.main_source_spec = lldb.SBFileSpec(self.main_source) - - def do_step(self, step_type, destination_line_entry, test_stack_depth): - expected_stack_depth = self.thread.GetNumFrames() - if step_type == "into": - expected_stack_depth += 1 - self.thread.StepInto() - elif step_type == "out": - expected_stack_depth -= 1 - self.thread.StepOut() - elif step_type == "over": - self.thread.StepOver() - else: - self.fail("Unrecognized step type: " + step_type) - - threads = lldbutil.get_stopped_threads( - self.process, lldb.eStopReasonPlanComplete) - if len(threads) != 1: - destination_description = lldb.SBStream() - destination_line_entry.GetDescription(destination_description) - self.fail( - "Failed to stop due to step " + - step_type + - " operation stepping to: " + - destination_description.GetData()) - - self.thread = threads[0] - - stop_line_entry = self.thread.GetFrameAtIndex(0).GetLineEntry() - self.assertTrue( - stop_line_entry.IsValid(), - "Stop line entry was not valid.") - - # Don't use the line entry equal operator because we don't care about - # the column number. - stop_at_right_place = (stop_line_entry.GetFileSpec() == destination_line_entry.GetFileSpec( - ) and stop_line_entry.GetLine() == destination_line_entry.GetLine()) - if not stop_at_right_place: - destination_description = lldb.SBStream() - destination_line_entry.GetDescription(destination_description) - - actual_description = lldb.SBStream() - stop_line_entry.GetDescription(actual_description) - - self.fail( - "Step " + - step_type + - " stopped at wrong place: expected: " + - destination_description.GetData() + - " got: " + - actual_description.GetData() + - ".") - - real_stack_depth = self.thread.GetNumFrames() - - if test_stack_depth and real_stack_depth != expected_stack_depth: - destination_description = lldb.SBStream() - destination_line_entry.GetDescription(destination_description) - self.fail( - "Step %s to %s got wrong number of frames, should be: %d was: %d." % - (step_type, - destination_description.GetData(), - expected_stack_depth, - real_stack_depth)) - - def run_step_sequence(self, step_sequence): - """This function takes a list of duples instructing how to run the program. The first element in each duple is - a source pattern for the target location, and the second is the operation that will take you from the current - source location to the target location. It will then run all the steps in the sequence. - It will check that you arrived at the expected source location at each step, and that the stack depth changed - correctly for the operation in the sequence.""" - - target_line_entry = lldb.SBLineEntry() - target_line_entry.SetFileSpec(self.main_source_spec) - - test_stack_depth = True - # Work around for <rdar://problem/16363195>, the darwin unwinder seems flakey about whether it duplicates the first frame - # or not, which makes counting stack depth unreliable. - if self.platformIsDarwin(): - test_stack_depth = False - - for step_pattern in step_sequence: - step_stop_line = line_number(self.main_source, step_pattern[0]) - target_line_entry.SetLine(step_stop_line) - self.do_step(step_pattern[1], target_line_entry, test_stack_depth) - - def inline_stepping(self): - """Use Python APIs to test stepping over and hitting breakpoints.""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - break_1_in_main = target.BreakpointCreateBySourceRegex( - '// Stop here and step over to set up stepping over.', self.main_source_spec) - self.assertTrue(break_1_in_main, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - self.process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(self.process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - threads = lldbutil.get_threads_stopped_at_breakpoint( - self.process, break_1_in_main) - - if len(threads) != 1: - self.fail("Failed to stop at first breakpoint in main.") - - self.thread = threads[0] - - # Step over the inline_value = 0 line to get us to inline_trivial_1 called from main. Doing it this way works - # around a bug in lldb where the breakpoint on the containing line of an inlined function with no return value - # gets set past the insertion line in the function. - # Then test stepping over a simple inlined function. Note, to test all the parts of the inlined stepping - # the calls inline_stepping_1 and inline_stepping_2 should line up at the same address, that way we will test - # the "virtual" stepping. - # FIXME: Put in a check to see if that is true and warn if it is not. - - step_sequence = [["// At inline_trivial_1 called from main.", "over"], - ["// At first call of caller_trivial_1 in main.", "over"]] - self.run_step_sequence(step_sequence) - - # Now step from caller_ref_1 all the way into called_by_inline_trivial - - step_sequence = [["// In caller_trivial_1.", "into"], - ["// In caller_trivial_2.", "into"], - ["// In inline_trivial_1.", "into"], - ["// In inline_trivial_2.", "into"], - ["// At caller_by_inline_trivial in inline_trivial_2.", "over"], - ["// In called_by_inline_trivial.", "into"]] - self.run_step_sequence(step_sequence) - - # Now run to the inline_trivial_1 just before the immediate step into - # inline_trivial_2: - - break_2_in_main = target.BreakpointCreateBySourceRegex( - '// At second call of caller_trivial_1 in main.', self.main_source_spec) - self.assertTrue(break_2_in_main, VALID_BREAKPOINT) - - threads = lldbutil.continue_to_breakpoint( - self.process, break_2_in_main) - self.assertTrue( - len(threads) == 1, - "Successfully ran to call site of second caller_trivial_1 call.") - self.thread = threads[0] - - step_sequence = [["// In caller_trivial_1.", "into"], - ["// In caller_trivial_2.", "into"], - ["// In inline_trivial_1.", "into"]] - self.run_step_sequence(step_sequence) - - # Then call some trivial function, and make sure we end up back where - # we were in the inlined call stack: - - frame = self.thread.GetFrameAtIndex(0) - before_line_entry = frame.GetLineEntry() - value = frame.EvaluateExpression("function_to_call()") - after_line_entry = frame.GetLineEntry() - - self.assertTrue( - before_line_entry.GetLine() == after_line_entry.GetLine(), - "Line entry before and after function calls are the same.") - - # Now make sure stepping OVER in the middle of the stack works, and - # then check finish from the inlined frame: - - step_sequence = [["// At increment in inline_trivial_1.", "over"], - ["// At increment in caller_trivial_2.", "out"]] - self.run_step_sequence(step_sequence) - - # Now run to the place in main just before the first call to - # caller_ref_1: - - break_3_in_main = target.BreakpointCreateBySourceRegex( - '// At first call of caller_ref_1 in main.', self.main_source_spec) - self.assertTrue(break_3_in_main, VALID_BREAKPOINT) - - threads = lldbutil.continue_to_breakpoint( - self.process, break_3_in_main) - self.assertTrue( - len(threads) == 1, - "Successfully ran to call site of first caller_ref_1 call.") - self.thread = threads[0] - - step_sequence = [["// In caller_ref_1.", "into"], - ["// In caller_ref_2.", "into"], - ["// In inline_ref_1.", "into"], - ["// In inline_ref_2.", "into"], - ["// In called_by_inline_ref.", "into"], - ["// In inline_ref_2.", "out"], - ["// In inline_ref_1.", "out"], - ["// At increment in inline_ref_1.", "over"], - ["// In caller_ref_2.", "out"], - ["// At increment in caller_ref_2.", "over"]] - self.run_step_sequence(step_sequence) - - def inline_stepping_step_over(self): - """Use Python APIs to test stepping over and hitting breakpoints.""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - break_1_in_main = target.BreakpointCreateBySourceRegex( - '// At second call of caller_ref_1 in main.', self.main_source_spec) - self.assertTrue(break_1_in_main, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - self.process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(self.process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - threads = lldbutil.get_threads_stopped_at_breakpoint( - self.process, break_1_in_main) - - if len(threads) != 1: - self.fail("Failed to stop at first breakpoint in main.") - - self.thread = threads[0] - - step_sequence = [["// In caller_ref_1.", "into"], - ["// In caller_ref_2.", "into"], - ["// At increment in caller_ref_2.", "over"]] - self.run_step_sequence(step_sequence) - - def step_in_template(self): - """Use Python APIs to test stepping in to templated functions.""" - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - break_1_in_main = target.BreakpointCreateBySourceRegex( - '// Call max_value template', self.main_source_spec) - self.assertTrue(break_1_in_main, VALID_BREAKPOINT) - - break_2_in_main = target.BreakpointCreateBySourceRegex( - '// Call max_value specialized', self.main_source_spec) - self.assertTrue(break_2_in_main, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - self.process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(self.process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - threads = lldbutil.get_threads_stopped_at_breakpoint( - self.process, break_1_in_main) - - if len(threads) != 1: - self.fail("Failed to stop at first breakpoint in main.") - - self.thread = threads[0] - - step_sequence = [["// In max_value template", "into"]] - self.run_step_sequence(step_sequence) - - threads = lldbutil.continue_to_breakpoint( - self.process, break_2_in_main) - self.assertEqual( - len(threads), - 1, - "Successfully ran to call site of second caller_trivial_1 call.") - self.thread = threads[0] - - step_sequence = [["// In max_value specialized", "into"]] - self.run_step_sequence(step_sequence) diff --git a/packages/Python/lldbsuite/test/functionalities/inline-stepping/calling.cpp b/packages/Python/lldbsuite/test/functionalities/inline-stepping/calling.cpp deleted file mode 100644 index 9982fbf42734..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/inline-stepping/calling.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include <algorithm> -#include <cstdio> -#include <string> - -inline int inline_ref_1 (int &value) __attribute__((always_inline)); -inline int inline_ref_2 (int &value) __attribute__((always_inline)); - -int caller_ref_1 (int &value); -int caller_ref_2 (int &value); - -int called_by_inline_ref (int &value); - -inline void inline_trivial_1 () __attribute__((always_inline)); -inline void inline_trivial_2 () __attribute__((always_inline)); - -void caller_trivial_1 (); -void caller_trivial_2 (); - -void called_by_inline_trivial (); - -static int inline_value; - -int -function_to_call () -{ - return inline_value; -} - -int -caller_ref_1 (int &value) -{ - int increment = caller_ref_2(value); // In caller_ref_1. - value += increment; // At increment in caller_ref_1. - return value; -} - -int -caller_ref_2 (int &value) -{ - int increment = inline_ref_1 (value); // In caller_ref_2. - value += increment; // At increment in caller_ref_2. - return value; -} - -int -called_by_inline_ref (int &value) -{ - value += 1; // In called_by_inline_ref. - return value; -} - -int -inline_ref_1 (int &value) -{ - int increment = inline_ref_2(value); // In inline_ref_1. - value += increment; // At increment in inline_ref_1. - return value; -} - -int -inline_ref_2 (int &value) -{ - int increment = called_by_inline_ref (value); // In inline_ref_2. - value += 1; // At increment in inline_ref_2. - return value; -} - -void -caller_trivial_1 () -{ - caller_trivial_2(); // In caller_trivial_1. - inline_value += 1; -} - -void -caller_trivial_2 () -{ - inline_trivial_1 (); // In caller_trivial_2. - inline_value += 1; // At increment in caller_trivial_2. -} - -void -called_by_inline_trivial () -{ - inline_value += 1; // In called_by_inline_trivial. -} - -void -inline_trivial_1 () -{ - inline_trivial_2(); // In inline_trivial_1. - inline_value += 1; // At increment in inline_trivial_1. -} - -void -inline_trivial_2 () -{ - inline_value += 1; // In inline_trivial_2. - called_by_inline_trivial (); // At caller_by_inline_trivial in inline_trivial_2. -} - -template<typename T> T -max_value(const T& lhs, const T& rhs) -{ - return std::max(lhs, rhs); // In max_value template -} - -template<> std::string -max_value(const std::string& lhs, const std::string& rhs) -{ - return (lhs.size() > rhs.size()) ? lhs : rhs; // In max_value specialized -} - -int -main (int argc, char **argv) -{ - - inline_value = 0; // Stop here and step over to set up stepping over. - - inline_trivial_1 (); // At inline_trivial_1 called from main. - - caller_trivial_1(); // At first call of caller_trivial_1 in main. - - caller_trivial_1(); // At second call of caller_trivial_1 in main. - - caller_ref_1 (argc); // At first call of caller_ref_1 in main. - - caller_ref_1 (argc); // At second call of caller_ref_1 in main. - - function_to_call (); // Make sure debug info for this function gets generated. - - max_value(123, 456); // Call max_value template - max_value(std::string("abc"), std::string("0022")); // Call max_value specialized - - return 0; // About to return from main. -} diff --git a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/Makefile b/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py b/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py deleted file mode 100644 index 07f04b18bb97..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py +++ /dev/null @@ -1,40 +0,0 @@ -"""Test for the JITLoaderGDB interface""" - -from __future__ import print_function - -import unittest2 -import os -import lldb -from lldbsuite.test import lldbutil -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -import re - - -class JITLoaderGDBTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipTestIfFn( - lambda: "Skipped because the test crashes the test runner", - bugnumber="llvm.org/pr24702") - @unittest2.expectedFailure("llvm.org/pr24702") - def test_bogus_values(self): - """Test that we handle inferior misusing the GDB JIT interface""" - self.build() - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # launch the process, do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # The inferior will now pass bogus values over the interface. Make sure - # we don't crash. - - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), 0) diff --git a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/main.c b/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/main.c deleted file mode 100644 index 6a8ec50e6637..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/main.c +++ /dev/null @@ -1,44 +0,0 @@ -#include <inttypes.h> - -// GDB JIT interface -enum JITAction { JIT_NOACTION, JIT_REGISTER_FN, JIT_UNREGISTER_FN }; - -struct JITCodeEntry -{ - struct JITCodeEntry* next; - struct JITCodeEntry* prev; - const char *symfile_addr; - uint64_t symfile_size; -}; - -struct JITDescriptor -{ - uint32_t version; - uint32_t action_flag; - struct JITCodeEntry* relevant_entry; - struct JITCodeEntry* first_entry; -}; - -struct JITDescriptor __jit_debug_descriptor = { 1, JIT_NOACTION, 0, 0 }; - -void __jit_debug_register_code() -{ -} -// end GDB JIT interface - -struct JITCodeEntry entry; - -int main() -{ - // Create a code entry with a bogus size - entry.next = entry.prev = 0; - entry.symfile_addr = (char *)&entry; - entry.symfile_size = (uint64_t)47<<32; - - __jit_debug_descriptor.relevant_entry = __jit_debug_descriptor.first_entry = &entry; - __jit_debug_descriptor.action_flag = JIT_REGISTER_FN; - - __jit_debug_register_code(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/Makefile b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py deleted file mode 100644 index 9b485b2235dd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py +++ /dev/null @@ -1,121 +0,0 @@ -""" -Test that argdumper is a viable launching strategy. -""" -from __future__ import print_function - - -import lldb -import os -import time -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 - 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/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file1.txt b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file1.txt deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file1.txt +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file2.txt b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file2.txt deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file2.txt +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file3.txt b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file3.txt deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file3.txt +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file4.txy b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file4.txy deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file4.txy +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file5.tyx b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file5.tyx deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/file5.tyx +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/foo bar b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/foo bar deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/foo bar +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/main.cpp b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/main.cpp deleted file mode 100644 index cbef8d1e6da1..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/load_unload/.categories b/packages/Python/lldbsuite/test/functionalities/load_unload/.categories deleted file mode 100644 index c00c25822e4c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/.categories +++ /dev/null @@ -1 +0,0 @@ -basic_process diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile b/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile deleted file mode 100644 index 0dd9eb41a408..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -LEVEL := ../../make - -LIB_PREFIX := loadunload_ - -LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules - -a.out: lib_a lib_b lib_c lib_d hidden_lib_d install_name_tool - -lib_%: - $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/$*.mk - -install_name_tool: -ifeq ($(OS),Darwin) - install_name_tool -id @executable_path/libloadunload_d.dylib libloadunload_d.dylib -endif - - -hidden_lib_d: - $(MAKE) VPATH=$(SRCDIR)/hidden -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile - -clean:: - $(MAKE) -f $(SRCDIR)/a.mk clean - $(MAKE) -f $(SRCDIR)/b.mk clean - $(MAKE) -f $(SRCDIR)/c.mk clean - $(MAKE) -f $(SRCDIR)/d.mk clean - $(MAKE) -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py b/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py deleted file mode 100644 index 7bc5d205a94f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py +++ /dev/null @@ -1,406 +0,0 @@ -""" -Test that breakpoint by symbol name works correctly with dynamic libs. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently -class LoadUnloadTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.setup_test() - # Invoke the default build rule. - self.build() - # Find the line number to break for main.cpp. - self.line = line_number( - 'main.cpp', - '// Set break point at this line for test_lldb_process_load_and_unload_commands().') - self.line_d_function = line_number( - 'd.cpp', '// Find this line number within d_dunction().') - - def setup_test(self): - lldbutil.mkdir_p(self.getBuildArtifact("hidden")) - if not self.platformIsDarwin(): - if not lldb.remote_platform and "LD_LIBRARY_PATH" in os.environ: - self.runCmd( - "settings set target.env-vars " + - self.dylibPath + - "=" + - os.environ["LD_LIBRARY_PATH"] + - ":" + - self.getBuildDir()) - else: - if lldb.remote_platform: - wd = lldb.remote_platform.GetWorkingDirectory() - else: - wd = self.getBuildDir() - self.runCmd( - "settings set target.env-vars " + - self.dylibPath + - "=" + - wd) - - def copy_shlibs_to_remote(self, hidden_dir=False): - """ Copies the shared libs required by this test suite to remote. - Does nothing in case of non-remote platforms. - """ - if lldb.remote_platform: - ext = 'so' - if self.platformIsDarwin(): - ext = 'dylib' - - shlibs = ['libloadunload_a.' + ext, 'libloadunload_b.' + ext, - 'libloadunload_c.' + ext, 'libloadunload_d.' + ext] - wd = lldb.remote_platform.GetWorkingDirectory() - cwd = os.getcwd() - for f in shlibs: - err = lldb.remote_platform.Put( - lldb.SBFileSpec(self.getBuildArtifact(f)), - lldb.SBFileSpec(os.path.join(wd, f))) - if err.Fail(): - raise RuntimeError( - "Unable copy '%s' to '%s'.\n>>> %s" % - (f, wd, err.GetCString())) - if hidden_dir: - shlib = 'libloadunload_d.' + ext - hidden_dir = os.path.join(wd, 'hidden') - hidden_file = os.path.join(hidden_dir, shlib) - err = lldb.remote_platform.MakeDirectory(hidden_dir) - if err.Fail(): - raise RuntimeError( - "Unable to create a directory '%s'." % hidden_dir) - err = lldb.remote_platform.Put( - lldb.SBFileSpec(os.path.join('hidden', shlib)), - lldb.SBFileSpec(hidden_file)) - if err.Fail(): - raise RuntimeError( - "Unable copy 'libloadunload_d.so' to '%s'.\n>>> %s" % - (wd, err.GetCString())) - - # libloadunload_d.so does not appear in the image list because executable - # dependencies are resolved relative to the debuggers PWD. Bug? - @expectedFailureAll(oslist=["linux"]) - @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support - @not_remote_testsuite_ready - @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently - def test_modules_search_paths(self): - """Test target modules list after loading a different copy of the library libd.dylib, and verifies that it works with 'target modules search-paths add'.""" - if self.platformIsDarwin(): - dylibName = 'libloadunload_d.dylib' - else: - dylibName = 'libloadunload_d.so' - - # The directory with the dynamic library we did not link to. - new_dir = os.path.join(self.getBuildDir(), "hidden") - - old_dylib = os.path.join(self.getBuildDir(), dylibName) - new_dylib = os.path.join(new_dir, dylibName) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.expect("target modules list", - substrs=[old_dylib]) - # self.expect("target modules list -t 3", - # patterns = ["%s-[^-]*-[^-]*" % self.getArchitecture()]) - # Add an image search path substitution pair. - self.runCmd( - "target modules search-paths add %s %s" % - (self.getBuildDir(), new_dir)) - - self.expect("target modules search-paths list", - substrs=[self.getBuildDir(), new_dir]) - - self.expect( - "target modules search-paths query %s" % - self.getBuildDir(), - "Image search path successfully transformed", - substrs=[new_dir]) - - # Obliterate traces of libd from the old location. - os.remove(old_dylib) - # Inform (DY)LD_LIBRARY_PATH of the new path, too. - env_cmd_string = "settings set target.env-vars " + self.dylibPath + "=" + new_dir - if self.TraceOn(): - print("Set environment to: ", env_cmd_string) - self.runCmd(env_cmd_string) - self.runCmd("settings show target.env-vars") - - remove_dyld_path_cmd = "settings remove target.env-vars " + self.dylibPath - self.addTearDownHook( - lambda: self.dbg.HandleCommand(remove_dyld_path_cmd)) - - self.runCmd("run") - - self.expect( - "target modules list", - "LLDB successfully locates the relocated dynamic library", - substrs=[new_dylib]) - - # libloadunload_d.so does not appear in the image list because executable - # dependencies are resolved relative to the debuggers PWD. Bug? - @expectedFailureAll(oslist=["linux"]) - @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support - @expectedFailureAndroid # wrong source file shows up for hidden library - @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently - @skipIfDarwinEmbedded - def test_dyld_library_path(self): - """Test (DY)LD_LIBRARY_PATH after moving libd.dylib, which defines d_function, somewhere else.""" - self.copy_shlibs_to_remote(hidden_dir=True) - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Shut off ANSI color usage so we don't get ANSI escape sequences - # mixed in with stop locations. - self.dbg.SetUseColor(False) - - if self.platformIsDarwin(): - dylibName = 'libloadunload_d.dylib' - dsymName = 'libloadunload_d.dylib.dSYM' - else: - dylibName = 'libloadunload_d.so' - - # The directory to relocate the dynamic library and its debugging info. - special_dir = "hidden" - if lldb.remote_platform: - wd = lldb.remote_platform.GetWorkingDirectory() - else: - wd = self.getBuildDir() - - old_dir = wd - new_dir = os.path.join(wd, special_dir) - old_dylib = os.path.join(old_dir, dylibName) - - remove_dyld_path_cmd = "settings remove target.env-vars " \ - + self.dylibPath - self.addTearDownHook( - lambda: self.dbg.HandleCommand(remove_dyld_path_cmd)) - - # For now we don't track (DY)LD_LIBRARY_PATH, so the old - # library will be in the modules list. - self.expect("target modules list", - substrs=[os.path.basename(old_dylib)], - matching=True) - - lldbutil.run_break_set_by_file_and_line( - self, "d.cpp", self.line_d_function, num_expected_locations=1) - # After run, make sure the non-hidden library is picked up. - self.expect("run", substrs=["return", "700"]) - - self.runCmd("continue") - - # Add the hidden directory first in the search path. - env_cmd_string = ("settings set target.env-vars %s=%s" % - (self.dylibPath, new_dir)) - if not self.platformIsDarwin(): - env_cmd_string += ":" + wd - self.runCmd(env_cmd_string) - - # This time, the hidden library should be picked up. - self.expect("run", substrs=["return", "12345"]) - - @expectedFailureAll( - bugnumber="llvm.org/pr25805", - hostoslist=["windows"], - triple='.*-android') - @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support - @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently - def test_lldb_process_load_and_unload_commands(self): - """Test that lldb process load/unload command work correctly.""" - self.copy_shlibs_to_remote() - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break at main.cpp before the call to dlopen(). - # Use lldb's process load command to load the dylib, instead. - - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - ctx = self.platformContext - dylibName = ctx.shlib_prefix + 'loadunload_a.' + ctx.shlib_extension - localDylibPath = self.getBuildArtifact(dylibName) - if lldb.remote_platform: - wd = lldb.remote_platform.GetWorkingDirectory() - remoteDylibPath = lldbutil.join_remote_paths(wd, dylibName) - else: - remoteDylibPath = localDylibPath - - # Make sure that a_function does not exist at this point. - self.expect( - "image lookup -n a_function", - "a_function should not exist yet", - error=True, - matching=False, - patterns=["1 match found"]) - - # Use lldb 'process load' to load the dylib. - self.expect( - "process load %s --install=%s" % (localDylibPath, remoteDylibPath), - "%s loaded correctly" % dylibName, - patterns=[ - 'Loading "%s".*ok' % localDylibPath, - 'Image [0-9]+ loaded']) - - # Search for and match the "Image ([0-9]+) loaded" pattern. - output = self.res.GetOutput() - pattern = re.compile("Image ([0-9]+) loaded") - for l in output.split(os.linesep): - #print("l:", l) - match = pattern.search(l) - if match: - break - index = match.group(1) - - # Now we should have an entry for a_function. - self.expect( - "image lookup -n a_function", - "a_function should now exist", - patterns=[ - "1 match found .*%s" % - dylibName]) - - # Use lldb 'process unload' to unload the dylib. - self.expect( - "process unload %s" % - index, - "%s unloaded correctly" % - dylibName, - patterns=[ - "Unloading .* with index %s.*ok" % - index]) - - self.runCmd("process continue") - - @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support - def test_load_unload(self): - """Test breakpoint by name works correctly with dlopen'ing.""" - self.copy_shlibs_to_remote() - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break by function name a_function (not yet loaded). - lldbutil.run_break_set_by_symbol( - self, "a_function", num_expected_locations=0) - - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint and at a_function. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'a_function', - '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']) - - # Issue the 'contnue' command. We should stop agaian at a_function. - # The stop reason of the thread should be breakpoint and at a_function. - self.runCmd("continue") - - # rdar://problem/8508987 - # The a_function breakpoint should be encountered twice. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'a_function', - 'stop reason = breakpoint']) - - # The breakpoint should have a hit count of 2. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 2']) - - @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support - @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently - def test_step_over_load(self): - """Test stepping over code that loads a shared library works correctly.""" - self.copy_shlibs_to_remote() - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break by function name a_function (not yet loaded). - lldbutil.run_break_set_by_file_and_line( - self, "main.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 at a_function. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - self.runCmd( - "thread step-over", - "Stepping over function that loads library") - - # The stop reason should be step end. - self.expect("thread list", "step over succeeded.", - substrs=['stopped', - 'stop reason = step over']) - - # We can't find a breakpoint location for d_init before launching because - # executable dependencies are resolved relative to the debuggers PWD. Bug? - @expectedFailureAll(oslist=["linux"]) - @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support - @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently - def test_static_init_during_load(self): - """Test that we can set breakpoints correctly in static initializers""" - self.copy_shlibs_to_remote() - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - a_init_bp_num = lldbutil.run_break_set_by_symbol( - self, "a_init", num_expected_locations=0) - b_init_bp_num = lldbutil.run_break_set_by_symbol( - self, "b_init", num_expected_locations=0) - d_init_bp_num = lldbutil.run_break_set_by_symbol( - self, "d_init", num_expected_locations=1) - - self.runCmd("run", RUN_SUCCEEDED) - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'd_init', - 'stop reason = breakpoint %d' % d_init_bp_num]) - - self.runCmd("continue") - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'b_init', - 'stop reason = breakpoint %d' % b_init_bp_num]) - self.expect("thread backtrace", - substrs=['b_init', - 'dlopen', - 'main']) - - self.runCmd("continue") - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'a_init', - 'stop reason = breakpoint %d' % a_init_bp_num]) - self.expect("thread backtrace", - substrs=['a_init', - 'dlopen', - 'main']) diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/a.cpp b/packages/Python/lldbsuite/test/functionalities/load_unload/a.cpp deleted file mode 100644 index 235749aef74a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/a.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===-- a.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -extern int b_function (); - -int a_init() -{ - return 234; -} - -int a_global = a_init(); - -extern "C" int -a_function () -{ - return b_function (); -} diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk b/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk deleted file mode 100644 index fddca925dea2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk +++ /dev/null @@ -1,19 +0,0 @@ -LEVEL := ../../make - -LIB_PREFIX := loadunload_ - -LD_EXTRAS := -L. -l$(LIB_PREFIX)b - -DYLIB_NAME := $(LIB_PREFIX)a -DYLIB_CXX_SOURCES := a.cpp -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules - -$(DYLIB_FILENAME): lib_b - -.PHONY lib_b: - $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/b.mk - -clean:: - $(MAKE) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/b.cpp b/packages/Python/lldbsuite/test/functionalities/load_unload/b.cpp deleted file mode 100644 index 4d383169b79c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/b.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- b.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int b_init() -{ - return 345; -} - -int b_global = b_init(); - -int -b_function () -{ - return 500; -} diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk b/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk deleted file mode 100644 index 2fcdbea3a1c4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL := ../../make - -LIB_PREFIX := loadunload_ - -DYLIB_NAME := $(LIB_PREFIX)b -DYLIB_CXX_SOURCES := b.cpp -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/c.cpp b/packages/Python/lldbsuite/test/functionalities/load_unload/c.cpp deleted file mode 100644 index f0dfb4ec0d38..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/c.cpp +++ /dev/null @@ -1,13 +0,0 @@ -//===-- c.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -extern "C" int -c_function () -{ - return 600; -} diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk b/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk deleted file mode 100644 index d40949b14630..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL := ../../make - -LIB_PREFIX := loadunload_ - -DYLIB_NAME := $(LIB_PREFIX)c -DYLIB_CXX_SOURCES := c.cpp -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/cmds.txt b/packages/Python/lldbsuite/test/functionalities/load_unload/cmds.txt deleted file mode 100644 index 1e4b198dc0d3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/cmds.txt +++ /dev/null @@ -1,2 +0,0 @@ -breakpoint set -n a_function -run diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/d.cpp b/packages/Python/lldbsuite/test/functionalities/load_unload/d.cpp deleted file mode 100644 index 55f2a6b404b3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/d.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- c.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int d_init() -{ - return 123; -} - -int d_global = d_init(); - -int -d_function () -{ // Find this line number within d_dunction(). - return 700; -} diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk b/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk deleted file mode 100644 index a5db3c7c31f0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk +++ /dev/null @@ -1,11 +0,0 @@ -LEVEL := ../../make - -LIB_PREFIX := loadunload_ - -DYLIB_EXECUTABLE_PATH := $(CURDIR) - -DYLIB_NAME := $(LIB_PREFIX)d -DYLIB_CXX_SOURCES := d.cpp -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile b/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile deleted file mode 100644 index 271117a0ad88..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL := ../../../make - -LIB_PREFIX := loadunload_ - -DYLIB_NAME := $(LIB_PREFIX)d -DYLIB_CXX_SOURCES := d.cpp -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.cpp b/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.cpp deleted file mode 100644 index 6a7642c08b93..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/d.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- c.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int d_init() -{ - return 456; -} - -int d_global = d_init(); - -int -d_function () -{ // Find this line number within d_dunction(). - return 12345; -} diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/main.cpp b/packages/Python/lldbsuite/test/functionalities/load_unload/main.cpp deleted file mode 100644 index bff9a3176060..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_unload/main.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <dlfcn.h> -#include <limits.h> -#include <string.h> -#include <unistd.h> -#include <libgen.h> -#include <stdlib.h> - -int -main (int argc, char const *argv[]) -{ -#if defined (__APPLE__) - const char *a_name = "@executable_path/libloadunload_a.dylib"; - const char *c_name = "@executable_path/libloadunload_c.dylib"; -#else - const char *a_name = "libloadunload_a.so"; - const char *c_name = "libloadunload_c.so"; -#endif - void *a_dylib_handle = NULL; - void *c_dylib_handle = NULL; - int (*a_function) (void); - - a_dylib_handle = dlopen (a_name, RTLD_NOW); // Set break point at this line for test_lldb_process_load_and_unload_commands(). - if (a_dylib_handle == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (1); - } - - a_function = (int (*) ()) dlsym (a_dylib_handle, "a_function"); - if (a_function == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (2); - } - printf ("First time around, got: %d\n", a_function ()); - dlclose (a_dylib_handle); - - c_dylib_handle = dlopen (c_name, RTLD_NOW); - if (c_dylib_handle == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (3); - } - a_function = (int (*) ()) dlsym (c_dylib_handle, "c_function"); - if (a_function == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (4); - } - - a_dylib_handle = dlopen (a_name, RTLD_NOW); - if (a_dylib_handle == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (5); - } - - a_function = (int (*) ()) dlsym (a_dylib_handle, "a_function"); - if (a_function == NULL) - { - fprintf (stderr, "%s\n", dlerror()); - exit (6); - } - printf ("Second time around, got: %d\n", a_function ()); - dlclose (a_dylib_handle); - - int d_function(void); - printf ("d_function returns: %d\n", d_function()); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/load_using_paths/.categories b/packages/Python/lldbsuite/test/functionalities/load_using_paths/.categories deleted file mode 100644 index c00c25822e4c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_using_paths/.categories +++ /dev/null @@ -1 +0,0 @@ -basic_process diff --git a/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile b/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile deleted file mode 100644 index c4c3cfe3c18e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -LEVEL := ../../make - -CXX_SOURCES := main.cpp -LD_EXTRAS := -ldl - -include $(LEVEL)/Makefile.rules - -all: hidden_lib a.out - -hidden_lib: - $(MAKE) VPATH=$(SRCDIR)/hidden -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile - -clean:: - $(MAKE) -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean diff --git a/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py b/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py deleted file mode 100644 index a4d0a0b958d5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py +++ /dev/null @@ -1,143 +0,0 @@ -""" -Test that SBProcess.LoadImageUsingPaths works correctly. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -@skipIfWindows # The Windows platform doesn't implement DoLoadImage. -class LoadUsingPathsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Make the hidden directory in the build hierarchy: - lldbutil.mkdir_p(self.getBuildArtifact("hidden")) - - # Invoke the default build rule. - self.build() - - ext = 'so' - if self.platformIsDarwin(): - ext = 'dylib' - self.lib_name = 'libloadunload.' + ext - - self.wd = self.getBuildDir() - self.hidden_dir = os.path.join(self.wd, 'hidden') - self.hidden_lib = os.path.join(self.hidden_dir, self.lib_name) - - @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support - @not_remote_testsuite_ready - @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently - def test_load_using_paths(self): - """Test that we can load a module by providing a set of search paths.""" - if self.platformIsDarwin(): - dylibName = 'libloadunload_d.dylib' - else: - dylibName = 'libloadunload_d.so' - - # The directory with the dynamic library we did not link to. - path_dir = os.path.join(self.getBuildDir(), "hidden") - - (target, process, thread, - _) = lldbutil.run_to_source_breakpoint(self, - "Break here to do the load using paths", - lldb.SBFileSpec("main.cpp")) - error = lldb.SBError() - lib_spec = lldb.SBFileSpec(self.lib_name) - paths = lldb.SBStringList() - paths.AppendString(self.wd) - paths.AppendString(os.path.join(self.wd, "no_such_dir")) - - out_spec = lldb.SBFileSpec() - - # First try with no correct directories on the path, and make sure that doesn't blow up: - token = process.LoadImageUsingPaths(lib_spec, paths, out_spec, error) - self.assertEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Only looked on the provided path.") - - # Now add the correct dir to the paths list and try again: - paths.AppendString(self.hidden_dir) - token = process.LoadImageUsingPaths(lib_spec, paths, out_spec, error) - - self.assertNotEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Got a valid token") - self.assertEqual(out_spec, lldb.SBFileSpec(self.hidden_lib), "Found the expected library") - - # Make sure this really is in the image list: - loaded_module = target.FindModule(out_spec) - - self.assertTrue(loaded_module.IsValid(), "The loaded module is in the image list.") - - # Now see that we can call a function in the loaded module. - value = thread.frames[0].EvaluateExpression("d_function()", lldb.SBExpressionOptions()) - self.assertTrue(value.GetError().Success(), "Got a value from the expression") - ret_val = value.GetValueAsSigned() - self.assertEqual(ret_val, 12345, "Got the right value") - - # Make sure the token works to unload it: - process.UnloadImage(token) - - # Make sure this really is no longer in the image list: - loaded_module = target.FindModule(out_spec) - - self.assertFalse(loaded_module.IsValid(), "The unloaded module is no longer in the image list.") - - # Make sure a relative path also works: - paths.Clear() - paths.AppendString(os.path.join(self.wd, "no_such_dir")) - paths.AppendString(self.wd) - relative_spec = lldb.SBFileSpec(os.path.join("hidden", self.lib_name)) - - out_spec = lldb.SBFileSpec() - token = process.LoadImageUsingPaths(relative_spec, paths, out_spec, error) - - self.assertNotEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Got a valid token with relative path") - self.assertEqual(out_spec, lldb.SBFileSpec(self.hidden_lib), "Found the expected library with relative path") - - process.UnloadImage(token) - - # Make sure the presence of an empty path doesn't mess anything up: - paths.Clear() - paths.AppendString("") - paths.AppendString(os.path.join(self.wd, "no_such_dir")) - paths.AppendString(self.wd) - relative_spec = lldb.SBFileSpec(os.path.join("hidden", self.lib_name)) - - out_spec = lldb.SBFileSpec() - token = process.LoadImageUsingPaths(relative_spec, paths, out_spec, error) - - self.assertNotEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Got a valid token with included empty path") - self.assertEqual(out_spec, lldb.SBFileSpec(self.hidden_lib), "Found the expected library with included empty path") - - process.UnloadImage(token) - - - - # Finally, passing in an absolute path should work like the basename: - # This should NOT work because we've taken hidden_dir off the paths: - abs_spec = lldb.SBFileSpec(os.path.join(self.hidden_dir, self.lib_name)) - - token = process.LoadImageUsingPaths(lib_spec, paths, out_spec, error) - self.assertEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Only looked on the provided path.") - - # But it should work when we add the dir: - # Now add the correct dir to the paths list and try again: - paths.AppendString(self.hidden_dir) - token = process.LoadImageUsingPaths(lib_spec, paths, out_spec, error) - - self.assertNotEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Got a valid token") - self.assertEqual(out_spec, lldb.SBFileSpec(self.hidden_lib), "Found the expected library") - - diff --git a/packages/Python/lldbsuite/test/functionalities/load_using_paths/hidden/Makefile b/packages/Python/lldbsuite/test/functionalities/load_using_paths/hidden/Makefile deleted file mode 100644 index bebfa92ecfb2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_using_paths/hidden/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL := ../../../make - -DYLIB_NAME := loadunload -DYLIB_CXX_SOURCES := d.cpp -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/load_using_paths/hidden/d.cpp b/packages/Python/lldbsuite/test/functionalities/load_using_paths/hidden/d.cpp deleted file mode 100644 index 6a7642c08b93..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_using_paths/hidden/d.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- c.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int d_init() -{ - return 456; -} - -int d_global = d_init(); - -int -d_function () -{ // Find this line number within d_dunction(). - return 12345; -} diff --git a/packages/Python/lldbsuite/test/functionalities/load_using_paths/main.cpp b/packages/Python/lldbsuite/test/functionalities/load_using_paths/main.cpp deleted file mode 100644 index 4b3320479c25..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/load_using_paths/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> - -int -main (int argc, char const *argv[]) -{ - printf("Break here to do the load using paths."); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/longjmp/Makefile b/packages/Python/lldbsuite/test/functionalities/longjmp/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/longjmp/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py b/packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py deleted file mode 100644 index db855f6302dd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -Test the use of setjmp/longjmp for non-local goto operations in a single-threaded inferior. -""" - -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 LongjmpTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp - @skipIfFreeBSD # llvm.org/pr17214 - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_step_out(self): - """Test stepping when the inferior calls setjmp/longjmp, in particular, thread step-out.""" - self.build() - self.step_out() - - @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp - @skipIfFreeBSD # llvm.org/pr17214 - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_step_over(self): - """Test stepping when the inferior calls setjmp/longjmp, in particular, thread step-over a longjmp.""" - self.build() - self.step_over() - - @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp - @skipIfFreeBSD # llvm.org/pr17214 - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - def test_step_back_out(self): - """Test stepping when the inferior calls setjmp/longjmp, in particular, thread step-out after thread step-in.""" - self.build() - self.step_back_out() - - def start_test(self, symbol): - exe = self.getBuildArtifact("a.out") - - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break in main(). - lldbutil.run_break_set_by_symbol( - self, symbol, 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']) - - def check_status(self): - # Note: Depending on the generated mapping of DWARF to assembly, - # the process may have stopped or exited. - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* exited with status = 0']) - - def step_out(self): - self.start_test("do_jump") - self.runCmd("thread step-out", RUN_SUCCEEDED) - self.check_status() - - def step_over(self): - self.start_test("do_jump") - self.runCmd("thread step-over", RUN_SUCCEEDED) - self.runCmd("thread step-over", RUN_SUCCEEDED) - self.check_status() - - def step_back_out(self): - self.start_test("main") - - self.runCmd("thread step-over", RUN_SUCCEEDED) - self.runCmd("thread step-in", RUN_SUCCEEDED) - self.runCmd("thread step-out", RUN_SUCCEEDED) - self.check_status() diff --git a/packages/Python/lldbsuite/test/functionalities/longjmp/main.c b/packages/Python/lldbsuite/test/functionalities/longjmp/main.c deleted file mode 100644 index 3879311eb452..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/longjmp/main.c +++ /dev/null @@ -1,31 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <setjmp.h> -#include <stdio.h> -#include <time.h> - -jmp_buf j; - -void do_jump(void) -{ - // We can't let the compiler know this will always happen or it might make - // optimizations that break our test. - if (!clock()) - longjmp(j, 1); // non-local goto -} - -int main (void) -{ - if (setjmp(j) == 0) - do_jump(); - else - return 0; // destination of longjmp - - return 1; -} diff --git a/packages/Python/lldbsuite/test/functionalities/memory-region/Makefile b/packages/Python/lldbsuite/test/functionalities/memory-region/Makefile deleted file mode 100644 index 9d4f3b7f1412..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory-region/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules - -clean:: - rm -rf $(wildcard *.o *.d *.dSYM) diff --git a/packages/Python/lldbsuite/test/functionalities/memory-region/TestMemoryRegion.py b/packages/Python/lldbsuite/test/functionalities/memory-region/TestMemoryRegion.py deleted file mode 100644 index 4d10e68672e0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory-region/TestMemoryRegion.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -Test the 'memory region' command. -""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class MemoryCommandRegion(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - TestBase.setUp(self) - # Find the line number to break for main.c. - self.line = line_number( - 'main.cpp', - '// Run here before printing memory regions') - - def test(self): - self.build() - - # Set breakpoint in main and run - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - 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) - - interp = self.dbg.GetCommandInterpreter() - result = lldb.SBCommandReturnObject() - - # Test that the first 'memory region' command prints the usage. - interp.HandleCommand("memory region", result) - self.assertFalse(result.Succeeded()) - self.assertRegexpMatches(result.GetError(), "Usage: memory region ADDR") - - # Now let's print the memory region starting at 0 which should always work. - interp.HandleCommand("memory region 0x0", result) - self.assertTrue(result.Succeeded()) - self.assertRegexpMatches(result.GetOutput(), "\\[0x0+-") - - # Keep printing memory regions until we printed all of them. - while True: - interp.HandleCommand("memory region", result) - if not result.Succeeded(): - break - - # Now that we reached the end, 'memory region' should again print the usage. - interp.HandleCommand("memory region", result) - self.assertFalse(result.Succeeded()) - self.assertRegexpMatches(result.GetError(), "Usage: memory region ADDR") diff --git a/packages/Python/lldbsuite/test/functionalities/memory-region/main.cpp b/packages/Python/lldbsuite/test/functionalities/memory-region/main.cpp deleted file mode 100644 index 116c10a6c3ea..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory-region/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include <iostream> - -int main (int argc, char const **argv) { - std::cout << "Program with sections" << std::endl; - return 0; // Run here before printing memory regions -} diff --git a/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile b/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py b/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py deleted file mode 100644 index 56984885104e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Test the MemoryCache L1 flush. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class MemoryCacheTestCase(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', '// Set break point at this line.') - - @skipIfWindows # This is flakey on Windows: llvm.org/pr38373 - def test_memory_cache(self): - """Test the MemoryCache class with a sequence of 'memory read' and 'memory write' operations.""" - 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']) - - # Read a chunk of memory containing &my_ints[0]. The number of bytes read - # must be greater than m_L2_cache_line_byte_size to make sure the L1 - # cache is used. - self.runCmd('memory read -f d -c 201 `&my_ints - 100`') - - # Check the value of my_ints[0] is the same as set in main.cpp. - line = self.res.GetOutput().splitlines()[100] - self.assertTrue(0x00000042 == int(line.split(':')[1], 0)) - - # Change the value of my_ints[0] in memory. - self.runCmd("memory write -s 4 `&my_ints` AA") - - # Re-read the chunk of memory. The cache line should have been - # flushed because of the 'memory write'. - self.runCmd('memory read -f d -c 201 `&my_ints - 100`') - - # Check the value of my_ints[0] have been updated correctly. - line = self.res.GetOutput().splitlines()[100] - self.assertTrue(0x000000AA == int(line.split(':')[1], 0)) diff --git a/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp b/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp deleted file mode 100644 index 7f25e2f4bf68..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp +++ /dev/null @@ -1,14 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main () -{ - int my_ints[] = {0x42}; - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/memory/find/Makefile b/packages/Python/lldbsuite/test/functionalities/memory/find/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/find/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py b/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py deleted file mode 100644 index 245aaa819c7f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py +++ /dev/null @@ -1,70 +0,0 @@ -""" -Test the 'memory find' command. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * - - -class MemoryFindTestCase(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_memory_find(self): - """Test the 'memory find' 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']) - - # Test the memory find commands. - - self.expect( - 'memory find -s "in const" `stringdata` `stringdata+(int)strlen(stringdata)`', - substrs=[ - 'data found at location: 0x', - '69 6e 20 63', - 'in const']) - - self.expect( - 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[15]`', - substrs=[ - 'data found at location: 0x', - '22 33 44 55 66']) - - self.expect( - 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[2]`', - substrs=['data not found within the range.']) - - self.expect('memory find -s "nothere" `stringdata` `stringdata+5`', - substrs=['data not found within the range.']) - - self.expect('memory find -s "nothere" `stringdata` `stringdata+10`', - substrs=['data not found within the range.']) diff --git a/packages/Python/lldbsuite/test/functionalities/memory/find/main.cpp b/packages/Python/lldbsuite/test/functionalities/memory/find/main.cpp deleted file mode 100644 index 250f359c76e0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/find/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -int main (int argc, char const *argv[]) -{ - const char* stringdata = "hello world; I like to write text in const char pointers"; - uint8_t bytedata[] = {0xAA,0xBB,0xCC,0xDD,0xEE,0xFF,0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99}; - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/memory/read/Makefile b/packages/Python/lldbsuite/test/functionalities/memory/read/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/read/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py b/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py deleted file mode 100644 index 2e4bbbd53f0f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py +++ /dev/null @@ -1,137 +0,0 @@ -""" -Test the 'memory read' command. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class MemoryReadTestCase(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', '// Set break point at this line.') - - def test_memory_read(self): - """Test the 'memory read' command with plain and vector formats.""" - 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']) - - # Test the memory read commands. - - # (lldb) memory read -f d -c 1 `&argc` - # 0x7fff5fbff9a0: 1 - self.runCmd("memory read -f d -c 1 `&argc`") - - # Find the starting address for variable 'argc' to verify later that the - # '--format uint32_t[] --size 4 --count 4' option increments the address - # correctly. - line = self.res.GetOutput().splitlines()[0] - items = line.split(':') - address = int(items[0], 0) - argc = int(items[1], 0) - self.assertTrue(address > 0 and argc == 1) - - # (lldb) memory read --format uint32_t[] --size 4 --count 4 `&argc` - # 0x7fff5fbff9a0: {0x00000001} - # 0x7fff5fbff9a4: {0x00000000} - # 0x7fff5fbff9a8: {0x0ec0bf27} - # 0x7fff5fbff9ac: {0x215db505} - self.runCmd( - "memory read --format uint32_t[] --size 4 --count 4 `&argc`") - lines = self.res.GetOutput().splitlines() - for i in range(4): - if i == 0: - # Verify that the printout for argc is correct. - self.assertTrue( - argc == int( - lines[i].split(':')[1].strip(' {}'), 0)) - addr = int(lines[i].split(':')[0], 0) - # Verify that the printout for addr is incremented correctly. - self.assertTrue(addr == (address + i * 4)) - - # (lldb) memory read --format char[] --size 7 --count 1 `&my_string` - # 0x7fff5fbff990: {abcdefg} - self.expect( - "memory read --format char[] --size 7 --count 1 `&my_string`", - substrs=['abcdefg']) - - # (lldb) memory read --format 'hex float' --size 16 `&argc` - # 0x7fff5fbff5b0: error: unsupported byte size (16) for hex float - # format - self.expect( - "memory read --format 'hex float' --size 16 `&argc`", - substrs=['unsupported byte size (16) for hex float format']) - - self.expect( - "memory read --format 'float' --count 1 --size 8 `&my_double`", - substrs=['1234.']) - - # (lldb) memory read --format 'float' --count 1 --size 20 `&my_double` - # 0x7fff5fbff598: error: unsupported byte size (20) for float format - self.expect( - "memory read --format 'float' --count 1 --size 20 `&my_double`", - substrs=['unsupported byte size (20) for float format']) - - self.expect('memory read --type int --count 5 `&my_ints[0]`', - substrs=['(int) 0x', '2', '4', '6', '8', '10']) - - self.expect( - 'memory read --type int --count 5 --format hex `&my_ints[0]`', - substrs=[ - '(int) 0x', - '0x', - '0a']) - - self.expect( - 'memory read --type int --count 5 --offset 5 `&my_ints[0]`', - substrs=[ - '(int) 0x', - '12', - '14', - '16', - '18', - '20']) - - # the gdb format specifier and the size in characters for - # the returned values including the 0x prefix. - variations = [['b', 4], ['h', 6], ['w', 10], ['g', 18]] - for v in variations: - formatter = v[0] - expected_object_length = v[1] - self.runCmd( - "memory read --gdb-format 4%s &my_uint64s" % formatter) - lines = self.res.GetOutput().splitlines() - objects_read = [] - for l in lines: - objects_read.extend(l.split(':')[1].split()) - # Check that we got back 4 0x0000 etc bytes - for o in objects_read: - self.assertTrue (len(o) == expected_object_length) - self.assertTrue(len(objects_read) == 4) diff --git a/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp b/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp deleted file mode 100644 index fdc7b8bdba18..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdint.h> - -int main (int argc, char const *argv[]) -{ - char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0}; - double my_double = 1234.5678; - int my_ints[] = {2,4,6,8,10,12,14,16,18,20,22}; - uint64_t my_uint64s[] = {0, 1, 2, 3, 4, 5, 6, 7}; - printf("my_string=%s\n", my_string); // Set break point at this line. - printf("my_double=%g\n", my_double); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile b/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile deleted file mode 100644 index 5665652329dc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -OBJC_SOURCES := main.m -LDFLAGS = $(CFLAGS) -lobjc -framework Foundation -framework AppKit - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py b/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py deleted file mode 100644 index b871b90961c9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -Tests basic Main Thread Checker support (detecting a main-thread-only violation). -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbplatformutil import * -import json - - -class MTCSimpleTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # Test file depends on AppKit which is not present on iOS etc. - def test(self): - self.mtc_dylib_path = findMainThreadCheckerDylib() - if self.mtc_dylib_path == "": - self.skipTest("This test requires libMainThreadChecker.dylib.") - - self.build() - self.mtc_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - @skipIf(archs=['i386']) - def mtc_tests(self): - # Load the test - exe = self.getBuildArtifact("a.out") - self.expect("file " + exe, patterns=["Current executable set to .*a.out"]) - - self.runCmd("env DYLD_INSERT_LIBRARIES=%s" % self.mtc_dylib_path) - self.runCmd("run") - - process = self.dbg.GetSelectedTarget().process - thread = process.GetSelectedThread() - frame = thread.GetSelectedFrame() - - self.expect("thread info", substrs=['stop reason = -[NSView superview] must be used from main thread only']) - - self.expect( - "thread info -s", - substrs=["instrumentation_class", "api_name", "class_name", "selector", "description"]) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation) - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - self.assertEqual(data["instrumentation_class"], "MainThreadChecker") - self.assertEqual(data["api_name"], "-[NSView superview]") - self.assertEqual(data["class_name"], "NSView") - self.assertEqual(data["selector"], "superview") - self.assertEqual(data["description"], "-[NSView superview] must be used from main thread only") diff --git a/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m b/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m deleted file mode 100644 index 651347cf74ee..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m +++ /dev/null @@ -1,15 +0,0 @@ -#import <Foundation/Foundation.h> -#import <AppKit/AppKit.h> - -int main() { - NSView *view = [[NSView alloc] init]; - dispatch_group_t g = dispatch_group_create(); - dispatch_group_enter(g); - [NSThread detachNewThreadWithBlock:^{ - @autoreleasepool { - [view superview]; - } - dispatch_group_leave(g); - }]; - dispatch_group_wait(g, DISPATCH_TIME_FOREVER); -} diff --git a/packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py b/packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py deleted file mode 100644 index 9cdd7158516d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class MultipleDebuggersCommandsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_multipledebuggers_commands(self): - """Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario""" - source_init_files = False - magic_text = "The following commands may relate to 'env'" - - debugger_1 = lldb.SBDebugger.Create(source_init_files) - interpreter_1 = debugger_1.GetCommandInterpreter() - - retobj = lldb.SBCommandReturnObject() - interpreter_1.HandleCommand("apropos env", retobj) - self.assertTrue( - magic_text in str(retobj), - "[interpreter_1]: the output does not contain the correct words") - - if self.TraceOn(): - print(str(retobj)) - - lldb.SBDebugger.Destroy(debugger_1) - - # now do this again with a different debugger - we shouldn't crash - - debugger_2 = lldb.SBDebugger.Create(source_init_files) - interpreter_2 = debugger_2.GetCommandInterpreter() - - retobj = lldb.SBCommandReturnObject() - interpreter_2.HandleCommand("apropos env", retobj) - self.assertTrue( - magic_text in str(retobj), - "[interpreter_2]: the output does not contain the correct words") - - if self.TraceOn(): - print(str(retobj)) - - lldb.SBDebugger.Destroy(debugger_2) diff --git a/packages/Python/lldbsuite/test/functionalities/nested_alias/Makefile b/packages/Python/lldbsuite/test/functionalities/nested_alias/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py b/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py deleted file mode 100644 index f805b53d3cd4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py +++ /dev/null @@ -1,93 +0,0 @@ -""" -Test that an alias can reference other aliases without crashing. -""" - -from __future__ import print_function - - -import os -import time -import re -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/packages/Python/lldbsuite/test/functionalities/nested_alias/main.cpp b/packages/Python/lldbsuite/test/functionalities/nested_alias/main.cpp deleted file mode 100644 index 4424cf30c3a4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/nested_alias/main.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <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/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/Makefile b/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py b/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py deleted file mode 100644 index 59e889e8b0fd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py +++ /dev/null @@ -1,48 +0,0 @@ -"""Test evaluating expressions which ref. index variable 'i' which just goes -from out of scope to in scope when stopped at the breakpoint.""" - -from __future__ import print_function - - -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class NonOverlappingIndexVariableCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - self.source = 'main.cpp' - self.line_to_break = line_number( - self.source, '// Set breakpoint here.') - - # rdar://problem/9890530 - def test_eval_index_variable(self): - """Test expressions of variable 'i' which appears in two for loops.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), - CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, - self.source, - self.line_to_break, - 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']) - - self.runCmd('frame variable i') - self.runCmd('expr i') - self.runCmd('expr ptr[0]->point.x') - self.runCmd('expr ptr[0]->point.y') - self.runCmd('expr ptr[i]->point.x') - self.runCmd('expr ptr[i]->point.y') diff --git a/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/main.cpp b/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/main.cpp deleted file mode 100644 index 2171a2648bde..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -class Point { -public: - int x; - int y; - Point(int a, int b): - x(a), - y(b) - {} -}; - -class Data { -public: - int id; - Point point; - Data(int i): - id(i), - point(0, 0) - {} -}; - -int main(int argc, char const *argv[]) { - Data *data[1000]; - Data **ptr = data; - for (int i = 0; i < 1000; ++i) { - ptr[i] = new Data(i); - ptr[i]->point.x = i; - ptr[i]->point.y = i+1; - } - - for (int i = 0; i < 1000; ++i) { - bool dump = argc > 1; // Set breakpoint here. - // Evaluate a couple of expressions (2*1000 = 2000 exprs): - // expr ptr[i]->point.x - // expr ptr[i]->point.y - } - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/nosucharch/Makefile b/packages/Python/lldbsuite/test/functionalities/nosucharch/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py b/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py deleted file mode 100644 index fd9812320f2b..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/nosucharch/main.cpp b/packages/Python/lldbsuite/test/functionalities/nosucharch/main.cpp deleted file mode 100644 index 4cce7f667ff7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/nosucharch/main.cpp +++ /dev/null @@ -1,3 +0,0 @@ -int main() { - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py b/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py deleted file mode 100644 index 93eac1ecd105..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Test lldb 'image list' on object files across multiple architectures. -This exercises classes like ObjectFileELF and their support for opening -foreign-architecture object files. -""" - -from __future__ import print_function - - -import os.path -import re - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestImageListMultiArchitecture(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - @skipIfRemote - def test_image_list_shows_multiple_architectures(self): - """Test that image list properly shows the correct architecture for a set of different architecture object files.""" - images = { - "hello-freebsd-10.0-x86_64-clang-3.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"), - "hello-freebsd-10.0-x86_64-gcc-4.7.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"), - "hello-netbsd-6.1-x86_64-gcc-4.5.3": re.compile(r"x86_64-(\*)?-netbsd(-unknown)? x86_64"), - "hello-ubuntu-14.04-x86_64-gcc-4.8.2": re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"), - "hello-ubuntu-14.04-x86_64-clang-3.5pre": re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"), - "hello-unknown-kalimba_arch4-kcc-36": re.compile(r"kalimba4-csr-(unknown|\*)(-unknown)? kalimba"), - "hello-unknown-kalimba_arch5-kcc-39": re.compile(r"kalimba5-csr-(unknown|\*)(-unknown)? kalimba"), - } - - for image_name in images: - file_name = os.path.abspath( - os.path.join( - os.path.dirname(__file__), - "bin", - image_name)) - expected_triple_and_arch_regex = images[image_name] - - self.runCmd("file {}".format(file_name)) - self.match("image list -t -A", [expected_triple_and_arch_regex]) - # Revert to the host platform after all of this is done - self.runCmd("platform select host") diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-freebsd-10.0-x86_64-clang-3.3 b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-freebsd-10.0-x86_64-clang-3.3 Binary files differdeleted file mode 100644 index cea323639b46..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-freebsd-10.0-x86_64-clang-3.3 +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-freebsd-10.0-x86_64-gcc-4.7.3 b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-freebsd-10.0-x86_64-gcc-4.7.3 Binary files differdeleted file mode 100644 index 38f43f8acb9d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-freebsd-10.0-x86_64-gcc-4.7.3 +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-netbsd-6.1-x86_64-gcc-4.5.3 b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-netbsd-6.1-x86_64-gcc-4.5.3 Binary files differdeleted file mode 100644 index 6d531320ae96..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-netbsd-6.1-x86_64-gcc-4.5.3 +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-ubuntu-14.04-x86_64-clang-3.5pre b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-ubuntu-14.04-x86_64-clang-3.5pre Binary files differdeleted file mode 100644 index 8bdcf4d5b59e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-ubuntu-14.04-x86_64-clang-3.5pre +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-ubuntu-14.04-x86_64-gcc-4.8.2 b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-ubuntu-14.04-x86_64-gcc-4.8.2 Binary files differdeleted file mode 100644 index 01efbb061b73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-ubuntu-14.04-x86_64-gcc-4.8.2 +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-unknown-kalimba_arch4-kcc-36 b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-unknown-kalimba_arch4-kcc-36 Binary files differdeleted file mode 100644 index 8e4dd8c883c9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-unknown-kalimba_arch4-kcc-36 +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-unknown-kalimba_arch5-kcc-39 b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-unknown-kalimba_arch5-kcc-39 Binary files differdeleted file mode 100644 index f80268a08e5e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello-unknown-kalimba_arch5-kcc-39 +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello.c b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello.c deleted file mode 100644 index 8c804005afe3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <stdio.h> - -int main(int argc, char **argv) -{ - printf("Hello, world\n"); - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello.cpp b/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello.cpp deleted file mode 100644 index 8c804005afe3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/object-file/bin/hello.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include <stdio.h> - -int main(int argc, char **argv) -{ - printf("Hello, world\n"); - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py b/packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py deleted file mode 100644 index 7fc9a743d321..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Test some lldb command abbreviations. -""" -from __future__ import print_function - - -import lldb -import os -import time -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestPaths(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_paths(self): - '''Test to make sure no file names are set in the lldb.SBFileSpec objects returned by lldb.SBHostOS.GetLLDBPath() for paths that are directories''' - dir_path_types = [lldb.ePathTypeLLDBShlibDir, - lldb.ePathTypeSupportExecutableDir, - lldb.ePathTypeHeaderDir, - lldb.ePathTypePythonDir, - lldb.ePathTypeLLDBSystemPlugins, - lldb.ePathTypeLLDBUserPlugins, - lldb.ePathTypeLLDBTempSystemDir] - - for path_type in dir_path_types: - f = lldb.SBHostOS.GetLLDBPath(path_type) - # No directory path types should have the filename set - self.assertTrue(f.GetFilename() is None) - - @no_debug_info_test - def test_directory_doesnt_end_with_slash(self): - current_directory_spec = lldb.SBFileSpec(os.path.curdir) - current_directory_string = current_directory_spec.GetDirectory() - self.assertNotEqual(current_directory_string[-1:], '/') - pass - - @skipUnlessPlatform(["windows"]) - @no_debug_info_test - def test_windows_double_slash(self): - '''Test to check the path with double slash is handled correctly ''' - # Create a path and see if lldb gets the directory and file right - fspec = lldb.SBFileSpec("C:\\dummy1\\dummy2//unknown_file", True) - self.assertEqual( - os.path.normpath( - fspec.GetDirectory()), - os.path.normpath("C:/dummy1/dummy2")) - self.assertEqual(fspec.GetFilename(), "unknown_file") diff --git a/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py b/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py deleted file mode 100644 index 302201a9256a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Test some lldb platform commands. -""" - -from __future__ import print_function - - -import os -import time -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']) - - @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/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py b/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py deleted file mode 100644 index b81446f5a58f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -Test the lldb platform Python API. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/plugins/commands/Makefile b/packages/Python/lldbsuite/test/functionalities/plugins/commands/Makefile deleted file mode 100644 index 8af06446ecef..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/commands/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../make - -DYLIB_CXX_SOURCES := plugin.cpp -DYLIB_NAME := plugin -DYLIB_ONLY := YES -MAKE_DSYM := NO - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py b/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py deleted file mode 100644 index 25b83ed5532f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Test that plugins that load commands work correctly. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class PluginCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - self.generateSource('plugin.cpp') - - @skipIfNoSBHeaders - # Requires a compatible arch and platform to link against the host's built - # lldb lib. - @skipIfHostIncompatibleWithRemote - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - @no_debug_info_test - def test_load_plugin(self): - """Test that plugins that load commands work correctly.""" - - plugin_name = "plugin" - if sys.platform.startswith("darwin"): - plugin_lib_name = "lib%s.dylib" % plugin_name - else: - plugin_lib_name = "lib%s.so" % plugin_name - - # Invoke the library build rule. - self.buildLibrary("plugin.cpp", plugin_name) - - debugger = lldb.SBDebugger.Create() - - retobj = lldb.SBCommandReturnObject() - - retval = debugger.GetCommandInterpreter().HandleCommand( - "plugin load %s" % self.getBuildArtifact(plugin_lib_name), retobj) - - retobj.Clear() - - retval = debugger.GetCommandInterpreter().HandleCommand( - "plugin_loaded_command child abc def ghi", retobj) - - if self.TraceOn(): - print(retobj.GetOutput()) - - self.expect(retobj, substrs=['abc def ghi'], exe=False) - - retobj.Clear() - - # check that abbreviations work correctly in plugin commands. - retval = debugger.GetCommandInterpreter().HandleCommand( - "plugin_loaded_ ch abc def ghi", retobj) - - if self.TraceOn(): - print(retobj.GetOutput()) - - self.expect(retobj, substrs=['abc def ghi'], exe=False) diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template b/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template deleted file mode 100644 index 393e9feec796..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template +++ /dev/null @@ -1,54 +0,0 @@ -//===-- plugin.cpp -------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -/* -An example plugin for LLDB that provides a new foo command with a child subcommand -Compile this into a dylib foo.dylib and load by placing in appropriate locations on disk or -by typing plugin load foo.dylib at the LLDB command line -*/ - -%include_SB_APIs% - -namespace lldb { - bool - PluginInitialize (lldb::SBDebugger debugger); -} - -class ChildCommand : public lldb::SBCommandPluginInterface -{ -public: - virtual bool - DoExecute (lldb::SBDebugger debugger, - char** command, - lldb::SBCommandReturnObject &result) - { - if (command) - { - const char* arg = *command; - while (arg) - { - result.Printf("%s ",arg); - arg = *(++command); - } - result.Printf("\n"); - return true; - } - return false; - } - -}; - -bool -lldb::PluginInitialize (lldb::SBDebugger debugger) -{ - lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter(); - lldb::SBCommand foo = interpreter.AddMultiwordCommand("plugin_loaded_command",NULL); - foo.AddCommand("child",new ChildCommand(),"a child of plugin_loaded_command"); - return true; -} diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/Makefile b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/Makefile deleted file mode 100644 index cd9ca5c86d84..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../../make -C_SOURCES := main.c -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py deleted file mode 100644 index 4a19a4e77607..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ /dev/null @@ -1,197 +0,0 @@ -""" -Test that the Python operating system plugin works correctly -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class PluginPythonOSPlugin(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_python_os_plugin(self): - """Test that the Python operating system plugin works correctly""" - self.build() - self.run_python_os_funcionality() - - def run_python_os_step(self): - """Test that the Python operating system plugin works correctly when single stepping a virtual thread""" - self.build() - self.run_python_os_step() - - def verify_os_thread_registers(self, thread): - frame = thread.GetFrameAtIndex(0) - registers = frame.GetRegisters().GetValueAtIndex(0) - reg_value = thread.GetThreadID() + 1 - for reg in registers: - self.assertTrue( - reg.GetValueAsUnsigned() == reg_value, - "Verify the registers contains the correct value") - reg_value = reg_value + 1 - - def run_python_os_funcionality(self): - """Test that the Python operating system plugin works correctly""" - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) - - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - python_os_plugin_path = os.path.join(self.getSourceDir(), - "operating_system.py") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Set breakpoints inside and outside methods that take pointers to the - # containing struct. - lldbutil.run_break_set_by_source_regexp(self, "// Set breakpoint here") - - # Register our shared libraries for remote targets so they get - # automatically uploaded - arguments = None - environment = None - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - arguments, environment, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # Make sure there are no OS plug-in created thread when we first stop - # at our breakpoint in main - thread = process.GetThreadByID(0x111111111) - self.assertFalse( - thread.IsValid(), - "Make sure there is no thread 0x111111111 before we load the python OS plug-in") - thread = process.GetThreadByID(0x222222222) - self.assertFalse( - thread.IsValid(), - "Make sure there is no thread 0x222222222 before we load the python OS plug-in") - thread = process.GetThreadByID(0x333333333) - self.assertFalse( - thread.IsValid(), - "Make sure there is no thread 0x333333333 before we load the python OS plug-in") - - # Now load the python OS plug-in which should update the thread list and we should have - # OS plug-in created threads with the IDs: 0x111111111, 0x222222222, - # 0x333333333 - command = "settings set target.process.python-os-plugin-path '%s'" % python_os_plugin_path - self.dbg.HandleCommand(command) - - # Verify our OS plug-in threads showed up - thread = process.GetThreadByID(0x111111111) - self.assertTrue( - thread.IsValid(), - "Make sure there is a thread 0x111111111 after we load the python OS plug-in") - self.verify_os_thread_registers(thread) - thread = process.GetThreadByID(0x222222222) - self.assertTrue( - thread.IsValid(), - "Make sure there is a thread 0x222222222 after we load the python OS plug-in") - self.verify_os_thread_registers(thread) - thread = process.GetThreadByID(0x333333333) - self.assertTrue( - thread.IsValid(), - "Make sure there is a thread 0x333333333 after we load the python OS plug-in") - self.verify_os_thread_registers(thread) - - # Now clear the OS plug-in path to make the OS plug-in created threads - # dissappear - self.dbg.HandleCommand( - "settings clear target.process.python-os-plugin-path") - - # Verify the threads are gone after unloading the python OS plug-in - thread = process.GetThreadByID(0x111111111) - self.assertFalse( - thread.IsValid(), - "Make sure there is no thread 0x111111111 after we unload the python OS plug-in") - thread = process.GetThreadByID(0x222222222) - self.assertFalse( - thread.IsValid(), - "Make sure there is no thread 0x222222222 after we unload the python OS plug-in") - thread = process.GetThreadByID(0x333333333) - self.assertFalse( - thread.IsValid(), - "Make sure there is no thread 0x333333333 after we unload the python OS plug-in") - - def run_python_os_step(self): - """Test that the Python operating system plugin works correctly and allows single stepping of a virtual thread that is backed by a real thread""" - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) - - # Create a target by the debugger. - exe = self.getBuildArtifact("a.out") - python_os_plugin_path = os.path.join(self.getSourceDir(), - "operating_system2.py") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Set breakpoints inside and outside methods that take pointers to the - # containing struct. - lldbutil.run_break_set_by_source_regexp(self, "// Set breakpoint here") - - # Register our shared libraries for remote targets so they get - # automatically uploaded - arguments = None - environment = None - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - arguments, environment, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # Make sure there are no OS plug-in created thread when we first stop - # at our breakpoint in main - thread = process.GetThreadByID(0x111111111) - self.assertFalse( - thread.IsValid(), - "Make sure there is no thread 0x111111111 before we load the python OS plug-in") - - # Now load the python OS plug-in which should update the thread list and we should have - # OS plug-in created threads with the IDs: 0x111111111, 0x222222222, - # 0x333333333 - command = "settings set target.process.python-os-plugin-path '%s'" % python_os_plugin_path - self.dbg.HandleCommand(command) - - # Verify our OS plug-in threads showed up - thread = process.GetThreadByID(0x111111111) - self.assertTrue( - thread.IsValid(), - "Make sure there is a thread 0x111111111 after we load the python OS plug-in") - - frame = thread.GetFrameAtIndex(0) - self.assertTrue( - frame.IsValid(), - "Make sure we get a frame from thread 0x111111111") - line_entry = frame.GetLineEntry() - - self.assertTrue( - line_entry.GetFileSpec().GetFilename() == 'main.c', - "Make sure we stopped on line 5 in main.c") - self.assertTrue( - line_entry.GetLine() == 5, - "Make sure we stopped on line 5 in main.c") - - # Now single step thread 0x111111111 and make sure it does what we need - # it to - thread.StepOver() - - frame = thread.GetFrameAtIndex(0) - self.assertTrue( - frame.IsValid(), - "Make sure we get a frame from thread 0x111111111") - line_entry = frame.GetLineEntry() - - self.assertTrue( - line_entry.GetFileSpec().GetFilename() == 'main.c', - "Make sure we stepped from line 5 to line 6 in main.c") - self.assertTrue(line_entry.GetLine() == 6, - "Make sure we stepped from line 5 to line 6 in main.c") diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/main.c b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/main.c deleted file mode 100644 index faa6dd58ecd6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main (int argc, char const *argv[], char const *envp[]) -{ - puts("stop here"); // Set breakpoint here - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py deleted file mode 100644 index 394c24b4a880..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/python - -import lldb -import struct - - -class OperatingSystemPlugIn(object): - """Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class""" - - def __init__(self, process): - '''Initialization needs a valid.SBProcess object. - - This plug-in will get created after a live process is valid and has stopped for the - first time.''' - self.process = None - self.registers = None - self.threads = None - if isinstance(process, lldb.SBProcess) and process.IsValid(): - self.process = process - self.threads = None # Will be an dictionary containing info for each thread - - def get_target(self): - # NOTE: Don't use "lldb.target" when trying to get your target as the "lldb.target" - # tracks the current target in the LLDB command interpreter which isn't the - # correct thing to use for this plug-in. - return self.process.target - - def create_thread(self, tid, context): - if tid == 0x444444444: - thread_info = { - 'tid': tid, - 'name': 'four', - 'queue': 'queue4', - 'state': 'stopped', - 'stop_reason': 'none'} - self.threads.append(thread_info) - return thread_info - return None - - def get_thread_info(self): - if not self.threads: - # The sample dictionary below shows the values that can be returned for a thread - # tid => thread ID (mandatory) - # name => thread name (optional key/value pair) - # queue => thread dispatch queue name (optional key/value pair) - # state => thred state (mandatory, set to 'stopped' for now) - # stop_reason => thread stop reason. (mandatory, usually set to 'none') - # Possible values include: - # 'breakpoint' if the thread is stopped at a breakpoint - # 'none' thread is just stopped because the process is stopped - # 'trace' the thread just single stepped - # The usual value for this while threads are in memory is 'none' - # register_data_addr => the address of the register data in memory (optional key/value pair) - # Specifying this key/value pair for a thread will avoid a call to get_register_data() - # and can be used when your registers are in a thread context structure that is contiguous - # in memory. Don't specify this if your register layout in memory doesn't match the layout - # described by the dictionary returned from a call to the - # get_register_info() method. - self.threads = [{'tid': 0x111111111, - 'name': 'one', - 'queue': 'queue1', - 'state': 'stopped', - 'stop_reason': 'breakpoint'}, - {'tid': 0x222222222, - 'name': 'two', - 'queue': 'queue2', - 'state': 'stopped', - 'stop_reason': 'none'}, - {'tid': 0x333333333, - 'name': 'three', - 'queue': 'queue3', - 'state': 'stopped', - 'stop_reason': 'trace'}] - return self.threads - - def get_register_info(self): - if self.registers is None: - self.registers = dict() - self.registers['sets'] = ['GPR'] - self.registers['registers'] = [ - {'name': 'rax', 'bitsize': 64, 'offset': 0, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 0, 'dwarf': 0}, - {'name': 'rbx', 'bitsize': 64, 'offset': 8, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 3, 'dwarf': 3}, - {'name': 'rcx', 'bitsize': 64, 'offset': 16, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 2, 'dwarf': 2, 'generic': 'arg4', 'alt-name': 'arg4', }, - {'name': 'rdx', 'bitsize': 64, 'offset': 24, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 1, 'dwarf': 1, 'generic': 'arg3', 'alt-name': 'arg3', }, - {'name': 'rdi', 'bitsize': 64, 'offset': 32, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 5, 'dwarf': 5, 'generic': 'arg1', 'alt-name': 'arg1', }, - {'name': 'rsi', 'bitsize': 64, 'offset': 40, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 4, 'dwarf': 4, 'generic': 'arg2', 'alt-name': 'arg2', }, - {'name': 'rbp', 'bitsize': 64, 'offset': 48, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 6, 'dwarf': 6, 'generic': 'fp', 'alt-name': 'fp', }, - {'name': 'rsp', 'bitsize': 64, 'offset': 56, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 7, 'dwarf': 7, 'generic': 'sp', 'alt-name': 'sp', }, - {'name': 'r8', 'bitsize': 64, 'offset': 64, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 8, 'dwarf': 8, 'generic': 'arg5', 'alt-name': 'arg5', }, - {'name': 'r9', 'bitsize': 64, 'offset': 72, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 9, 'dwarf': 9, 'generic': 'arg6', 'alt-name': 'arg6', }, - {'name': 'r10', 'bitsize': 64, 'offset': 80, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 10, 'dwarf': 10}, - {'name': 'r11', 'bitsize': 64, 'offset': 88, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 11, 'dwarf': 11}, - {'name': 'r12', 'bitsize': 64, 'offset': 96, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 12, 'dwarf': 12}, - {'name': 'r13', 'bitsize': 64, 'offset': 104, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 13, 'dwarf': 13}, - {'name': 'r14', 'bitsize': 64, 'offset': 112, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 14, 'dwarf': 14}, - {'name': 'r15', 'bitsize': 64, 'offset': 120, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 15, 'dwarf': 15}, - {'name': 'rip', 'bitsize': 64, 'offset': 128, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 16, 'dwarf': 16, 'generic': 'pc', 'alt-name': 'pc'}, - {'name': 'rflags', 'bitsize': 64, 'offset': 136, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'generic': 'flags', 'alt-name': 'flags'}, - {'name': 'cs', 'bitsize': 64, 'offset': 144, 'encoding': 'uint', 'format': 'hex', 'set': 0}, - {'name': 'fs', 'bitsize': 64, 'offset': 152, 'encoding': 'uint', 'format': 'hex', 'set': 0}, - {'name': 'gs', 'bitsize': 64, 'offset': 160, 'encoding': 'uint', 'format': 'hex', 'set': 0}, - ] - return self.registers - - def get_register_data(self, tid): - return struct.pack( - '21Q', - tid + 1, - tid + 2, - tid + 3, - tid + 4, - tid + 5, - tid + 6, - tid + 7, - tid + 8, - tid + 9, - tid + 10, - tid + 11, - tid + 12, - tid + 13, - tid + 14, - tid + 15, - tid + 16, - tid + 17, - tid + 18, - tid + 19, - tid + 20, - tid + 21) diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py deleted file mode 100644 index 438538ca922e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/python - -import lldb -import struct - - -class OperatingSystemPlugIn(object): - """Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class""" - - def __init__(self, process): - '''Initialization needs a valid.SBProcess object. - - This plug-in will get created after a live process is valid and has stopped for the - first time.''' - self.process = None - self.registers = None - self.threads = None - if isinstance(process, lldb.SBProcess) and process.IsValid(): - self.process = process - self.threads = None # Will be an dictionary containing info for each thread - - def get_target(self): - # NOTE: Don't use "lldb.target" when trying to get your target as the "lldb.target" - # tracks the current target in the LLDB command interpreter which isn't the - # correct thing to use for this plug-in. - return self.process.target - - def create_thread(self, tid, context): - if tid == 0x444444444: - thread_info = { - 'tid': tid, - 'name': 'four', - 'queue': 'queue4', - 'state': 'stopped', - 'stop_reason': 'none'} - self.threads.append(thread_info) - return thread_info - return None - - def get_thread_info(self): - if not self.threads: - # The sample dictionary below shows the values that can be returned for a thread - # tid => thread ID (mandatory) - # name => thread name (optional key/value pair) - # queue => thread dispatch queue name (optional key/value pair) - # state => thred state (mandatory, set to 'stopped' for now) - # stop_reason => thread stop reason. (mandatory, usually set to 'none') - # Possible values include: - # 'breakpoint' if the thread is stopped at a breakpoint - # 'none' thread is just stopped because the process is stopped - # 'trace' the thread just single stepped - # The usual value for this while threads are in memory is 'none' - # register_data_addr => the address of the register data in memory (optional key/value pair) - # Specifying this key/value pair for a thread will avoid a call to get_register_data() - # and can be used when your registers are in a thread context structure that is contiguous - # in memory. Don't specify this if your register layout in memory doesn't match the layout - # described by the dictionary returned from a call to the - # get_register_info() method. - self.threads = [ - {'tid': 0x111111111, 'core': 0} - ] - return self.threads - - def get_register_info(self): - if self.registers is None: - self.registers = dict() - self.registers['sets'] = ['GPR'] - self.registers['registers'] = [ - {'name': 'rax', 'bitsize': 64, 'offset': 0, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 0, 'dwarf': 0}, - {'name': 'rbx', 'bitsize': 64, 'offset': 8, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 3, 'dwarf': 3}, - {'name': 'rcx', 'bitsize': 64, 'offset': 16, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 2, 'dwarf': 2, 'generic': 'arg4', 'alt-name': 'arg4', }, - {'name': 'rdx', 'bitsize': 64, 'offset': 24, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 1, 'dwarf': 1, 'generic': 'arg3', 'alt-name': 'arg3', }, - {'name': 'rdi', 'bitsize': 64, 'offset': 32, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 5, 'dwarf': 5, 'generic': 'arg1', 'alt-name': 'arg1', }, - {'name': 'rsi', 'bitsize': 64, 'offset': 40, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 4, 'dwarf': 4, 'generic': 'arg2', 'alt-name': 'arg2', }, - {'name': 'rbp', 'bitsize': 64, 'offset': 48, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 6, 'dwarf': 6, 'generic': 'fp', 'alt-name': 'fp', }, - {'name': 'rsp', 'bitsize': 64, 'offset': 56, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 7, 'dwarf': 7, 'generic': 'sp', 'alt-name': 'sp', }, - {'name': 'r8', 'bitsize': 64, 'offset': 64, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 8, 'dwarf': 8, 'generic': 'arg5', 'alt-name': 'arg5', }, - {'name': 'r9', 'bitsize': 64, 'offset': 72, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 9, 'dwarf': 9, 'generic': 'arg6', 'alt-name': 'arg6', }, - {'name': 'r10', 'bitsize': 64, 'offset': 80, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 10, 'dwarf': 10}, - {'name': 'r11', 'bitsize': 64, 'offset': 88, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 11, 'dwarf': 11}, - {'name': 'r12', 'bitsize': 64, 'offset': 96, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 12, 'dwarf': 12}, - {'name': 'r13', 'bitsize': 64, 'offset': 104, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 13, 'dwarf': 13}, - {'name': 'r14', 'bitsize': 64, 'offset': 112, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 14, 'dwarf': 14}, - {'name': 'r15', 'bitsize': 64, 'offset': 120, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 15, 'dwarf': 15}, - {'name': 'rip', 'bitsize': 64, 'offset': 128, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 16, 'dwarf': 16, 'generic': 'pc', 'alt-name': 'pc'}, - {'name': 'rflags', 'bitsize': 64, 'offset': 136, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'generic': 'flags', 'alt-name': 'flags'}, - {'name': 'cs', 'bitsize': 64, 'offset': 144, 'encoding': 'uint', 'format': 'hex', 'set': 0}, - {'name': 'fs', 'bitsize': 64, 'offset': 152, 'encoding': 'uint', 'format': 'hex', 'set': 0}, - {'name': 'gs', 'bitsize': 64, 'offset': 160, 'encoding': 'uint', 'format': 'hex', 'set': 0}, - ] - return self.registers - - def get_register_data(self, tid): - return struct.pack( - '21Q', - tid + 1, - tid + 2, - tid + 3, - tid + 4, - tid + 5, - tid + 6, - tid + 7, - tid + 8, - tid + 9, - tid + 10, - tid + 11, - tid + 12, - tid + 13, - tid + 14, - tid + 15, - tid + 16, - tid + 17, - tid + 18, - tid + 19, - tid + 20, - tid + 21) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py deleted file mode 100644 index 2c25ccc253fd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py +++ /dev/null @@ -1,361 +0,0 @@ -""" -Test basics of linux core file debugging. -""" - -from __future__ import print_function - -import shutil -import struct -import os - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LinuxCoreTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - _i386_pid = 32306 - _x86_64_pid = 32259 - _s390x_pid = 1045 - _mips64_n64_pid = 25619 - _mips64_n32_pid = 3670 - _mips_o32_pid = 3532 - _ppc64le_pid = 28147 - - _i386_regions = 4 - _x86_64_regions = 5 - _s390x_regions = 2 - _mips_regions = 5 - _ppc64le_regions = 2 - - def setUp(self): - super(LinuxCoreTestCase, self).setUp() - self._initial_platform = lldb.DBG.GetSelectedPlatform() - - def tearDown(self): - lldb.DBG.SetSelectedPlatform(self._initial_platform) - super(LinuxCoreTestCase, self).tearDown() - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("X86") - def test_i386(self): - """Test that lldb can read the process information from an i386 linux core file.""" - self.do_test("linux-i386", self._i386_pid, self._i386_regions, "a.out") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIfLLVMTargetMissing("Mips") - def test_mips_o32(self): - """Test that lldb can read the process information from an MIPS O32 linux core file.""" - self.do_test("linux-mipsel-gnuabio32", self._mips_o32_pid, - self._mips_regions, "linux-mipsel-gn") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIfLLVMTargetMissing("Mips") - def test_mips_n32(self): - """Test that lldb can read the process information from an MIPS N32 linux core file """ - self.do_test("linux-mips64el-gnuabin32", self._mips64_n32_pid, - self._mips_regions, "linux-mips64el-") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIfLLVMTargetMissing("Mips") - def test_mips_n64(self): - """Test that lldb can read the process information from an MIPS N64 linux core file """ - self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid, - self._mips_regions, "linux-mips64el-") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("PowerPC") - def test_ppc64le(self): - """Test that lldb can read the process information from an ppc64le linux core file.""" - self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions, - "linux-ppc64le.ou") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("X86") - def test_x86_64(self): - """Test that lldb can read the process information from an x86_64 linux core file.""" - self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions, - "a.out") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("SystemZ") - def test_s390x(self): - """Test that lldb can read the process information from an s390x linux core file.""" - self.do_test("linux-s390x", self._s390x_pid, self._s390x_regions, - "a.out") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("X86") - def test_same_pid_running(self): - """Test that we read the information from the core correctly even if we have a running - process with the same PID around""" - exe_file = self.getBuildArtifact("linux-x86_64-pid.out") - core_file = self.getBuildArtifact("linux-x86_64-pid.core") - shutil.copyfile("linux-x86_64.out", exe_file) - shutil.copyfile("linux-x86_64.core", core_file) - with open(core_file, "r+b") as f: - # These are offsets into the NT_PRSTATUS and NT_PRPSINFO structures in the note - # segment of the core file. If you update the file, these offsets may need updating - # as well. (Notes can be viewed with readelf --notes.) - for pid_offset in [0x1c4, 0x320]: - f.seek(pid_offset) - self.assertEqual( - struct.unpack( - "<I", - f.read(4))[0], - self._x86_64_pid) - - # We insert our own pid, and make sure the test still - # works. - f.seek(pid_offset) - f.write(struct.pack("<I", os.getpid())) - self.do_test(self.getBuildArtifact("linux-x86_64-pid"), os.getpid(), - self._x86_64_regions, "a.out") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("X86") - def test_two_cores_same_pid(self): - """Test that we handle the situation if we have two core files with the same PID - around""" - alttarget = self.dbg.CreateTarget("altmain.out") - altprocess = alttarget.LoadCore("altmain.core") - self.assertTrue(altprocess, PROCESS_IS_VALID) - self.assertEqual(altprocess.GetNumThreads(), 1) - self.assertEqual(altprocess.GetProcessID(), self._x86_64_pid) - - altframe = altprocess.GetSelectedThread().GetFrameAtIndex(0) - self.assertEqual(altframe.GetFunctionName(), "_start") - self.assertEqual( - altframe.GetLineEntry().GetLine(), - line_number( - "altmain.c", - "Frame _start")) - - error = lldb.SBError() - F = altprocess.ReadCStringFromMemory( - altframe.FindVariable("F").GetValueAsUnsigned(), 256, error) - self.assertTrue(error.Success()) - self.assertEqual(F, "_start") - - # without destroying this process, run the test which opens another core file with the - # same pid - self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions, - "a.out") - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("X86") - def test_FPR_SSE(self): - # check x86_64 core file - target = self.dbg.CreateTarget(None) - self.assertTrue(target, VALID_TARGET) - process = target.LoadCore("linux-fpr_sse_x86_64.core") - - values = {} - values["fctrl"] = "0x037f" - values["fstat"] = "0x0000" - values["ftag"] = "0x00ff" - values["fop"] = "0x0000" - values["fiseg"] = "0x00000000" - values["fioff"] = "0x0040011e" - values["foseg"] = "0x00000000" - values["fooff"] = "0x00000000" - values["mxcsr"] = "0x00001f80" - values["mxcsrmask"] = "0x0000ffff" - values["st0"] = "{0x99 0xf7 0xcf 0xfb 0x84 0x9a 0x20 0x9a 0xfd 0x3f}" - values["st1"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x3f}" - values["st2"] = "{0xfe 0x8a 0x1b 0xcd 0x4b 0x78 0x9a 0xd4 0x00 0x40}" - values["st3"] = "{0xac 0x79 0xcf 0xd1 0xf7 0x17 0x72 0xb1 0xfe 0x3f}" - values["st4"] = "{0xbc 0xf0 0x17 0x5c 0x29 0x3b 0xaa 0xb8 0xff 0x3f}" - values["st5"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x3f}" - values["st6"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}" - values["st7"] = "{0x35 0xc2 0x68 0x21 0xa2 0xda 0x0f 0xc9 0x00 0x40}" - values["xmm0"] = "{0x29 0x31 0x64 0x46 0x29 0x31 0x64 0x46 0x29 0x31 0x64 0x46 0x29 0x31 0x64 0x46}" - values["xmm1"] = "{0x9c 0xed 0x86 0x64 0x9c 0xed 0x86 0x64 0x9c 0xed 0x86 0x64 0x9c 0xed 0x86 0x64}" - values["xmm2"] = "{0x07 0xc2 0x1f 0xd7 0x07 0xc2 0x1f 0xd7 0x07 0xc2 0x1f 0xd7 0x07 0xc2 0x1f 0xd7}" - values["xmm3"] = "{0xa2 0x20 0x48 0x25 0xa2 0x20 0x48 0x25 0xa2 0x20 0x48 0x25 0xa2 0x20 0x48 0x25}" - values["xmm4"] = "{0xeb 0x5a 0xa8 0xc4 0xeb 0x5a 0xa8 0xc4 0xeb 0x5a 0xa8 0xc4 0xeb 0x5a 0xa8 0xc4}" - values["xmm5"] = "{0x49 0x41 0x20 0x0b 0x49 0x41 0x20 0x0b 0x49 0x41 0x20 0x0b 0x49 0x41 0x20 0x0b}" - values["xmm6"] = "{0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 0x8b 0x4f}" - values["xmm7"] = "{0x13 0xf1 0x30 0xcd 0x13 0xf1 0x30 0xcd 0x13 0xf1 0x30 0xcd 0x13 0xf1 0x30 0xcd}" - - for regname, value in values.iteritems(): - self.expect("register read {}".format(regname), substrs=["{} = {}".format(regname, value)]) - - - # now check i386 core file - target = self.dbg.CreateTarget(None) - self.assertTrue(target, VALID_TARGET) - process = target.LoadCore("linux-fpr_sse_i386.core") - - values["fioff"] = "0x080480cc" - - for regname, value in values.iteritems(): - self.expect("register read {}".format(regname), substrs=["{} = {}".format(regname, value)]) - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - @skipIf(triple='^mips') - @skipIfLLVMTargetMissing("X86") - def test_i386_sysroot(self): - """Test that lldb can find the exe for an i386 linux core file using the sysroot.""" - - # Copy linux-i386.out to tmp_sysroot/home/labath/test/a.out (since it was compiled as - # /home/labath/test/a.out) - tmp_sysroot = os.path.join(self.getBuildDir(), "lldb_i386_mock_sysroot") - executable = os.path.join(tmp_sysroot, "home", "labath", "test", "a.out") - lldbutil.mkdir_p(os.path.dirname(executable)) - shutil.copyfile("linux-i386.out", executable) - - # Set sysroot and load core - self.runCmd("platform select remote-linux --sysroot '%s'" % tmp_sysroot) - target = self.dbg.CreateTarget(None) - self.assertTrue(target, VALID_TARGET) - process = target.LoadCore("linux-i386.core") - - # Check that we found a.out from the sysroot - self.check_all(process, self._i386_pid, self._i386_regions, "a.out") - - self.dbg.DeleteTarget(target) - - def check_memory_regions(self, process, region_count): - region_list = process.GetMemoryRegions() - self.assertEqual(region_list.GetSize(), region_count) - - region = lldb.SBMemoryRegionInfo() - - # Check we have the right number of regions. - self.assertEqual(region_list.GetSize(), region_count) - - # Check that getting a region beyond the last in the list fails. - self.assertFalse( - region_list.GetMemoryRegionAtIndex( - region_count, region)) - - # Check each region is valid. - for i in range(region_list.GetSize()): - # Check we can actually get this region. - self.assertTrue(region_list.GetMemoryRegionAtIndex(i, region)) - - # Every region in the list should be mapped. - self.assertTrue(region.IsMapped()) - - # Test the address at the start of a region returns it's enclosing - # region. - begin_address = region.GetRegionBase() - region_at_begin = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo(begin_address, region_at_begin) - self.assertEqual(region, region_at_begin) - - # Test an address in the middle of a region returns it's enclosing - # region. - middle_address = (region.GetRegionBase() + - region.GetRegionEnd()) / 2 - region_at_middle = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo( - middle_address, region_at_middle) - self.assertEqual(region, region_at_middle) - - # Test the address at the end of a region returns it's enclosing - # region. - end_address = region.GetRegionEnd() - 1 - region_at_end = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo(end_address, region_at_end) - self.assertEqual(region, region_at_end) - - # Check that quering the end address does not return this region but - # the next one. - next_region = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo( - region.GetRegionEnd(), next_region) - self.assertNotEqual(region, next_region) - self.assertEqual( - region.GetRegionEnd(), - next_region.GetRegionBase()) - - # Check that query beyond the last region returns an unmapped region - # that ends at LLDB_INVALID_ADDRESS - last_region = lldb.SBMemoryRegionInfo() - region_list.GetMemoryRegionAtIndex(region_count - 1, last_region) - end_region = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo( - last_region.GetRegionEnd(), end_region) - self.assertFalse(end_region.IsMapped()) - self.assertEqual( - last_region.GetRegionEnd(), - end_region.GetRegionBase()) - self.assertEqual(end_region.GetRegionEnd(), lldb.LLDB_INVALID_ADDRESS) - - def check_state(self, process): - with open(os.devnull) as devnul: - # sanitize test output - self.dbg.SetOutputFileHandle(devnul, False) - self.dbg.SetErrorFileHandle(devnul, False) - - self.assertTrue(process.is_stopped) - - # Process.Continue - error = process.Continue() - self.assertFalse(error.Success()) - self.assertTrue(process.is_stopped) - - # Thread.StepOut - thread = process.GetSelectedThread() - thread.StepOut() - self.assertTrue(process.is_stopped) - - # command line - self.dbg.HandleCommand('s') - self.assertTrue(process.is_stopped) - self.dbg.HandleCommand('c') - self.assertTrue(process.is_stopped) - - # restore file handles - self.dbg.SetOutputFileHandle(None, False) - self.dbg.SetErrorFileHandle(None, False) - - def check_stack(self, process, pid, thread_name): - thread = process.GetSelectedThread() - self.assertTrue(thread) - self.assertEqual(thread.GetThreadID(), pid) - self.assertEqual(thread.GetName(), thread_name) - backtrace = ["bar", "foo", "_start"] - self.assertEqual(thread.GetNumFrames(), len(backtrace)) - for i in range(len(backtrace)): - frame = thread.GetFrameAtIndex(i) - self.assertTrue(frame) - self.assertEqual(frame.GetFunctionName(), backtrace[i]) - self.assertEqual(frame.GetLineEntry().GetLine(), - line_number("main.c", "Frame " + backtrace[i])) - self.assertEqual( - frame.FindVariable("F").GetValueAsUnsigned(), ord( - backtrace[i][0])) - - def check_all(self, process, pid, region_count, thread_name): - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetNumThreads(), 1) - self.assertEqual(process.GetProcessID(), pid) - - self.check_state(process) - - self.check_stack(process, pid, thread_name) - - self.check_memory_regions(process, region_count) - - def do_test(self, filename, pid, region_count, thread_name): - target = self.dbg.CreateTarget(filename + ".out") - process = target.LoadCore(filename + ".core") - - self.check_all(process, pid, region_count, thread_name) - - self.dbg.DeleteTarget(target) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.c b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.c deleted file mode 100644 index da49a00996e1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.c +++ /dev/null @@ -1,6 +0,0 @@ -void _start(void) -{ - const char *F = "_start"; - char *boom = (char *)0; - *boom = 47; // Frame _start -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.core Binary files differdeleted file mode 100644 index 423413070c7a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.out Binary files differdeleted file mode 100755 index 2fddf3e8f803..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/fpr_sse.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/fpr_sse.cpp deleted file mode 100644 index e6826fc7a097..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/fpr_sse.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// fpr_sse_x86_64.core was generated with: -// ./make-core.sh fpr_sse.cpp -// -// fpr_sse_i386.core was generated with: -// export CFLAGS=-m32 -// ./make-core.sh fpr_sse.cpp - -void _start(void) { - __asm__("fldpi;" - "fldz;" - "fld1;" - "fldl2e;" - "fldln2;" - "fldl2t;" - "fld1;" - "fldlg2;"); - - unsigned int values[8] = { - 0x46643129, 0x6486ed9c, 0xd71fc207, 0x254820a2, - 0xc4a85aeb, 0x0b204149, 0x4f8bf1f8, 0xcd30f113, - }; - - __asm__("vbroadcastss %0, %%xmm0;" - "vbroadcastss %1, %%xmm1;" - "vbroadcastss %2, %%xmm2;" - "vbroadcastss %3, %%xmm3;" - "vbroadcastss %4, %%xmm4;" - "vbroadcastss %5, %%xmm5;" - "vbroadcastss %6, %%xmm6;" - "vbroadcastss %7, %%xmm7;" - - ::"m"(values[0]), - "m"(values[1]), "m"(values[2]), "m"(values[3]), "m"(values[4]), - "m"(values[5]), "m"(values[6]), "m"(values[7])); - - volatile int *a = 0; - *a = 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py deleted file mode 100644 index 5a11a52e93a6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Test signal reporting when debugging with linux core files. -""" - -from __future__ import print_function - -import shutil -import struct - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class GCoreTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - _initial_platform = lldb.DBG.GetSelectedPlatform() - - _i386_pid = 5586 - _x86_64_pid = 5669 - - @skipIf(oslist=['windows']) - @skipIf(triple='^mips') - def test_i386(self): - """Test that lldb can read the process information from an i386 linux core file.""" - self.do_test("linux-i386", self._i386_pid) - - @skipIf(oslist=['windows']) - @skipIf(triple='^mips') - def test_x86_64(self): - """Test that lldb can read the process information from an x86_64 linux core file.""" - self.do_test("linux-x86_64", self._x86_64_pid) - - def do_test(self, filename, pid): - target = self.dbg.CreateTarget("") - process = target.LoadCore(filename + ".core") - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetNumThreads(), 3) - self.assertEqual(process.GetProcessID(), pid) - - for thread in process: - reason = thread.GetStopReason() - self.assertEqual(reason, lldb.eStopReasonSignal) - signal = thread.GetStopReasonDataAtIndex(1) - # Check we got signal 19 (SIGSTOP) - self.assertEqual(signal, 19) - - self.dbg.DeleteTarget(target) - lldb.DBG.SetSelectedPlatform(self._initial_platform) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-i386.core Binary files differdeleted file mode 100644 index 8f9ac87c19f2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-i386.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-x86_64.core Binary files differdeleted file mode 100644 index ef673e45b219..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-x86_64.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp deleted file mode 100644 index f53ce2f35924..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test verifies the correct handling of child thread exits. - -#include "pseudo_barrier.h" -#include <thread> -#include <csignal> - -pseudo_barrier_t g_barrier1; -pseudo_barrier_t g_barrier2; - -void * -thread1 () -{ - // Synchronize with the main thread. - pseudo_barrier_wait(g_barrier1); - - // Synchronize with the main thread and thread2. - pseudo_barrier_wait(g_barrier2); - - // Return - return NULL; -} - -void * -thread2 () -{ - - // Synchronize with thread1 and the main thread. - pseudo_barrier_wait(g_barrier2); // Should not reach here. - - // Return - return NULL; -} - -int main () -{ - - pseudo_barrier_init(g_barrier1, 2); - pseudo_barrier_init(g_barrier2, 3); - - // Create a thread. - std::thread thread_1(thread1); - - // Wait for thread1 to start. - pseudo_barrier_wait(g_barrier1); - - // Wait for thread1 to start. - std::thread thread_2(thread2); - - // Thread 2 is waiting for another thread to reach the barrier. - // This should have for ever. (So we can run gcore against this process.) - thread_2.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.mk b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.mk deleted file mode 100755 index ff874a21f760..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.mk +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/make-core.sh b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/make-core.sh deleted file mode 100755 index b6979c7790de..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/make-core.sh +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh - -linux_check_ptrace_scope() -{ - if grep -q '1' </proc/sys/kernel/yama/ptrace_scope; then - cat <<EOF -Your system prevents the use of PTRACE to attach to non-child processes. The core file -cannot be generated. Please reset /proc/sys/kernel/yama/ptrace_scope to 0 (requires root -privileges) to enable core generation via gcore. -EOF - exit 1 - fi -} - -set -e -x - -OS=$(uname -s) -if [ "$OS" = Linux ]; then - linux_check_ptrace_scope -fi - -rm -f a.out -make -f main.mk - -cat <<EOF -Executable file is in a.out. -Core file will be saved as core.<pid>. -EOF - -stack_size=`ulimit -s` - -# Decrease stack size to 16k => smaller core files. -# gcore won't run with the smaller stack -ulimit -Ss 16 - -core_dump_filter=`cat /proc/self/coredump_filter` -echo 0 > /proc/self/coredump_filter - -./a.out & - -pid=$! - -echo $core_dump_filter > /proc/self/coredump_filter - -# Reset stack size as so there's enough space to run gcore. -ulimit -s $stack_size - -echo "Sleeping for 5 seconds to wait for $pid" - -sleep 5 -echo "Taking core from process $pid" - -gcore -o core $pid - -echo "Killing process $pid" -kill -9 $pid diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_i386.core Binary files differdeleted file mode 100644 index b0fdaf67ca4f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_i386.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_x86_64.core Binary files differdeleted file mode 100644 index 5fb39ee115b2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_x86_64.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.core Binary files differdeleted file mode 100644 index f8deff474d1f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.out Binary files differdeleted file mode 100755 index 3cdd4eeca103..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core Binary files differdeleted file mode 100644 index 272c627cd244..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out Binary files differdeleted file mode 100755 index a230aa4251ae..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core Binary files differdeleted file mode 100644 index 19c8100bdb11..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out Binary files differdeleted file mode 100755 index d1293a71a856..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core Binary files differdeleted file mode 100644 index 2ad41395a2e0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out Binary files differdeleted file mode 100755 index dc809c8da482..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core Binary files differdeleted file mode 100644 index c0ed578bd796..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out Binary files differdeleted file mode 100755 index 05c69fd291b7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.core Binary files differdeleted file mode 100644 index b97fc43e967d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.out Binary files differdeleted file mode 100755 index 640fbdc257d9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.core Binary files differdeleted file mode 100644 index e2fa69e4558e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.out Binary files differdeleted file mode 100755 index 842402fd519d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/main.c b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/main.c deleted file mode 100644 index f5bde4171ca5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/main.c +++ /dev/null @@ -1,17 +0,0 @@ -static void bar(char *boom) -{ - char F = 'b'; - *boom = 47; // Frame bar -} - -static void foo(char *boom, void (*boomer)(char *)) -{ - char F = 'f'; - boomer(boom); // Frame foo -} - -void _start(void) -{ - char F = '_'; - foo(0, bar); // Frame _start -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/make-core.sh b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/make-core.sh deleted file mode 100755 index 9dd83f19c76e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/make-core.sh +++ /dev/null @@ -1,61 +0,0 @@ -#! /bin/sh - -linux_check_core_pattern() -{ - if grep -q '^|' </proc/sys/kernel/core_pattern; then - cat <<EOF -Your system uses a crash report tool ($(cat /proc/sys/kernel/core_pattern)). Core files -will not be generated. Please reset /proc/sys/kernel/core_pattern (requires root -privileges) to enable core generation. -EOF - exit 1 - fi -} - -OS=$(uname -s) -case "$OS" in -FreeBSD) - core_pattern=$(sysctl -n kern.corefile) - ;; -Linux) - core_pattern=$(cat /proc/sys/kernel/core_pattern) - ;; -*) - echo "OS $OS not supported" >&2 - exit 1 - ;; -esac - -set -e -x - -file=$1 -if [ -z "$file" ]; then - cat <<EOF -Please supply the main source file as the first argument. -EOF - exit 1 -fi - -if [ "$OS" = Linux ]; then - linux_check_core_pattern -fi - -ulimit -c 1000 -real_limit=$(ulimit -c) -if [ $real_limit -lt 100 ]; then - cat <<EOF -Unable to increase the core file limit. Core file may be truncated! -To fix this, increase HARD core file limit (ulimit -H -c 1000). This may require root -privileges. -EOF -fi - -${CC:-cc} -nostdlib -static -g $CFLAGS "$file" -o a.out - -cat <<EOF -Executable file is in a.out. -Core file will be saved according to pattern $core_pattern. -EOF - -ulimit -s 8 # Decrease stack size to 8k => smaller core files. -exec ./a.out diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py deleted file mode 100644 index 7cc3c0775ced..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Test signal reporting when debugging with linux core files. -""" - -from __future__ import print_function - -import shutil -import struct - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LinuxCoreThreadsTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - _initial_platform = lldb.DBG.GetSelectedPlatform() - - _i386_pid = 5193 - _x86_64_pid = 5222 - - # Thread id for the failing thread. - _i386_tid = 5195 - _x86_64_tid = 5250 - - @skipIf(oslist=['windows']) - @skipIf(triple='^mips') - def test_i386(self): - """Test that lldb can read the process information from an i386 linux core file.""" - self.do_test("linux-i386", self._i386_pid, self._i386_tid) - - @skipIf(oslist=['windows']) - @skipIf(triple='^mips') - def test_x86_64(self): - """Test that lldb can read the process information from an x86_64 linux core file.""" - self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_tid) - - def do_test(self, filename, pid, tid): - target = self.dbg.CreateTarget("") - process = target.LoadCore(filename + ".core") - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetNumThreads(), 3) - self.assertEqual(process.GetProcessID(), pid) - - for thread in process: - reason = thread.GetStopReason() - if( thread.GetThreadID() == tid ): - self.assertEqual(reason, lldb.eStopReasonSignal) - signal = thread.GetStopReasonDataAtIndex(1) - # Check we got signal 4 (SIGILL) - self.assertEqual(signal, 4) - else: - signal = thread.GetStopReasonDataAtIndex(1) - # Check we got no signal on the other threads - self.assertEqual(signal, 0) - - self.dbg.DeleteTarget(target) - lldb.DBG.SetSelectedPlatform(self._initial_platform) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-i386.core Binary files differdeleted file mode 100644 index 86c6fb8c5ac3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-i386.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-x86_64.core Binary files differdeleted file mode 100644 index fc27e5810ee5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-x86_64.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp deleted file mode 100644 index 7e09662edb2d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test verifies the correct handling of child thread exits. - -#include "pseudo_barrier.h" -#include <thread> -#include <csignal> - -pseudo_barrier_t g_barrier1; -pseudo_barrier_t g_barrier2; - -void * -thread1 () -{ - // Synchronize with the main thread. - pseudo_barrier_wait(g_barrier1); - - // Synchronize with the main thread and thread2. - pseudo_barrier_wait(g_barrier2); - - // Return - return NULL; // Should not reach here. (thread2 should raise SIGILL) -} - -void * -thread2 () -{ - raise(SIGILL); // Raise SIGILL - - // Synchronize with thread1 and the main thread. - pseudo_barrier_wait(g_barrier2); // Should not reach here. - - // Return - return NULL; -} - -int main () -{ - pseudo_barrier_init(g_barrier1, 2); - pseudo_barrier_init(g_barrier2, 3); - - // Create a thread. - std::thread thread_1(thread1); - - // Wait for thread1 to start. - pseudo_barrier_wait(g_barrier1); - - // Create another thread. - std::thread thread_2(thread2); - - // Wait for thread2 to start. - // Second thread should crash but first thread and main thread may reach here. - pseudo_barrier_wait(g_barrier2); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.mk b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.mk deleted file mode 100755 index ff874a21f760..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.mk +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/make-core.sh b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/make-core.sh deleted file mode 100755 index ea263c86ea46..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/make-core.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh - -linux_check_core_pattern() -{ - if grep -q '^|' </proc/sys/kernel/core_pattern; then - cat <<EOF -Your system uses a crash report tool ($(cat /proc/sys/kernel/core_pattern)). Core files -will not be generated. Please reset /proc/sys/kernel/core_pattern (requires root -privileges) to enable core generation. -EOF - exit 1 - fi -} - -OS=$(uname -s) -case "$OS" in -FreeBSD) - core_pattern=$(sysctl -n kern.corefile) - ;; -Linux) - core_pattern=$(cat /proc/sys/kernel/core_pattern) - ;; -*) - echo "OS $OS not supported" >&2 - exit 1 - ;; -esac - -set -e -x - -if [ "$OS" = Linux ]; then - linux_check_core_pattern -fi - -ulimit -c 1000 -real_limit=$(ulimit -c) -if [ $real_limit -lt 100 ]; then - cat <<EOF -Unable to increase the core file limit. Core file may be truncated! -To fix this, increase HARD core file limit (ulimit -H -c 1000). This may require root -privileges. -EOF -fi - -rm -f a.out -make -f main.mk - -cat <<EOF -Executable file is in a.out. -Core file will be saved according to pattern $core_pattern. -EOF - -# Save stack size and core_dump_filter -stack_size=`ulimit -s` -ulimit -Ss 32 # Decrease stack size to 32k => smaller core files. - -core_dump_filter=`cat /proc/self/coredump_filter` -echo 0 > /proc/self/coredump_filter - -exec ./a.out - -# Reset stack size and core_dump_filter -echo core_dump_filter > /proc/self/coredump_filter -ulimit -s $stack_size diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py deleted file mode 100644 index a299a4308bc8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Test basics of mach core file debugging. -""" - -from __future__ import print_function - -import shutil -import struct - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class MachCoreTestCase(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - super(MachCoreTestCase, self).setUp() - self._initial_platform = lldb.DBG.GetSelectedPlatform() - - def tearDown(self): - lldb.DBG.SetSelectedPlatform(self._initial_platform) - super(MachCoreTestCase, self).tearDown() - - @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) - def test_selected_thread(self): - """Test that the right thread is selected after a core is loaded.""" - # Create core form YAML. - self.yaml2obj("test.core.yaml", self.getBuildArtifact("test.core")) - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) - - # Create a target by the debugger. - target = self.dbg.CreateTarget("") - - # Load OS plugin. - python_os_plugin_path = os.path.join(self.getSourceDir(), - 'operating_system.py') - command = "settings set target.process.python-os-plugin-path '{}'".format( - python_os_plugin_path) - self.dbg.HandleCommand(command) - - # Load core. - process = target.LoadCore(self.getBuildArtifact("test.core")) - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetNumThreads(), 3) - - # Verify our OS plug-in threads showed up - thread = process.GetThreadByID(0x111111111) - self.assertTrue(thread.IsValid( - ), "Make sure there is a thread 0x111111111 after we load the python OS plug-in" - ) - thread = process.GetThreadByID(0x222222222) - self.assertTrue(thread.IsValid( - ), "Make sure there is a thread 0x222222222 after we load the python OS plug-in" - ) - thread = process.GetThreadByID(0x333333333) - self.assertTrue(thread.IsValid( - ), "Make sure there is a thread 0x333333333 after we load the python OS plug-in" - ) - - # Verify that the correct thread is selected - thread = process.GetSelectedThread() - self.assertEqual(thread.GetThreadID(), 0x333333333) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py b/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py deleted file mode 100644 index de6c3b7dd56f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py +++ /dev/null @@ -1,45 +0,0 @@ -import lldb -import struct - - -class OperatingSystemPlugIn(object): - """Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class""" - - def __init__(self, process): - '''Initialization needs a valid.SBProcess object. - - This plug-in will get created after a live process is valid and has stopped for the first time. - ''' - self.process = None - self.registers = None - self.threads = None - if isinstance(process, lldb.SBProcess) and process.IsValid(): - self.process = process - self.threads = None # Will be an dictionary containing info for each thread - - def get_target(self): - return self.process.target - - def get_thread_info(self): - if not self.threads: - self.threads = [{ - 'tid': 0x111111111, - 'name': 'one', - 'queue': 'queue1', - 'state': 'stopped', - 'stop_reason': 'none' - }, { - 'tid': 0x222222222, - 'name': 'two', - 'queue': 'queue2', - 'state': 'stopped', - 'stop_reason': 'none' - }, { - 'tid': 0x333333333, - 'name': 'three', - 'queue': 'queue3', - 'state': 'stopped', - 'stop_reason': 'sigstop', - 'core': 0 - }] - return self.threads diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml b/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml deleted file mode 100644 index 84ce54e45e1f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml +++ /dev/null @@ -1,853 +0,0 @@ ---- !mach-o -FileHeader: - magic: 0xFEEDFACF - cputype: 0x01000007 - cpusubtype: 0x00000003 - filetype: 0x00000004 - ncmds: 59 - sizeofcmds: 4384 - flags: 0x00000000 - reserved: 0x00000000 -LoadCommands: - - cmd: LC_THREAD - cmdsize: 208 - PayloadBytes: - - 0x04 - - 0x00 - - 0x00 - - 0x00 - - 0x2A - - 0x00 - - 0x00 - - 0x00 - - 0x01 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x80 - - 0xF7 - - 0xBF - - 0xEF - - 0xFE - - 0x7F - - 0x00 - - 0x00 - - 0x20 - - 0xF6 - - 0xBF - - 0xEF - - 0xFE - - 0x7F - - 0x00 - - 0x00 - - 0x01 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x10 - - 0xF6 - - 0xBF - - 0xEF - - 0xFE - - 0x7F - - 0x00 - - 0x00 - - 0xF0 - - 0xF5 - - 0xBF - - 0xEF - - 0xFE - - 0x7F - - 0x00 - - 0x00 - - 0xF0 - - 0xF5 - - 0xBF - - 0xEF - - 0xFE - - 0x7F - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0xFF - - 0xFF - - 0xFF - - 0xFF - - 0xC8 - - 0xB0 - - 0x70 - - 0xA7 - - 0xFF - - 0x7F - - 0x00 - - 0x00 - - 0xD0 - - 0xB0 - - 0x70 - - 0xA7 - - 0xFF - - 0x7F - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0xA0 - - 0x0F - - 0x00 - - 0x00 - - 0x01 - - 0x00 - - 0x00 - - 0x00 - - 0x46 - - 0x02 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x2B - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x06 - - 0x00 - - 0x00 - - 0x00 - - 0x04 - - 0x00 - - 0x00 - - 0x00 - - 0x03 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x00 - - 0x10 - - 0x00 - - 0x02 - - 0xA7 - - 0xFF - - 0x7F - - 0x00 - - 0x00 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4294967296 - vmsize: 4096 - fileoff: 8192 - filesize: 4096 - maxprot: 5 - initprot: 5 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4294971392 - vmsize: 4096 - fileoff: 12288 - filesize: 4096 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4294975488 - vmsize: 307200 - fileoff: 16384 - filesize: 307200 - maxprot: 5 - initprot: 5 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295282688 - vmsize: 12288 - fileoff: 323584 - filesize: 12288 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295294976 - vmsize: 217088 - fileoff: 335872 - filesize: 217088 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295512064 - vmsize: 110592 - fileoff: 552960 - filesize: 110592 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295622656 - vmsize: 8192 - fileoff: 663552 - filesize: 8192 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295630848 - vmsize: 8192 - fileoff: 671744 - filesize: 8192 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295639040 - vmsize: 4096 - fileoff: 679936 - filesize: 4096 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295643136 - vmsize: 4096 - fileoff: 684032 - filesize: 4096 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295651328 - vmsize: 24576 - fileoff: 688128 - filesize: 24576 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295684096 - vmsize: 24576 - fileoff: 712704 - filesize: 24576 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295712768 - vmsize: 4096 - fileoff: 737280 - filesize: 4096 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4295716864 - vmsize: 8192 - fileoff: 741376 - filesize: 8192 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4296015872 - vmsize: 1048576 - fileoff: 749568 - filesize: 1048576 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4297064448 - vmsize: 1048576 - fileoff: 1798144 - filesize: 1048576 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4298113024 - vmsize: 1048576 - fileoff: 2846720 - filesize: 1048576 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 4303355904 - vmsize: 8388608 - fileoff: 3895296 - filesize: 8388608 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140732912369664 - vmsize: 8388608 - fileoff: 12283904 - filesize: 8388608 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140734252867584 - vmsize: 811999232 - fileoff: 20672512 - filesize: 811999232 - maxprot: 5 - initprot: 5 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735863480320 - vmsize: 20553728 - fileoff: 832671744 - filesize: 20553728 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735884034048 - vmsize: 2097152 - fileoff: 853225472 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735886131200 - vmsize: 2097152 - fileoff: 855322624 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735888228352 - vmsize: 2097152 - fileoff: 857419776 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735890325504 - vmsize: 2097152 - fileoff: 859516928 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735892422656 - vmsize: 2097152 - fileoff: 861614080 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735894519808 - vmsize: 2097152 - fileoff: 863711232 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735896616960 - vmsize: 2097152 - fileoff: 865808384 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735898714112 - vmsize: 2097152 - fileoff: 867905536 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735900811264 - vmsize: 2097152 - fileoff: 870002688 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735902908416 - vmsize: 10485760 - fileoff: 872099840 - filesize: 10485760 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735913394176 - vmsize: 4194304 - fileoff: 882585600 - filesize: 4194304 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735917588480 - vmsize: 2097152 - fileoff: 886779904 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735919685632 - vmsize: 2097152 - fileoff: 888877056 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735921782784 - vmsize: 4194304 - fileoff: 890974208 - filesize: 4194304 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735925977088 - vmsize: 4194304 - fileoff: 895168512 - filesize: 4194304 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735930171392 - vmsize: 6291456 - fileoff: 899362816 - filesize: 6291456 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735936462848 - vmsize: 2097152 - fileoff: 905654272 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735938560000 - vmsize: 2097152 - fileoff: 907751424 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735940657152 - vmsize: 2097152 - fileoff: 909848576 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735942754304 - vmsize: 2097152 - fileoff: 911945728 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735944851456 - vmsize: 6291456 - fileoff: 914042880 - filesize: 6291456 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735951142912 - vmsize: 2097152 - fileoff: 920334336 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735953240064 - vmsize: 4194304 - fileoff: 922431488 - filesize: 4194304 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735957434368 - vmsize: 2097152 - fileoff: 926625792 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735959531520 - vmsize: 2097152 - fileoff: 928722944 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735961628672 - vmsize: 20971520 - fileoff: 930820096 - filesize: 20971520 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735982600192 - vmsize: 6291456 - fileoff: 951791616 - filesize: 6291456 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735988891648 - vmsize: 2097152 - fileoff: 958083072 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735990988800 - vmsize: 2097152 - fileoff: 960180224 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735993085952 - vmsize: 2097152 - fileoff: 962277376 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735995183104 - vmsize: 2097152 - fileoff: 964374528 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735997280256 - vmsize: 2097152 - fileoff: 966471680 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140735999377408 - vmsize: 2097152 - fileoff: 968568832 - filesize: 2097152 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140736001474560 - vmsize: 1302528 - fileoff: 970665984 - filesize: 1302528 - maxprot: 3 - initprot: 3 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140736937222144 - vmsize: 219267072 - fileoff: 971968512 - filesize: 219267072 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140737486258176 - vmsize: 4096 - fileoff: 1191235584 - filesize: 4096 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: '' - vmaddr: 140737487028224 - vmsize: 4096 - fileoff: 1191239680 - filesize: 4096 - maxprot: 5 - initprot: 5 - nsects: 0 - flags: 0 -... diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py deleted file mode 100644 index 46398e39a0e0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ /dev/null @@ -1,512 +0,0 @@ -""" -Test basics of Minidump debugging. -""" - -from __future__ import print_function -from six import iteritems - -import shutil - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class MiniDumpNewTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - _linux_x86_64_pid = 29917 - _linux_x86_64_not_crashed_pid = 29939 - _linux_x86_64_not_crashed_pid_offset = 0xD967 - - def setUp(self): - super(MiniDumpNewTestCase, self).setUp() - self._initial_platform = lldb.DBG.GetSelectedPlatform() - - def tearDown(self): - lldb.DBG.SetSelectedPlatform(self._initial_platform) - super(MiniDumpNewTestCase, self).tearDown() - - def check_state(self): - with open(os.devnull) as devnul: - # sanitize test output - self.dbg.SetOutputFileHandle(devnul, False) - self.dbg.SetErrorFileHandle(devnul, False) - - self.assertTrue(self.process.is_stopped) - - # Process.Continue - error = self.process.Continue() - self.assertFalse(error.Success()) - self.assertTrue(self.process.is_stopped) - - # Thread.StepOut - thread = self.process.GetSelectedThread() - thread.StepOut() - self.assertTrue(self.process.is_stopped) - - # command line - self.dbg.HandleCommand('s') - self.assertTrue(self.process.is_stopped) - self.dbg.HandleCommand('c') - self.assertTrue(self.process.is_stopped) - - # restore file handles - self.dbg.SetOutputFileHandle(None, False) - self.dbg.SetErrorFileHandle(None, False) - - def test_loadcore_error_status(self): - """Test the SBTarget.LoadCore(core, error) overload.""" - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - error = lldb.SBError() - self.process = self.target.LoadCore("linux-x86_64.dmp", error) - self.assertTrue(self.process, PROCESS_IS_VALID) - self.assertTrue(error.Success()) - - def test_loadcore_error_status_failure(self): - """Test the SBTarget.LoadCore(core, error) overload.""" - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - error = lldb.SBError() - self.process = self.target.LoadCore("non-existent.dmp", error) - self.assertFalse(self.process, PROCESS_IS_VALID) - self.assertTrue(error.Fail()) - - def test_process_info_in_minidump(self): - """Test that lldb can read the process information from the Minidump.""" - # target create -c linux-x86_64.dmp - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("linux-x86_64.dmp") - self.assertTrue(self.process, PROCESS_IS_VALID) - self.assertEqual(self.process.GetNumThreads(), 1) - self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid) - self.check_state() - - def test_memory_region_name(self): - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("regions-linux-map.dmp") - result = lldb.SBCommandReturnObject() - addr_region_name_pairs = [ - ("0x400d9000", "/system/bin/app_process"), - ("0x400db000", "/system/bin/app_process"), - ("0x400dd000", "/system/bin/linker"), - ("0x400ed000", "/system/bin/linker"), - ("0x400ee000", "/system/bin/linker"), - ("0x400fb000", "/system/lib/liblog.so"), - ("0x400fc000", "/system/lib/liblog.so"), - ("0x400fd000", "/system/lib/liblog.so"), - ("0x400ff000", "/system/lib/liblog.so"), - ("0x40100000", "/system/lib/liblog.so"), - ("0x40101000", "/system/lib/libc.so"), - ("0x40122000", "/system/lib/libc.so"), - ("0x40123000", "/system/lib/libc.so"), - ("0x40167000", "/system/lib/libc.so"), - ("0x40169000", "/system/lib/libc.so"), - ] - ci = self.dbg.GetCommandInterpreter() - for (addr, region_name) in addr_region_name_pairs: - command = 'memory region ' + addr - ci.HandleCommand(command, result, False) - message = 'Ensure memory "%s" shows up in output for "%s"' % ( - region_name, command) - self.assertTrue(region_name in result.GetOutput(), message) - - def test_modules_in_mini_dump(self): - """Test that lldb can read the list of modules from the minidump.""" - # target create -c linux-x86_64.dmp - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("linux-x86_64.dmp") - self.assertTrue(self.process, PROCESS_IS_VALID) - expected_modules = [ - { - 'filename' : 'linux-x86_64', - 'uuid' : 'E35C283B-C327-C287-62DB-788BF5A4078B-E2351448', - }, - { - 'filename' : 'libm-2.19.so', - 'uuid' : 'D144258E-6149-00B2-55A3-1F3FD2283A87-8670D5BC', - }, - { - 'filename' : 'libgcc_s.so.1', - 'uuid' : '36311B44-5771-0AE5-578C-4BF00791DED7-359DBB92', - }, - { - 'filename' : 'libstdc++.so.6.0.19', - 'uuid' : '76190E92-2AF7-457D-078F-75C9B15FA184-E83EB506', - }, - { - 'filename' : 'libc-2.19.so', - 'uuid' : 'CF699A15-CAAE-64F5-0311-FC4655B86DC3-9A479789', - }, - { - 'filename' : 'libpthread-2.19.so', - 'uuid' : '31E9F21A-E8C1-0396-171F-1E13DA157809-86FA696C', - }, - { - 'filename' : 'libbreakpad.so', - 'uuid' : '784FD549-332D-826E-D23F-18C17C6F320A', - }, - { - 'filename' : 'ld-2.19.so', - 'uuid' : 'D0F53790-4076-D73F-29E4-A37341F8A449-E2EF6CD0', - }, - { - 'filename' : 'linux-gate.so', - 'uuid' : '4EAD28F8-88EF-3520-872B-73C6F2FE7306-C41AF22F', - }, - ] - self.assertEqual(self.target.GetNumModules(), len(expected_modules)) - for module, expected in zip(self.target.modules, expected_modules): - self.assertTrue(module.IsValid()) - self.assertEqual(module.file.basename, expected['filename']) - self.assertEqual(module.GetUUIDString(), expected['uuid']) - - def test_thread_info_in_minidump(self): - """Test that lldb can read the thread information from the Minidump.""" - # target create -c linux-x86_64.dmp - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("linux-x86_64.dmp") - self.check_state() - # This process crashed due to a segmentation fault in its - # one and only thread. - self.assertEqual(self.process.GetNumThreads(), 1) - thread = self.process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal) - stop_description = thread.GetStopDescription(256) - self.assertTrue("SIGSEGV" in stop_description) - - def test_stack_info_in_minidump(self): - """Test that we can see a trivial stack in a breakpad-generated Minidump.""" - # target create linux-x86_64 -c linux-x86_64.dmp - self.dbg.CreateTarget("linux-x86_64") - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("linux-x86_64.dmp") - self.check_state() - self.assertEqual(self.process.GetNumThreads(), 1) - self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid) - thread = self.process.GetThreadAtIndex(0) - # frame #0: linux-x86_64`crash() - # frame #1: linux-x86_64`_start - self.assertEqual(thread.GetNumFrames(), 2) - frame = thread.GetFrameAtIndex(0) - self.assertTrue(frame.IsValid()) - self.assertTrue(frame.GetModule().IsValid()) - pc = frame.GetPC() - eip = frame.FindRegister("pc") - self.assertTrue(eip.IsValid()) - self.assertEqual(pc, eip.GetValueAsUnsigned()) - - def test_snapshot_minidump(self): - """Test that if we load a snapshot minidump file (meaning the process - did not crash) there is no stop reason.""" - # target create -c linux-x86_64_not_crashed.dmp - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("linux-x86_64_not_crashed.dmp") - self.check_state() - self.assertEqual(self.process.GetNumThreads(), 1) - thread = self.process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone) - stop_description = thread.GetStopDescription(256) - self.assertEqual(stop_description, "") - - def check_register_unsigned(self, set, name, expected): - reg_value = set.GetChildMemberWithName(name) - self.assertTrue(reg_value.IsValid(), - 'Verify we have a register named "%s"' % (name)) - self.assertEqual(reg_value.GetValueAsUnsigned(), expected, - 'Verify "%s" == %i' % (name, expected)) - - def check_register_string_value(self, set, name, expected, format): - reg_value = set.GetChildMemberWithName(name) - self.assertTrue(reg_value.IsValid(), - 'Verify we have a register named "%s"' % (name)) - if format is not None: - reg_value.SetFormat(format) - self.assertEqual(reg_value.GetValue(), expected, - 'Verify "%s" has string value "%s"' % (name, - expected)) - - def test_arm64_registers(self): - """Test ARM64 registers from a breakpad created minidump.""" - # target create -c arm64-macos.dmp - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("arm64-macos.dmp") - self.check_state() - self.assertEqual(self.process.GetNumThreads(), 1) - thread = self.process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone) - stop_description = thread.GetStopDescription(256) - self.assertEqual(stop_description, "") - registers = thread.GetFrameAtIndex(0).GetRegisters() - # Verify the GPR registers are all correct - # Verify x0 - x31 register values - gpr = registers.GetValueAtIndex(0) - for i in range(32): - v = i+1 | i+2 << 32 | i+3 << 48 - w = i+1 - self.check_register_unsigned(gpr, 'x%i' % (i), v) - self.check_register_unsigned(gpr, 'w%i' % (i), w) - # Verify arg1 - arg8 register values - for i in range(1, 9): - v = i | i+1 << 32 | i+2 << 48 - self.check_register_unsigned(gpr, 'arg%i' % (i), v) - i = 29 - v = i+1 | i+2 << 32 | i+3 << 48 - self.check_register_unsigned(gpr, 'fp', v) - i = 30 - v = i+1 | i+2 << 32 | i+3 << 48 - self.check_register_unsigned(gpr, 'lr', v) - i = 31 - v = i+1 | i+2 << 32 | i+3 << 48 - self.check_register_unsigned(gpr, 'sp', v) - self.check_register_unsigned(gpr, 'pc', 0x1000) - self.check_register_unsigned(gpr, 'cpsr', 0x11223344) - self.check_register_unsigned(gpr, 'psr', 0x11223344) - - # Verify the FPR registers are all correct - fpr = registers.GetValueAtIndex(1) - for i in range(32): - v = "0x" - d = "0x" - s = "0x" - h = "0x" - for j in range(i+15, i-1, -1): - v += "%2.2x" % (j) - for j in range(i+7, i-1, -1): - d += "%2.2x" % (j) - for j in range(i+3, i-1, -1): - s += "%2.2x" % (j) - for j in range(i+1, i-1, -1): - h += "%2.2x" % (j) - self.check_register_string_value(fpr, "v%i" % (i), v, - lldb.eFormatHex) - self.check_register_string_value(fpr, "d%i" % (i), d, - lldb.eFormatHex) - self.check_register_string_value(fpr, "s%i" % (i), s, - lldb.eFormatHex) - self.check_register_string_value(fpr, "h%i" % (i), h, - lldb.eFormatHex) - self.check_register_unsigned(gpr, 'fpsr', 0x55667788) - self.check_register_unsigned(gpr, 'fpcr', 0x99aabbcc) - - def verify_arm_registers(self, apple=False): - """ - Verify values of all ARM registers from a breakpad created - minidump. - """ - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - if apple: - self.process = self.target.LoadCore("arm-macos.dmp") - else: - self.process = self.target.LoadCore("arm-linux.dmp") - self.check_state() - self.assertEqual(self.process.GetNumThreads(), 1) - thread = self.process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone) - stop_description = thread.GetStopDescription(256) - self.assertEqual(stop_description, "") - registers = thread.GetFrameAtIndex(0).GetRegisters() - # Verify the GPR registers are all correct - # Verify x0 - x31 register values - gpr = registers.GetValueAtIndex(0) - for i in range(1, 16): - self.check_register_unsigned(gpr, 'r%i' % (i), i+1) - # Verify arg1 - arg4 register values - for i in range(1, 5): - self.check_register_unsigned(gpr, 'arg%i' % (i), i) - if apple: - self.check_register_unsigned(gpr, 'fp', 0x08) - else: - self.check_register_unsigned(gpr, 'fp', 0x0c) - self.check_register_unsigned(gpr, 'lr', 0x0f) - self.check_register_unsigned(gpr, 'sp', 0x0e) - self.check_register_unsigned(gpr, 'pc', 0x10) - self.check_register_unsigned(gpr, 'cpsr', 0x11223344) - - # Verify the FPR registers are all correct - fpr = registers.GetValueAtIndex(1) - # Check d0 - d31 - self.check_register_unsigned(gpr, 'fpscr', 0x55667788aabbccdd) - for i in range(32): - value = (i+1) | (i+1) << 8 | (i+1) << 32 | (i+1) << 48 - self.check_register_unsigned(fpr, "d%i" % (i), value) - # Check s0 - s31 - for i in range(32): - i_val = (i >> 1) + 1 - if i & 1: - value = "%#8.8x" % (i_val | i_val << 16) - else: - value = "%#8.8x" % (i_val | i_val << 8) - self.check_register_string_value(fpr, "s%i" % (i), value, - lldb.eFormatHex) - # Check q0 - q15 - for i in range(15): - a = i * 2 + 1 - b = a + 1 - value = ("0x00%2.2x00%2.2x0000%2.2x%2.2x" - "00%2.2x00%2.2x0000%2.2x%2.2x") % (b, b, b, b, a, a, a, a) - self.check_register_string_value(fpr, "q%i" % (i), value, - lldb.eFormatHex) - - def test_linux_arm_registers(self): - """Test Linux ARM registers from a breakpad created minidump. - - The frame pointer is R11 for linux. - """ - self.verify_arm_registers(apple=False) - - def test_apple_arm_registers(self): - """Test Apple ARM registers from a breakpad created minidump. - - The frame pointer is R7 for linux. - """ - self.verify_arm_registers(apple=True) - - def do_test_deeper_stack(self, binary, core, pid): - target = self.dbg.CreateTarget(binary) - process = target.LoadCore(core) - thread = process.GetThreadAtIndex(0) - - self.assertEqual(process.GetProcessID(), pid) - - expected_stack = {1: 'bar', 2: 'foo', 3: '_start'} - self.assertGreaterEqual(thread.GetNumFrames(), len(expected_stack)) - for index, name in iteritems(expected_stack): - frame = thread.GetFrameAtIndex(index) - self.assertTrue(frame.IsValid()) - function_name = frame.GetFunctionName() - self.assertTrue(name in function_name) - - def test_deeper_stack_in_minidump(self): - """Test that we can examine a more interesting stack in a Minidump.""" - # Launch with the Minidump, and inspect the stack. - # target create linux-x86_64_not_crashed -c linux-x86_64_not_crashed.dmp - self.do_test_deeper_stack("linux-x86_64_not_crashed", - "linux-x86_64_not_crashed.dmp", - self._linux_x86_64_not_crashed_pid) - - def do_change_pid_in_minidump(self, core, newcore, offset, oldpid, newpid): - """ This assumes that the minidump is breakpad generated on Linux - - meaning that the PID in the file will be an ascii string part of - /proc/PID/status which is written in the file - """ - shutil.copyfile(core, newcore) - with open(newcore, "rb+") as f: - f.seek(offset) - currentpid = f.read(5).decode('utf-8') - self.assertEqual(currentpid, oldpid) - - f.seek(offset) - if len(newpid) < len(oldpid): - newpid += " " * (len(oldpid) - len(newpid)) - newpid += "\n" - f.write(newpid.encode('utf-8')) - - def test_deeper_stack_in_minidump_with_same_pid_running(self): - """Test that we read the information from the core correctly even if we - have a running process with the same PID""" - new_core = self.getBuildArtifact("linux-x86_64_not_crashed-pid.dmp") - self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp", - new_core, - self._linux_x86_64_not_crashed_pid_offset, - str(self._linux_x86_64_not_crashed_pid), - str(os.getpid())) - self.do_test_deeper_stack("linux-x86_64_not_crashed", new_core, os.getpid()) - - def test_two_cores_same_pid(self): - """Test that we handle the situation if we have two core files with the same PID """ - new_core = self.getBuildArtifact("linux-x86_64_not_crashed-pid.dmp") - self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp", - new_core, - self._linux_x86_64_not_crashed_pid_offset, - str(self._linux_x86_64_not_crashed_pid), - str(self._linux_x86_64_pid)) - self.do_test_deeper_stack("linux-x86_64_not_crashed", - new_core, self._linux_x86_64_pid) - self.test_stack_info_in_minidump() - - def test_local_variables_in_minidump(self): - """Test that we can examine local variables in a Minidump.""" - # Launch with the Minidump, and inspect a local variable. - # target create linux-x86_64_not_crashed -c linux-x86_64_not_crashed.dmp - self.target = self.dbg.CreateTarget("linux-x86_64_not_crashed") - self.process = self.target.LoadCore("linux-x86_64_not_crashed.dmp") - self.check_state() - thread = self.process.GetThreadAtIndex(0) - frame = thread.GetFrameAtIndex(1) - value = frame.EvaluateExpression('x') - self.assertEqual(value.GetValueAsSigned(), 3) - - def test_memory_regions_in_minidump(self): - """Test memory regions from a Minidump""" - # target create -c regions-linux-map.dmp - self.dbg.CreateTarget(None) - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("regions-linux-map.dmp") - self.check_state() - - regions_count = 19 - region_info_list = self.process.GetMemoryRegions() - self.assertEqual(region_info_list.GetSize(), regions_count) - - def check_region(index, start, end, read, write, execute, mapped, name): - region_info = lldb.SBMemoryRegionInfo() - self.assertTrue( - self.process.GetMemoryRegionInfo(start, region_info).Success()) - self.assertEqual(start, region_info.GetRegionBase()) - self.assertEqual(end, region_info.GetRegionEnd()) - self.assertEqual(read, region_info.IsReadable()) - self.assertEqual(write, region_info.IsWritable()) - self.assertEqual(execute, region_info.IsExecutable()) - self.assertEqual(mapped, region_info.IsMapped()) - self.assertEqual(name, region_info.GetName()) - - # Ensure we have the same regions as SBMemoryRegionInfoList contains. - if index >= 0 and index < regions_count: - region_info_from_list = lldb.SBMemoryRegionInfo() - self.assertTrue(region_info_list.GetMemoryRegionAtIndex( - index, region_info_from_list)) - self.assertEqual(region_info_from_list, region_info) - - a = "/system/bin/app_process" - b = "/system/bin/linker" - c = "/system/lib/liblog.so" - d = "/system/lib/libc.so" - n = None - max_int = 0xffffffffffffffff - - # Test address before the first entry comes back with nothing mapped up - # to first valid region info - check_region(-1, 0x00000000, 0x400d9000, False, False, False, False, n) - check_region( 0, 0x400d9000, 0x400db000, True, False, True, True, a) - check_region( 1, 0x400db000, 0x400dc000, True, False, False, True, a) - check_region( 2, 0x400dc000, 0x400dd000, True, True, False, True, n) - check_region( 3, 0x400dd000, 0x400ec000, True, False, True, True, b) - check_region( 4, 0x400ec000, 0x400ed000, True, False, False, True, n) - check_region( 5, 0x400ed000, 0x400ee000, True, False, False, True, b) - check_region( 6, 0x400ee000, 0x400ef000, True, True, False, True, b) - check_region( 7, 0x400ef000, 0x400fb000, True, True, False, True, n) - check_region( 8, 0x400fb000, 0x400fc000, True, False, True, True, c) - check_region( 9, 0x400fc000, 0x400fd000, True, True, True, True, c) - check_region(10, 0x400fd000, 0x400ff000, True, False, True, True, c) - check_region(11, 0x400ff000, 0x40100000, True, False, False, True, c) - check_region(12, 0x40100000, 0x40101000, True, True, False, True, c) - check_region(13, 0x40101000, 0x40122000, True, False, True, True, d) - check_region(14, 0x40122000, 0x40123000, True, True, True, True, d) - check_region(15, 0x40123000, 0x40167000, True, False, True, True, d) - check_region(16, 0x40167000, 0x40169000, True, False, False, True, d) - check_region(17, 0x40169000, 0x4016b000, True, True, False, True, d) - check_region(18, 0x4016b000, 0x40176000, True, True, False, True, n) - check_region(-1, 0x40176000, max_int, False, False, False, False, n) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-linux.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-linux.dmp Binary files differdeleted file mode 100644 index 3b0cb8268def..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-linux.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-macos.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-macos.dmp Binary files differdeleted file mode 100644 index 9ff6a8396ec5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-macos.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm64-macos.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm64-macos.dmp Binary files differdeleted file mode 100644 index ba658dd48feb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm64-macos.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp deleted file mode 100644 index c34ac17128fa..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "client/linux/handler/exception_handler.h" - -static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor, - void *context, bool succeeded) { - return succeeded; -} - -google_breakpad::ExceptionHandler *eh; - -void InstallBreakpad() { - google_breakpad::MinidumpDescriptor descriptor("/tmp"); - eh = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, - NULL, true, -1); -} - -void WriteMinidump() { eh->WriteMinidump(); } diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64 b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64 Binary files differdeleted file mode 100755 index 078d9c8fa90a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64 +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp deleted file mode 100644 index 61d31492940d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp +++ /dev/null @@ -1,12 +0,0 @@ -void crash() { - volatile int *a = (int *)(nullptr); - *a = 1; -} - -extern "C" void _start(); -void InstallBreakpad(); - -void _start() { - InstallBreakpad(); - crash(); -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp Binary files differdeleted file mode 100644 index e2ae724abe99..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed Binary files differdeleted file mode 100755 index 8b38cdb48bdd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp deleted file mode 100644 index 070c565e72bd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp +++ /dev/null @@ -1,22 +0,0 @@ -void InstallBreakpad(); -void WriteMinidump(); - -int global = 42; - -int bar(int x) { - WriteMinidump(); - int y = 4 * x + global; - return y; -} - -int foo(int x) { - int y = 2 * bar(3 * x); - return y; -} - -extern "C" void _start(); - -void _start() { - InstallBreakpad(); - foo(1); -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp Binary files differdeleted file mode 100644 index ad4b61a7bbb4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt deleted file mode 100644 index 79a95d61d85e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt +++ /dev/null @@ -1,29 +0,0 @@ -# This makefile aims to make the binaries as small as possible, for us not to -# upload huge binary blobs in the repo. -# The binary should have debug symbols because stack unwinding doesn't work -# correctly using the information in the Minidump only. Also we want to evaluate -# local variables, etc. -# Breakpad compiles as a static library, so statically linking againts it -# makes the binary huge. -# Dynamically linking to it does improve things, but we are still #include-ing -# breakpad headers (which is a lot of source code for which we generate debug -# symbols) -# So, install_breakpad.cpp does the #include-ing and defines a global function -# "InstallBreakpad" that does all the exception handler registration. -# We compile install_breakpad to object file and then link it, alongside the -# static libbreakpad, into a shared library. -# Then the binaries dynamically link to that lib. -# The other optimisation is not using the standard library (hence the _start -# instead of main). We only link dynamically to some standard libraries. -# This way we have a tiny binary (~8K) that has debug symbols and uses breakpad -# to generate a Minidump when the binary crashes/requests such. -# -CC=g++ -FLAGS=-g --std=c++11 -INCLUDE=-I$HOME/breakpad/src/src/ -LINK=-L. -lbreakpad -lpthread -nostdlib -lc -lstdc++ -lgcc_s -fno-exceptions -all: - $(CC) $(FLAGS) -fPIC -c install_breakpad.cpp $(INCLUDE) -o install_breakpad.o - ld -shared install_breakpad.o libbreakpad_client.a -o libbreakpad.so - $(CC) $(FLAGS) -o linux-x86_64 linux-x86_64.cpp $(LINK) - $(CC) $(FLAGS) -o linux-x86_64_not_crashed linux-x86_64_not_crashed.cpp $(LINK) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp Binary files differdeleted file mode 100644 index 3f1dd53d98fa..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/Makefile b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/Makefile deleted file mode 100644 index b3034c12abd9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules - diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py deleted file mode 100644 index fe13871ddac9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py +++ /dev/null @@ -1,168 +0,0 @@ -""" -Test basics of mini dump debugging. -""" - -from __future__ import print_function -from six import iteritems - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class MiniDumpTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def test_process_info_in_mini_dump(self): - """Test that lldb can read the process information from the minidump.""" - # target create -c fizzbuzz_no_heap.dmp - self.dbg.CreateTarget("") - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp") - self.assertTrue(self.process, PROCESS_IS_VALID) - self.assertEqual(self.process.GetNumThreads(), 1) - self.assertEqual(self.process.GetProcessID(), 4440) - - def test_thread_info_in_mini_dump(self): - """Test that lldb can read the thread information from the minidump.""" - # target create -c fizzbuzz_no_heap.dmp - self.dbg.CreateTarget("") - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp") - # This process crashed due to an access violation (0xc0000005) in its - # one and only thread. - self.assertEqual(self.process.GetNumThreads(), 1) - thread = self.process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonException) - stop_description = thread.GetStopDescription(256) - self.assertTrue("0xc0000005" in stop_description) - - def test_modules_in_mini_dump(self): - """Test that lldb can read the list of modules from the minidump.""" - # target create -c fizzbuzz_no_heap.dmp - self.dbg.CreateTarget("") - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp") - self.assertTrue(self.process, PROCESS_IS_VALID) - expected_modules = [ - { - 'filename' : r"C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug/fizzbuzz.exe", - 'uuid' : '91B7450F-969A-F946-BF8F-2D6076EA421A-11000000', - }, - { - 'filename' : r"C:\Windows\SysWOW64/ntdll.dll", - 'uuid' : '6A84B0BB-2C40-5240-A16B-67650BBFE6B0-02000000', - }, - { - 'filename' : r"C:\Windows\SysWOW64/kernel32.dll", - 'uuid' : '1B7ECBE5-5E00-1341-AB98-98D6913B52D8-02000000', - }, - { - 'filename' : r"C:\Windows\SysWOW64/KERNELBASE.dll", - 'uuid' : '4152F90B-0DCB-D44B-AC5D-186A6452E522-01000000', - }, - { - 'filename' : r"C:\Windows\System32/MSVCP120D.dll", - 'uuid' : '6E51053C-E757-EB40-8D3F-9722C5BD80DD-01000000', - }, - { - 'filename' : r"C:\Windows\System32/MSVCR120D.dll", - 'uuid' : '86FB8263-C446-4640-AE42-8D97B3F91FF2-01000000', - }, - ] - self.assertEqual(self.target.GetNumModules(), len(expected_modules)) - for module, expected in zip(self.target.modules, expected_modules): - self.assertTrue(module.IsValid()) - self.assertEqual(module.file.fullpath, expected['filename']) - self.assertEqual(module.GetUUIDString(), expected['uuid']) - - def test_stack_info_in_mini_dump(self): - """Test that we can see a trivial stack in a VS-generate mini dump.""" - # target create -c fizzbuzz_no_heap.dmp - self.dbg.CreateTarget("") - self.target = self.dbg.GetSelectedTarget() - self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp") - self.assertEqual(self.process.GetNumThreads(), 1) - thread = self.process.GetThreadAtIndex(0) - - pc_list = [ 0x00164d14, 0x00167c79, 0x00167e6d, 0x7510336a, 0x77759882, 0x77759855] - - self.assertEqual(thread.GetNumFrames(), len(pc_list)) - for i in range(len(pc_list)): - frame = thread.GetFrameAtIndex(i) - self.assertTrue(frame.IsValid()) - self.assertEqual(frame.GetPC(), pc_list[i]) - self.assertTrue(frame.GetModule().IsValid()) - - @skipUnlessWindows # Minidump saving works only on windows - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_deeper_stack_in_mini_dump(self): - """Test that we can examine a more interesting stack in a mini dump.""" - self.build() - exe = self.getBuildArtifact("a.out") - core = self.getBuildArtifact("core.dmp") - try: - # Set a breakpoint and capture a mini dump. - target = self.dbg.CreateTarget(exe) - breakpoint = target.BreakpointCreateByName("bar") - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertEqual(process.GetState(), lldb.eStateStopped) - self.assertTrue(process.SaveCore(core)) - self.assertTrue(os.path.isfile(core)) - self.assertTrue(process.Kill().Success()) - - # Launch with the mini dump, and inspect the stack. - target = self.dbg.CreateTarget(None) - process = target.LoadCore(core) - thread = process.GetThreadAtIndex(0) - - expected_stack = {0: 'bar', 1: 'foo', 2: 'main'} - self.assertGreaterEqual(thread.GetNumFrames(), len(expected_stack)) - for index, name in iteritems(expected_stack): - frame = thread.GetFrameAtIndex(index) - self.assertTrue(frame.IsValid()) - function_name = frame.GetFunctionName() - self.assertTrue(name in function_name) - - finally: - # Clean up the mini dump file. - self.assertTrue(self.dbg.DeleteTarget(target)) - if (os.path.isfile(core)): - os.unlink(core) - - @skipUnlessWindows # Minidump saving works only on windows - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_local_variables_in_mini_dump(self): - """Test that we can examine local variables in a mini dump.""" - self.build() - exe = self.getBuildArtifact("a.out") - core = self.getBuildArtifact("core.dmp") - try: - # Set a breakpoint and capture a mini dump. - target = self.dbg.CreateTarget(exe) - breakpoint = target.BreakpointCreateByName("bar") - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertEqual(process.GetState(), lldb.eStateStopped) - self.assertTrue(process.SaveCore(core)) - self.assertTrue(os.path.isfile(core)) - self.assertTrue(process.Kill().Success()) - - # Launch with the mini dump, and inspect a local variable. - target = self.dbg.CreateTarget(None) - process = target.LoadCore(core) - thread = process.GetThreadAtIndex(0) - frame = thread.GetFrameAtIndex(0) - value = frame.EvaluateExpression('x') - self.assertEqual(value.GetValueAsSigned(), 3) - - finally: - # Clean up the mini dump file. - self.assertTrue(self.dbg.DeleteTarget(target)) - if (os.path.isfile(core)): - os.unlink(core) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.cpp deleted file mode 100644 index 295d4a1f24db..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// A sample program for getting minidumps on Windows. - -#include <iostream> - -bool -fizz(int x) -{ - return x % 3 == 0; -} - -bool -buzz(int x) -{ - return x % 5 == 0; -} - -int -main() -{ - int *buggy = 0; - - for (int i = 1; i <= 100; ++i) - { - if (fizz(i)) std::cout << "fizz"; - if (buzz(i)) std::cout << "buzz"; - if (!fizz(i) && !buzz(i)) std::cout << i; - std::cout << '\n'; - } - - return *buggy; -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp Binary files differdeleted file mode 100644 index 19008c91fc3e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz_no_heap.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/main.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/main.cpp deleted file mode 100644 index 4037ea522cac..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -int global = 42; - -int -bar(int x) -{ - int y = 4*x + global; - return y; -} - -int -foo(int x) -{ - int y = 2*bar(3*x); - return y; -} - -int -main() -{ - return 0 * foo(1); -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py b/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py deleted file mode 100644 index 73ad3940aca2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py +++ /dev/null @@ -1,73 +0,0 @@ -""" -Test basics of a mini dump taken of a 32-bit process running in WoW64 - -WoW64 is the subsystem that lets 32-bit processes run in 64-bit Windows. If you -capture a mini dump of a process running under WoW64 with a 64-bit debugger, you -end up with a dump of the WoW64 layer. In that case, LLDB must do extra work to -get the 32-bit register contexts. -""" - -from __future__ import print_function -from six import iteritems - - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class Wow64MiniDumpTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def test_wow64_mini_dump(self): - """Test that lldb can read the process information from the minidump.""" - # target create -c fizzbuzz_wow64.dmp - target = self.dbg.CreateTarget("") - process = target.LoadCore("fizzbuzz_wow64.dmp") - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetNumThreads(), 1) - self.assertEqual(process.GetProcessID(), 0x1E9C) - - def test_thread_info_in_wow64_mini_dump(self): - """Test that lldb can read the thread information from the minidump.""" - # target create -c fizzbuzz_wow64.dmp - target = self.dbg.CreateTarget("") - process = target.LoadCore("fizzbuzz_wow64.dmp") - # This process crashed due to an access violation (0xc0000005), but the - # minidump doesn't have an exception record--perhaps the crash handler - # ate it. - # TODO: See if we can recover the exception information from the TEB, - # which, according to Windbg, has a pointer to an exception list. - - # In the dump, none of the threads are stopped, so we cannot use - # lldbutil.get_stopped_thread. - thread = process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone) - - def test_stack_info_in_wow64_mini_dump(self): - """Test that we can see a trivial stack in a VS-generate mini dump.""" - # target create -c fizzbuzz_no_heap.dmp - target = self.dbg.CreateTarget("") - process = target.LoadCore("fizzbuzz_wow64.dmp") - self.assertGreaterEqual(process.GetNumThreads(), 1) - # This process crashed due to an access violation (0xc0000005), but the - # minidump doesn't have an exception record--perhaps the crash handler - # ate it. - # TODO: See if we can recover the exception information from the TEB, - # which, according to Windbg, has a pointer to an exception list. - - # In the dump, none of the threads are stopped, so we cannot use - # lldbutil.get_stopped_thread. - thread = process.GetThreadAtIndex(0) - # The crash is in main, so there should be at least one frame on the - # stack. - self.assertGreaterEqual(thread.GetNumFrames(), 1) - frame = thread.GetFrameAtIndex(0) - self.assertTrue(frame.IsValid()) - pc = frame.GetPC() - eip = frame.FindRegister("pc") - self.assertTrue(eip.IsValid()) - self.assertEqual(pc, eip.GetValueAsUnsigned()) diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/fizzbuzz.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/fizzbuzz.cpp deleted file mode 100644 index 295d4a1f24db..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/fizzbuzz.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// A sample program for getting minidumps on Windows. - -#include <iostream> - -bool -fizz(int x) -{ - return x % 3 == 0; -} - -bool -buzz(int x) -{ - return x % 5 == 0; -} - -int -main() -{ - int *buggy = 0; - - for (int i = 1; i <= 100; ++i) - { - if (fizz(i)) std::cout << "fizz"; - if (buzz(i)) std::cout << "buzz"; - if (!fizz(i) && !buzz(i)) std::cout << i; - std::cout << '\n'; - } - - return *buggy; -} diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/fizzbuzz_wow64.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/fizzbuzz_wow64.dmp Binary files differdeleted file mode 100644 index 3d97186f2cd2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/fizzbuzz_wow64.dmp +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile deleted file mode 100644 index 624a6e1584e4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../make - -DYLIB_NAME := unlikely_name -DYLIB_CXX_SOURCES := foo.cpp -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py deleted file mode 100644 index 65084211cd6d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/TestPreRunDylibs.py +++ /dev/null @@ -1,38 +0,0 @@ -from __future__ import print_function - -import unittest2 -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * - -class TestPreRunLibraries(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - @skipIf(oslist=no_match(['darwin','macos'])) - def test(self): - """Test that we find directly linked dylib pre-run.""" - - self.build() - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.assertTrue(target, VALID_TARGET) - - # I don't know what the name of a shared library - # extension is in general, so instead of using FindModule, - # I'll iterate through the module and do a basename match. - found_it = False - for module in target.modules: - file_name = module.GetFileSpec().GetFilename() - if file_name.find("unlikely_name") != -1: - found_it = True - break - - self.assertTrue(found_it, "Couldn't find unlikely_to_occur_name in loaded libraries.") - - diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.cpp b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.cpp deleted file mode 100644 index 8dad0a23f368..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "foo.h" - -int call_foo1() { return foo1(); } diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.h b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.h deleted file mode 100644 index 060b91f5a5ea..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/foo.h +++ /dev/null @@ -1,6 +0,0 @@ -LLDB_TEST_API inline int foo1() { return 1; } // !BR1 - -LLDB_TEST_API inline int foo2() { return 2; } // !BR2 - -LLDB_TEST_API extern int call_foo1(); -LLDB_TEST_API extern int call_foo2(); diff --git a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/main.cpp b/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/main.cpp deleted file mode 100644 index c9295a5c7d3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "foo.h" - -int call_foo2() { return foo2(); } - -int -main() // !BR_main -{ - return call_foo1() + call_foo2(); -} diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/Makefile b/packages/Python/lldbsuite/test/functionalities/process_attach/Makefile deleted file mode 100644 index a964853f534b..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py deleted file mode 100644 index f485c13fa9f1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -Test process attach. -""" - -from __future__ import print_function - - -import os -import time -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 - 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) - - 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) - - 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/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile deleted file mode 100644 index 3c1f73515eb7..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py deleted file mode 100644 index b915b541fb4b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Test denied process attach. -""" - -from __future__ import print_function - - -import os -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/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist deleted file mode 100644 index 3d60e8bd0b94..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/main.cpp b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/main.cpp deleted file mode 100644 index ff1fccae4b1c..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_attach/main.cpp b/packages/Python/lldbsuite/test/functionalities/process_attach/main.cpp deleted file mode 100644 index 46ffacc0a840..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_group/Makefile b/packages/Python/lldbsuite/test/functionalities/process_group/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_group/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py b/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py deleted file mode 100644 index d3b153270119..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py +++ /dev/null @@ -1,90 +0,0 @@ -"""Test that we handle inferiors which change their process group""" - -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 ChangeProcessGroupTestCase(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 for main.c. - self.line = line_number('main.c', '// Set breakpoint here') - - @skipIfFreeBSD # Times out on FreeBSD llvm.org/pr23731 - @skipIfWindows # setpgid call does not exist on Windows - @expectedFailureAndroid("http://llvm.org/pr23762", api_levels=[16]) - def test_setpgid(self): - self.build() - exe = self.getBuildArtifact("a.out") - - # 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))) - - popen = self.spawnSubprocess(exe, [pid_file_path]) - self.addTearDownHook(self.cleanupSubprocesses) - - pid = lldbutil.wait_for_file_on_target(self, pid_file_path) - - # make sure we cleanup the forked child also - def cleanupChild(): - if lldb.remote_platform: - lldb.remote_platform.Kill(int(pid)) - else: - if os.path.exists("/proc/" + pid): - os.kill(int(pid), signal.SIGKILL) - self.addTearDownHook(cleanupChild) - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - listener = lldb.SBListener("my.attach.listener") - error = lldb.SBError() - process = target.AttachToProcessWithID(listener, int(pid), error) - self.assertTrue(error.Success() and process, PROCESS_IS_VALID) - - # set a breakpoint just before the setpgid() call - lldbutil.run_break_set_by_file_and_line( - self, 'main.c', self.line, num_expected_locations=-1) - - thread = process.GetSelectedThread() - - # release the child from its loop - value = thread.GetSelectedFrame().EvaluateExpression("release_child_flag = 1") - self.assertTrue(value.IsValid() and value.GetValueAsUnsigned(0) == 1) - process.Continue() - - # make sure the child's process group id is different from its pid - value = thread.GetSelectedFrame().EvaluateExpression("(int)getpgid(0)") - self.assertTrue(value.IsValid()) - self.assertNotEqual(value.GetValueAsUnsigned(0), int(pid)) - - # step over the setpgid() call - thread.StepOver() - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete) - - # verify that the process group has been set correctly - # this also checks that we are still in full control of the child - value = thread.GetSelectedFrame().EvaluateExpression("(int)getpgid(0)") - self.assertTrue(value.IsValid()) - self.assertEqual(value.GetValueAsUnsigned(0), int(pid)) - - # run to completion - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateExited) diff --git a/packages/Python/lldbsuite/test/functionalities/process_group/main.c b/packages/Python/lldbsuite/test/functionalities/process_group/main.c deleted file mode 100644 index 7e986bbac65d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_group/main.c +++ /dev/null @@ -1,71 +0,0 @@ -#include <stdio.h> -#include <unistd.h> -#include <sys/wait.h> - -volatile int release_child_flag = 0; - -int main(int argc, char const *argv[]) -{ - pid_t child = fork(); - if (child == -1) - { - perror("fork"); - return 1; - } - - if (child > 0) - { // parent - if (argc < 2) - { - fprintf(stderr, "Need pid filename.\n"); - return 2; - } - - // Let the test suite know the child's pid. - FILE *pid_file = fopen(argv[1], "w"); - if (pid_file == NULL) - { - perror("fopen"); - return 3; - } - - fprintf(pid_file, "%d\n", child); - if (fclose(pid_file) == EOF) - { - perror("fclose"); - return 4; - } - - // And wait for the child to finish it's work. - int status = 0; - pid_t wpid = wait(&status); - if (wpid == -1) - { - perror("wait"); - return 5; - } - if (wpid != child) - { - fprintf(stderr, "wait() waited for wrong child\n"); - return 6; - } - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) - { - fprintf(stderr, "child did not exit correctly\n"); - return 7; - } - } - else - { // child - lldb_enable_attach(); - - while (! release_child_flag) // Wait for debugger to attach - sleep(1); - - printf("Child's previous process group is: %d\n", getpgid(0)); - setpgid(0, 0); // Set breakpoint here - printf("Child's process group set to: %d\n", getpgid(0)); - } - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/process_launch/Makefile b/packages/Python/lldbsuite/test/functionalities/process_launch/Makefile deleted file mode 100644 index 313da706b4a2..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py b/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py deleted file mode 100644 index 9d1cac90d856..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py +++ /dev/null @@ -1,208 +0,0 @@ -""" -Test lldb process launch flags. -""" - -from __future__ import print_function - -import copy -import os -import time - -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") - 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) - pass - 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) - pass diff --git a/packages/Python/lldbsuite/test/functionalities/process_launch/input-file.txt b/packages/Python/lldbsuite/test/functionalities/process_launch/input-file.txt deleted file mode 100644 index cc269ba0ff8c..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_launch/main.cpp b/packages/Python/lldbsuite/test/functionalities/process_launch/main.cpp deleted file mode 100644 index f2035d551679..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_launch/print_cwd.cpp b/packages/Python/lldbsuite/test/functionalities/process_launch/print_cwd.cpp deleted file mode 100644 index b4b073fbcb8d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp b/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp deleted file mode 100644 index 8c6df8ea01a4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/process_save_core/Makefile b/packages/Python/lldbsuite/test/functionalities/process_save_core/Makefile deleted file mode 100644 index b76d2cdb93f1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_save_core/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules - diff --git a/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py b/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py deleted file mode 100644 index 55dbc4223711..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Test saving a core file (or mini dump). -""" - -from __future__ import print_function - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ProcessSaveCoreTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @not_remote_testsuite_ready - @skipUnlessWindows - def test_cannot_save_core_unless_process_stopped(self): - """Test that SaveCore fails if the process isn't stopped.""" - self.build() - exe = self.getBuildArtifact("a.out") - core = self.getBuildArtifact("core.dmp") - target = self.dbg.CreateTarget(exe) - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertNotEqual(process.GetState(), lldb.eStateStopped) - error = process.SaveCore(core) - self.assertTrue(error.Fail()) - - @not_remote_testsuite_ready - @skipUnlessWindows - def test_save_windows_mini_dump(self): - """Test that we can save a Windows mini dump.""" - self.build() - exe = self.getBuildArtifact("a.out") - core = self.getBuildArtifact("core.dmp") - try: - target = self.dbg.CreateTarget(exe) - breakpoint = target.BreakpointCreateByName("bar") - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertEqual(process.GetState(), lldb.eStateStopped) - self.assertTrue(process.SaveCore(core)) - self.assertTrue(os.path.isfile(core)) - self.assertTrue(process.Kill().Success()) - - # To verify, we'll launch with the mini dump, and ensure that we see - # the executable in the module list. - target = self.dbg.CreateTarget(None) - process = target.LoadCore(core) - files = [ - target.GetModuleAtIndex(i).GetFileSpec() for i in range( - 0, target.GetNumModules())] - paths = [ - os.path.join( - f.GetDirectory(), - f.GetFilename()) for f in files] - self.assertTrue(exe in paths) - - finally: - # Clean up the mini dump file. - self.assertTrue(self.dbg.DeleteTarget(target)) - if (os.path.isfile(core)): - os.unlink(core) diff --git a/packages/Python/lldbsuite/test/functionalities/process_save_core/main.cpp b/packages/Python/lldbsuite/test/functionalities/process_save_core/main.cpp deleted file mode 100644 index 4037ea522cac..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/process_save_core/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -int global = 42; - -int -bar(int x) -{ - int y = 4*x + global; - return y; -} - -int -foo(int x) -{ - int y = 2*bar(3*x); - return y; -} - -int -main() -{ - return 0 * foo(1); -} diff --git a/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile b/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ptr_refs/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py b/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py deleted file mode 100644 index 80ace219aeb1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Test the ptr_refs tool on Darwin -""" - -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 TestPtrRefs(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - def test_ptr_refs(self): - """Test format string functionality.""" - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - main_file_spec = lldb.SBFileSpec('main.c') - breakpoint = target.BreakpointCreateBySourceRegex( - 'break', main_file_spec) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - 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. - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint condition") - - frame = thread.GetFrameAtIndex(0) - - self.dbg.HandleCommand("script import lldb.macosx.heap") - self.expect("ptr_refs my_ptr", substrs=["malloc", "stack"]) diff --git a/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c b/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c deleted file mode 100644 index 4053f9997276..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ptr_refs/main.c +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -struct referent { - const char *p; -}; - -int main (int argc, char const *argv[]) -{ - const char *my_ptr = strdup("hello"); - struct referent *r = malloc(sizeof(struct referent)); - r->p = my_ptr; - - printf("%p\n", r); // break here - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/recursion/Makefile b/packages/Python/lldbsuite/test/functionalities/recursion/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/recursion/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py b/packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py deleted file mode 100644 index 569ecd249b21..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Test lldb data formatter subsystem. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class ValueObjectRecursionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def test_with_run_command(self): - """Test that deeply nested ValueObjects still work.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type format clear', check=False) - self.runCmd('type summary clear', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - root = self.frame().FindVariable("root") - child = root.GetChildAtIndex(1) - if self.TraceOn(): - print(root) - print(child) - for i in range(0, 15000): - child = child.GetChildAtIndex(1) - if self.TraceOn(): - print(child) - self.assertTrue( - child.IsValid(), - "could not retrieve the deep ValueObject") - self.assertTrue( - child.GetChildAtIndex(0).IsValid(), - "the deep ValueObject has no value") - self.assertTrue( - child.GetChildAtIndex(0).GetValueAsUnsigned() != 0, - "the deep ValueObject has a zero value") - self.assertTrue( - child.GetChildAtIndex(1).GetValueAsUnsigned() != 0, - "the deep ValueObject has no next") diff --git a/packages/Python/lldbsuite/test/functionalities/recursion/main.cpp b/packages/Python/lldbsuite/test/functionalities/recursion/main.cpp deleted file mode 100644 index f75a7f8698bb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/recursion/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -struct node; -struct node { - int value; - node* next; - node () : value(1),next(NULL) {} - node (int v) : value(v), next(NULL) {} -}; - -void make_tree(node* root, int count) -{ - int countdown=1; - if (!root) - return; - root->value = countdown; - while (count > 0) - { - root->next = new node(++countdown); - root = root->next; - count--; - } -} - -int main (int argc, const char * argv[]) -{ - node root(1); - make_tree(&root,25000); - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile deleted file mode 100644 index 7aadba93b7fe..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -CFLAGS_EXTRAS ?= -g -O1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py deleted file mode 100644 index 1919d4b1ac6d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -Test that we correctly read the YMM registers. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestYMMRegister(TestBase): - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @skipIfFreeBSD - @skipIfiOSSimulator - @skipIfTargetAndroid() - @skipIf(archs=no_match(['i386', 'x86_64'])) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995") - def test(self): - self.build(dictionary={"CFLAGS_EXTRAS": "-march=haswell"}) - self.setTearDownCleanup() - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - - self.assertTrue(target, VALID_TARGET) - - byte_pattern1 = 0x80 - byte_pattern2 = 0xFF - - # 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) - - if self.getArchitecture() == 'x86_64': - register_range = 16 - else: - register_range = 8 - for i in range(register_range): - j = i - ((i / 8) * 8) - self.runCmd("thread step-inst") - - register_byte = (byte_pattern1 | j) - pattern = "ymm" + str(i) + " = " + str('{') + ( - str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) + str('}') - - self.expect( - "register read ymm" + str(i), - substrs=[pattern]) - - register_byte = (byte_pattern2 | j) - pattern = "ymm" + str(i) + " = " + str('{') + ( - str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) + str('}') - - self.runCmd("thread step-inst") - self.expect( - "register read ymm" + str(i), - substrs=[pattern]) diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py deleted file mode 100644 index 92c67c88f020..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py +++ /dev/null @@ -1,126 +0,0 @@ -""" -Test that we correctly read the YMM registers. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestYMMRegister(TestBase): - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @skipUnlessDarwin - @skipIfiOSSimulator - @skipIf(archs=no_match(['i386', 'x86_64'])) - @debugserver_test - @skipUnlessFeature('hw.optional.avx512f') - def test(self): - self.build(dictionary={"CFLAGS_EXTRAS": "-mavx512f"}) - self.setTearDownCleanup() - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - - self.assertTrue(target, VALID_TARGET) - - byte_pattern1 = 0x80 - byte_pattern2 = 0xFF - - # This test is working with assembly instructions; it'll make - # it easier to debug the console output if the assembly is - # displayed. - self.runCmd("settings set stop-disassembly-display always") - - # 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) - - if self.getArchitecture() == 'x86_64': - register_range = 16 - else: - register_range = 8 - for i in range(register_range): - j = i - ((i / 8) * 8) - self.runCmd("thread step-inst") - - register_byte = (byte_pattern1 | j) - pattern = "ymm" + str(i) + " = " + str('{') + ( - str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) + str('}') - - self.expect( - "register read ymm" + str(i), - substrs=[pattern]) - - register_byte = (byte_pattern2 | j) - pattern = "ymm" + str(i) + " = " + str('{') + ( - str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) + str('}') - - self.runCmd("thread step-inst") - self.expect( - "register read ymm" + str(i), - substrs=[pattern]) - - self.expect("continue", 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) - - if self.getArchitecture() == 'x86_64': - register_range = 32 - else: - register_range = 8 - for i in range(register_range): - j = i - ((i / 8) * 8) - self.runCmd("thread step-inst") - self.runCmd("thread step-inst") - - register_byte = (byte_pattern2 | j) - pattern = "zmm" + str(i) + " = " + str('{') + ( - str(hex(register_byte)) + ' ') * 63 + str(hex(register_byte)) + str('}') - - self.expect( - "register read zmm" + str(i), - substrs=[pattern]) - - register_byte = (byte_pattern2 | j) - pattern = "zmm" + str(i) + " = " + str('{') + ( - str(hex(register_byte)) + ' ') * 63 + str(hex(register_byte)) + str('}') - - self.runCmd("thread step-inst") - self.expect( - "register read zmm" + str(i), - substrs=[pattern]) diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c deleted file mode 100644 index 671331fe450f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c +++ /dev/null @@ -1,143 +0,0 @@ -//===-- main.c ------------------------------------------------*- C -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -void func() { - unsigned int ymmvalues[16]; - for (int i = 0 ; i < 16 ; i++) - { - unsigned char val = (0x80 | i); - ymmvalues[i] = (val << 24) | (val << 16) | (val << 8) | val; - } - - unsigned int ymmallones = 0xFFFFFFFF; -#if defined(__AVX__) - __asm__("int3;" - "vbroadcastss %1, %%ymm0;" - "vbroadcastss %0, %%ymm0;" - "vbroadcastss %2, %%ymm1;" - "vbroadcastss %0, %%ymm1;" - "vbroadcastss %3, %%ymm2;" - "vbroadcastss %0, %%ymm2;" - "vbroadcastss %4, %%ymm3;" - "vbroadcastss %0, %%ymm3;" - "vbroadcastss %5, %%ymm4;" - "vbroadcastss %0, %%ymm4;" - "vbroadcastss %6, %%ymm5;" - "vbroadcastss %0, %%ymm5;" - "vbroadcastss %7, %%ymm6;" - "vbroadcastss %0, %%ymm6;" - "vbroadcastss %8, %%ymm7;" - "vbroadcastss %0, %%ymm7;" -#if defined(__x86_64__) - "vbroadcastss %1, %%ymm8;" - "vbroadcastss %0, %%ymm8;" - "vbroadcastss %2, %%ymm9;" - "vbroadcastss %0, %%ymm9;" - "vbroadcastss %3, %%ymm10;" - "vbroadcastss %0, %%ymm10;" - "vbroadcastss %4, %%ymm11;" - "vbroadcastss %0, %%ymm11;" - "vbroadcastss %5, %%ymm12;" - "vbroadcastss %0, %%ymm12;" - "vbroadcastss %6, %%ymm13;" - "vbroadcastss %0, %%ymm13;" - "vbroadcastss %7, %%ymm14;" - "vbroadcastss %0, %%ymm14;" - "vbroadcastss %8, %%ymm15;" - "vbroadcastss %0, %%ymm15;" -#endif - ::"m"(ymmallones), - "m"(ymmvalues[0]), "m"(ymmvalues[1]), "m"(ymmvalues[2]), "m"(ymmvalues[3]), - "m"(ymmvalues[4]), "m"(ymmvalues[5]), "m"(ymmvalues[6]), "m"(ymmvalues[7]) - ); -#endif - -#if defined(__AVX512F__) - unsigned int zmmvalues[32]; - for (int i = 0 ; i < 32 ; i++) - { - unsigned char val = (0x80 | i); - zmmvalues[i] = (val << 24) | (val << 16) | (val << 8) | val; - } - - __asm__("int3;" - "vbroadcastss %1, %%zmm0;" - "vbroadcastss %0, %%zmm0;" - "vbroadcastss %2, %%zmm1;" - "vbroadcastss %0, %%zmm1;" - "vbroadcastss %3, %%zmm2;" - "vbroadcastss %0, %%zmm2;" - "vbroadcastss %4, %%zmm3;" - "vbroadcastss %0, %%zmm3;" - "vbroadcastss %5, %%zmm4;" - "vbroadcastss %0, %%zmm4;" - "vbroadcastss %6, %%zmm5;" - "vbroadcastss %0, %%zmm5;" - "vbroadcastss %7, %%zmm6;" - "vbroadcastss %0, %%zmm6;" - "vbroadcastss %8, %%zmm7;" - "vbroadcastss %0, %%zmm7;" -#if defined(__x86_64__) - "vbroadcastss %1, %%zmm8;" - "vbroadcastss %0, %%zmm8;" - "vbroadcastss %2, %%zmm9;" - "vbroadcastss %0, %%zmm9;" - "vbroadcastss %3, %%zmm10;" - "vbroadcastss %0, %%zmm10;" - "vbroadcastss %4, %%zmm11;" - "vbroadcastss %0, %%zmm11;" - "vbroadcastss %5, %%zmm12;" - "vbroadcastss %0, %%zmm12;" - "vbroadcastss %6, %%zmm13;" - "vbroadcastss %0, %%zmm13;" - "vbroadcastss %7, %%zmm14;" - "vbroadcastss %0, %%zmm14;" - "vbroadcastss %8, %%zmm15;" - "vbroadcastss %0, %%zmm15;" - "vbroadcastss %1, %%zmm16;" - "vbroadcastss %0, %%zmm16;" - "vbroadcastss %2, %%zmm17;" - "vbroadcastss %0, %%zmm17;" - "vbroadcastss %3, %%zmm18;" - "vbroadcastss %0, %%zmm18;" - "vbroadcastss %4, %%zmm19;" - "vbroadcastss %0, %%zmm19;" - "vbroadcastss %5, %%zmm20;" - "vbroadcastss %0, %%zmm20;" - "vbroadcastss %6, %%zmm21;" - "vbroadcastss %0, %%zmm21;" - "vbroadcastss %7, %%zmm22;" - "vbroadcastss %0, %%zmm22;" - "vbroadcastss %8, %%zmm23;" - "vbroadcastss %0, %%zmm23;" - "vbroadcastss %1, %%zmm24;" - "vbroadcastss %0, %%zmm24;" - "vbroadcastss %2, %%zmm25;" - "vbroadcastss %0, %%zmm25;" - "vbroadcastss %3, %%zmm26;" - "vbroadcastss %0, %%zmm26;" - "vbroadcastss %4, %%zmm27;" - "vbroadcastss %0, %%zmm27;" - "vbroadcastss %5, %%zmm28;" - "vbroadcastss %0, %%zmm28;" - "vbroadcastss %6, %%zmm29;" - "vbroadcastss %0, %%zmm29;" - "vbroadcastss %7, %%zmm30;" - "vbroadcastss %0, %%zmm30;" - "vbroadcastss %8, %%zmm31;" - "vbroadcastss %0, %%zmm31;" -#endif - ::"m"(ymmallones), - "m"(zmmvalues[0]), "m"(zmmvalues[1]), "m"(zmmvalues[2]), "m"(zmmvalues[3]), - "m"(zmmvalues[4]), "m"(zmmvalues[5]), "m"(zmmvalues[6]), "m"(zmmvalues[7]) - ); -#endif -} - -int main(int argc, char const *argv[]) { func(); } diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile deleted file mode 100644 index 1c1be94b3d00..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py deleted file mode 100644 index 00802ff89505..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Test the Intel(R) MPX registers. -""" - -from __future__ import print_function - - -import os -import sys -import time -import re -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/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp deleted file mode 100644 index 3e528d281eee..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -//// -//// The LLVM Compiler Infrastructure -//// -//// This file is distributed under the University of Illinois Open Source -//// License. See LICENSE.TXT for details. -//// -////===----------------------------------------------------------------------===// -// - -#include <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/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile deleted file mode 100644 index aa88c47ff3f6..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py deleted file mode 100644 index 2fd2dab0184c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Test the Intel(R) MPX bound violation signal. -""" - -from __future__ import print_function - - -import os -import sys -import time -import re -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/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp deleted file mode 100644 index b78eb9e5a2a2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -//// -//// The LLVM Compiler Infrastructure -//// -//// This file is distributed under the University of Illinois Open Source -//// License. See LICENSE.TXT for details. -//// -////===----------------------------------------------------------------------===// -// - -#include <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/packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile b/packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile deleted file mode 100644 index 3c6deff2d972..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py b/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py deleted file mode 100644 index 41e566438724..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py +++ /dev/null @@ -1,473 +0,0 @@ -""" -Test the 'register' command. -""" - -from __future__ import print_function - - -import os -import sys -import time -import re -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'])) - 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") - 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") - 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") - 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") - 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 - - self.runCmd("register 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']) diff --git a/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp b/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp deleted file mode 100644 index fbacec1918e8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===-- a.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp deleted file mode 100644 index 156515768ddb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <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/packages/Python/lldbsuite/test/functionalities/rerun/Makefile b/packages/Python/lldbsuite/test/functionalities/rerun/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/rerun/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py b/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py deleted file mode 100644 index 044d3d25b724..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Test that argdumper is a viable launching strategy. -""" -from __future__ import print_function - - -import lldb -import os -import time -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestRerun(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - 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 1 2 3") - - process = self.process() - thread = lldbutil.get_one_thread_stopped_at_breakpoint( - process, breakpoint) - self.assertIsNotNone( - thread, "Process should be stopped at a breakpoint in main") - self.assertTrue(thread.IsValid(), "Stopped thread is not valid") - - self.expect("frame variable argv[1]", substrs=['1']) - self.expect("frame variable argv[2]", substrs=['2']) - self.expect("frame variable argv[3]", substrs=['3']) - - # Let program exit - self.runCmd("continue") - - # Re-run with no args and make sure we still run with 1 2 3 as arguments as - # they should have been stored in "target.run-args" - self.runCmd("process launch") - - process = self.process() - thread = lldbutil.get_one_thread_stopped_at_breakpoint( - process, breakpoint) - - self.assertIsNotNone( - thread, "Process should be stopped at a breakpoint in main") - self.assertTrue(thread.IsValid(), "Stopped thread is not valid") - - self.expect("frame variable argv[1]", substrs=['1']) - self.expect("frame variable argv[2]", substrs=['2']) - self.expect("frame variable argv[3]", substrs=['3']) diff --git a/packages/Python/lldbsuite/test/functionalities/rerun/main.cpp b/packages/Python/lldbsuite/test/functionalities/rerun/main.cpp deleted file mode 100644 index cbef8d1e6da1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/rerun/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int -main (int argc, char const **argv) -{ - return 0; // break here -} diff --git a/packages/Python/lldbsuite/test/functionalities/return-value/Makefile b/packages/Python/lldbsuite/test/functionalities/return-value/Makefile deleted file mode 100644 index cb03eabfc274..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/return-value/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := call-func.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py deleted file mode 100644 index 929bd4a73511..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py +++ /dev/null @@ -1,246 +0,0 @@ -""" -Test getting return-values correctly when stepping out -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ReturnValueTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def affected_by_pr33042(self): - return ("clang" in self.getCompiler() and self.getArchitecture() == - "aarch64" and self.getPlatform() == "linux") - - # ABIMacOSX_arm can't fetch simple values inside a structure - def affected_by_radar_34562999(self): - return (self.getArchitecture() == 'armv7' or self.getArchitecture() == 'armv7k') and self.platformIsDarwin() - - @expectedFailureAll(oslist=["freebsd"], archs=["i386"]) - @expectedFailureAll(oslist=["macosx"], archs=["i386"], bugnumber="<rdar://problem/28719652>") - @expectedFailureAll( - oslist=["linux"], - compiler="clang", - compiler_version=[ - "<=", - "3.6"], - archs=["i386"]) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - @add_test_categories(['pyapi']) - def test_with_python(self): - """Test getting return values from stepping out.""" - self.build() - exe = self.getBuildArtifact("a.out") - (self.target, self.process, thread, inner_sint_bkpt) = lldbutil.run_to_name_breakpoint(self, "inner_sint", exe_name = exe) - - error = lldb.SBError() - - # inner_sint returns the variable value, so capture that here: - in_int = thread.GetFrameAtIndex(0).FindVariable( - "value").GetValueAsSigned(error) - self.assertTrue(error.Success()) - - thread.StepOut() - - self.assertTrue(self.process.GetState() == lldb.eStateStopped) - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) - - frame = thread.GetFrameAtIndex(0) - fun_name = frame.GetFunctionName() - self.assertTrue(fun_name == "outer_sint") - - return_value = thread.GetStopReturnValue() - self.assertTrue(return_value.IsValid()) - - ret_int = return_value.GetValueAsSigned(error) - self.assertTrue(error.Success()) - self.assertTrue(in_int == ret_int) - - # Run again and we will stop in inner_sint the second time outer_sint is called. - # Then test stepping out two frames at once: - - thread_list = lldbutil.continue_to_breakpoint(self.process, inner_sint_bkpt) - self.assertTrue(len(thread_list) == 1) - thread = thread_list[0] - - # We are done with the inner_sint breakpoint: - self.target.BreakpointDelete(inner_sint_bkpt.GetID()) - - frame = thread.GetFrameAtIndex(1) - fun_name = frame.GetFunctionName() - self.assertTrue(fun_name == "outer_sint") - in_int = frame.FindVariable("value").GetValueAsSigned(error) - self.assertTrue(error.Success()) - - thread.StepOutOfFrame(frame) - - self.assertTrue(self.process.GetState() == lldb.eStateStopped) - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) - frame = thread.GetFrameAtIndex(0) - fun_name = frame.GetFunctionName() - self.assertTrue(fun_name == "main") - - ret_value = thread.GetStopReturnValue() - self.assertTrue(return_value.IsValid()) - ret_int = ret_value.GetValueAsSigned(error) - self.assertTrue(error.Success()) - self.assertTrue(2 * in_int == ret_int) - - # Now try some simple returns that have different types: - inner_float_bkpt = self.target.BreakpointCreateByName( - "inner_float", exe) - self.assertTrue(inner_float_bkpt, VALID_BREAKPOINT) - self.process.Continue() - thread_list = lldbutil.get_threads_stopped_at_breakpoint( - self.process, inner_float_bkpt) - self.assertTrue(len(thread_list) == 1) - thread = thread_list[0] - - self.target.BreakpointDelete(inner_float_bkpt.GetID()) - - frame = thread.GetFrameAtIndex(0) - in_value = frame.FindVariable("value") - in_float = float(in_value.GetValue()) - thread.StepOut() - - self.assertTrue(self.process.GetState() == lldb.eStateStopped) - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) - - frame = thread.GetFrameAtIndex(0) - fun_name = frame.GetFunctionName() - self.assertTrue(fun_name == "outer_float") - - #return_value = thread.GetStopReturnValue() - #self.assertTrue(return_value.IsValid()) - #return_float = float(return_value.GetValue()) - - #self.assertTrue(in_float == return_float) - - if not self.affected_by_radar_34562999(): - self.return_and_test_struct_value("return_one_int") - self.return_and_test_struct_value("return_two_int") - self.return_and_test_struct_value("return_three_int") - self.return_and_test_struct_value("return_four_int") - if not self.affected_by_pr33042(): - self.return_and_test_struct_value("return_five_int") - - self.return_and_test_struct_value("return_two_double") - self.return_and_test_struct_value("return_one_double_two_float") - self.return_and_test_struct_value("return_one_int_one_float_one_int") - - self.return_and_test_struct_value("return_one_pointer") - self.return_and_test_struct_value("return_two_pointer") - self.return_and_test_struct_value("return_one_float_one_pointer") - self.return_and_test_struct_value("return_one_int_one_pointer") - self.return_and_test_struct_value("return_three_short_one_float") - - self.return_and_test_struct_value("return_one_int_one_double") - self.return_and_test_struct_value("return_one_int_one_double_one_int") - self.return_and_test_struct_value( - "return_one_short_one_double_one_short") - self.return_and_test_struct_value("return_one_float_one_int_one_float") - self.return_and_test_struct_value("return_two_float") - # I am leaving out the packed test until we have a way to tell CLANG - # about alignment when reading DWARF for packed types. - #self.return_and_test_struct_value ("return_one_int_one_double_packed") - self.return_and_test_struct_value("return_one_int_one_long") - - @expectedFailureAll(oslist=["freebsd"], archs=["i386"]) - @expectedFailureAll(oslist=["macosx"], archs=["i386"], bugnumber="<rdar://problem/28719652>") - @expectedFailureAll( - oslist=["linux"], - compiler="clang", - compiler_version=[ - "<=", - "3.6"], - archs=["i386"]) - @expectedFailureAll(compiler=["gcc"], archs=["x86_64", "i386"]) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - @skipIfDarwinEmbedded # <rdar://problem/33976032> ABIMacOSX_arm64 doesn't get structs this big correctly - def test_vector_values(self): - self.build() - exe = self.getBuildArtifact("a.out") - error = lldb.SBError() - - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - main_bktp = self.target.BreakpointCreateByName("main", exe) - self.assertTrue(main_bktp, VALID_BREAKPOINT) - - self.process = self.target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint( - self.process, main_bktp)), 1) - - self.return_and_test_struct_value("return_vector_size_float32_8") - self.return_and_test_struct_value("return_vector_size_float32_16") - self.return_and_test_struct_value("return_vector_size_float32_32") - self.return_and_test_struct_value("return_ext_vector_size_float32_2") - self.return_and_test_struct_value("return_ext_vector_size_float32_4") - self.return_and_test_struct_value("return_ext_vector_size_float32_8") - - def return_and_test_struct_value(self, func_name): - """Pass in the name of the function to return from - takes in value, returns value.""" - - # Set the breakpoint, run to it, finish out. - bkpt = self.target.BreakpointCreateByName(func_name) - self.assertTrue(bkpt.GetNumResolvedLocations() > 0) - - self.process.Continue() - - thread_list = lldbutil.get_threads_stopped_at_breakpoint( - self.process, bkpt) - - self.assertTrue(len(thread_list) == 1) - thread = thread_list[0] - - self.target.BreakpointDelete(bkpt.GetID()) - - in_value = thread.GetFrameAtIndex(0).FindVariable("value") - - self.assertTrue(in_value.IsValid()) - num_in_children = in_value.GetNumChildren() - - # This is a little hokey, but if we don't get all the children now, then - # once we've stepped we won't be able to get them? - - for idx in range(0, num_in_children): - in_child = in_value.GetChildAtIndex(idx) - in_child_str = in_child.GetValue() - - thread.StepOut() - - self.assertTrue(self.process.GetState() == lldb.eStateStopped) - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) - - # Assuming all these functions step out to main. Could figure out the caller dynamically - # if that would add something to the test. - frame = thread.GetFrameAtIndex(0) - fun_name = frame.GetFunctionName() - self.assertTrue(fun_name == "main") - - frame = thread.GetFrameAtIndex(0) - ret_value = thread.GetStopReturnValue() - - self.assertTrue(ret_value.IsValid()) - - num_ret_children = ret_value.GetNumChildren() - self.assertTrue(num_in_children == num_ret_children) - for idx in range(0, num_ret_children): - in_child = in_value.GetChildAtIndex(idx) - ret_child = ret_value.GetChildAtIndex(idx) - in_child_str = in_child.GetValue() - ret_child_str = ret_child.GetValue() - - self.assertEqual(in_child_str, ret_child_str) diff --git a/packages/Python/lldbsuite/test/functionalities/return-value/call-func.c b/packages/Python/lldbsuite/test/functionalities/return-value/call-func.c deleted file mode 100644 index 0c026ffcca17..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/return-value/call-func.c +++ /dev/null @@ -1,407 +0,0 @@ -// Some convenient things to return: -static char *g_first_pointer = "I am the first"; -static char *g_second_pointer = "I am the second"; - -// First we have some simple functions that return standard types, ints, floats and doubles. -// We have a function calling a function in a few cases to test that if you stop in the -// inner function then do "up/fin" you get the return value from the outer-most frame. - -int -inner_sint (int value) -{ - return value; -} - -int -outer_sint (int value) -{ - int outer_value = 2 * inner_sint (value); - return outer_value; -} - -float -inner_float (float value) -{ - return value; -} - -float -outer_float (float value) -{ - float outer_value = 2 * inner_float(value); - return outer_value; -} - -double -return_double (double value) -{ - return value; -} - -long double -return_long_double (long double value) -{ - return value; -} - -char * -return_pointer (char *value) -{ - return value; -} - -struct one_int -{ - int one_field; -}; - -struct one_int -return_one_int (struct one_int value) -{ - return value; -} - -struct two_int -{ - int first_field; - int second_field; -}; - -struct two_int -return_two_int (struct two_int value) -{ - return value; -} - -struct three_int -{ - int first_field; - int second_field; - int third_field; -}; - -struct three_int -return_three_int (struct three_int value) -{ - return value; -} - -struct four_int -{ - int first_field; - int second_field; - int third_field; - int fourth_field; -}; - -struct four_int -return_four_int (struct four_int value) -{ - return value; -} - -struct five_int -{ - int first_field; - int second_field; - int third_field; - int fourth_field; - int fifth_field; -}; - -struct five_int -return_five_int (struct five_int value) -{ - return value; -} - -struct one_int_one_double -{ - int first_field; - double second_field; -}; - -struct one_int_one_double -return_one_int_one_double (struct one_int_one_double value) -{ - return value; -} - -struct one_int_one_double_one_int -{ - int one_field; - double second_field; - int third_field; -}; - -struct one_int_one_double_one_int -return_one_int_one_double_one_int (struct one_int_one_double_one_int value) -{ - return value; -} - -struct one_short_one_double_one_short -{ - int one_field; - double second_field; - int third_field; -}; - -struct one_short_one_double_one_short -return_one_short_one_double_one_short (struct one_short_one_double_one_short value) -{ - return value; -} - -struct three_short_one_float -{ - short one_field; - short second_field; - short third_field; - float fourth_field; -}; - -struct three_short_one_float -return_three_short_one_float (struct three_short_one_float value) -{ - return value; -} - -struct one_int_one_float_one_int -{ - int one_field; - float second_field; - int third_field; -}; - -struct one_int_one_float_one_int -return_one_int_one_float_one_int (struct one_int_one_float_one_int value) -{ - return value; -} - -struct one_float_one_int_one_float -{ - float one_field; - int second_field; - float third_field; -}; - -struct one_float_one_int_one_float -return_one_float_one_int_one_float (struct one_float_one_int_one_float value) -{ - return value; -} - -struct one_double_two_float -{ - double one_field; - float second_field; - float third_field; -}; - -struct one_double_two_float -return_one_double_two_float (struct one_double_two_float value) -{ - return value; -} - -struct two_double -{ - double first_field; - double second_field; -}; - -struct two_double -return_two_double (struct two_double value) -{ - return value; -} - -struct two_float -{ - float first_field; - float second_field; -}; - -struct two_float -return_two_float (struct two_float value) -{ - return value; -} - -struct one_int_one_double_packed -{ - int first_field; - double second_field; -} __attribute__((__packed__)); - -struct one_int_one_double_packed -return_one_int_one_double_packed (struct one_int_one_double_packed value) -{ - return value; -} - -struct one_int_one_long -{ - int first_field; - long second_field; -}; - -struct one_int_one_long -return_one_int_one_long (struct one_int_one_long value) -{ - return value; -} - -struct one_pointer -{ - char *first_field; -}; - -struct one_pointer -return_one_pointer (struct one_pointer value) -{ - return value; -} - -struct two_pointer -{ - char *first_field; - char *second_field; -}; - -struct two_pointer -return_two_pointer (struct two_pointer value) -{ - return value; -} - -struct one_float_one_pointer -{ - float first_field; - char *second_field; -}; - -struct one_float_one_pointer -return_one_float_one_pointer (struct one_float_one_pointer value) -{ - return value; -} - -struct one_int_one_pointer -{ - int first_field; - char *second_field; -}; - -struct one_int_one_pointer -return_one_int_one_pointer (struct one_int_one_pointer value) -{ - return value; -} - -typedef float vector_size_float32_8 __attribute__((__vector_size__(8))); -typedef float vector_size_float32_16 __attribute__((__vector_size__(16))); -typedef float vector_size_float32_32 __attribute__((__vector_size__(32))); - -typedef float ext_vector_size_float32_2 __attribute__((ext_vector_type(2))); -typedef float ext_vector_size_float32_4 __attribute__((ext_vector_type(4))); -typedef float ext_vector_size_float32_8 __attribute__((ext_vector_type(8))); - -vector_size_float32_8 -return_vector_size_float32_8 (vector_size_float32_8 value) -{ - return value; -} - -vector_size_float32_16 -return_vector_size_float32_16 (vector_size_float32_16 value) -{ - return value; -} - -vector_size_float32_32 -return_vector_size_float32_32 (vector_size_float32_32 value) -{ - return value; -} - -ext_vector_size_float32_2 -return_ext_vector_size_float32_2 (ext_vector_size_float32_2 value) -{ - return value; -} - -ext_vector_size_float32_4 -return_ext_vector_size_float32_4 (ext_vector_size_float32_4 value) -{ - return value; -} - -ext_vector_size_float32_8 -return_ext_vector_size_float32_8 (ext_vector_size_float32_8 value) -{ - return value; -} - -int -main () -{ - int first_int = 123456; - int second_int = 234567; - - outer_sint (first_int); - outer_sint (second_int); - - float first_float_value = 12.34; - float second_float_value = 23.45; - - outer_float (first_float_value); - outer_float (second_float_value); - - double double_value = -23.45; - - return_double (double_value); - - return_pointer(g_first_pointer); - - long double long_double_value = -3456789.987654321; - - return_long_double (long_double_value); - - // Okay, now the structures: - return_one_int ((struct one_int) {10}); - return_two_int ((struct two_int) {10, 20}); - return_three_int ((struct three_int) {10, 20, 30}); - return_four_int ((struct four_int) {10, 20, 30, 40}); - return_five_int ((struct five_int) {10, 20, 30, 40, 50}); - - return_two_double ((struct two_double) {10.0, 20.0}); - return_one_double_two_float ((struct one_double_two_float) {10.0, 20.0, 30.0}); - return_one_int_one_float_one_int ((struct one_int_one_float_one_int) {10, 20.0, 30}); - - return_one_pointer ((struct one_pointer) {g_first_pointer}); - return_two_pointer ((struct two_pointer) {g_first_pointer, g_second_pointer}); - return_one_float_one_pointer ((struct one_float_one_pointer) {10.0, g_first_pointer}); - return_one_int_one_pointer ((struct one_int_one_pointer) {10, g_first_pointer}); - return_three_short_one_float ((struct three_short_one_float) {10, 20, 30, 40.0}); - - return_one_int_one_double ((struct one_int_one_double) {10, 20.0}); - return_one_int_one_double_one_int ((struct one_int_one_double_one_int) {10, 20.0, 30}); - return_one_short_one_double_one_short ((struct one_short_one_double_one_short) {10, 20.0, 30}); - return_one_float_one_int_one_float ((struct one_float_one_int_one_float) {10.0, 20, 30.0}); - return_two_float ((struct two_float) { 10.0, 20.0}); - return_one_int_one_double_packed ((struct one_int_one_double_packed) {10, 20.0}); - return_one_int_one_long ((struct one_int_one_long) {10, 20}); - - return_vector_size_float32_8 (( vector_size_float32_8 ){1.5, 2.25}); - return_vector_size_float32_16 (( vector_size_float32_16 ){1.5, 2.25, 4.125, 8.0625}); - return_vector_size_float32_32 (( vector_size_float32_32 ){1.5, 2.25, 4.125, 8.0625, 7.89, 8.52, 6.31, 9.12}); - - return_ext_vector_size_float32_2 ((ext_vector_size_float32_2){ 16.5, 32.25}); - return_ext_vector_size_float32_4 ((ext_vector_size_float32_4){ 16.5, 32.25, 64.125, 128.0625}); - return_ext_vector_size_float32_8 ((ext_vector_size_float32_8){ 16.5, 32.25, 64.125, 128.0625, 1.59, 3.57, 8.63, 9.12 }); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/set-data/Makefile b/packages/Python/lldbsuite/test/functionalities/set-data/Makefile deleted file mode 100644 index 9e1d63a183bc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/set-data/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../make - -OBJC_SOURCES := main.m - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py b/packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py deleted file mode 100644 index 6e4dbf40e467..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -Set the contents of variables and registers using raw data -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class SetDataTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - def test_set_data(self): - """Test setting the contents of variables and registers using raw data.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.runCmd("br s -p First") - self.runCmd("br s -p Second") - - self.runCmd("run", RUN_SUCCEEDED) - - self.expect("p myFoo.x", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['2']) - - process = self.dbg.GetSelectedTarget().GetProcess() - frame = process.GetSelectedThread().GetFrameAtIndex(0) - - x = frame.FindVariable("myFoo").GetChildMemberWithName("x") - - my_data = lldb.SBData.CreateDataFromSInt32Array( - lldb.eByteOrderLittle, 8, [4]) - err = lldb.SBError() - - self.assertTrue(x.SetData(my_data, err)) - - self.runCmd("continue") - - self.expect("p myFoo.x", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['4']) - - frame = process.GetSelectedThread().GetFrameAtIndex(0) - - x = frame.FindVariable("string") - - if process.GetAddressByteSize() == 8: - my_data = lldb.SBData.CreateDataFromUInt64Array( - process.GetByteOrder(), 8, [0]) - else: - my_data = lldb.SBData.CreateDataFromUInt32Array( - process.GetByteOrder(), 4, [0]) - - err = lldb.SBError() - - self.assertTrue(x.SetData(my_data, err)) - - self.expect( - "fr var -d run-target string", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'NSString *', - 'nil']) diff --git a/packages/Python/lldbsuite/test/functionalities/set-data/main.m b/packages/Python/lldbsuite/test/functionalities/set-data/main.m deleted file mode 100644 index e1e69dc55715..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/set-data/main.m +++ /dev/null @@ -1,19 +0,0 @@ -#import <Foundation/Foundation.h> - -int main () -{ - @autoreleasepool - { - struct foo { - int x; - int y; - } myFoo; - - myFoo.x = 2; - myFoo.y = 3; // First breakpoint - - NSString *string = [NSString stringWithFormat:@"%s", "Hello world!"]; - - NSLog(@"%d %@", myFoo.x, string); // Second breakpoint - } -} diff --git a/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py b/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py deleted file mode 100644 index a56282efd77d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py +++ /dev/null @@ -1,34 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * - -# This test checks that source code location is shown correctly -# when DWARF5 debug information is used. - -class TestTargetSourceMap(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_source_map(self): - # Set the target soure map to map "./" to the current test directory. - yaml_path = os.path.join(self.getSourceDir(), "a.yaml") - yaml_base, ext = os.path.splitext(yaml_path) - obj_path = self.getBuildArtifact(yaml_base) - self.yaml2obj(yaml_path, obj_path) - - def cleanup(): - if os.path.exists(obj_path): - os.unlink(obj_path) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Create a target with the object file we just created from YAML - target = self.dbg.CreateTarget(obj_path) - - # Check we are able to show the locations properly. - self.expect("b main", VALID_BREAKPOINT_LOCATION, - substrs=['main + 13 at test.cpp:2:3, address = 0x000000000040052d']) - - self.expect("b foo", VALID_BREAKPOINT_LOCATION, - substrs=['foo() + 4 at test.cpp:6:1, address = 0x0000000000400534']) diff --git a/packages/Python/lldbsuite/test/functionalities/show_location/a.yaml b/packages/Python/lldbsuite/test/functionalities/show_location/a.yaml deleted file mode 100644 index 27b119d3df63..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/show_location/a.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# This file is a shorten version of the output -# produced with the following invocations and input: -# ./clang test.cpp -g -gdwarf-5 -o test.exe -# ./obj2yaml test.exe > test.yaml -# -# // test.cpp -# int main() { -# return 0; -# } -# -# void foo() { -# } - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_X86_64 - Entry: 0x0000000000400440 -Sections: - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x0000000000400440 - AddressAlign: 0x0000000000000010 - Content: 31ED4989D15E4889E24883E4F0505449C7C0B005400048C7C14005400048C7C720054000E8B7FFFFFFF4660F1F44000055B820204000483D202040004889E57417B8000000004885C0740D5DBF20204000FFE00F1F4400005DC3660F1F440000BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF20204000FFE00F1F005DC3660F1F440000803D391B0000007517554889E5E87EFFFFFFC605271B0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89660F1F840000000000554889E531C0C745FC000000005DC390554889E55DC3662E0F1F840000000000415741564189FF415541544C8D25B618000055488D2DB6180000534989F64989D54C29E54883EC0848C1FD03E87FFEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 - - Name: .debug_str_offsets - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: 200000000500000000000000230000002C0000004A0000004F000000530000005B000000 - - Name: .debug_str - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 636C616E672076657273696F6E20382E302E3020287472756E6B203334313935382900746573742E637070002F686F6D652F756D622F4C4C564D2F6275696C645F6C6C64622F62696E006D61696E00696E74005F5A33666F6F7600666F6F00 - - Name: .debug_abbrev - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: 011101252513050325721710171B25110112060000022E0011011206401803253A0B3B0B49133F190000032E001101120640186E2503253A0B3B0B3F19000004240003253E0B0B0B000000 - - Name: .debug_info - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: 50000000050001080000000001000400010800000000000000022005400000000000160000000220054000000000000F00000001560301014F000000033005400000000000060000000156050601050404050400 - - Name: .debug_macinfo - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: '00' - - Name: .debug_line - Type: SHT_PROGBITS - AddressAlign: 0x0000000000000001 - Content: 70000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E021E00000000FD7C0F2E46BA561F7BDA351B04E677091E00000000FD7C0F2E46BA561F7BDA351B04E6770900090220054000000000000105030AC905003F05010A4B0202000101 - - Name: .debug_line_str - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x0000000000000001 - Content: 2F686F6D652F756D622F4C4C564D2F6275696C645F6C6C64622F62696E00746573742E63707000 -... diff --git a/packages/Python/lldbsuite/test/functionalities/signal/Makefile b/packages/Python/lldbsuite/test/functionalities/signal/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py b/packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py deleted file mode 100644 index 316233b909e7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py +++ /dev/null @@ -1,115 +0,0 @@ -"""Test that lldb command 'process signal SIGUSR1' to send a signal to the inferior works.""" - -from __future__ import print_function - - -import os -import time -import signal -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class SendSignalTestCase(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.c', 'Put breakpoint here') - - @expectedFailureAll( - oslist=['freebsd'], - bugnumber="llvm.org/pr23318: does not report running state") - @skipIfWindows # Windows does not support signals - def test_with_run_command(self): - """Test that lldb command 'process signal SIGUSR1' sends a signal to the inferior process.""" - 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 on main.c by name 'c'. - breakpoint = target.BreakpointCreateByLocation('main.c', self.line) - 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) - - # Now launch the process, no arguments & do not stop at entry point. - launch_info = lldb.SBLaunchInfo([exe]) - launch_info.SetWorkingDirectory(self.get_process_working_directory()) - - process_listener = lldb.SBListener("signal_test_listener") - launch_info.SetListener(process_listener) - error = lldb.SBError() - process = target.Launch(launch_info, error) - self.assertTrue(process, PROCESS_IS_VALID) - - self.runCmd("process handle -n False -p True -s True SIGUSR1") - - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertTrue(thread.IsValid(), "We hit the first breakpoint.") - - # After resuming the process, send it a SIGUSR1 signal. - - self.setAsync(True) - - self.assertTrue( - process_listener.IsValid(), - "Got a good process listener") - - # Disable our breakpoint, we don't want to hit it anymore... - breakpoint.SetEnabled(False) - - # Now continue: - process.Continue() - - # If running remote test, there should be a connected event - if lldb.remote_platform: - self.match_state(process_listener, lldb.eStateConnected) - - self.match_state(process_listener, lldb.eStateRunning) - - # Now signal the process, and make sure it stops: - process.Signal(lldbutil.get_signal_number('SIGUSR1')) - - self.match_state(process_listener, lldb.eStateStopped) - - # Now make sure the thread was stopped with a SIGUSR1: - threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonSignal) - self.assertTrue(len(threads) == 1, "One thread stopped for a signal.") - thread = threads[0] - - self.assertTrue( - thread.GetStopReasonDataCount() >= 1, - "There was data in the event.") - self.assertTrue( - thread.GetStopReasonDataAtIndex(0) == lldbutil.get_signal_number('SIGUSR1'), - "The stop signal was SIGUSR1") - - def match_state(self, process_listener, expected_state): - num_seconds = 5 - broadcaster = self.process().GetBroadcaster() - event_type_mask = lldb.SBProcess.eBroadcastBitStateChanged - event = lldb.SBEvent() - got_event = process_listener.WaitForEventForBroadcasterWithType( - num_seconds, broadcaster, event_type_mask, event) - self.assertTrue(got_event, "Got an event") - state = lldb.SBProcess.GetStateFromEvent(event) - self.assertTrue(state == expected_state, - "It was the %s state." % - lldb.SBDebugger_StateAsCString(expected_state)) diff --git a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/Makefile b/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py b/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py deleted file mode 100644 index 1ebab8837b92..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py +++ /dev/null @@ -1,49 +0,0 @@ -"""Test that we can debug inferiors that handle SIGSEGV by themselves""" - -from __future__ import print_function - - -import os -import re - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class HandleSegvTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfWindows # signals do not exist on Windows - @skipIfDarwin - def test_inferior_handle_sigsegv(self): - self.build() - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # launch - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetState(), lldb.eStateStopped) - signo = process.GetUnixSignals().GetSignalNumberFromName("SIGSEGV") - - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal) - self.assertTrue( - thread and thread.IsValid(), - "Thread should be stopped due to a signal") - self.assertTrue( - thread.GetStopReasonDataCount() >= 1, - "There was data in the event.") - self.assertEqual(thread.GetStopReasonDataAtIndex(0), - signo, "The stop signal was SIGSEGV") - - # Continue until we exit. - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), 0) diff --git a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/main.c b/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/main.c deleted file mode 100644 index 27d9b8e500ab..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/main.c +++ /dev/null @@ -1,58 +0,0 @@ -#include <sys/mman.h> -#include <signal.h> -#include <stdio.h> -#include <unistd.h> - -enum { - kMmapSize = 0x1000, - kMagicValue = 47, -}; - -void *address; -volatile sig_atomic_t signaled = 0; - -void handler(int sig) -{ - signaled = 1; - if (munmap(address, kMmapSize) != 0) - { - perror("munmap"); - _exit(5); - } - - void* newaddr = mmap(address, kMmapSize, PROT_READ | PROT_WRITE, - MAP_ANON | MAP_FIXED | MAP_PRIVATE, -1, 0); - if (newaddr != address) - { - fprintf(stderr, "Newly mmaped address (%p) does not equal old address (%p).\n", - newaddr, address); - _exit(6); - } - *(int*)newaddr = kMagicValue; -} - -int main() -{ - if (signal(SIGSEGV, handler) == SIG_ERR) - { - perror("signal"); - return 1; - } - - address = mmap(NULL, kMmapSize, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); - if (address == MAP_FAILED) - { - perror("mmap"); - return 2; - } - - // This should first trigger a segfault. Our handler will make the memory readable and write - // the magic value into memory. - if (*(int*)address != kMagicValue) - return 3; - - if (! signaled) - return 4; - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/signal/main.c b/packages/Python/lldbsuite/test/functionalities/signal/main.c deleted file mode 100644 index 77e760503410..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/main.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <signal.h> -#include <stdio.h> -#include <unistd.h> - -void handler_usr1 (int i) -{ - puts ("got signal usr1"); -} - -void handler_alrm (int i) -{ - puts ("got signal ALRM"); -} - -int main () -{ - int i = 0; - - signal (SIGUSR1, handler_usr1); - signal (SIGALRM, handler_alrm); - - puts ("Put breakpoint here"); - - while (i++ < 20) - sleep (1); -} - diff --git a/packages/Python/lldbsuite/test/functionalities/signal/raise/Makefile b/packages/Python/lldbsuite/test/functionalities/signal/raise/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/raise/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py b/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py deleted file mode 100644 index dfc54a639ea0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py +++ /dev/null @@ -1,190 +0,0 @@ -"""Test that we handle inferiors that send signals to themselves""" - -from __future__ import print_function - - -import os -import lldb -import re -from lldbsuite.test.lldbplatformutil import getDarwinOSTriples -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -@skipIfWindows # signals do not exist on Windows -class RaiseTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def test_sigstop(self): - self.build() - self.signal_test('SIGSTOP', False) - # passing of SIGSTOP is not correctly handled, so not testing that - # scenario: https://llvm.org/bugs/show_bug.cgi?id=23574 - - @skipIfDarwin # darwin does not support real time signals - @skipIfTargetAndroid() - def test_sigsigrtmin(self): - self.build() - self.signal_test('SIGRTMIN', True) - - def test_sigtrap(self): - self.build() - self.signal_test('SIGTRAP', True) - - def launch(self, target, signal): - # launch the process, do not stop at entry point. - process = target.LaunchSimple( - [signal], None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(process.GetState(), lldb.eStateStopped) - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "Thread should be stopped due to a breakpoint") - return process - - def set_handle(self, signal, pass_signal, stop_at_signal, notify_signal): - return_obj = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand( - "process handle %s -p %s -s %s -n %s" % - (signal, pass_signal, stop_at_signal, notify_signal), return_obj) - self.assertTrue( - return_obj.Succeeded(), - "Setting signal handling failed") - - def signal_test(self, signal, test_passing): - """Test that we handle inferior raising signals""" - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - lldbutil.run_break_set_by_symbol(self, "main") - - # launch - process = self.launch(target, signal) - signo = process.GetUnixSignals().GetSignalNumberFromName(signal) - - # retrieve default signal disposition - return_obj = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand( - "process handle %s " % signal, return_obj) - match = re.match( - 'NAME *PASS *STOP *NOTIFY.*(false|true) *(false|true) *(false|true)', - return_obj.GetOutput(), - re.IGNORECASE | re.DOTALL) - if not match: - self.fail('Unable to retrieve default signal disposition.') - default_pass = match.group(1) - default_stop = match.group(2) - default_notify = match.group(3) - - # Make sure we stop at the signal - self.set_handle(signal, "false", "true", "true") - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateStopped) - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal) - self.assertTrue( - thread.IsValid(), - "Thread should be stopped due to a signal") - self.assertTrue( - thread.GetStopReasonDataCount() >= 1, - "There was data in the event.") - self.assertEqual(thread.GetStopReasonDataAtIndex(0), signo, - "The stop signal was %s" % signal) - - # Continue until we exit. - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), 0) - - # launch again - process = self.launch(target, signal) - - # Make sure we do not stop at the signal. We should still get the - # notification. - self.set_handle(signal, "false", "false", "true") - self.expect( - "process continue", - substrs=[ - "stopped and restarted", - signal]) - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), 0) - - # launch again - process = self.launch(target, signal) - - # Make sure we do not stop at the signal, and we do not get the - # notification. - self.set_handle(signal, "false", "false", "false") - self.expect( - "process continue", - substrs=["stopped and restarted"], - matching=False) - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), 0) - - if not test_passing: - # reset signal handling to default - self.set_handle(signal, default_pass, default_stop, default_notify) - return - - # launch again - process = self.launch(target, signal) - - # Make sure we stop at the signal - self.set_handle(signal, "true", "true", "true") - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateStopped) - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal) - self.assertTrue( - thread.IsValid(), - "Thread should be stopped due to a signal") - self.assertTrue( - thread.GetStopReasonDataCount() >= 1, - "There was data in the event.") - self.assertEqual( - thread.GetStopReasonDataAtIndex(0), - process.GetUnixSignals().GetSignalNumberFromName(signal), - "The stop signal was %s" % - signal) - - # Continue until we exit. The process should receive the signal. - process.Continue() - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), signo) - - # launch again - process = self.launch(target, signal) - - # Make sure we do not stop at the signal. We should still get the notification. Process - # should receive the signal. - self.set_handle(signal, "true", "false", "true") - self.expect( - "process continue", - substrs=[ - "stopped and restarted", - signal]) - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), signo) - - # launch again - process = self.launch(target, signal) - - # Make sure we do not stop at the signal, and we do not get the notification. Process - # should receive the signal. - self.set_handle(signal, "true", "false", "false") - self.expect( - "process continue", - substrs=["stopped and restarted"], - matching=False) - self.assertEqual(process.GetState(), lldb.eStateExited) - self.assertEqual(process.GetExitStatus(), signo) - - # reset signal handling to default - self.set_handle(signal, default_pass, default_stop, default_notify) diff --git a/packages/Python/lldbsuite/test/functionalities/signal/raise/main.c b/packages/Python/lldbsuite/test/functionalities/signal/raise/main.c deleted file mode 100644 index 4203fe5d4c89..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/signal/raise/main.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <signal.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -void handler(int signo) -{ - _exit(signo); -} - -int main (int argc, char *argv[]) -{ - if (signal(SIGTRAP, handler) == SIG_ERR) - { - perror("signal(SIGTRAP)"); - return 1; - } -#ifndef __APPLE__ - // Real time signals not supported on apple platforms. - if (signal(SIGRTMIN, handler) == SIG_ERR) - { - perror("signal(SIGRTMIN)"); - return 1; - } -#endif - - if (argc < 2) - { - puts("Please specify a signal to raise"); - return 1; - } - - if (strcmp(argv[1], "SIGSTOP") == 0) - raise(SIGSTOP); - else if (strcmp(argv[1], "SIGTRAP") == 0) - raise(SIGTRAP); -#ifndef __APPLE__ - else if (strcmp(argv[1], "SIGRTMIN") == 0) - raise(SIGRTMIN); -#endif - else - { - printf("Unknown signal: %s\n", argv[1]); - return 1; - } - - return 0; -} - diff --git a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/Makefile b/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py b/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py deleted file mode 100644 index 984e802fdaa0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py +++ /dev/null @@ -1,73 +0,0 @@ -""" -Test the lldb command line takes a filename with single quote chars. -""" - -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 SingleQuoteInCommandLineTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - myexe = "path with '09/a.out" - - @classmethod - def classCleanup(cls): - """Cleanup the test byproducts.""" - try: - os.remove("child_send.txt") - os.remove("child_read.txt") - os.remove(cls.myexe) - except: - pass - - @expectedFailureAll( - hostoslist=["windows"], - bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") - @no_debug_info_test - def test_lldb_invocation_with_single_quote_in_filename(self): - """Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it.""" - import pexpect - self.buildDefault() - lldbutil.mkdir_p(self.getBuildArtifact("path with '09")) - system([["cp", - self.getBuildArtifact("a.out"), - "\"%s\"" % self.getBuildArtifact(self.myexe)]]) - - # The default lldb prompt. - prompt = "(lldb) " - - # So that the child gets torn down after the test. - self.child = pexpect.spawn( - '%s %s "%s"' % - (lldbtest_config.lldbExec, self.lldbOption, - self.getBuildArtifact(self.myexe))) - child = self.child - child.setecho(True) - child.logfile_send = send = six.StringIO() - child.logfile_read = read = six.StringIO() - child.expect_exact(prompt) - - child.send("help watchpoint") - child.sendline('') - child.expect_exact(prompt) - - # Now that the necessary logging is done, restore logfile to None to - # stop further logging. - child.logfile_send = None - child.logfile_read = None - - if self.TraceOn(): - print("\n\nContents of send") - print(send.getvalue()) - print("\n\nContents of read") - print(read.getvalue()) - - self.expect(read.getvalue(), exe=False, - substrs=["Current executable set to"]) diff --git a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/main.c b/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/main.c deleted file mode 100644 index 7cee7306547a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main(int argc, const char *argv[]) -{ - printf("Hello, world!\n"); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py b/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py deleted file mode 100644 index 6bcd9c92f8ce..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py +++ /dev/null @@ -1,41 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * - - -class TestTargetSourceMap(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_source_map(self): - """Test target.source-map' functionality.""" - # Set the target soure map to map "./" to the current test directory - src_dir = self.getSourceDir() - src_path = os.path.join(src_dir, "main.c") - yaml_path = os.path.join(src_dir, "a.yaml") - yaml_base, ext = os.path.splitext(yaml_path) - obj_path = self.getBuildArtifact(yaml_base) - self.yaml2obj(yaml_path, obj_path) - - def cleanup(): - if os.path.exists(obj_path): - os.unlink(obj_path) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # Create a target with the object file we just created from YAML - target = self.dbg.CreateTarget(obj_path) - - # Set a breakpoint before we remap source and verify that it fails - bp = target.BreakpointCreateByLocation(src_path, 2) - self.assertTrue(bp.GetNumLocations() == 0, - "make sure no breakpoints were resolved without map") - src_map_cmd = 'settings set target.source-map ./ "%s"' % (src_dir) - self.dbg.HandleCommand(src_map_cmd) - - # Set a breakpoint after we remap source and verify that it succeeds - bp = target.BreakpointCreateByLocation(src_path, 2) - self.assertTrue(bp.GetNumLocations() == 1, - "make sure breakpoint was resolved with map") diff --git a/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml b/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml deleted file mode 100644 index 2ffb94cb7754..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml +++ /dev/null @@ -1,396 +0,0 @@ ---- !mach-o -FileHeader: - magic: 0xFEEDFACF - cputype: 0x01000007 - cpusubtype: 0x00000003 - filetype: 0x0000000A - ncmds: 6 - sizeofcmds: 1376 - flags: 0x00000000 - reserved: 0x00000000 -LoadCommands: - - cmd: LC_UUID - cmdsize: 24 - uuid: D37CC773-C218-3F97-99C9-CE4E77DDF2CE - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 4096 - nsyms: 2 - stroff: 4128 - strsize: 28 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __PAGEZERO - vmaddr: 0 - vmsize: 4294967296 - fileoff: 0 - filesize: 0 - maxprot: 0 - initprot: 0 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 232 - segname: __TEXT - vmaddr: 4294967296 - vmsize: 4096 - fileoff: 0 - filesize: 0 - maxprot: 7 - initprot: 5 - nsects: 2 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x0000000100000FA0 - size: 15 - offset: 0x00000000 - align: 4 - reloff: 0x00000000 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __unwind_info - segname: __TEXT - addr: 0x0000000100000FB0 - size: 72 - offset: 0x00000000 - align: 2 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 4294971392 - vmsize: 4096 - fileoff: 4096 - filesize: 60 - maxprot: 7 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_SEGMENT_64 - cmdsize: 952 - segname: __DWARF - vmaddr: 4294975488 - vmsize: 4096 - fileoff: 8192 - filesize: 563 - maxprot: 7 - initprot: 3 - nsects: 11 - flags: 0 - Sections: - - sectname: __debug_line - segname: __DWARF - addr: 0x0000000100002000 - size: 60 - offset: 0x00002000 - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __debug_pubnames - segname: __DWARF - addr: 0x000000010000203C - size: 27 - offset: 0x0000203C - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __debug_pubtypes - segname: __DWARF - addr: 0x0000000100002057 - size: 26 - offset: 0x00002057 - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __debug_aranges - segname: __DWARF - addr: 0x0000000100002071 - size: 48 - offset: 0x00002071 - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __debug_info - segname: __DWARF - addr: 0x00000001000020A1 - size: 75 - offset: 0x000020A1 - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __debug_abbrev - segname: __DWARF - addr: 0x00000001000020EC - size: 52 - offset: 0x000020EC - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __debug_str - segname: __DWARF - addr: 0x0000000100002120 - size: 28 - offset: 0x00002120 - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __apple_names - segname: __DWARF - addr: 0x0000000100002160 - size: 60 - offset: 0x00002160 - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __apple_namespac - segname: __DWARF - addr: 0x000000010000219C - size: 36 - offset: 0x0000219C - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __apple_types - segname: __DWARF - addr: 0x00000001000021C0 - size: 79 - offset: 0x000021C0 - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 - - sectname: __apple_objc - segname: __DWARF - addr: 0x000000010000220F - size: 36 - offset: 0x0000220F - align: 0 - reloff: 0x00000000 - nreloc: 0 - flags: 0x00000000 - reserved1: 0x00000000 - reserved2: 0x00000000 - reserved3: 0x00000000 -LinkEditData: - NameList: - - n_strx: 2 - n_type: 0x0F - n_sect: 1 - n_desc: 16 - n_value: 4294967296 - - n_strx: 22 - n_type: 0x0F - n_sect: 1 - n_desc: 0 - n_value: 4294971296 - StringTable: - - '' - - '' - - __mh_execute_header - - _main -DWARF: - debug_str: - - '' - - obj2yaml - - main.c - - . - - main - - int - debug_abbrev: - - Code: 0x00000001 - Tag: DW_TAG_compile_unit - Children: DW_CHILDREN_yes - Attributes: - - Attribute: DW_AT_producer - Form: DW_FORM_strp - - Attribute: DW_AT_language - Form: DW_FORM_data2 - - Attribute: DW_AT_name - Form: DW_FORM_strp - - Attribute: DW_AT_stmt_list - Form: DW_FORM_sec_offset - - Attribute: DW_AT_comp_dir - Form: DW_FORM_strp - - Attribute: DW_AT_low_pc - Form: DW_FORM_addr - - Attribute: DW_AT_high_pc - Form: DW_FORM_data4 - - Code: 0x00000002 - Tag: DW_TAG_subprogram - Children: DW_CHILDREN_no - Attributes: - - Attribute: DW_AT_low_pc - Form: DW_FORM_addr - - Attribute: DW_AT_high_pc - Form: DW_FORM_data4 - - Attribute: DW_AT_frame_base - Form: DW_FORM_exprloc - - Attribute: DW_AT_name - Form: DW_FORM_strp - - Attribute: DW_AT_decl_file - Form: DW_FORM_data1 - - Attribute: DW_AT_decl_line - Form: DW_FORM_data1 - - Attribute: DW_AT_type - Form: DW_FORM_ref4 - - Attribute: DW_AT_external - Form: DW_FORM_flag_present - - Code: 0x00000003 - Tag: DW_TAG_base_type - Children: DW_CHILDREN_no - Attributes: - - Attribute: DW_AT_name - Form: DW_FORM_strp - - Attribute: DW_AT_encoding - Form: DW_FORM_data1 - - Attribute: DW_AT_byte_size - Form: DW_FORM_data1 - debug_aranges: - - Length: - TotalLength: 44 - Version: 2 - CuOffset: 0 - AddrSize: 8 - SegSize: 0 - Descriptors: - - Address: 0x0000000100000FA0 - Length: 15 - debug_pubnames: - Length: - TotalLength: 23 - Version: 2 - UnitOffset: 0 - UnitSize: 75 - Entries: - - DieOffset: 0x0000002A - Name: main - debug_pubtypes: - Length: - TotalLength: 22 - Version: 2 - UnitOffset: 0 - UnitSize: 75 - Entries: - - DieOffset: 0x00000043 - Name: int - debug_info: - - Length: - TotalLength: 71 - Version: 4 - AbbrOffset: 0 - AddrSize: 8 - Entries: - - AbbrCode: 0x00000001 - Values: - - Value: 0x0000000000000001 - - Value: 0x000000000000000C - - Value: 0x000000000000000A - - Value: 0x0000000000000000 - - Value: 0x0000000000000011 - - Value: 0x0000000100000FA0 - - Value: 0x000000000000000F - - AbbrCode: 0x00000002 - Values: - - Value: 0x0000000100000FA0 - - Value: 0x000000000000000F - - Value: 0x0000000000000001 - BlockData: - - 0x56 - - Value: 0x0000000000000013 - - Value: 0x0000000000000001 - - Value: 0x0000000000000001 - - Value: 0x0000000000000043 - - Value: 0x0000000000000001 - - AbbrCode: 0x00000003 - Values: - - Value: 0x0000000000000018 - - Value: 0x0000000000000005 - - Value: 0x0000000000000004 - - AbbrCode: 0x00000000 - Values: - debug_line: - - Length: - TotalLength: 56 - Version: 2 - PrologueLength: 29 - MinInstLength: 1 - DefaultIsStmt: 1 - LineBase: 251 - LineRange: 14 - OpcodeBase: 13 - StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] - IncludeDirs: - Files: - - Name: main.c - DirIdx: 0 - ModTime: 0 - Length: 0 - Opcodes: - - Opcode: DW_LNS_extended_op - ExtLen: 9 - SubOpcode: DW_LNE_set_address - Data: 4294971296 - - Opcode: DW_LNS_copy - Data: 4294971296 - - Opcode: DW_LNS_set_column - Data: 2 - - Opcode: DW_LNS_set_prologue_end - Data: 2 - - Opcode: 0xC9 - Data: 2 - - Opcode: DW_LNS_advance_pc - Data: 2 - - Opcode: DW_LNS_extended_op - ExtLen: 1 - SubOpcode: DW_LNE_end_sequence - Data: 2 -... diff --git a/packages/Python/lldbsuite/test/functionalities/stats/Makefile b/packages/Python/lldbsuite/test/functionalities/stats/Makefile deleted file mode 100644 index f5a47fcc46cc..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/stats/TestStats.py b/packages/Python/lldbsuite/test/functionalities/stats/TestStats.py deleted file mode 100644 index 48e49ed009ba..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/stats/main.c b/packages/Python/lldbsuite/test/functionalities/stats/main.c deleted file mode 100644 index 9adb3a09a080..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile b/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile deleted file mode 100644 index f5a47fcc46cc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../make -C_SOURCES := main.c -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py b/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py deleted file mode 100644 index f2027eb131c5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py +++ /dev/null @@ -1,37 +0,0 @@ -# Test the SBAPI for GetStatistics() - -import json -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestStatsAPI(TestBase): - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - def test_stats_api(self): - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - - # Test enabling/disabling stats - self.assertFalse(target.GetCollectingStats()) - target.SetCollectingStats(True) - self.assertTrue(target.GetCollectingStats()) - target.SetCollectingStats(False) - self.assertFalse(target.GetCollectingStats()) - - # Test the function to get the statistics in JSON'ish. - stats = target.GetStatistics() - stream = lldb.SBStream() - res = stats.GetAsJSON(stream) - stats_json = sorted(json.loads(stream.GetData())) - self.assertEqual(len(stats_json), 4) - self.assertTrue("Number of expr evaluation failures" in stats_json) - self.assertTrue("Number of expr evaluation successes" in stats_json) - self.assertTrue("Number of frame var failures" in stats_json) - self.assertTrue("Number of frame var successes" in stats_json) diff --git a/packages/Python/lldbsuite/test/functionalities/stats_api/main.c b/packages/Python/lldbsuite/test/functionalities/stats_api/main.c deleted file mode 100644 index 03b2213bb9a3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/stats_api/main.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile deleted file mode 100644 index 4f71dc87646d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := with-debug.c without-debug.c - -include $(LEVEL)/Makefile.rules - -without-debug.o: without-debug.c - $(CC) $(CFLAGS_NO_DEBUG) -c $< diff --git a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py deleted file mode 100644 index 446c2675f884..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py +++ /dev/null @@ -1,157 +0,0 @@ -""" -Test thread step-in, step-over and step-out work with the "Avoid no debug" option. -""" - -from __future__ import print_function - - -import os -import re -import sys - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StepAvoidsNoDebugTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_step_out_with_python(self): - """Test stepping out using avoid-no-debug with dsyms.""" - self.build() - self.get_to_starting_point() - self.do_step_out_past_nodebug() - - @add_test_categories(['pyapi']) - @decorators.expectedFailureAll( - compiler="gcc", bugnumber="llvm.org/pr28549") - @decorators.expectedFailureAll( - compiler="clang", - compiler_version=[ - ">=", - "3.9"], - archs=["i386"], - bugnumber="llvm.org/pr28549") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_step_over_with_python(self): - """Test stepping over using avoid-no-debug with dwarf.""" - self.build() - self.get_to_starting_point() - self.do_step_over_past_nodebug() - - @add_test_categories(['pyapi']) - @decorators.expectedFailureAll( - compiler="gcc", bugnumber="llvm.org/pr28549") - @decorators.expectedFailureAll( - compiler="clang", - compiler_version=[ - ">=", - "3.9"], - archs=["i386"], - bugnumber="llvm.org/pr28549") - @expectedFailureAll(oslist=["ios", "tvos", "bridgeos"], bugnumber="<rdar://problem/34026777>") # lldb doesn't step past last source line in function on arm64 - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_step_in_with_python(self): - """Test stepping in using avoid-no-debug with dwarf.""" - self.build() - self.get_to_starting_point() - self.do_step_in_past_nodebug() - - def setUp(self): - TestBase.setUp(self) - self.main_source = "with-debug.c" - self.main_source_spec = lldb.SBFileSpec("with-debug.c") - self.dbg.HandleCommand( - "settings set target.process.thread.step-out-avoid-nodebug true") - - def tearDown(self): - self.dbg.HandleCommand( - "settings set target.process.thread.step-out-avoid-nodebug false") - TestBase.tearDown(self) - - def hit_correct_line(self, pattern): - target_line = line_number(self.main_source, pattern) - self.assertTrue( - target_line != 0, - "Could not find source pattern " + - pattern) - cur_line = self.thread.frames[0].GetLineEntry().GetLine() - self.assertTrue( - cur_line == target_line, - "Stepped to line %d instead of expected %d with pattern '%s'." % - (cur_line, - target_line, - pattern)) - - def hit_correct_function(self, pattern): - name = self.thread.frames[0].GetFunctionName() - self.assertTrue( - pattern in name, "Got to '%s' not the expected function '%s'." % - (name, pattern)) - - def get_to_starting_point(self): - exe = self.getBuildArtifact("a.out") - error = lldb.SBError() - - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - inner_bkpt = self.target.BreakpointCreateBySourceRegex( - "Stop here and step out of me", self.main_source_spec) - self.assertTrue(inner_bkpt, VALID_BREAKPOINT) - - # 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, inner_bkpt) - self.assertTrue(len(threads) == 1, "Stopped at inner breakpoint.") - self.thread = threads[0] - - def do_step_out_past_nodebug(self): - # The first step out takes us to the called_from_nodebug frame, just to make sure setting - # step-out-avoid-nodebug doesn't change the behavior in frames with - # debug info. - self.thread.StepOut() - self.hit_correct_line( - "intermediate_return_value = called_from_nodebug_actual(some_value)") - self.thread.StepOut() - self.hit_correct_line( - "int return_value = no_debug_caller(5, called_from_nodebug)") - - def do_step_over_past_nodebug(self): - self.thread.StepOver() - self.hit_correct_line( - "intermediate_return_value = called_from_nodebug_actual(some_value)") - self.thread.StepOver() - self.hit_correct_line("return intermediate_return_value") - self.thread.StepOver() - # Note, lldb doesn't follow gdb's distinction between "step-out" and "step-over/step-in" - # when exiting a frame. In all cases we leave the pc at the point where we exited the - # frame. In gdb, step-over/step-in move to the end of the line they stepped out to. - # If we ever change this we will need to fix this test. - self.hit_correct_line( - "int return_value = no_debug_caller(5, called_from_nodebug)") - - def do_step_in_past_nodebug(self): - self.thread.StepInto() - self.hit_correct_line( - "intermediate_return_value = called_from_nodebug_actual(some_value)") - self.thread.StepInto() - self.hit_correct_line("return intermediate_return_value") - self.thread.StepInto() - # Note, lldb doesn't follow gdb's distinction between "step-out" and "step-over/step-in" - # when exiting a frame. In all cases we leave the pc at the point where we exited the - # frame. In gdb, step-over/step-in move to the end of the line they stepped out to. - # If we ever change this we will need to fix this test. - self.hit_correct_line( - "int return_value = no_debug_caller(5, called_from_nodebug)") diff --git a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/with-debug.c b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/with-debug.c deleted file mode 100644 index c7ac309d2c1a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/with-debug.c +++ /dev/null @@ -1,29 +0,0 @@ -#include <stdio.h> - -typedef int (*debug_callee) (int); - -extern int no_debug_caller (int, debug_callee); - -int -called_from_nodebug_actual(int some_value) -{ - int return_value = 0; - return_value = printf ("Length: %d.\n", some_value); - return return_value; // Stop here and step out of me -} - -int -called_from_nodebug(int some_value) -{ - int intermediate_return_value = 0; - intermediate_return_value = called_from_nodebug_actual(some_value); - return intermediate_return_value; -} - -int -main() -{ - int return_value = no_debug_caller(5, called_from_nodebug); - printf ("I got: %d.\n", return_value); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/without-debug.c b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/without-debug.c deleted file mode 100644 index d71d74af5e90..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/without-debug.c +++ /dev/null @@ -1,17 +0,0 @@ -typedef int (*debug_callee) (int); - -int -no_debug_caller_intermediate(int input, debug_callee callee) -{ - int return_value = 0; - return_value = callee(input); - return return_value; -} - -int -no_debug_caller (int input, debug_callee callee) -{ - int return_value = 0; - return_value = no_debug_caller_intermediate (input, callee); - return return_value; -} diff --git a/packages/Python/lldbsuite/test/functionalities/step_scripted/Makefile b/packages/Python/lldbsuite/test/functionalities/step_scripted/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step_scripted/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/step_scripted/Steps.py b/packages/Python/lldbsuite/test/functionalities/step_scripted/Steps.py deleted file mode 100644 index 1383a03f4647..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step_scripted/Steps.py +++ /dev/null @@ -1,37 +0,0 @@ -import lldb - -class StepWithChild: - def __init__(self, thread_plan): - self.thread_plan = thread_plan - self.child_thread_plan = self.queue_child_thread_plan() - - def explains_stop(self, event): - return False - - def should_stop(self, event): - if not self.child_thread_plan.IsPlanComplete(): - return False - - self.thread_plan.SetPlanComplete(True) - - return True - - def should_step(self): - return False - - def queue_child_thread_plan(self): - return None - -class StepOut(StepWithChild): - def __init__(self, thread_plan, dict): - StepWithChild.__init__(self, thread_plan) - - def queue_child_thread_plan(self): - return self.thread_plan.QueueThreadPlanForStepOut(0) - -class StepScripted(StepWithChild): - def __init__(self, thread_plan, dict): - StepWithChild.__init__(self, thread_plan) - - def queue_child_thread_plan(self): - return self.thread_plan.QueueThreadPlanForStepScripted("Steps.StepOut") diff --git a/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py b/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py deleted file mode 100644 index a111ede6739c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -Tests stepping with scripted thread plans. -""" - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * - -class StepScriptedTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - NO_DEBUG_INFO_TESTCASE = True - - def test_standard_step_out(self): - """Tests stepping with the scripted thread plan laying over a standard thread plan for stepping out.""" - self.build() - self.main_source_file = lldb.SBFileSpec("main.c") - self.step_out_with_scripted_plan("Steps.StepOut") - - def test_scripted_step_out(self): - """Tests stepping with the scripted thread plan laying over an another scripted thread plan for stepping out.""" - self.build() - self.main_source_file = lldb.SBFileSpec("main.c") - self.step_out_with_scripted_plan("Steps.StepScripted") - - def setUp(self): - TestBase.setUp(self) - self.runCmd("command script import Steps.py") - - def step_out_with_scripted_plan(self, name): - (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", self.main_source_file) - - frame = thread.GetFrameAtIndex(0) - self.assertEqual("foo", frame.GetFunctionName()) - - err = thread.StepUsingScriptedThreadPlan(name) - self.assertTrue(err.Success(), err.GetCString()) - - frame = thread.GetFrameAtIndex(0) - self.assertEqual("main", frame.GetFunctionName()) diff --git a/packages/Python/lldbsuite/test/functionalities/step_scripted/main.c b/packages/Python/lldbsuite/test/functionalities/step_scripted/main.c deleted file mode 100644 index 88b3c17125db..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/step_scripted/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> - -void foo() { - printf("Set a breakpoint here.\n"); -} - -int main() { - foo(); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/main.cpp deleted file mode 100644 index 48190184be10..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq1/main.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; //% self.filecheck("bt", "main.cpp") - // CHECK-NOT: func{{[23]}}_amb -} - -void __attribute__((noinline)) func3_amb() { sink(); /* tail */ } - -void __attribute__((noinline)) func2_amb() { sink(); /* tail */ } - -void __attribute__((noinline)) func1() { - if (x > 0) - func2_amb(); /* tail */ - else - func3_amb(); /* tail */ -} - -int __attribute__((disable_tail_calls)) main(int argc, char **) { - // The sequences `main -> func1 -> f{2,3}_amb -> sink` are both plausible. Test - // that lldb doesn't attempt to guess which one occurred. - func1(); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/main.cpp deleted file mode 100644 index 1651db2ea4a1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; //% self.filecheck("bt", "main.cpp") - // CHECK-NOT: func{{[23]}} -} - -void func2(); - -void __attribute__((noinline)) func1() { - if (x < 1) - func2(); - else - sink(); -} - -void __attribute__((noinline)) func2() { - if (x < 1) - sink(); - else - func1(); -} - -int main() { - // Tail recursion creates ambiguous execution histories. - x = 0; - func1(); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/main.cpp deleted file mode 100644 index d3aef19f7a4f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_call_site/main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial") - // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 [opt] - // CHECK-NEXT: func2{{.*}} [opt] [artificial] - // CHECK-NEXT: main{{.*}} [opt] -} - -void __attribute__((noinline)) func2() { - sink(); /* tail */ -} - -void __attribute__((noinline)) func1() { sink(); /* tail */ } - -int __attribute__((disable_tail_calls)) main(int argc, char **) { - // The sequences `main -> f{1,2} -> sink` are both plausible. Test that - // return-pc call site info allows lldb to pick the correct sequence. - func2(); - if (argc == 100) - func1(); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp deleted file mode 100644 index 5189218c4ef4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink2() { - x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=FROM-FUNC1") - // FROM-FUNC1: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]:{{.*}} [opt] - // FROM-FUNC1-NEXT: sink({{.*}} [opt] - // FROM-FUNC1-NEXT: func1{{.*}} [opt] [artificial] - // FROM-FUNC1-NEXT: main{{.*}} [opt] -} - -void __attribute__((noinline)) sink(bool called_from_main) { - if (called_from_main) { - x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=FROM-MAIN") - // FROM-MAIN: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]:{{.*}} [opt] - // FROM-MAIN-NEXT: main{{.*}} [opt] - } else { - sink2(); - } -} - -void __attribute__((noinline)) func1() { sink(false); /* tail */ } - -int __attribute__((disable_tail_calls)) main(int argc, char **) { - // When func1 tail-calls sink, make sure that the former appears in the - // backtrace. - sink(true); - func1(); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp deleted file mode 100644 index 3c723b8a3ee3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial") - // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 [opt] - // CHECK-NEXT: func3{{.*}} [opt] [artificial] - // CHECK-NEXT: func1{{.*}} [opt] [artificial] - // CHECK-NEXT: main{{.*}} [opt] -} - -void __attribute__((noinline)) func3() { sink(); /* tail */ } - -void __attribute__((noinline)) func2() { sink(); /* tail */ } - -void __attribute__((noinline)) func1() { func3(); /* tail */ } - -int __attribute__((disable_tail_calls)) main(int argc, char **) { - // The sequences `main -> func1 -> f{2,3} -> sink` are both plausible. Test - // that lldb picks the latter sequence. - func1(); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp deleted file mode 100644 index e4504ad151fa..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) tail_call_sink() { - x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=TAIL-CALL-SINK") - // TAIL-CALL-SINK: frame #0: 0x{{[0-9a-f]+}} a.out`tail_call_sink() at main.cpp:[[@LINE-1]]:4 [opt] - // TAIL-CALL-SINK-NEXT: func3{{.*}} [opt] [artificial] - // TAIL-CALL-SINK-NEXT: main{{.*}} [opt] - - // TODO: The backtrace should include inlinable_function_which_tail_calls. -} - -void __attribute__((always_inline)) inlinable_function_which_tail_calls() { - tail_call_sink(); -} - -void __attribute__((noinline)) func3() { - inlinable_function_which_tail_calls(); -} - -void __attribute__((always_inline)) inline_sink() { - x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=INLINE-SINK") - // INLINE-SINK: frame #0: 0x{{[0-9a-f]+}} a.out`func2() [inlined] inline_sink() at main.cpp:[[@LINE-1]]:4 [opt] - // INLINE-SINK-NEXT: func2{{.*}} [opt] - // INLINE-SINK-NEXT: func1{{.*}} [opt] [artificial] - // INLINE-SINK-NEXT: main{{.*}} [opt] -} - -void __attribute__((noinline)) func2() { inline_sink(); /* inlined */ } - -void __attribute__((noinline)) func1() { func2(); /* tail */ } - -int __attribute__((disable_tail_calls)) main() { - // First, call a function that tail-calls a function, which itself inlines - // a third function. - func1(); - - // Next, call a function which contains an inlined tail-call. - func3(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py deleted file mode 100644 index 038a0c45bf42..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py +++ /dev/null @@ -1,73 +0,0 @@ -""" -Test SB API support for identifying artificial (tail call) frames. -""" - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * - -class TestTailCallFrameSBAPI(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 - - @skipIf(compiler="clang", compiler_version=['<', '7.0']) - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265") - def test_tail_call_frame_sbapi(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) - - breakpoint = target.BreakpointCreateBySourceRegex("break here", - lldb.SBFileSpec("main.cpp")) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - error = lldb.SBError() - launch_info = lldb.SBLaunchInfo(None) - process = target.Launch(launch_info, error) - self.assertTrue(process, PROCESS_IS_VALID) - - # Did we hit our breakpoint? - threads = lldbutil.get_threads_stopped_at_breakpoint(process, - breakpoint) - self.assertEqual( - len(threads), 1, - "There should be a thread stopped at our breakpoint") - - self.assertEqual(breakpoint.GetHitCount(), 1) - - thread = threads[0] - - # Here's what we expect to see in the backtrace: - # frame #0: ... a.out`sink() at main.cpp:13:4 [opt] - # frame #1: ... a.out`func3() at main.cpp:14:1 [opt] [artificial] - # frame #2: ... a.out`func2() at main.cpp:18:62 [opt] - # frame #3: ... a.out`func1() at main.cpp:18:85 [opt] [artificial] - # frame #4: ... a.out`main at main.cpp:23:3 [opt] - names = ["sink", "func3", "func2", "func1", "main"] - artificiality = [False, True, False, True, False] - for idx, (name, is_artificial) in enumerate(zip(names, artificiality)): - frame = thread.GetFrameAtIndex(idx) - - # Use a relaxed substring check because function dislpay names are - # platform-dependent. E.g we see "void sink(void)" on Windows, but - # "sink()" on Darwin. This seems like a bug -- just work around it - # for now. - self.assertTrue(name in frame.GetDisplayFunctionName()) - self.assertEqual(frame.IsArtificial(), is_artificial) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/main.cpp deleted file mode 100644 index f9e84da51739..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; /* break here */ -} - -void __attribute__((noinline)) func3() { sink(); /* tail */ } - -void __attribute__((disable_tail_calls, noinline)) func2() { func3(); /* regular */ } - -void __attribute__((noinline)) func1() { func2(); /* tail */ } - -int __attribute__((disable_tail_calls)) main() { - func1(); /* regular */ - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/main.cpp deleted file mode 100644 index f2f11365df7a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_message/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; //% self.filecheck("finish", "main.cpp", "-implicit-check-not=artificial") - // CHECK: stop reason = step out - // CHECK-NEXT: Stepped out past: frame #1: 0x{{[0-9a-f]+}} a.out`func3{{.*}} [opt] [artificial] - // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`func2{{.*}} [opt] -} - -void __attribute__((noinline)) func3() { sink(); /* tail */ } - -void __attribute__((disable_tail_calls, noinline)) func2() { func3(); /* regular */ } - -void __attribute__((noinline)) func1() { func2(); /* tail */ } - -int __attribute__((disable_tail_calls)) main() { - func1(); /* regular */ - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py deleted file mode 100644 index 2b432e56a740..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Test SB API support for identifying artificial (tail call) frames. -""" - -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * - -class TestArtificialFrameThreadStepOut1(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 prepare_thread(self): - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - breakpoint = target.BreakpointCreateBySourceRegex("break here", - lldb.SBFileSpec("main.cpp")) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - error = lldb.SBError() - launch_info = lldb.SBLaunchInfo(None) - process = target.Launch(launch_info, error) - self.assertTrue(process, PROCESS_IS_VALID) - - # Did we hit our breakpoint? - threads = lldbutil.get_threads_stopped_at_breakpoint(process, - breakpoint) - self.assertEqual( - len(threads), 1, - "There should be a thread stopped at our breakpoint") - - self.assertEqual(breakpoint.GetHitCount(), 1) - - thread = threads[0] - - # Here's what we expect to see in the backtrace: - # frame #0: ... a.out`sink() at main.cpp:13:4 [opt] - # frame #1: ... a.out`func3() at main.cpp:14:1 [opt] [artificial] - # frame #2: ... a.out`func2() at main.cpp:18:62 [opt] - # frame #3: ... a.out`func1() at main.cpp:18:85 [opt] [artificial] - # frame #4: ... a.out`main at main.cpp:23:3 [opt] - return thread - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265") - def test_stepping_out_past_artificial_frame(self): - self.build() - thread = self.prepare_thread() - - # Frame #0's ancestor is artificial. Stepping out should move to - # frame #2, because we behave as-if artificial frames were not present. - thread.StepOut() - frame2 = thread.GetSelectedFrame() - self.assertEqual(frame2.GetDisplayFunctionName(), "func2()") - self.assertFalse(frame2.IsArtificial()) - - # Ditto: stepping out of frame #2 should move to frame #4. - thread.StepOut() - frame4 = thread.GetSelectedFrame() - self.assertEqual(frame4.GetDisplayFunctionName(), "main") - self.assertFalse(frame2.IsArtificial()) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265") - def test_return_past_artificial_frame(self): - self.build() - thread = self.prepare_thread() - - value = lldb.SBValue() - - # Frame #0's ancestor is artificial. Returning from frame #0 should move - # to frame #2. - thread.ReturnFromFrame(thread.GetSelectedFrame(), value) - frame2 = thread.GetSelectedFrame() - self.assertEqual(frame2.GetDisplayFunctionName(), "func2()") - self.assertFalse(frame2.IsArtificial()) - - # Ditto: stepping out of frame #2 should move to frame #4. - thread.ReturnFromFrame(thread.GetSelectedFrame(), value) - frame4 = thread.GetSelectedFrame() - self.assertEqual(frame4.GetDisplayFunctionName(), "main") - self.assertFalse(frame2.IsArtificial()) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/main.cpp deleted file mode 100644 index f7a81873906e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; // break here -} - -void __attribute__((noinline)) func3() { sink(); /* tail */ } - -void __attribute__((disable_tail_calls, noinline)) func2() { func3(); /* regular */ } - -void __attribute__((noinline)) func1() { func2(); /* tail */ } - -int __attribute__((disable_tail_calls)) main() { - func1(); /* regular */ - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/Makefile b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/Makefile deleted file mode 100644 index 15bc2e7f415b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules -CXXFLAGS += -g -O1 -glldb diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py deleted file mode 100644 index aec4d503fd73..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py +++ /dev/null @@ -1,5 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipUnlessHasCallSiteInfo]) diff --git a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/main.cpp b/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/main.cpp deleted file mode 100644 index c180d45b9de6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tail_call_frames/unambiguous_sequence/main.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -volatile int x; - -void __attribute__((noinline)) sink() { - x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial") - // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 [opt] - // CHECK-NEXT: frame #1: 0x{{[0-9a-f]+}} a.out`func3{{.*}} [opt] [artificial] - // CHECK-NEXT: frame #2: 0x{{[0-9a-f]+}} a.out`func2{{.*}} [opt] - // CHECK-NEXT: frame #3: 0x{{[0-9a-f]+}} a.out`func1{{.*}} [opt] [artificial] - // CHECK-NEXT: frame #4: 0x{{[0-9a-f]+}} a.out`main{{.*}} [opt] -} - -void __attribute__((noinline)) func3() { sink(); /* tail */ } - -void __attribute__((disable_tail_calls, noinline)) func2() { func3(); /* regular */ } - -void __attribute__((noinline)) func1() { func2(); /* tail */ } - -int __attribute__((disable_tail_calls)) main() { - func1(); /* regular */ - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/target_command/Makefile b/packages/Python/lldbsuite/test/functionalities/target_command/Makefile deleted file mode 100644 index 9117ab9388b7..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py b/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py deleted file mode 100644 index 71bfff1d05d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py +++ /dev/null @@ -1,277 +0,0 @@ -""" -Test some target commands: create, list, select, variable. -""" - -from __future__ import print_function - - -import lldb -import sys -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 test_target_command(self): - """Test some target commands: create, list, select.""" - da = {'C_SOURCES': 'a.c', 'EXE': self.getBuildArtifact('a.out')} - self.build(dictionary=da) - self.addTearDownCleanup(dictionary=da) - - db = {'C_SOURCES': 'b.c', 'EXE': self.getBuildArtifact('b.out')} - self.build(dictionary=db) - self.addTearDownCleanup(dictionary=db) - - dc = {'C_SOURCES': 'c.c', 'EXE': self.getBuildArtifact('c.out')} - self.build(dictionary=dc) - self.addTearDownCleanup(dictionary=dc) - - self.do_target_command() - - # rdar://problem/9763907 - # 'target variable' command fails if the target program has been run - @expectedFailureAndroid(archs=['aarch64']) - 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') - - @expectedFailureAndroid(archs=['aarch64']) - 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'"]) diff --git a/packages/Python/lldbsuite/test/functionalities/target_command/a.c b/packages/Python/lldbsuite/test/functionalities/target_command/a.c deleted file mode 100644 index 9d0706a0862d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_command/a.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/target_command/b.c b/packages/Python/lldbsuite/test/functionalities/target_command/b.c deleted file mode 100644 index 62ec97f43284..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_command/b.c +++ /dev/null @@ -1,13 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main (int argc, char const *argv[]) -{ - return 0; // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/functionalities/target_command/c.c b/packages/Python/lldbsuite/test/functionalities/target_command/c.c deleted file mode 100644 index 7c362cc437af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_command/c.c +++ /dev/null @@ -1,29 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/target_command/globals.c b/packages/Python/lldbsuite/test/functionalities/target_command/globals.c deleted file mode 100644 index 6902bc415681..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_command/globals.c +++ /dev/null @@ -1,25 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/target_create_deps/Makefile b/packages/Python/lldbsuite/test/functionalities/target_create_deps/Makefile deleted file mode 100644 index 15cb0b64f218..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py b/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py deleted file mode 100644 index a6c383ce3c80..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py +++ /dev/null @@ -1,100 +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"]) #linux does not support loading dependent files - 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"]) #linux does not support loading dependent files - 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"]) #linux does not support loading dependent files - 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) - - 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"]) #linux does not support loading dependent files - 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/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.cpp b/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.cpp deleted file mode 100644 index c0dac40d0eed..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.cpp +++ /dev/null @@ -1,13 +0,0 @@ -//===-- b.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int a_function () -{ - return 500; -} diff --git a/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.mk b/packages/Python/lldbsuite/test/functionalities/target_create_deps/a.mk deleted file mode 100644 index f199bfed5b0d..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/target_create_deps/main.cpp b/packages/Python/lldbsuite/test/functionalities/target_create_deps/main.cpp deleted file mode 100644 index 08fbb59d8a58..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_create_deps/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -extern int a_function (); -extern int b_function (); - -int -main (int argc, char const *argv[]) -{ - return a_function(); -} diff --git a/packages/Python/lldbsuite/test/functionalities/target_var/Makefile b/packages/Python/lldbsuite/test/functionalities/target_var/Makefile deleted file mode 100644 index bb9cc4f2f66d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_var/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -LEVEL = ../../make - -include $(LEVEL)/Makefile.rules - -a.out: globals.ll - $(CC) $(CFLAGS) -g -c $^ -o globals.o - $(LD) $(LDFLAGS) -g globals.o -o $@ - -clean:: - rm -rf globals.o a.out *.dSYM diff --git a/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py b/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py deleted file mode 100644 index d3afacca72f5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -Test that target var can resolve complex DWARF expressions. -""" - -import lldb -import sys -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class targetCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @skipIfDarwinEmbedded # needs x86_64 - @skipIf(debug_info="gmodules") # not relevant - @skipIf(compiler="clang", compiler_version=['<', '7.0']) - def testTargetVarExpr(self): - self.build() - lldbutil.run_to_name_breakpoint(self, 'main') - self.expect("target variable i", substrs=['i', '42']) diff --git a/packages/Python/lldbsuite/test/functionalities/target_var/globals.c b/packages/Python/lldbsuite/test/functionalities/target_var/globals.c deleted file mode 100644 index 266192849641..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_var/globals.c +++ /dev/null @@ -1,6 +0,0 @@ -int i = 42; -int *p = &i; - -int main() { - return *p; -} diff --git a/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll b/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll deleted file mode 100644 index 192d4e126981..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll +++ /dev/null @@ -1,42 +0,0 @@ -source_filename = "globals.c" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.14.0" - -@i = global i32 42, align 4 -@p = global i32* @i, align 8, !dbg !0, !dbg !6 - -; Function Attrs: noinline nounwind optnone ssp uwtable -define i32 @main() #0 !dbg !15 { -entry: - %retval = alloca i32, align 4 - store i32 0, i32* %retval, align 4 - %0 = load i32*, i32** @p, align 8, !dbg !18 - %1 = load i32, i32* %0, align 4, !dbg !18 - ret i32 %1, !dbg !18 -} - -attributes #0 = { noinline nounwind optnone ssp uwtable } - -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!10, !11, !12, !13} -!llvm.ident = !{!14} - -!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_deref)) -!1 = distinct !DIGlobalVariable(name: "i", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, emissionKind: FullDebug, globals: !5) -!3 = !DIFile(filename: "globals.c", directory: "/") -!4 = !{} -!5 = !{!0, !6} -!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) -!7 = distinct !DIGlobalVariable(name: "p", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: true) -!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64) -!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!10 = !{i32 2, !"Dwarf Version", i32 4} -!11 = !{i32 2, !"Debug Info Version", i32 3} -!12 = !{i32 1, !"wchar_size", i32 4} -!13 = !{i32 7, !"PIC Level", i32 2} -!14 = !{!"clang version 8.0.0 (trunk 340838) (llvm/trunk 340843)"} -!15 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 4, type: !16, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: false, unit: !2, retainedNodes: !4) -!16 = !DISubroutineType(types: !17) -!17 = !{!9} -!18 = !DILocation(line: 5, scope: !15) diff --git a/packages/Python/lldbsuite/test/functionalities/testid/TestTestId.py b/packages/Python/lldbsuite/test/functionalities/testid/TestTestId.py deleted file mode 100644 index a594ad2c9e44..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/testid/TestTestId.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Add a test to verify our test instance returns something non-None for -an id(). Other parts of the test running infrastructure are counting on this. -""" - -from __future__ import print_function -from lldbsuite.test.lldbtest import TestBase - -class TestIdTestCase(TestBase): - - NO_DEBUG_INFO_TESTCASE = True - - mydir = TestBase.compute_mydir(__file__) - - def test_id_exists(self): - self.assertIsNotNone(self.id(), "Test instance should have an id()") - diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/Makefile deleted file mode 100644 index 24e68012ebd3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -CXXFLAGS += -std=c++11 -CXX_SOURCES := ParallelTask.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/ParallelTask.cpp b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/ParallelTask.cpp deleted file mode 100755 index 8e0f76f691b9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/ParallelTask.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include <cstdint> -#include <thread> -#include <vector> -#include <queue> -#include <functional> -#include <future> -#include <iostream> -#include <cassert> - -class TaskPoolImpl -{ -public: - TaskPoolImpl(uint32_t num_threads) : - m_stop(false) - { - for (uint32_t i = 0; i < num_threads; ++i) - m_threads.emplace_back(Worker, this); - } - - ~TaskPoolImpl() - { - Stop(); - } - - template<typename F, typename... Args> - std::future<typename std::result_of<F(Args...)>::type> - AddTask(F&& f, Args&&... args) - { - auto task = std::make_shared<std::packaged_task<typename std::result_of<F(Args...)>::type()>>( - std::bind(std::forward<F>(f), std::forward<Args>(args)...)); - - std::unique_lock<std::mutex> lock(m_tasks_mutex); - assert(!m_stop && "Can't add task to TaskPool after it is stopped"); - m_tasks.emplace([task](){ (*task)(); }); - lock.unlock(); - m_tasks_cv.notify_one(); - - return task->get_future(); - } - - void - Stop() - { - std::unique_lock<std::mutex> lock(m_tasks_mutex); - m_stop = true; - m_tasks_mutex.unlock(); - m_tasks_cv.notify_all(); - for (auto& t : m_threads) - t.join(); - } - -private: - static void - Worker(TaskPoolImpl* pool) - { - while (true) - { - std::unique_lock<std::mutex> lock(pool->m_tasks_mutex); - if (pool->m_tasks.empty()) - pool->m_tasks_cv.wait(lock, [pool](){ return !pool->m_tasks.empty() || pool->m_stop; }); - if (pool->m_tasks.empty()) - break; - - std::function<void()> f = pool->m_tasks.front(); - pool->m_tasks.pop(); - lock.unlock(); - - f(); - } - } - - std::queue<std::function<void()>> m_tasks; - std::mutex m_tasks_mutex; - std::condition_variable m_tasks_cv; - bool m_stop; - std::vector<std::thread> m_threads; -}; - -class TaskPool -{ -public: - // Add a new task to the thread pool and return a std::future belongs for the newly created task. - // The caller of this function have to wait on the future for this task to complete. - template<typename F, typename... Args> - static std::future<typename std::result_of<F(Args...)>::type> - AddTask(F&& f, Args&&... args) - { - return GetImplementation().AddTask(std::forward<F>(f), std::forward<Args>(args)...); - } - - // Run all of the specified tasks on the thread pool and wait until all of them are finished - // before returning - template<typename... T> - static void - RunTasks(T&&... t) - { - RunTaskImpl<T...>::Run(std::forward<T>(t)...); - } - -private: - static TaskPoolImpl& - GetImplementation() - { - static TaskPoolImpl g_task_pool_impl(std::thread::hardware_concurrency()); - return g_task_pool_impl; - } - - template<typename... T> - struct RunTaskImpl; -}; - -template<typename H, typename... T> -struct TaskPool::RunTaskImpl<H, T...> -{ - static void - Run(H&& h, T&&... t) - { - auto f = AddTask(std::forward<H>(h)); - RunTaskImpl<T...>::Run(std::forward<T>(t)...); - f.wait(); - } -}; - -template<> -struct TaskPool::RunTaskImpl<> -{ - static void - Run() {} -}; - -int main() -{ - std::vector<std::future<uint32_t>> tasks; - for (int i = 0; i < 100000; ++i) - { - tasks.emplace_back(TaskPool::AddTask([](int i){ - uint32_t s = 0; - for (int j = 0; j <= i; ++j) - s += j; - return s; - }, - i)); - } - - for (auto& it : tasks) // Set breakpoint here - it.wait(); - - TaskPool::RunTasks( - []() { return 1; }, - []() { return "aaaa"; } - ); -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py deleted file mode 100644 index e2026267c60e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Test regression for Bug 25251. -""" - -import os -import time -import unittest2 -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointAfterJoinTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number for our breakpoint. - self.breakpoint = line_number( - 'ParallelTask.cpp', '// Set breakpoint here') - - # The android-arm compiler can't compile the inferior - @skipIfTargetAndroid(archs=["arm"]) - # because of an issue around std::future. - # TODO: Change the test to don't depend on std::future<T> - def test(self): - """Test breakpoint handling after a thread join.""" - self.build(dictionary=self.getBuildFlags()) - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint - lldbutil.run_break_set_by_file_and_line( - self, "ParallelTask.cpp", self.breakpoint, num_expected_locations=-1) - - # The breakpoint list should show 1 location. - self.expect( - "breakpoint list -f", - "Breakpoint location shown correctly", - substrs=[ - "1: file = 'ParallelTask.cpp', line = %d, exact_match = 0" % - self.breakpoint]) - - # 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']) - - # This should not result in a segmentation fault - self.expect("thread backtrace all", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - # Run to completion - self.runCmd("continue") - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/Makefile deleted file mode 100644 index f0bcf9752de2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -CXXFLAGS += -std=c++11 -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/TestBacktraceLimit.py b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/TestBacktraceLimit.py deleted file mode 100644 index 4e595ea4c5f6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/TestBacktraceLimit.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Test that the target.process.thread.max-backtrace-depth setting works. -""" - -import unittest2 -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BacktraceLimitSettingTest(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def test_backtrace_depth(self): - """Test that the max-backtrace-depth setting limits backtraces.""" - self.build() - self.main_source_file = lldb.SBFileSpec("main.cpp") - (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("settings set target.process.thread.max-backtrace-depth 30", result) - self.assertEqual(True, result.Succeeded()) - self.assertEqual(30, thread.GetNumFrames()) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/main.cpp deleted file mode 100644 index eca1eadc8e45..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_limit/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -int bottom () { - return 1; // Set a breakpoint here -} -int foo(int in) { - if (in > 0) - return foo(--in) + 5; - else - return bottom(); -} -int main() -{ - return foo(500); -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/Makefile deleted file mode 100644 index 67aa16625bff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py deleted file mode 100644 index cef24d688bf9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Test number of threads. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class BreakpointAfterJoinTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number for our breakpoint. - self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll( - oslist=lldbplatformutil.getDarwinOSTriples(), - bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr18190 thread states not properly maintained") - def test(self): - """Test breakpoint handling after a thread join.""" - self.build(dictionary=self.getBuildFlags()) - - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # The breakpoint list should show 1 location. - self.expect( - "breakpoint list -f", - "Breakpoint location shown correctly", - substrs=[ - "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.breakpoint]) - - # 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']) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - # The exit probably occurred during breakpoint handling, but it isn't - # guaranteed. The main thing we're testing here is that the debugger - # handles this cleanly is some way. - - # Get the number of threads - num_threads = process.GetNumThreads() - - # Make sure we see at least six threads - self.assertTrue( - num_threads >= 6, - 'Number of expected threads and actual threads do not match.') - - # Make sure all threads are stopped - for i in range(0, num_threads): - self.assertTrue( - process.GetThreadAtIndex(i).IsStopped(), - "Thread {0} didn't stop during breakpoint.".format(i)) - - # Run to completion - self.runCmd("continue") - - # If the process hasn't exited, collect some information - if process.GetState() != lldb.eStateExited: - self.runCmd("thread list") - self.runCmd("process status") - - # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, - PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/main.cpp deleted file mode 100644 index f06761936d12..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to create a situation in which one thread will exit -// while a breakpoint is being handled in another thread. This may not always -// happen because it's possible that the exiting thread will exit before the -// breakpoint is hit. The test case should be flexible enough to treat that -// as success. - -#include "pseudo_barrier.h" -#include <chrono> -#include <thread> - -volatile int g_test = 0; - -// A barrier to synchronize all the threads. -pseudo_barrier_t g_barrier1; - -// A barrier to keep the threads from exiting until after the breakpoint has -// been passed. -pseudo_barrier_t g_barrier2; - -void * -break_thread_func () -{ - // Wait until all the threads are running - pseudo_barrier_wait(g_barrier1); - - // Wait for the join thread to join - std::this_thread::sleep_for(std::chrono::microseconds(50)); - - // Do something - g_test++; // Set breakpoint here - - // Synchronize after the breakpoint - pseudo_barrier_wait(g_barrier2); - - // Return - return NULL; -} - -void * -wait_thread_func () -{ - // Wait until the entire first group of threads is running - pseudo_barrier_wait(g_barrier1); - - // Wait until the breakpoint has been passed - pseudo_barrier_wait(g_barrier2); - - // Return - return NULL; -} - -void * -join_thread_func (void *input) -{ - std::thread *thread_to_join = (std::thread *)input; - - // Sync up with the rest of the threads. - pseudo_barrier_wait(g_barrier1); - - // Join the other thread - thread_to_join->join(); - - // Return - return NULL; -} - -int main () -{ - // The first barrier waits for the non-joining threads to start. - // This thread will also participate in that barrier. - // The idea here is to guarantee that the joining thread will be - // last in the internal list maintained by the debugger. - pseudo_barrier_init(g_barrier1, 5); - - // The second barrier keeps the waiting threads around until the breakpoint - // has been passed. - pseudo_barrier_init(g_barrier2, 4); - - // Create a thread to hit the breakpoint - std::thread thread_1(break_thread_func); - - // Create more threads to slow the debugger down during processing. - std::thread thread_2(wait_thread_func); - std::thread thread_3(wait_thread_func); - std::thread thread_4(wait_thread_func); - - // Create a thread to join the breakpoint thread - std::thread thread_5(join_thread_func, &thread_1); - - // Wait for the threads to finish - thread_5.join(); // implies thread_1 is already finished - thread_4.join(); - thread_3.join(); - thread_2.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile deleted file mode 100644 index 469c0809aa24..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp - -ENABLE_THREADS := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointDelayBreakpointOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointDelayBreakpointOneSignal.py deleted file mode 100644 index 2506a8231883..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointDelayBreakpointOneSignal.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentBreakpointDelayBreakpointOneSignal(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test two threads that trigger a breakpoint (one with a 1 second delay) and one signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, - num_delay_breakpoint_threads=1, - num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointOneDelayBreakpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointOneDelayBreakpointThreads.py deleted file mode 100644 index 8712342e5811..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointOneDelayBreakpointThreads.py +++ /dev/null @@ -1,22 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentBreakpointOneDelayBreakpointThreads(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test threads that trigger a breakpoint where one thread has a 1 second delay. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, - num_delay_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py deleted file mode 100644 index 275d54d2149c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py +++ /dev/null @@ -1,25 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentBreakpointsDelayedBreakpointOneWatchpoint( - ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test a breakpoint, a delayed breakpoint, and one watchpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, - num_delay_breakpoint_threads=1, - num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithBreak.py deleted file mode 100644 index 33d1074211ee..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithBreak.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentCrashWithBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """ Test a thread that crashes while another thread hits a breakpoint.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithSignal.py deleted file mode 100644 index 560c79ed8a8f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithSignal.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentCrashWithSignal(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """ Test a thread that crashes while another thread generates a signal.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpoint.py deleted file mode 100644 index c9cc6db96004..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpoint.py +++ /dev/null @@ -1,22 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentCrashWithWatchpoint(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """ Test a thread that crashes while another thread hits a watchpoint.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py deleted file mode 100644 index d99107b6e9b6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py +++ /dev/null @@ -1,25 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentCrashWithWatchpointBreakpointSignal(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """ Test a thread that crashes while other threads generate a signal and hit a watchpoint and breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, - num_breakpoint_threads=1, - num_signal_threads=1, - num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalBreak.py deleted file mode 100644 index 442134f4a0c7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalBreak.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentDelaySignalBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test (1-second delay) signal and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_breakpoint_threads=1, - num_delay_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalWatch.py deleted file mode 100644 index 28c5c68d4506..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalWatch.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentDelaySignalWatch(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test a watchpoint and a (1 second delay) signal in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_delay_signal_threads=1, - num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayWatchBreak.py deleted file mode 100644 index 2d7c984e0e1c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayWatchBreak.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentDelayWatchBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test (1-second delay) watchpoint and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_breakpoint_threads=1, - num_delay_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointSignal.py deleted file mode 100644 index 2b7e1b457268..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointSignal.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentDelayedCrashWithBreakpointSignal(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """ Test a thread with a delayed crash while other threads generate a signal and hit a breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_delay_crash_threads=1, - num_breakpoint_threads=1, - num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py deleted file mode 100644 index 0564c86dfcbd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentDelayedCrashWithBreakpointWatchpoint(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """ Test a thread with a delayed crash while other threads hit a watchpoint and a breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_delay_crash_threads=1, - num_breakpoint_threads=1, - num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py deleted file mode 100644 index a9f3fbb799f1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentManyBreakpoints(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @unittest2.skipIf( - TestBase.skipLongRunningTest(), - "Skip this long running test") - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test 100 breakpoints from 100 threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py deleted file mode 100644 index 88ab1d5e204c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentManyCrash(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @unittest2.skipIf( - TestBase.skipLongRunningTest(), - "Skip this long running test") - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test 100 threads that cause a segfault.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py deleted file mode 100644 index 232b694c80f4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentManySignals(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @unittest2.skipIf( - TestBase.skipLongRunningTest(), - "Skip this long running test") - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test 100 signals from 100 threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py deleted file mode 100644 index 96b610f2b90b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentManyWatchpoints(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @unittest2.skipIf( - TestBase.skipLongRunningTest(), - "Skip this long running test") - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test 100 watchpoints from 100 threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentNWatchNBreak.py deleted file mode 100644 index b921ac04ccc5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentNWatchNBreak.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentNWatchNBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test with 5 watchpoint and breakpoint threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=5, - num_breakpoint_threads=5) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalBreak.py deleted file mode 100644 index b8819f286984..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalBreak.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentSignalBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test signal and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalDelayBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalDelayBreak.py deleted file mode 100644 index b7d8cb174d24..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalDelayBreak.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentSignalDelayBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test signal and a (1 second delay) breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_delay_breakpoint_threads=1, - num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalDelayWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalDelayWatch.py deleted file mode 100644 index 2f3b858854b8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalDelayWatch.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentSignalDelayWatch(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test a (1 second delay) watchpoint and a signal in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_signal_threads=1, - num_delay_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalNWatchNBreak.py deleted file mode 100644 index ebb13d99fb3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalNWatchNBreak.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentSignalNWatchNBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test one signal thread with 5 watchpoint and breakpoint threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=1, - num_watchpoint_threads=5, - num_breakpoint_threads=5) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalWatch.py deleted file mode 100644 index 0fbaf364045d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalWatch.py +++ /dev/null @@ -1,22 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentSignalWatch(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test a watchpoint and a signal in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=1, num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalWatchBreak.py deleted file mode 100644 index 53da6658550d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalWatchBreak.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentSignalWatchBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test a signal/watchpoint/breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=1, - num_watchpoint_threads=1, - num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointThreads.py deleted file mode 100644 index 4e6bed2d5cbc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointThreads.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoBreakpointThreads(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test two threads that trigger a breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=2) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneDelaySignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneDelaySignal.py deleted file mode 100644 index d7630575cb34..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneDelaySignal.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoBreakpointsOneDelaySignal(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test two threads that trigger a breakpoint and one (1 second delay) signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_breakpoint_threads=2, - num_delay_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneSignal.py deleted file mode 100644 index 4c4caa533734..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneSignal.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoBreakpointsOneSignal(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - def test(self): - """Test two threads that trigger a breakpoint and one signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=2, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneWatchpoint.py deleted file mode 100644 index 687be17ddc5a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneWatchpoint.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoBreakpointsOneWatchpoint(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test two threads that trigger a breakpoint and one watchpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_breakpoint_threads=2, - num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointThreads.py deleted file mode 100644 index 025d91169451..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointThreads.py +++ /dev/null @@ -1,22 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoWatchpointThreads(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test two threads that trigger a watchpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=2) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneBreakpoint.py deleted file mode 100644 index 5e95531ae09a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneBreakpoint.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoWatchpointsOneBreakpoint(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test two threads that trigger a watchpoint and one breakpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_watchpoint_threads=2, - num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py deleted file mode 100644 index aa57e816bb58..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoWatchpointsOneDelayBreakpoint(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test two threads that trigger a watchpoint and one (1 second delay) breakpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_watchpoint_threads=2, - num_delay_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneSignal.py deleted file mode 100644 index 31b583c1a65a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneSignal.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentTwoWatchpointsOneSignal(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @expectedFailureAll(bugnumber="llvm.org/pr35228", archs=["arm", "aarch64"]) - @add_test_categories(["watchpoint"]) - def test(self): - """Test two threads that trigger a watchpoint and one signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=2, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreak.py deleted file mode 100644 index 241ea5b64a03..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreak.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentWatchBreak(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test watchpoint and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_breakpoint_threads=1, - num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreakDelay.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreakDelay.py deleted file mode 100644 index 79a54b620e53..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreakDelay.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentWatchBreakDelay(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test watchpoint and a (1 second delay) breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions( - num_delay_breakpoint_threads=1, - num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py deleted file mode 100644 index 6a37abdbcbb8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentWatchpointDelayWatchpointOneBreakpoint(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test two threads that trigger a watchpoint (one with a 1 second delay) and one breakpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=1, - num_delay_watchpoint_threads=1, - num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointWithDelayWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointWithDelayWatchpointThreads.py deleted file mode 100644 index 67ac92b853cd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointWithDelayWatchpointThreads.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import print_function - -import unittest2 - -from lldbsuite.test.decorators import * -from lldbsuite.test.concurrent_base import ConcurrentEventsBase -from lldbsuite.test.lldbtest import TestBase - - -@skipIfWindows -class ConcurrentWatchpointWithDelayWatchpointThreads(ConcurrentEventsBase): - - mydir = ConcurrentEventsBase.compute_mydir(__file__) - - @skipIfFreeBSD # timing out on buildbot - # Atomic sequences are not supported yet for MIPS in LLDB. - @skipIf(triple='^mips') - @add_test_categories(["watchpoint"]) - def test(self): - """Test two threads that trigger a watchpoint where one thread has a 1 second delay. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=1, - num_delay_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp deleted file mode 100644 index c888aa0b6eb6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/main.cpp +++ /dev/null @@ -1,188 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to create a situation in which multiple events -// (breakpoints, watchpoints, crashes, and signal generation/delivery) happen -// from multiple threads. The test expects the debugger to set a breakpoint on -// the main thread (before any worker threads are spawned) and modify variables -// which control the number of threads that are spawned for each action. - -#include "pseudo_barrier.h" -#include <vector> -using namespace std; - -#include <pthread.h> - -#include <signal.h> -#include <sys/types.h> -#include <unistd.h> - -typedef std::vector<std::pair<unsigned, void*(*)(void*)> > action_counts; -typedef std::vector<pthread_t> thread_vector; - -pseudo_barrier_t g_barrier; -int g_breakpoint = 0; -int g_sigusr1_count = 0; -uint32_t g_watchme; - -struct action_args { - int delay; -}; - -// Perform any extra actions required by thread 'input' arg -void do_action_args(void *input) { - if (input) { - action_args *args = static_cast<action_args*>(input); - sleep(args->delay); - } -} - -void * -breakpoint_func (void *input) -{ - // Wait until all threads are running - pseudo_barrier_wait(g_barrier); - do_action_args(input); - - // Do something - g_breakpoint++; // Set breakpoint here - return 0; -} - -void * -signal_func (void *input) { - // Wait until all threads are running - pseudo_barrier_wait(g_barrier); - do_action_args(input); - - // Send a user-defined signal to the current process - //kill(getpid(), SIGUSR1); - // Send a user-defined signal to the current thread - pthread_kill(pthread_self(), SIGUSR1); - - return 0; -} - -void * -watchpoint_func (void *input) { - pseudo_barrier_wait(g_barrier); - do_action_args(input); - - g_watchme = 1; // watchpoint triggers here - return 0; -} - -void * -crash_func (void *input) { - pseudo_barrier_wait(g_barrier); - do_action_args(input); - - int *a = 0; - *a = 5; // crash happens here - return 0; -} - -void sigusr1_handler(int sig) { - if (sig == SIGUSR1) - g_sigusr1_count += 1; // Break here in signal handler -} - -/// Register a simple function for to handle signal -void register_signal_handler(int signal, void (*handler)(int)) -{ - sigset_t empty_sigset; - sigemptyset(&empty_sigset); - - struct sigaction action; - action.sa_sigaction = 0; - action.sa_mask = empty_sigset; - action.sa_flags = 0; - action.sa_handler = handler; - sigaction(SIGUSR1, &action, 0); -} - -void start_threads(thread_vector& threads, - action_counts& actions, - void* args = 0) { - action_counts::iterator b = actions.begin(), e = actions.end(); - for(action_counts::iterator i = b; i != e; ++i) { - for(unsigned count = 0; count < i->first; ++count) { - pthread_t t; - pthread_create(&t, 0, i->second, args); - threads.push_back(t); - } - } -} - -int dotest() -{ - g_watchme = 0; - - // Actions are triggered immediately after the thread is spawned - unsigned num_breakpoint_threads = 1; - unsigned num_watchpoint_threads = 0; - unsigned num_signal_threads = 1; - unsigned num_crash_threads = 0; - - // Actions below are triggered after a 1-second delay - unsigned num_delay_breakpoint_threads = 0; - unsigned num_delay_watchpoint_threads = 0; - unsigned num_delay_signal_threads = 0; - unsigned num_delay_crash_threads = 0; - - register_signal_handler(SIGUSR1, sigusr1_handler); // Break here and adjust num_[breakpoint|watchpoint|signal|crash]_threads - - unsigned total_threads = num_breakpoint_threads \ - + num_watchpoint_threads \ - + num_signal_threads \ - + num_crash_threads \ - + num_delay_breakpoint_threads \ - + num_delay_watchpoint_threads \ - + num_delay_signal_threads \ - + num_delay_crash_threads; - - // Don't let either thread do anything until they're both ready. - pseudo_barrier_init(g_barrier, total_threads); - - action_counts actions; - actions.push_back(std::make_pair(num_breakpoint_threads, breakpoint_func)); - actions.push_back(std::make_pair(num_watchpoint_threads, watchpoint_func)); - actions.push_back(std::make_pair(num_signal_threads, signal_func)); - actions.push_back(std::make_pair(num_crash_threads, crash_func)); - - action_counts delay_actions; - delay_actions.push_back(std::make_pair(num_delay_breakpoint_threads, breakpoint_func)); - delay_actions.push_back(std::make_pair(num_delay_watchpoint_threads, watchpoint_func)); - delay_actions.push_back(std::make_pair(num_delay_signal_threads, signal_func)); - delay_actions.push_back(std::make_pair(num_delay_crash_threads, crash_func)); - - // Create threads that handle instant actions - thread_vector threads; - start_threads(threads, actions); - - // Create threads that handle delayed actions - action_args delay_arg; - delay_arg.delay = 1; - start_threads(threads, delay_actions, &delay_arg); - - // Join all threads - typedef std::vector<pthread_t>::iterator thread_iterator; - for(thread_iterator t = threads.begin(); t != threads.end(); ++t) - pthread_join(*t, 0); - - return 0; -} - -int main () -{ - dotest(); - return 0; // Break here and verify one thread is active. -} - - diff --git a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/Makefile deleted file mode 100644 index 26db4816b6ea..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py deleted file mode 100644 index fa96db06a59d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Test that step-inst over a crash behaves correctly. -""" - -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 CrashDuringStepTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - - # IO error due to breakpoint at invalid address - @expectedFailureAll(triple=re.compile('^mips')) - def test_step_inst_with(self): - """Test thread creation during step-inst handling.""" - self.build(dictionary=self.getBuildFlags()) - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target and target.IsValid(), "Target is valid") - - self.bp_num = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # Run the program. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) - - # The stop reason should be breakpoint. - self.assertEqual( - process.GetState(), - lldb.eStateStopped, - PROCESS_STOPPED) - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertTrue(thread.IsValid(), STOPPED_DUE_TO_BREAKPOINT) - - # Keep stepping until the inferior crashes - while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread): - thread.StepInstruction(False) - - self.assertEqual( - process.GetState(), - lldb.eStateStopped, - PROCESS_STOPPED) - self.assertTrue( - lldbutil.is_thread_crashed( - self, - thread), - "Thread has crashed") - process.Kill() diff --git a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/main.cpp deleted file mode 100644 index 02f3ce338229..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -void (*crash)() = nullptr; - -int main() -{ - crash(); // Set breakpoint here - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/Makefile deleted file mode 100644 index 67aa16625bff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py deleted file mode 100644 index 2afa77d34b5e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py +++ /dev/null @@ -1,129 +0,0 @@ -""" -Test thread creation after process attach. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CreateAfterAttachTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfFreeBSD # Hangs. May be the same as Linux issue llvm.org/pr16229 but - # not yet investigated. Revisit once required functionality - # is implemented for FreeBSD. - # Occasionally hangs on Windows, may be same as other issues. - @skipIfWindows - @skipIfiOSSimulator - def test_create_after_attach_with_popen(self): - """Test thread creation after process attach.""" - self.build(dictionary=self.getBuildFlags(use_cpp11=False)) - self.create_after_attach(use_fork=False) - - @skipIfFreeBSD # Hangs. Revisit once required functionality is implemented - # for FreeBSD. - @skipIfRemote - @skipIfWindows # Windows doesn't have fork. - @skipIfiOSSimulator - def test_create_after_attach_with_fork(self): - """Test thread creation after process attach.""" - self.build(dictionary=self.getBuildFlags(use_cpp11=False)) - self.create_after_attach(use_fork=True) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers for our breakpoints. - self.break_1 = line_number('main.cpp', '// Set first breakpoint here') - self.break_2 = line_number('main.cpp', '// Set second breakpoint here') - self.break_3 = line_number('main.cpp', '// Set third breakpoint here') - - def create_after_attach(self, use_fork): - """Test thread creation after process attach.""" - - exe = self.getBuildArtifact("a.out") - - # Spawn a new process - if use_fork: - pid = self.forkSubprocess(exe) - else: - popen = self.spawnSubprocess(exe) - pid = popen.pid - self.addTearDownHook(self.cleanupSubprocesses) - - # Attach to the spawned process - self.runCmd("process attach -p " + str(pid)) - - target = self.dbg.GetSelectedTarget() - - process = target.GetProcess() - self.assertTrue(process, PROCESS_IS_VALID) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_1, num_expected_locations=1) - - # This should create a breakpoint in the second child thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_2, num_expected_locations=1) - - # This should create a breakpoint in the first child thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_3, num_expected_locations=1) - - # Note: With std::thread, we cannot rely on particular thread numbers. Using - # std::thread may cause the program to spin up a thread pool (and it does on - # Windows), so the thread numbers are non-deterministic. - - # Run to the first breakpoint - self.runCmd("continue") - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - '* thread #', - 'main', - 'stop reason = breakpoint']) - - # Change a variable to escape the loop - self.runCmd("expression main_thread_continue = 1") - - # Run to the second breakpoint - self.runCmd("continue") - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - '* thread #', - 'thread_2_func', - 'stop reason = breakpoint']) - - # Change a variable to escape the loop - self.runCmd("expression child_thread_continue = 1") - - # Run to the third breakpoint - self.runCmd("continue") - - # The stop reason of the thread should be breakpoint. - # Thread 3 may or may not have already exited. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - '* thread #', - 'thread_1_func', - 'stop reason = breakpoint']) - - # Run to completion - self.runCmd("continue") - - # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, - PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/main.cpp deleted file mode 100644 index d8f06e55a2dd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include <stdio.h> -#include <chrono> -#include <thread> - -using std::chrono::microseconds; - -volatile int g_thread_2_continuing = 0; - -void * -thread_1_func (void *input) -{ - // Waiting to be released by the debugger. - while (!g_thread_2_continuing) // Another thread will change this value - { - std::this_thread::sleep_for(microseconds(1)); - } - - // Return - return NULL; // Set third breakpoint here -} - -void * -thread_2_func (void *input) -{ - // Waiting to be released by the debugger. - int child_thread_continue = 0; - while (!child_thread_continue) // The debugger will change this value - { - std::this_thread::sleep_for(microseconds(1)); // Set second breakpoint here - } - - // Release thread 1 - g_thread_2_continuing = 1; - - // Return - return NULL; -} - -int main(int argc, char const *argv[]) -{ - lldb_enable_attach(); - - // Create a new thread - std::thread thread_1(thread_1_func, nullptr); - - // Waiting to be attached by the debugger. - int main_thread_continue = 0; - while (!main_thread_continue) // The debugger will change this value - { - std::this_thread::sleep_for(microseconds(1)); // Set first breakpoint here - } - - // Create another new thread - std::thread thread_2(thread_2_func, nullptr); - - // Wait for the threads to finish. - thread_1.join(); - thread_2.join(); - - printf("Exiting now\n"); -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/Makefile deleted file mode 100644 index 67aa16625bff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py deleted file mode 100644 index 9e30ba3e1345..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py +++ /dev/null @@ -1,154 +0,0 @@ -""" -Test number of threads. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CreateDuringStepTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll( - oslist=lldbplatformutil.getDarwinOSTriples(), - bugnumber="llvm.org/pr15824 thread states not properly maintained, <rdar://problem/28557237>") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") - def test_step_inst(self): - """Test thread creation during step-inst handling.""" - self.build(dictionary=self.getBuildFlags()) - self.create_during_step_base( - "thread step-inst -m all-threads", - 'stop reason = instruction step') - - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll( - oslist=lldbplatformutil.getDarwinOSTriples(), - bugnumber="llvm.org/pr15824 thread states not properly maintained, <rdar://problem/28557237>") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") - def test_step_over(self): - """Test thread creation during step-over handling.""" - self.build(dictionary=self.getBuildFlags()) - self.create_during_step_base( - "thread step-over -m all-threads", - 'stop reason = step over') - - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll( - oslist=lldbplatformutil.getDarwinOSTriples(), - bugnumber="<rdar://problem/28574077>") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") - def test_step_in(self): - """Test thread creation during step-in handling.""" - self.build(dictionary=self.getBuildFlags()) - self.create_during_step_base( - "thread step-in -m all-threads", - 'stop reason = step in') - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break and continue. - self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - self.continuepoint = line_number('main.cpp', '// Continue from here') - - def create_during_step_base(self, step_cmd, step_stop_reason): - """Test thread creation while using step-in.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Get the target process - target = self.dbg.GetSelectedTarget() - - # This should create a breakpoint in the stepping thread. - self.bkpt = target.BreakpointCreateByLocation("main.cpp", self.breakpoint) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - process = target.GetProcess() - - # The stop reason of the thread should be breakpoint. - stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, self.bkpt) - self.assertTrue(stepping_thread.IsValid(), "We stopped at the right breakpoint") - - # Get the number of threads - num_threads = process.GetNumThreads() - - # Make sure we see only two threads - self.assertTrue( - num_threads == 2, - 'Number of expected threads and actual threads do not match.') - - # Get the thread objects - thread1 = process.GetThreadAtIndex(0) - thread2 = process.GetThreadAtIndex(1) - - current_line = self.breakpoint - # Keep stepping until we've reached our designated continue point - while current_line != self.continuepoint: - if stepping_thread != process.GetSelectedThread(): - process.SetSelectedThread(stepping_thread) - - self.runCmd(step_cmd) - - frame = stepping_thread.GetFrameAtIndex(0) - current_line = frame.GetLineEntry().GetLine() - - # Make sure we're still where we thought we were - self.assertTrue( - current_line >= self.breakpoint, - "Stepped to unexpected line, " + - str(current_line)) - self.assertTrue( - current_line <= self.continuepoint, - "Stepped to unexpected line, " + - str(current_line)) - - # Update the number of threads - num_threads = process.GetNumThreads() - - # Check to see that we increased the number of threads as expected - self.assertTrue( - num_threads == 3, - 'Number of expected threads and actual threads do not match after thread exit.') - - stop_reason = stepping_thread.GetStopReason() - self.assertEqual(stop_reason, lldb.eStopReasonPlanComplete, "Stopped for plan completion") - - # Run to completion - self.runCmd("process continue") - - # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, - PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/main.cpp deleted file mode 100644 index f927e3d9d496..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/main.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to create a situation in which one thread will be -// created while the debugger is stepping in another thread. - -#include "pseudo_barrier.h" -#include <thread> - -#define do_nothing() - -pseudo_barrier_t g_barrier; - -volatile int g_thread_created = 0; -volatile int g_test = 0; - -void * -step_thread_func () -{ - g_test = 0; // Set breakpoint here - - while (!g_thread_created) - g_test++; - - // One more time to provide a continue point - g_test++; // Continue from here - - // Return - return NULL; -} - -void * -create_thread_func (void *input) -{ - std::thread *step_thread = (std::thread*)input; - - // Wait until the main thread knows this thread is started. - pseudo_barrier_wait(g_barrier); - - // Wait until the other thread is done. - step_thread->join(); - - // Return - return NULL; -} - -int main () -{ - // Use a simple count to simulate a barrier. - pseudo_barrier_init(g_barrier, 2); - - // Create a thread to hit the breakpoint. - std::thread thread_1(step_thread_func); - - // Wait until the step thread is stepping - while (g_test < 1) - do_nothing(); - - // Create a thread to exit while we're stepping. - std::thread thread_2(create_thread_func, &thread_1); - - // Wait until that thread is started - pseudo_barrier_wait(g_barrier); - - // Let the stepping thread know the other thread is there - g_thread_created = 1; - - // Wait for the threads to finish. - thread_2.join(); - thread_1.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/Makefile deleted file mode 100644 index 67aa16625bff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py deleted file mode 100644 index 76c2c47da2cf..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Test number of threads. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ExitDuringBreakpointTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number for our breakpoint. - self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - - def test(self): - """Test thread exit during breakpoint handling.""" - self.build(dictionary=self.getBuildFlags()) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # 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']) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - # The exit probably occurred during breakpoint handling, but it isn't - # guaranteed. The main thing we're testing here is that the debugger - # handles this cleanly is some way. - - # Get the number of threads - num_threads = process.GetNumThreads() - - # Make sure we see at least five threads - self.assertTrue( - num_threads >= 5, - 'Number of expected threads and actual threads do not match.') - - # Run to completion - self.runCmd("continue") - - # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, - PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp deleted file mode 100644 index 8fc1e42e96d0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/main.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to create a situation in which one thread will exit -// while a breakpoint is being handled in another thread. This may not always -// happen because it's possible that the exiting thread will exit before the -// breakpoint is hit. The test case should be flexible enough to treat that -// as success. - -#include "pseudo_barrier.h" -#include <chrono> -#include <thread> - -volatile int g_test = 0; - -// A barrier to synchronize all the threads except the one that will exit. -pseudo_barrier_t g_barrier1; - -// A barrier to synchronize all the threads including the one that will exit. -pseudo_barrier_t g_barrier2; - -// A barrier to keep the first group of threads from exiting until after the -// breakpoint has been passed. -pseudo_barrier_t g_barrier3; - -void * -break_thread_func () -{ - // Wait until the entire first group of threads is running - pseudo_barrier_wait(g_barrier1); - - // Wait for the exiting thread to start - pseudo_barrier_wait(g_barrier2); - - // Do something - g_test++; // Set breakpoint here - - // Synchronize after the breakpoint - pseudo_barrier_wait(g_barrier3); - - // Return - return NULL; -} - -void * -wait_thread_func () -{ - // Wait until the entire first group of threads is running - pseudo_barrier_wait(g_barrier1); - - // Wait for the exiting thread to start - pseudo_barrier_wait(g_barrier2); - - // Wait until the breakpoint has been passed - pseudo_barrier_wait(g_barrier3); - - // Return - return NULL; -} - -void * -exit_thread_func () -{ - // Sync up with the rest of the threads. - pseudo_barrier_wait(g_barrier2); - - // Try to make sure this thread doesn't exit until the breakpoint is hit. - std::this_thread::sleep_for(std::chrono::microseconds(1)); - - // Return - return NULL; -} - -int main () -{ - - // The first barrier waits for the non-exiting threads to start. - // This thread will also participate in that barrier. - // The idea here is to guarantee that the exiting thread will be - // last in the internal list maintained by the debugger. - pseudo_barrier_init(g_barrier1, 5); - - // The second break synchronizes thread execution with the breakpoint. - pseudo_barrier_init(g_barrier2, 5); - - // The third barrier keeps the waiting threads around until the breakpoint - // has been passed. - pseudo_barrier_init(g_barrier3, 4); - - // Create a thread to hit the breakpoint - std::thread thread_1(break_thread_func); - - // Create more threads to slow the debugger down during processing. - std::thread thread_2(wait_thread_func); - std::thread thread_3(wait_thread_func); - std::thread thread_4(wait_thread_func); - - // Wait for all these threads to get started. - pseudo_barrier_wait(g_barrier1); - - // Create a thread to exit during the breakpoint - std::thread thread_5(exit_thread_func); - - // Wait for the threads to finish - thread_5.join(); - thread_4.join(); - thread_3.join(); - thread_2.join(); - thread_1.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/Makefile deleted file mode 100644 index d06a7d4685f3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py deleted file mode 100644 index 76488a7185de..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py +++ /dev/null @@ -1,153 +0,0 @@ -""" -Test number of threads. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ExitDuringStepTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfFreeBSD # llvm.org/pr21411: test is hanging - @skipIfWindows # This is flakey on Windows: llvm.org/pr38373 - def test(self): - """Test thread exit during step handling.""" - self.build(dictionary=self.getBuildFlags()) - self.exit_during_step_base( - "thread step-inst -m all-threads", - 'stop reason = instruction step', - True) - - @skipIfFreeBSD # llvm.org/pr21411: test is hanging - @skipIfWindows # This is flakey on Windows: llvm.org/pr38373 - def test_step_over(self): - """Test thread exit during step-over handling.""" - self.build(dictionary=self.getBuildFlags()) - self.exit_during_step_base( - "thread step-over -m all-threads", - 'stop reason = step over', - False) - - @skipIfFreeBSD # llvm.org/pr21411: test is hanging - @skipIfWindows # This is flakey on Windows: llvm.org/pr38373 - def test_step_in(self): - """Test thread exit during step-in handling.""" - self.build(dictionary=self.getBuildFlags()) - self.exit_during_step_base( - "thread step-in -m all-threads", - 'stop reason = step in', - False) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break and continue. - self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - self.continuepoint = line_number('main.cpp', '// Continue from here') - - def exit_during_step_base(self, step_cmd, step_stop_reason, by_instruction): - """Test thread exit during step handling.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - self.bp_num = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # The breakpoint list should show 1 location. - self.expect( - "breakpoint list -f", - "Breakpoint location shown correctly", - substrs=[ - "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.breakpoint]) - - # 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']) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - num_threads = process.GetNumThreads() - # Make sure we see all three threads - self.assertGreaterEqual( - num_threads, - 3, - 'Number of expected threads and actual threads do not match.') - - stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( - process, self.bp_num) - self.assertIsNotNone( - stepping_thread, - "Could not find a thread stopped at the breakpoint") - - current_line = self.breakpoint - stepping_frame = stepping_thread.GetFrameAtIndex(0) - self.assertEqual( - current_line, - stepping_frame.GetLineEntry().GetLine(), - "Starting line for stepping doesn't match breakpoint line.") - - # Keep stepping until we've reached our designated continue point - while current_line != self.continuepoint: - # Since we're using the command interpreter to issue the thread command - # (on the selected thread) we need to ensure the selected thread is the - # stepping thread. - if stepping_thread != process.GetSelectedThread(): - process.SetSelectedThread(stepping_thread) - - self.runCmd(step_cmd) - - frame = stepping_thread.GetFrameAtIndex(0) - - current_line = frame.GetLineEntry().GetLine() - - if by_instruction and current_line == 0: - continue - - self.assertGreaterEqual( - current_line, - self.breakpoint, - "Stepped to unexpected line, " + - str(current_line)) - self.assertLessEqual( - current_line, - self.continuepoint, - "Stepped to unexpected line, " + - str(current_line)) - - self.runCmd("thread list") - - # Update the number of threads - new_num_threads = process.GetNumThreads() - - # Check to see that we reduced the number of threads as expected - self.assertEqual( - new_num_threads, - num_threads - 1, - 'Number of threads did not reduce by 1 after thread exit.') - - self.expect("thread list", 'Process state is stopped due to step', - substrs=['stopped', - step_stop_reason]) - - # Run to completion - self.runCmd("continue") - - # At this point, the inferior process should have exited. - self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/main.cpp deleted file mode 100644 index c7affd2a59ab..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/main.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to create a situation in which one thread will exit -// while the debugger is stepping in another thread. - -#include "pseudo_barrier.h" -#include <thread> - -#define do_nothing() - -// A barrier to synchronize thread start. -pseudo_barrier_t g_barrier; - -volatile int g_thread_exited = 0; - -volatile int g_test = 0; - -void * -step_thread_func () -{ - // Wait until both threads are started. - pseudo_barrier_wait(g_barrier); - - g_test = 0; // Set breakpoint here - - while (!g_thread_exited) - g_test++; - - // One more time to provide a continue point - g_test++; // Continue from here - - // Return - return NULL; -} - -void * -exit_thread_func () -{ - // Wait until both threads are started. - pseudo_barrier_wait(g_barrier); - - // Wait until the other thread is stepping. - while (g_test == 0) - do_nothing(); - - // Return - return NULL; -} - -int main () -{ - // Synchronize thread start so that doesn't happen during stepping. - pseudo_barrier_init(g_barrier, 2); - - // Create a thread to hit the breakpoint. - std::thread thread_1(step_thread_func); - - // Create a thread to exit while we're stepping. - std::thread thread_2(exit_thread_func); - - // Wait for the exit thread to finish. - thread_2.join(); - - // Let the stepping thread know the other thread is gone. - g_thread_exited = 1; - - // Wait for the stepping thread to finish. - thread_1.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/jump/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/jump/Makefile deleted file mode 100644 index b726fc3695fd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/jump/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp other.cpp -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py b/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py deleted file mode 100644 index 7194dafe0ac1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Test jumping to different places. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ThreadJumpTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test(self): - """Test thread jump handling.""" - self.build(dictionary=self.getBuildFlags()) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Find the line numbers for our breakpoints. - self.mark1 = line_number('main.cpp', '// 1st marker') - self.mark2 = line_number('main.cpp', '// 2nd marker') - self.mark3 = line_number('main.cpp', '// 3rd marker') - self.mark4 = line_number('main.cpp', '// 4th marker') - self.mark5 = line_number('other.cpp', '// other marker') - - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.mark3, num_expected_locations=1) - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint 1. - self.expect( - "thread list", - STOPPED_DUE_TO_BREAKPOINT + " 1", - substrs=[ - 'stopped', - 'main.cpp:{}'.format( - self.mark3), - 'stop reason = breakpoint 1']) - - # Try the int path, force it to return 'a' - self.do_min_test(self.mark3, self.mark1, "i", "4") - # Try the int path, force it to return 'b' - self.do_min_test(self.mark3, self.mark2, "i", "5") - # Try the double path, force it to return 'a' - self.do_min_test(self.mark4, self.mark1, "j", "7") - # Expected to fail on powerpc64le architecture - if not self.isPPC64le(): - # Try the double path, force it to return 'b' - self.do_min_test(self.mark4, self.mark2, "j", "8") - - # Try jumping to another function in a different file. - self.runCmd( - "thread jump --file other.cpp --line %i --force" % - self.mark5) - self.expect("process status", - substrs=["at other.cpp:%i" % self.mark5]) - - # Try jumping to another function (without forcing) - self.expect( - "j main.cpp:%i" % - self.mark1, - COMMAND_FAILED_AS_EXPECTED, - error=True, - substrs=["error"]) - - def do_min_test(self, start, jump, var, value): - # jump to the start marker - self.runCmd("j %i" % start) - self.runCmd("thread step-in") # step into the min fn - # jump to the branch we're interested in - self.runCmd("j %i" % jump) - self.runCmd("thread step-out") # return out - self.runCmd("thread step-over") # assign to the global - self.expect("expr %s" % var, substrs=[value]) # check it diff --git a/packages/Python/lldbsuite/test/functionalities/thread/jump/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/jump/main.cpp deleted file mode 100644 index 3497155a98f2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/jump/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test verifies the correct handling of program counter jumps. - -int otherfn(); - -template<typename T> -T min(T a, T b) -{ - if (a < b) - { - return a; // 1st marker - } else { - return b; // 2nd marker - } -} - -int main () -{ - int i; - double j; - int min_i_a = 4, min_i_b = 5; - double min_j_a = 7.0, min_j_b = 8.0; - i = min(min_i_a, min_i_b); // 3rd marker - j = min(min_j_a, min_j_b); // 4th marker - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/jump/other.cpp b/packages/Python/lldbsuite/test/functionalities/thread/jump/other.cpp deleted file mode 100644 index 8108a52c163d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/jump/other.cpp +++ /dev/null @@ -1,13 +0,0 @@ -//===-- other.cpp -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int otherfn() -{ - return 4; // other marker -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/Makefile deleted file mode 100644 index 67aa16625bff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py deleted file mode 100644 index 3d7e26816f84..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py +++ /dev/null @@ -1,92 +0,0 @@ -""" -Test number of threads. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class MultipleBreakpointTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number for our breakpoint. - self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll( - oslist=lldbplatformutil.getDarwinOSTriples(), - bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr18190 thread states not properly maintained") - @skipIfWindows # This is flakey on Windows: llvm.org/pr24668, llvm.org/pr38373 - def test(self): - """Test simultaneous breakpoints in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - # The breakpoint may be hit in either thread 2 or thread 3. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - # Get the number of threads - num_threads = process.GetNumThreads() - - # Make sure we see all three threads - self.assertTrue( - num_threads >= 3, - 'Number of expected threads and actual threads do not match.') - - # Get the thread objects - thread1 = process.GetThreadAtIndex(0) - thread2 = process.GetThreadAtIndex(1) - thread3 = process.GetThreadAtIndex(2) - - # Make sure both threads are stopped - self.assertTrue( - thread1.IsStopped(), - "Primary thread didn't stop during breakpoint") - self.assertTrue( - thread2.IsStopped(), - "Secondary thread didn't stop during breakpoint") - self.assertTrue( - thread3.IsStopped(), - "Tertiary thread didn't stop during breakpoint") - - # Delete the first breakpoint then continue - self.runCmd("breakpoint delete 1") - - # Run to completion - self.runCmd("continue") - - # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, - PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/main.cpp deleted file mode 100644 index d46038109fc2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/main.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to create a situation in which a breakpoint will be -// hit in two threads at nearly the same moment. The expected result is that -// the breakpoint in the second thread will be hit while the breakpoint handler -// in the first thread is trying to stop all threads. - -#include "pseudo_barrier.h" -#include <thread> - -pseudo_barrier_t g_barrier; - -volatile int g_test = 0; - -void * -thread_func () -{ - // Wait until both threads are running - pseudo_barrier_wait(g_barrier); - - // Do something - g_test++; // Set breakpoint here - - // Return - return NULL; -} - -int main () -{ - // Don't let either thread do anything until they're both ready. - pseudo_barrier_init(g_barrier, 2); - - // Create two threads - std::thread thread_1(thread_func); - std::thread thread_2(thread_func); - - // Wait for the threads to finish - thread_1.join(); - thread_2.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/Makefile deleted file mode 100644 index 67aa16625bff..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py deleted file mode 100644 index 9aa4a831a745..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py +++ /dev/null @@ -1,125 +0,0 @@ -""" -Test number of threads. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class NumberOfThreadsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers for our break points. - self.thread3_notify_all_line = line_number('main.cpp', '// Set thread3 break point on notify_all at this line.') - self.thread3_before_lock_line = line_number('main.cpp', '// thread3-before-lock') - - def test_number_of_threads(self): - """Test number of threads.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint with 1 location. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.thread3_notify_all_line, num_expected_locations=1) - - # The breakpoint list should show 1 location. - self.expect( - "breakpoint list -f", - "Breakpoint location shown correctly", - substrs=[ - "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.thread3_notify_all_line]) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Stopped once. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - # Get the number of threads - num_threads = process.GetNumThreads() - - # Using std::thread may involve extra threads, so we assert that there are - # at least 4 rather than exactly 4. - self.assertTrue( - num_threads >= 13, - 'Number of expected threads and actual threads do not match.') - - @skipIfDarwin # rdar://33462362 - @skipIfWindows # This is flakey on Windows: llvm.org/pr37658, llvm.org/pr38373 - def test_unique_stacks(self): - """Test backtrace unique with multiple threads executing the same stack.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Set a break point on the thread3 notify all (should get hit on threads 4-13). - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.thread3_before_lock_line, num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Stopped once. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint 1."]) - - process = self.process() - - # Get the number of threads - num_threads = process.GetNumThreads() - - # Using std::thread may involve extra threads, so we assert that there are - # at least 10 thread3's rather than exactly 10. - self.assertTrue( - num_threads >= 10, - 'Number of expected threads and actual threads do not match.') - - # Attempt to walk each of the thread's executing the thread3 function to - # the same breakpoint. - def is_thread3(thread): - for frame in thread: - if "thread3" in frame.GetFunctionName(): return True - return False - - expect_threads = "" - for i in range(num_threads): - thread = process.GetThreadAtIndex(i) - self.assertTrue(thread.IsValid()) - if not is_thread3(thread): - continue - - # If we aren't stopped out the thread breakpoint try to resume. - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - self.runCmd("thread continue %d"%(i+1)) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint) - - expect_threads += " #%d"%(i+1) - - # Construct our expected back trace string - expect_string = "10 thread(s)%s" % (expect_threads) - - # Now that we are stopped, we should have 10 threads waiting in the - # thread3 function. All of these threads should show as one stack. - self.expect("thread backtrace unique", - "Backtrace with unique stack shown correctly", - substrs=[expect_string, - "main.cpp:%d"%self.thread3_before_lock_line]) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp deleted file mode 100644 index fdc060d135dc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "pseudo_barrier.h" -#include <condition_variable> -#include <mutex> -#include <thread> -#include <vector> - -std::mutex mutex; -std::condition_variable cond; -pseudo_barrier_t thread3_barrier; - -void * -thread3(void *input) -{ - pseudo_barrier_wait(thread3_barrier); - - int dummy = 47; // thread3-before-lock - - std::unique_lock<std::mutex> lock(mutex); - cond.notify_all(); // Set thread3 break point on notify_all at this line. - return NULL; -} - -void * -thread2(void *input) -{ - std::unique_lock<std::mutex> lock(mutex); - cond.notify_all(); // release main thread - cond.wait(lock); - return NULL; -} - -void * -thread1(void *input) -{ - std::thread thread_2(thread2, nullptr); - thread_2.join(); - - return NULL; -} - -int main() -{ - std::unique_lock<std::mutex> lock(mutex); - - std::thread thread_1(thread1, nullptr); - cond.wait(lock); // wait for thread2 - - pseudo_barrier_init(thread3_barrier, 10); - - std::vector<std::thread> thread_3s; - for (int i = 0; i < 10; i++) { - thread_3s.push_back(std::thread(thread3, nullptr)); - } - - cond.wait(lock); // wait for thread_3s - - lock.unlock(); - - thread_1.join(); - for (auto &t : thread_3s){ - t.join(); - } - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/state/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/state/Makefile deleted file mode 100644 index 26db4816b6ea..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/state/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py b/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py deleted file mode 100644 index 4b1247316e18..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py +++ /dev/null @@ -1,326 +0,0 @@ -""" -Test thread states. -""" - -from __future__ import print_function - - -import unittest2 -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ThreadStateTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr15824 thread states not properly maintained") - @skipIfDarwin # llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237> - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr18190 thread states not properly maintained") - def test_state_after_breakpoint(self): - """Test thread state after breakpoint.""" - self.build(dictionary=self.getBuildFlags(use_cpp11=False)) - self.thread_state_after_breakpoint_test() - - @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly - @expectedFailureAll( - oslist=lldbplatformutil.getDarwinOSTriples(), - bugnumber="llvm.org/pr23669") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr15824") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660") - def test_state_after_continue(self): - """Test thread state after continue.""" - self.build(dictionary=self.getBuildFlags(use_cpp11=False)) - self.thread_state_after_continue_test() - - @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly - @expectedFailureDarwin('llvm.org/pr23669') - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660") - # thread states not properly maintained - @unittest2.expectedFailure("llvm.org/pr16712") - def test_state_after_expression(self): - """Test thread state after expression.""" - self.build(dictionary=self.getBuildFlags(use_cpp11=False)) - self.thread_state_after_expression_test() - - # thread states not properly maintained - @unittest2.expectedFailure("llvm.org/pr15824 and <rdar://problem/28557237>") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") - @skipIfDarwin # llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237> - def test_process_state(self): - """Test thread states (comprehensive).""" - self.build(dictionary=self.getBuildFlags(use_cpp11=False)) - self.thread_states_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers for our breakpoints. - self.break_1 = line_number('main.cpp', '// Set first breakpoint here') - self.break_2 = line_number('main.cpp', '// Set second breakpoint here') - - def thread_state_after_breakpoint_test(self): - """Test thread state after breakpoint.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - bp = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_1, num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - # Make sure the thread is in the stopped state. - self.assertTrue( - thread.IsStopped(), - "Thread state isn't \'stopped\' during breakpoint 1.") - self.assertFalse(thread.IsSuspended(), - "Thread state is \'suspended\' during breakpoint 1.") - - # Kill the process - self.runCmd("process kill") - - def wait_for_running_event(self, process): - listener = self.dbg.GetListener() - if lldb.remote_platform: - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateConnected]) - lldbutil.expect_state_changes( - self, listener, process, [ - lldb.eStateRunning]) - - def thread_state_after_continue_test(self): - """Test thread state after continue.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_1, num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_2, num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - # Continue, the inferior will go into an infinite loop waiting for - # 'g_test' to change. - self.dbg.SetAsync(True) - self.runCmd("continue") - self.wait_for_running_event(process) - - # Check the thread state. It should be running. - self.assertFalse( - thread.IsStopped(), - "Thread state is \'stopped\' when it should be running.") - self.assertFalse( - thread.IsSuspended(), - "Thread state is \'suspended\' when it should be running.") - - # Go back to synchronous interactions - self.dbg.SetAsync(False) - - # Kill the process - self.runCmd("process kill") - - def thread_state_after_expression_test(self): - """Test thread state after expression.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_1, num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_2, num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - # Get the inferior out of its loop - self.runCmd("expression g_test = 1") - - # Check the thread state - self.assertTrue( - thread.IsStopped(), - "Thread state isn't \'stopped\' after expression evaluation.") - self.assertFalse( - thread.IsSuspended(), - "Thread state is \'suspended\' after expression evaluation.") - - # Let the process run to completion - self.runCmd("process continue") - - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") - @skipIfDarwin # llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237> - @no_debug_info_test - def test_process_interrupt(self): - """Test process interrupt and continue.""" - self.build(dictionary=self.getBuildFlags(use_cpp11=False)) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - bpno = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_1, num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - # Remove the breakpoint to avoid the single-step-over-bkpt dance in the - # "continue" below - self.assertTrue(target.BreakpointDelete(bpno)) - - # Continue, the inferior will go into an infinite loop waiting for - # 'g_test' to change. - self.dbg.SetAsync(True) - self.runCmd("continue") - self.wait_for_running_event(process) - - # Go back to synchronous interactions - self.dbg.SetAsync(False) - - # Stop the process - self.runCmd("process interrupt") - - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal) - - # Get the inferior out of its loop - self.runCmd("expression g_test = 1") - - # Run to completion - self.runCmd("continue") - - def thread_states_test(self): - """Test thread states (comprehensive).""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_1, num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_2, num_expected_locations=1) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - # Make sure the thread is in the stopped state. - self.assertTrue( - thread.IsStopped(), - "Thread state isn't \'stopped\' during breakpoint 1.") - self.assertFalse(thread.IsSuspended(), - "Thread state is \'suspended\' during breakpoint 1.") - - # Continue, the inferior will go into an infinite loop waiting for - # 'g_test' to change. - self.dbg.SetAsync(True) - self.runCmd("continue") - self.wait_for_running_event(process) - - # Check the thread state. It should be running. - self.assertFalse( - thread.IsStopped(), - "Thread state is \'stopped\' when it should be running.") - self.assertFalse( - thread.IsSuspended(), - "Thread state is \'suspended\' when it should be running.") - - # Go back to synchronous interactions - self.dbg.SetAsync(False) - - # Stop the process - self.runCmd("process interrupt") - - self.assertEqual(thread.GetState(), lldb.eStopReasonSignal) - - # Check the thread state - self.assertTrue( - thread.IsStopped(), - "Thread state isn't \'stopped\' after process stop.") - self.assertFalse(thread.IsSuspended(), - "Thread state is \'suspended\' after process stop.") - - # Get the inferior out of its loop - self.runCmd("expression g_test = 1") - - # Check the thread state - self.assertTrue( - thread.IsStopped(), - "Thread state isn't \'stopped\' after expression evaluation.") - self.assertFalse( - thread.IsSuspended(), - "Thread state is \'suspended\' after expression evaluation.") - - self.assertEqual(thread.GetState(), lldb.eStopReasonSignal) - - # Run to breakpoint 2 - self.runCmd("continue") - - self.assertEqual(thread.GetState(), lldb.eStopReasonBreakpoint) - - # Make sure both threads are stopped - self.assertTrue( - thread.IsStopped(), - "Thread state isn't \'stopped\' during breakpoint 2.") - self.assertFalse(thread.IsSuspended(), - "Thread state is \'suspended\' during breakpoint 2.") - - # Run to completion - self.runCmd("continue") - - # At this point, the inferior process should have exited. - self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/state/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/state/main.cpp deleted file mode 100644 index 081203da8da9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/state/main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to verify that thread states are properly maintained -// when transitional actions are performed in the debugger. Most of the logic -// is in the test script. This program merely provides places where the test -// can create the intended states. - -#include <chrono> -#include <thread> - -volatile int g_test = 0; - -int addSomething(int a) -{ - return a + g_test; -} - -int doNothing() -{ - int temp = 0; // Set first breakpoint here - - while (!g_test && temp < 5) - { - ++temp; - std::this_thread::sleep_for(std::chrono::seconds(2)); - } - - return temp; // Set second breakpoint here -} - -int main () -{ - int result = doNothing(); - - int i = addSomething(result); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_out/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/step_out/Makefile deleted file mode 100644 index 035413ff763d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_out/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py b/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py deleted file mode 100644 index e786e8d7ff1e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py +++ /dev/null @@ -1,183 +0,0 @@ -""" -Test stepping out from a function in a multi-threaded program. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ThreadStepOutTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - # Test occasionally times out on the Linux build bot - @skipIfLinux - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr18066 inferior does not exit") - @skipIfWindows # This test will hang on windows llvm.org/pr21753 - @expectedFailureAll(oslist=["windows"]) - def test_step_single_thread(self): - """Test thread step out on one thread via command interpreter. """ - self.build(dictionary=self.getBuildFlags()) - self.step_out_test(self.step_out_single_thread_with_cmd) - - # Test occasionally times out on the Linux build bot - @skipIfLinux - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint") - @skipIfWindows # This test will hang on windows llvm.org/pr21753 - @expectedFailureAll(oslist=["windows"]) - @expectedFailureAll(oslist=["watchos"], archs=['armv7k'], bugnumber="rdar://problem/34674488") # stop reason is trace when it should be step-out - def test_step_all_threads(self): - """Test thread step out on all threads via command interpreter. """ - self.build(dictionary=self.getBuildFlags()) - self.step_out_test(self.step_out_all_threads_with_cmd) - - # Test occasionally times out on the Linux build bot - @skipIfLinux - @expectedFailureAll( - oslist=["linux"], - bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint") - @skipIfWindows # This test will hang on windows llvm.org/pr21753 - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24681") - def test_python(self): - """Test thread step out on one thread via Python API (dwarf).""" - self.build(dictionary=self.getBuildFlags()) - self.step_out_test(self.step_out_with_python) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number for our breakpoint. - self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - if "gcc" in self.getCompiler() or self.isIntelCompiler(): - self.step_out_destination = line_number( - 'main.cpp', '// Expect to stop here after step-out (icc and gcc)') - else: - self.step_out_destination = line_number( - 'main.cpp', '// Expect to stop here after step-out (clang)') - - def step_out_single_thread_with_cmd(self): - self.step_out_with_cmd("this-thread") - self.expect( - "thread backtrace all", - "Thread location after step out is correct", - substrs=[ - "main.cpp:%d" % - self.step_out_destination, - "main.cpp:%d" % - self.breakpoint]) - - def step_out_all_threads_with_cmd(self): - self.step_out_with_cmd("all-threads") - self.expect( - "thread backtrace all", - "Thread location after step out is correct", - substrs=[ - "main.cpp:%d" % - self.step_out_destination]) - - def step_out_with_cmd(self, run_mode): - self.runCmd("thread select %d" % self.step_out_thread.GetIndexID()) - self.runCmd("thread step-out -m %s" % run_mode) - self.expect("process status", "Expected stop reason to be step-out", - substrs=["stop reason = step out"]) - - self.expect( - "thread list", - "Selected thread did not change during step-out", - substrs=[ - "* thread #%d" % - self.step_out_thread.GetIndexID()]) - - def step_out_with_python(self): - self.step_out_thread.StepOut() - - reason = self.step_out_thread.GetStopReason() - self.assertEqual( - lldb.eStopReasonPlanComplete, - reason, - "Expected thread stop reason 'plancomplete', but got '%s'" % - lldbutil.stop_reason_to_str(reason)) - - # Verify location after stepping out - frame = self.step_out_thread.GetFrameAtIndex(0) - desc = lldbutil.get_description(frame.GetLineEntry()) - expect = "main.cpp:%d" % self.step_out_destination - self.assertTrue( - expect in desc, "Expected %s but thread stopped at %s" % - (expect, desc)) - - def step_out_test(self, step_out_func): - """Test single thread step out of a function.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # The breakpoint list should show 1 location. - self.expect( - "breakpoint list -f", - "Breakpoint location shown correctly", - substrs=[ - "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.breakpoint]) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Get the target process - self.inferior_target = self.dbg.GetSelectedTarget() - self.inferior_process = self.inferior_target.GetProcess() - - # Get the number of threads, ensure we see all three. - num_threads = self.inferior_process.GetNumThreads() - self.assertEqual( - num_threads, - 3, - 'Number of expected threads and actual threads do not match.') - - (breakpoint_threads, other_threads) = ([], []) - lldbutil.sort_stopped_threads(self.inferior_process, - breakpoint_threads=breakpoint_threads, - other_threads=other_threads) - - while len(breakpoint_threads) < 2: - self.runCmd("thread continue %s" % - " ".join([str(x.GetIndexID()) for x in other_threads])) - lldbutil.sort_stopped_threads( - self.inferior_process, - breakpoint_threads=breakpoint_threads, - other_threads=other_threads) - - self.step_out_thread = breakpoint_threads[0] - - # Step out of thread stopped at breakpoint - step_out_func() - - # Run to completion - self.runCmd("continue") - - # At this point, the inferior process should have exited. - self.assertTrue(self.inferior_process.GetState() == - lldb.eStateExited, PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp deleted file mode 100644 index ecc0571f2bd3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_out/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to create a situation in which two threads are stopped -// at a breakpoint and the debugger issues a step-out command. - -#include "pseudo_barrier.h" -#include <thread> - -pseudo_barrier_t g_barrier; - -volatile int g_test = 0; - -void step_out_of_here() { - g_test += 5; // Set breakpoint here -} - -void * -thread_func () -{ - // Wait until both threads are running - pseudo_barrier_wait(g_barrier); - - // Do something - step_out_of_here(); // Expect to stop here after step-out (clang) - - // Return - return NULL; // Expect to stop here after step-out (icc and gcc) -} - -int main () -{ - // Don't let either thread do anything until they're both ready. - pseudo_barrier_init(g_barrier, 2); - - // Create two threads - std::thread thread_1(thread_func); - std::thread thread_2(thread_func); - - // Wait for the threads to finish - thread_1.join(); - thread_2.join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories b/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories deleted file mode 100644 index c00c25822e4c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_until/.categories +++ /dev/null @@ -1 +0,0 @@ -basic_process diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py b/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py deleted file mode 100644 index b0e7add37297..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py +++ /dev/null @@ -1,89 +0,0 @@ -"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StepUntilTestCase(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" - self.less_than_two = line_number('main.c', 'Less than 2') - self.greater_than_two = line_number('main.c', 'Greater than or equal to 2.') - self.back_out_in_main = line_number('main.c', 'Back out in main') - - def do_until (self, args, until_lines, expected_linenum): - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - main_source_spec = lldb.SBFileSpec(self.main_source) - break_before = target.BreakpointCreateBySourceRegex( - 'At the start', - main_source_spec) - self.assertTrue(break_before, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - args, 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_before) - - if len(threads) != 1: - self.fail("Failed to stop at first breakpoint in main.") - - thread = threads[0] - return thread - - thread = self.common_setup(None) - - cmd_interp = self.dbg.GetCommandInterpreter() - ret_obj = lldb.SBCommandReturnObject() - - cmd_line = "thread until" - for line_num in until_lines: - cmd_line += " %d"%(line_num) - - cmd_interp.HandleCommand(cmd_line, ret_obj) - self.assertTrue(ret_obj.Succeeded(), "'%s' failed: %s."%(cmd_line, ret_obj.GetError())) - - frame = thread.frames[0] - line = frame.GetLineEntry().GetLine() - self.assertEqual(line, expected_linenum, 'Did not get the expected stop line number') - - def test_hitting_one (self): - """Test thread step until - targeting one line and hitting it.""" - self.do_until(None, [self.less_than_two], self.less_than_two) - - def test_targetting_two_hitting_first (self): - """Test thread step until - targeting two lines and hitting one.""" - self.do_until(["foo", "bar", "baz"], [self.less_than_two, self.greater_than_two], self.greater_than_two) - - def test_targetting_two_hitting_second (self): - """Test thread step until - targeting two lines and hitting the other one.""" - self.do_until(None, [self.less_than_two, self.greater_than_two], self.less_than_two) - - def test_missing_one (self): - """Test thread step until - targeting one line and missing it.""" - self.do_until(["foo", "bar", "baz"], [self.less_than_two], self.back_out_in_main) - - - diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c b/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c deleted file mode 100644 index e0b4d8ab951e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <stdio.h> - -void call_me(int argc) -{ - printf ("At the start, argc: %d.\n", argc); - - if (argc < 2) - printf("Less than 2.\n"); - else - printf("Greater than or equal to 2.\n"); -} - -int -main(int argc, char **argv) -{ - call_me(argc); - printf("Back out in main.\n"); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/Makefile deleted file mode 100644 index d06a7d4685f3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -ENABLE_THREADS := YES -CXX_SOURCES := main.cpp -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py deleted file mode 100644 index c8b6e675b8a9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py +++ /dev/null @@ -1,124 +0,0 @@ -""" -Test number of threads. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class ThreadExitTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers for our breakpoints. - self.break_1 = line_number('main.cpp', '// Set first breakpoint here') - self.break_2 = line_number('main.cpp', '// Set second breakpoint here') - self.break_3 = line_number('main.cpp', '// Set third breakpoint here') - self.break_4 = line_number('main.cpp', '// Set fourth breakpoint here') - - @skipIfWindows # This is flakey on Windows: llvm.org/pr38373 - def test(self): - """Test thread exit handling.""" - self.build(dictionary=self.getBuildFlags()) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # This should create a breakpoint with 1 location. - bp1_id = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_1, num_expected_locations=1) - bp2_id = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_2, num_expected_locations=1) - bp3_id = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_3, num_expected_locations=1) - bp4_id = lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.break_4, num_expected_locations=1) - - # The breakpoint list should show 1 locations. - self.expect( - "breakpoint list -f", - "Breakpoint location shown correctly", - substrs=[ - "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.break_1, - "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.break_2, - "3: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.break_3, - "4: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % - self.break_4]) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - # Get the target process - target = self.dbg.GetSelectedTarget() - process = target.GetProcess() - - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( - process, bp1_id) - self.assertIsNotNone(stopped_thread, - "Process is not stopped at breakpoint 1") - - # Get the number of threads - num_threads = process.GetNumThreads() - self.assertGreaterEqual( - num_threads, - 2, - 'Number of expected threads and actual threads do not match at breakpoint 1.') - - # Run to the second breakpoint - self.runCmd("continue") - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( - process, bp2_id) - self.assertIsNotNone(stopped_thread, - "Process is not stopped at breakpoint 2") - - # Update the number of threads - new_num_threads = process.GetNumThreads() - self.assertEqual( - new_num_threads, - num_threads + 1, - 'Number of expected threads did not increase by 1 at bp 2.') - - # Run to the third breakpoint - self.runCmd("continue") - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( - process, bp3_id) - self.assertIsNotNone(stopped_thread, - "Process is not stopped at breakpoint 3") - - # Update the number of threads - new_num_threads = process.GetNumThreads() - self.assertEqual( - new_num_threads, - num_threads, - 'Number of expected threads is not equal to original number of threads at bp 3.') - - # Run to the fourth breakpoint - self.runCmd("continue") - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( - process, bp4_id) - self.assertIsNotNone(stopped_thread, - "Process is not stopped at breakpoint 4") - - # Update the number of threads - new_num_threads = process.GetNumThreads() - self.assertEqual( - new_num_threads, - num_threads - 1, - 'Number of expected threads did not decrease by 1 at bp 4.') - - # Run to completion - self.runCmd("continue") - - # At this point, the inferior process should have exited. - self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp deleted file mode 100644 index 432adc0ea00e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/main.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test verifies the correct handling of child thread exits. - -#include "pseudo_barrier.h" -#include <thread> - -pseudo_barrier_t g_barrier1; -pseudo_barrier_t g_barrier2; -pseudo_barrier_t g_barrier3; - -void * -thread1 () -{ - // Synchronize with the main thread. - pseudo_barrier_wait(g_barrier1); - - // Synchronize with the main thread and thread2. - pseudo_barrier_wait(g_barrier2); - - // Return - return NULL; // Set second breakpoint here -} - -void * -thread2 () -{ - // Synchronize with thread1 and the main thread. - pseudo_barrier_wait(g_barrier2); - - // Synchronize with the main thread. - pseudo_barrier_wait(g_barrier3); - - // Return - return NULL; -} - -int main () -{ - pseudo_barrier_init(g_barrier1, 2); - pseudo_barrier_init(g_barrier2, 3); - pseudo_barrier_init(g_barrier3, 2); - - // Create a thread. - std::thread thread_1(thread1); - - // Wait for thread1 to start. - pseudo_barrier_wait(g_barrier1); - - // Create another thread. - std::thread thread_2(thread2); // Set first breakpoint here - - // Wait for thread2 to start. - pseudo_barrier_wait(g_barrier2); - - // Wait for the first thread to finish - thread_1.join(); - - // Synchronize with the remaining thread - int dummy = 47; // Set third breakpoint here - pseudo_barrier_wait(g_barrier3); - - // Wait for the second thread to finish - thread_2.join(); - - return 0; // Set fourth breakpoint here -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/Makefile deleted file mode 100644 index 035413ff763d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py deleted file mode 100644 index 9fdf42ac4e3c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -Test that we obey thread conditioned breakpoints. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -def set_thread_id(thread, breakpoint): - id = thread.id - breakpoint.SetThreadID(id) - -def set_thread_name(thread, breakpoint): - breakpoint.SetThreadName("main-thread") - -class ThreadSpecificBreakTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - @add_test_categories(['pyapi']) - - @expectedFailureAll(oslist=["windows"]) - @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'armv7k'], bugnumber='rdar://problem/34563920') # armv7 ios problem - breakpoint with tid qualifier isn't working - def test_thread_id(self): - self.do_test(set_thread_id) - - @skipUnlessDarwin - @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'armv7k'], bugnumber='rdar://problem/34563920') # armv7 ios problem - breakpoint with tid qualifier isn't working - def test_thread_name(self): - self.do_test(set_thread_name) - - def do_test(self, setter_method): - """Test that we obey thread conditioned breakpoints.""" - self.build() - main_source_spec = lldb.SBFileSpec("main.cpp") - (target, process, main_thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(self, - "Set main breakpoint here", main_source_spec) - - main_thread_id = main_thread.GetThreadID() - - # This test works by setting a breakpoint in a function conditioned to stop only on - # the main thread, and then calling this function on a secondary thread, joining, - # and then calling again on the main thread. If the thread specific breakpoint works - # then it should not be hit on the secondary thread, only on the main - # thread. - thread_breakpoint = target.BreakpointCreateBySourceRegex( - "Set thread-specific breakpoint here", main_source_spec) - self.assertGreater( - thread_breakpoint.GetNumLocations(), - 0, - "thread breakpoint has no locations associated with it.") - - # Set the thread-specific breakpoint to only stop on the main thread. The run the function - # on another thread and join on it. If the thread-specific breakpoint works, the next - # stop should be on the main thread. - - main_thread_id = main_thread.GetThreadID() - setter_method(main_thread, thread_breakpoint) - - process.Continue() - next_stop_state = process.GetState() - self.assertEqual( - next_stop_state, - lldb.eStateStopped, - "We should have stopped at the thread breakpoint.") - stopped_threads = lldbutil.get_threads_stopped_at_breakpoint( - process, thread_breakpoint) - self.assertEqual( - len(stopped_threads), - 1, - "thread breakpoint stopped at unexpected number of threads") - self.assertEqual( - stopped_threads[0].GetThreadID(), - main_thread_id, - "thread breakpoint stopped at the wrong thread") diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp deleted file mode 100644 index 0509b3d37a7f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <chrono> -#include <thread> - -void -thread_function () -{ - // Set thread-specific breakpoint here. - std::this_thread::sleep_for(std::chrono::microseconds(100)); -} - -int -main () -{ - // Set main breakpoint here. - - #ifdef __APPLE__ - pthread_setname_np("main-thread"); - #endif - - std::thread t(thread_function); - t.join(); - - thread_function(); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/Makefile deleted file mode 100644 index 035413ff763d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py deleted file mode 100644 index 8bf897f0bba7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py +++ /dev/null @@ -1,79 +0,0 @@ -""" -Test that we obey thread conditioned breakpoints and expression -conditioned breakpoints simultaneously -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ThreadSpecificBreakPlusConditionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - # test frequently times out or hangs - @skipIf(oslist=['windows', 'freebsd']) - @skipIfDarwin - # hits break in another thread in testrun - @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr18522') - @add_test_categories(['pyapi']) - @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], archs=['armv7', 'armv7k'], bugnumber='rdar://problem/34563348') # Two threads seem to end up with the same my_value when built for armv7. - def test_python(self): - """Test that we obey thread conditioned breakpoints.""" - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - main_source_spec = lldb.SBFileSpec("main.cpp") - - # Set a breakpoint in the thread body, and make it active for only the - # first thread. - break_thread_body = target.BreakpointCreateBySourceRegex( - "Break here in thread body.", main_source_spec) - self.assertTrue( - break_thread_body.IsValid() and break_thread_body.GetNumLocations() > 0, - "Failed to set thread body breakpoint.") - - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, break_thread_body) - - victim_thread = threads[0] - - # Pick one of the threads, and change the breakpoint so it ONLY stops for this thread, - # but add a condition that it won't stop for this thread's my_value. The other threads - # pass the condition, so they should stop, but if the thread-specification is working - # they should not stop. So nobody should hit the breakpoint anymore, and we should - # just exit cleanly. - - frame = victim_thread.GetFrameAtIndex(0) - value = frame.FindVariable("my_value").GetValueAsSigned(0) - self.assertTrue( - value > 0 and value < 11, - "Got a reasonable value for my_value.") - - cond_string = "my_value != %d" % (value) - - break_thread_body.SetThreadID(victim_thread.GetThreadID()) - break_thread_body.SetCondition(cond_string) - - process.Continue() - - next_stop_state = process.GetState() - self.assertTrue( - next_stop_state == lldb.eStateExited, - "We should have not hit the breakpoint again.") diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/main.cpp b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/main.cpp deleted file mode 100644 index af8ab84157fd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include <chrono> -#include <thread> -#include <vector> - -void * -thread_function (void *thread_marker) -{ - int keep_going = 1; - int my_value = *((int *)thread_marker); - int counter = 0; - - while (counter < 20) - { - counter++; // Break here in thread body. - std::this_thread::sleep_for(std::chrono::microseconds(10)); - } - return NULL; -} - - -int -main () -{ - std::vector<std::thread> threads; - - int thread_value = 0; - int i; - - for (i = 0; i < 10; i++) - { - thread_value += 1; - threads.push_back(std::thread(thread_function, &thread_value)); - } - - for (i = 0; i < 10; i++) - threads[i].join(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/basic/Makefile b/packages/Python/lldbsuite/test/functionalities/tsan/basic/Makefile deleted file mode 100644 index c930ae563fc1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/basic/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=thread -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py b/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py deleted file mode 100644 index c91ed41a2478..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py +++ /dev/null @@ -1,136 +0,0 @@ -""" -Tests basic ThreadSanitizer support (detecting a data race). -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class TsanBasicTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessThreadSanitizer - def test(self): - self.build() - self.tsan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.line_malloc = line_number('main.c', '// malloc line') - self.line_thread1 = line_number('main.c', '// thread1 line') - self.line_thread2 = line_number('main.c', '// thread2 line') - - def tsan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - # the stop reason of the thread should be breakpoint. - self.expect("thread list", "A data race should be detected", - substrs=['stopped', 'stop reason = Data race detected']) - - self.assertEqual( - self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), - lldb.eStopReasonInstrumentation) - - # test that the TSan dylib is present - self.expect( - "image lookup -n __tsan_get_current_report", - "__tsan_get_current_report should be present", - substrs=['1 match found']) - - # We should be stopped in __tsan_on_report - process = self.dbg.GetSelectedTarget().process - thread = process.GetSelectedThread() - frame = thread.GetSelectedFrame() - self.assertTrue("__tsan_on_report" in frame.GetFunctionName()) - - # The stopped thread backtrace should contain either line1 or line2 - # from main.c. - found = False - for i in range(0, thread.GetNumFrames()): - frame = thread.GetFrameAtIndex(i) - if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c": - if frame.GetLineEntry().GetLine() == self.line_thread1: - found = True - if frame.GetLineEntry().GetLine() == self.line_thread2: - found = True - self.assertTrue(found) - - self.expect( - "thread info -s", - "The extended stop info should contain the TSan provided fields", - substrs=[ - "instrumentation_class", - "description", - "mops"]) - - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - self.assertEqual(data["instrumentation_class"], "ThreadSanitizer") - self.assertEqual(data["issue_type"], "data-race") - self.assertEqual(len(data["mops"]), 2) - - backtraces = thread.GetStopReasonExtendedBacktraces( - lldb.eInstrumentationRuntimeTypeAddressSanitizer) - self.assertEqual(backtraces.GetSize(), 0) - - backtraces = thread.GetStopReasonExtendedBacktraces( - lldb.eInstrumentationRuntimeTypeThreadSanitizer) - self.assertTrue(backtraces.GetSize() >= 2) - - # First backtrace is a memory operation - thread = backtraces.GetThreadAtIndex(0) - found = False - for i in range(0, thread.GetNumFrames()): - frame = thread.GetFrameAtIndex(i) - if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c": - if frame.GetLineEntry().GetLine() == self.line_thread1: - found = True - if frame.GetLineEntry().GetLine() == self.line_thread2: - found = True - self.assertTrue(found) - - # Second backtrace is a memory operation - thread = backtraces.GetThreadAtIndex(1) - found = False - for i in range(0, thread.GetNumFrames()): - frame = thread.GetFrameAtIndex(i) - if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c": - if frame.GetLineEntry().GetLine() == self.line_thread1: - found = True - if frame.GetLineEntry().GetLine() == self.line_thread2: - found = True - self.assertTrue(found) - - self.runCmd("continue") - - # the stop reason of the thread should be a SIGABRT. - self.expect("thread list", "We should be stopped due a SIGABRT", - substrs=['stopped', 'stop reason = signal SIGABRT']) - - # test that we're in pthread_kill now (TSan abort the process) - self.expect("thread list", "We should be stopped in pthread_kill", - substrs=['pthread_kill']) diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/basic/main.c b/packages/Python/lldbsuite/test/functionalities/tsan/basic/main.c deleted file mode 100644 index c082b01a57c7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/basic/main.c +++ /dev/null @@ -1,37 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> - -char *pointer; - -void *f1(void *p) { - pointer[0] = 'x'; // thread1 line - return NULL; -} - -void *f2(void *p) { - pointer[0] = 'y'; // thread2 line - return NULL; -} - -int main (int argc, char const *argv[]) -{ - pointer = (char *)malloc(10); // malloc line - - pthread_t t1, t2; - pthread_create(&t1, NULL, f1, NULL); - pthread_create(&t2, NULL, f2, NULL); - - pthread_join(t1, NULL); - pthread_join(t2, NULL); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/Makefile b/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/Makefile deleted file mode 100644 index a58194779074..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -CFLAGS_EXTRAS := -fsanitize=thread -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py b/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py deleted file mode 100644 index 7451dde1fa59..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Tests that TSan correctly reports the filename and line number of a racy global C++ variable. -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class TsanCPPGlobalLocationTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessThreadSanitizer - def test(self): - self.build() - self.tsan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def tsan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - # the stop reason of the thread should be breakpoint. - self.expect("thread list", "A data race should be detected", - substrs=['stopped', 'stop reason = Data race detected']) - - self.expect( - "thread info -s", - "The extended stop info should contain the TSan provided fields", - substrs=[ - "instrumentation_class", - "description", - "mops"]) - - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - self.assertEqual(data["instrumentation_class"], "ThreadSanitizer") - self.assertEqual(data["issue_type"], "data-race") - - self.assertTrue(data["location_filename"].endswith("/main.cpp")) - self.assertEqual( - data["location_line"], - line_number( - 'main.cpp', - '// global variable')) diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/main.cpp b/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/main.cpp deleted file mode 100644 index 80f72ae83cf7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -long my_global_variable; // global variable - -void *f1(void *p) { - my_global_variable = 42; - return NULL; -} - -void *f2(void *p) { - my_global_variable = 43; - return NULL; -} - -int main (int argc, char const *argv[]) -{ - pthread_t t1; - pthread_create(&t1, NULL, f1, NULL); - - pthread_t t2; - pthread_create(&t2, NULL, f2, NULL); - - pthread_join(t1, NULL); - pthread_join(t2, NULL); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/Makefile b/packages/Python/lldbsuite/test/functionalities/tsan/global_location/Makefile deleted file mode 100644 index c930ae563fc1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=thread -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py b/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py deleted file mode 100644 index c68c2efff4cd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Tests that TSan correctly reports the filename and line number of a racy global variable. -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class TsanGlobalLocationTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessThreadSanitizer - def test(self): - self.build() - self.tsan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def tsan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - # the stop reason of the thread should be breakpoint. - self.expect("thread list", "A data race should be detected", - substrs=['stopped', 'stop reason = Data race detected']) - - self.expect( - "thread info -s", - "The extended stop info should contain the TSan provided fields", - substrs=[ - "instrumentation_class", - "description", - "mops"]) - - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - self.assertEqual(data["instrumentation_class"], "ThreadSanitizer") - self.assertEqual(data["issue_type"], "data-race") - - self.assertTrue(data["location_filename"].endswith("/main.c")) - self.assertEqual( - data["location_line"], - line_number( - 'main.c', - '// global variable')) diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/main.c b/packages/Python/lldbsuite/test/functionalities/tsan/global_location/main.c deleted file mode 100644 index caa2c3cb43cd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/main.c +++ /dev/null @@ -1,38 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -long my_global_variable; // global variable - -void *f1(void *p) { - my_global_variable = 42; - return NULL; -} - -void *f2(void *p) { - my_global_variable = 43; - return NULL; -} - -int main (int argc, char const *argv[]) -{ - pthread_t t1; - pthread_create(&t1, NULL, f1, NULL); - - pthread_t t2; - pthread_create(&t2, NULL, f2, NULL); - - pthread_join(t1, NULL); - pthread_join(t2, NULL); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/Makefile b/packages/Python/lldbsuite/test/functionalities/tsan/multiple/Makefile deleted file mode 100644 index c930ae563fc1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=thread -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py b/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py deleted file mode 100644 index 93b06f6502a1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Test ThreadSanitizer when multiple different issues are found. -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class TsanMultipleTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessThreadSanitizer - def test(self): - self.build() - self.tsan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def tsan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("env TSAN_OPTIONS=abort_on_error=0") - - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - report_count = 0 - while self.dbg.GetSelectedTarget().process.GetSelectedThread( - ).GetStopReason() == lldb.eStopReasonInstrumentation: - report_count += 1 - - stop_description = self.dbg.GetSelectedTarget( - ).process.GetSelectedThread().GetStopDescription(100) - - self.assertTrue( - (stop_description == "Data race detected") or - (stop_description == "Use of deallocated memory detected") or - (stop_description == "Thread leak detected") or - (stop_description == "Use of an uninitialized or destroyed mutex detected") or - (stop_description == "Unlock of an unlocked mutex (or by a wrong thread) detected") - ) - - self.expect( - "thread info -s", - "The extended stop info should contain the TSan provided fields", - substrs=[ - "instrumentation_class", - "description", - "mops"]) - - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - self.assertEqual(data["instrumentation_class"], "ThreadSanitizer") - - backtraces = self.dbg.GetSelectedTarget().process.GetSelectedThread( - ).GetStopReasonExtendedBacktraces(lldb.eInstrumentationRuntimeTypeThreadSanitizer) - self.assertTrue(backtraces.GetSize() >= 1) - - self.runCmd("continue") - - self.assertEqual( - self.dbg.GetSelectedTarget().process.GetState(), - lldb.eStateExited, - PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/main.m b/packages/Python/lldbsuite/test/functionalities/tsan/multiple/main.m deleted file mode 100644 index f7c48b45422b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/main.m +++ /dev/null @@ -1,138 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> -#import <pthread.h> - -long my_global; - -void *Thread1(void *arg) { - my_global = 42; - return NULL; -} - -void *Thread2(void *arg) { - my_global = 144; - return NULL; -} - -void TestDataRace1() { - pthread_t t1, t2; - pthread_create(&t1, NULL, Thread1, NULL); - pthread_create(&t2, NULL, Thread2, NULL); - - pthread_join(t1, NULL); - pthread_join(t2, NULL); -} - -void TestInvalidMutex() { - pthread_mutex_t m = {0}; - pthread_mutex_lock(&m); - - pthread_mutex_init(&m, NULL); - pthread_mutex_lock(&m); - pthread_mutex_unlock(&m); - pthread_mutex_destroy(&m); - pthread_mutex_lock(&m); -} - -void TestMutexWrongLock() { - pthread_mutex_t m = {0}; - pthread_mutex_init(&m, NULL); - pthread_mutex_unlock(&m); -} - -long some_global; - -void TestDataRaceBlocks1() { - dispatch_queue_t q = dispatch_queue_create("my.queue", DISPATCH_QUEUE_CONCURRENT); - - for (int i = 0; i < 2; i++) { - dispatch_async(q, ^{ - some_global++; // race 1 - - usleep(100000); // force the blocks to be on different threads - }); - } - - usleep(100000); - dispatch_barrier_sync(q, ^{ }); -} - -void TestDataRaceBlocks2() { - dispatch_queue_t q = dispatch_queue_create("my.queue2", DISPATCH_QUEUE_CONCURRENT); - - char *c; - - c = malloc((rand() % 1000) + 10); - for (int i = 0; i < 2; i++) { - dispatch_async(q, ^{ - c[0] = 'x'; // race 2 - fprintf(stderr, "tid: %p\n", pthread_self()); - usleep(100000); // force the blocks to be on different threads - }); - } - dispatch_barrier_sync(q, ^{ }); - - free(c); -} - -void TestUseAfterFree() { - char *c; - - c = malloc((rand() % 1000) + 10); - free(c); - c[0] = 'x'; -} - -void TestRacePipe() { - dispatch_queue_t q = dispatch_queue_create("my.queue3", DISPATCH_QUEUE_CONCURRENT); - - int a[2]; - pipe(a); - int fd = a[0]; - - for (int i = 0; i < 2; i++) { - dispatch_async(q, ^{ - write(fd, "abc", 3); - usleep(100000); // force the blocks to be on different threads - }); - dispatch_async(q, ^{ - close(fd); - usleep(100000); - }); - } - - dispatch_barrier_sync(q, ^{ }); -} - -void TestThreadLeak() { - pthread_t t1; - pthread_create(&t1, NULL, Thread1, NULL); -} - -int main(int argc, const char * argv[]) { - TestDataRace1(); - - TestInvalidMutex(); - - TestMutexWrongLock(); - - TestDataRaceBlocks1(); - - TestDataRaceBlocks2(); - - TestUseAfterFree(); - - TestRacePipe(); - - TestThreadLeak(); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/Makefile b/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/Makefile deleted file mode 100644 index c930ae563fc1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=thread -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py b/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py deleted file mode 100644 index 6e6587387ea9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Tests ThreadSanitizer's support to detect a leaked thread. -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class TsanThreadLeakTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessThreadSanitizer - def test(self): - self.build() - self.tsan_tests() - - def tsan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - # the stop reason of the thread should be breakpoint. - self.expect("thread list", "A thread leak should be detected", - substrs=['stopped', 'stop reason = Thread leak detected']) - - self.assertEqual( - self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), - lldb.eStopReasonInstrumentation) diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/main.c b/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/main.c deleted file mode 100644 index 3c17e228487b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/main.c +++ /dev/null @@ -1,24 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> - -void *f1(void *p) { - printf("hello\n"); - return NULL; -} - -int main (int argc, char const *argv[]) -{ - pthread_t t1; - pthread_create(&t1, NULL, f1, NULL); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/Makefile b/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/Makefile deleted file mode 100644 index c930ae563fc1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=thread -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py b/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py deleted file mode 100644 index 6565a2336563..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -Tests that TSan and LLDB have correct thread numbers. -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class TsanThreadNumbersTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["linux"], - bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") - @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default - @skipIfRemote - @skipUnlessThreadSanitizer - def test(self): - self.build() - self.tsan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def tsan_tests(self): - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("run") - - stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() - if stop_reason == lldb.eStopReasonExec: - # On OS X 10.10 and older, we need to re-exec to enable - # interceptors. - self.runCmd("continue") - - # the stop reason of the thread should be breakpoint. - self.expect("thread list", "A data race should be detected", - substrs=['stopped', 'stop reason = Data race detected']) - - self.assertEqual( - self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), - lldb.eStopReasonInstrumentation) - - report_thread_id = self.dbg.GetSelectedTarget( - ).process.GetSelectedThread().GetIndexID() - - self.expect( - "thread info -s", - "The extended stop info should contain the TSan provided fields", - substrs=[ - "instrumentation_class", - "description", - "mops"]) - - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - self.assertEqual(data["instrumentation_class"], "ThreadSanitizer") - self.assertEqual(data["issue_type"], "data-race") - self.assertEqual(len(data["mops"]), 2) - - self.assertEqual(data["mops"][0]["thread_id"], report_thread_id) - - other_thread_id = data["mops"][1]["thread_id"] - self.assertTrue(other_thread_id != report_thread_id) - other_thread = self.dbg.GetSelectedTarget( - ).process.GetThreadByIndexID(other_thread_id) - self.assertTrue(other_thread.IsValid()) - - self.runCmd("thread select %d" % other_thread_id) - - self.expect( - "thread backtrace", - "The other thread should be stopped in f1 or f2", - substrs=[ - "a.out", - "main.c"]) diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/main.c b/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/main.c deleted file mode 100644 index 04ebb723c3b7..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/main.c +++ /dev/null @@ -1,58 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -char *pointer; - -void *nothing(void *p) { - return NULL; -} - -void *f1(void *p) { - pointer[0] = 'x'; - sleep(100); - return NULL; -} - -void *f2(void *p) { - pointer[0] = 'y'; - sleep(100); - return NULL; -} - -int main (int argc, char const *argv[]) -{ - pointer = (char *)malloc(10); - - for (int i = 0; i < 3; i++) { - pthread_t t; - pthread_create(&t, NULL, nothing, NULL); - pthread_join(t, NULL); - } - - pthread_t t1; - pthread_create(&t1, NULL, f1, NULL); - - for (int i = 0; i < 3; i++) { - pthread_t t; - pthread_create(&t, NULL, nothing, NULL); - pthread_join(t, NULL); - } - - pthread_t t2; - pthread_create(&t2, NULL, f2, NULL); - - pthread_join(t1, NULL); - pthread_join(t2, NULL); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/tty/Makefile b/packages/Python/lldbsuite/test/functionalities/tty/Makefile deleted file mode 100644 index 0d70f2595019..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tty/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py b/packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py deleted file mode 100644 index c4d31df0989b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Test lldb command aliases. -""" - -from __future__ import print_function - - -import unittest2 -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LaunchInTerminalTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - # Darwin is the only platform that I know of that supports optionally launching - # a program in a separate terminal window. It would be great if other platforms - # added support for this. - @skipUnlessDarwin - # If the test is being run under sudo, the spawned terminal won't retain that elevated - # privilege so it can't open the socket to talk back to the test case - @unittest2.skipIf(hasattr(os, 'geteuid') and os.geteuid() - == 0, "test cannot be run as root") - # Do we need to disable this test if the testsuite is being run on a remote system? - # This env var is only defined when the shell is running in a local mac - # terminal window - @unittest2.skipUnless( - 'TERM_PROGRAM' in os.environ, - "test must be run on local system") - @no_debug_info_test - def test_launch_in_terminal(self): - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - launch_info = lldb.SBLaunchInfo(["-lAF", "/tmp/"]) - launch_info.SetLaunchFlags( - lldb.eLaunchFlagLaunchInTTY | lldb.eLaunchFlagCloseTTYOnExit) - error = lldb.SBError() - process = target.Launch(launch_info, error) - print("Error was: %s."%(error.GetCString())) - self.assertTrue( - error.Success(), - "Make sure launch happened successfully in a terminal window") - # Running in synchronous mode our process should have run and already - # exited by the time target.Launch() returns - self.assertTrue(process.GetState() == lldb.eStateExited) diff --git a/packages/Python/lldbsuite/test/functionalities/tty/main.c b/packages/Python/lldbsuite/test/functionalities/tty/main.c deleted file mode 100644 index 71c854b5bf40..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/tty/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> - -int -main(int argc, char** argv) -{ - for (int i = 0; i < argc; i++) { - printf("%d: %s.\n", i, argv[i]); - } - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile b/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py b/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py deleted file mode 100644 index 2c7fb01f2f26..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py +++ /dev/null @@ -1,158 +0,0 @@ -""" -Check that types only get completed when necessary. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TypeCompletionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - compiler="icc", - bugnumber="often fails with 'NameAndAddress should be valid.") - # Fails with gcc 4.8.1 with llvm.org/pr15301 LLDB prints incorrect sizes - # of STL containers - def test_with_run_command(self): - """Check that types only get completed when necessary.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_source_regexp( - self, "// Set break point at this line.") - - 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']) - - # This is the function to remove the custom formats in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('type category enable -l c++', check=False) - - self.runCmd('type category disable -l c++', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - p_vector = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable('p') - p_type = p_vector.GetType() - self.assertFalse( - p_type.IsTypeComplete(), - 'vector<T> complete but it should not be') - - self.runCmd("continue") - - p_vector = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable('p') - p_type = p_vector.GetType() - self.assertFalse( - p_type.IsTypeComplete(), - 'vector<T> complete but it should not be') - - self.runCmd("continue") - - self.runCmd("frame variable p --show-types") - - p_vector = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable('p') - p_type = p_vector.GetType() - self.assertTrue( - p_type.IsTypeComplete(), - 'vector<T> should now be complete') - name_address_type = p_type.GetTemplateArgumentType(0) - self.assertTrue( - name_address_type.IsValid(), - 'NameAndAddress should be valid') - self.assertFalse( - name_address_type.IsTypeComplete(), - 'NameAndAddress complete but it should not be') - - self.runCmd("continue") - - self.runCmd("frame variable guy --show-types") - - p_vector = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable('p') - p_type = p_vector.GetType() - self.assertTrue( - p_type.IsTypeComplete(), - 'vector<T> should now be complete') - name_address_type = p_type.GetTemplateArgumentType(0) - self.assertTrue( - name_address_type.IsValid(), - 'NameAndAddress should be valid') - self.assertTrue( - name_address_type.IsTypeComplete(), - 'NameAndAddress should now be complete') - field0 = name_address_type.GetFieldAtIndex(0) - self.assertTrue( - field0.IsValid(), - 'NameAndAddress::m_name should be valid') - string = field0.GetType().GetPointeeType() - self.assertTrue(string.IsValid(), 'CustomString should be valid') - self.assertFalse(string.IsTypeComplete(), - 'CustomString complete but it should not be') - - self.runCmd("continue") - - p_vector = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable('p') - p_type = p_vector.GetType() - self.assertTrue( - p_type.IsTypeComplete(), - 'vector<T> should now be complete') - name_address_type = p_type.GetTemplateArgumentType(0) - self.assertTrue( - name_address_type.IsValid(), - 'NameAndAddress should be valid') - self.assertTrue( - name_address_type.IsTypeComplete(), - 'NameAndAddress should now be complete') - field0 = name_address_type.GetFieldAtIndex(0) - self.assertTrue( - field0.IsValid(), - 'NameAndAddress::m_name should be valid') - string = field0.GetType().GetPointeeType() - self.assertTrue(string.IsValid(), 'CustomString should be valid') - self.assertFalse(string.IsTypeComplete(), - 'CustomString complete but it should not be') - - self.runCmd('type category enable -l c++', check=False) - self.runCmd('frame variable guy --show-types --ptr-depth=1') - - p_vector = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame().FindVariable('p') - p_type = p_vector.GetType() - self.assertTrue( - p_type.IsTypeComplete(), - 'vector<T> should now be complete') - name_address_type = p_type.GetTemplateArgumentType(0) - self.assertTrue( - name_address_type.IsValid(), - 'NameAndAddress should be valid') - self.assertTrue( - name_address_type.IsTypeComplete(), - 'NameAndAddress should now be complete') - field0 = name_address_type.GetFieldAtIndex(0) - self.assertTrue( - field0.IsValid(), - 'NameAndAddress::m_name should be valid') - string = field0.GetType().GetPointeeType() - self.assertTrue(string.IsValid(), 'CustomString should be valid') - self.assertTrue( - string.IsTypeComplete(), - 'CustomString should now be complete') diff --git a/packages/Python/lldbsuite/test/functionalities/type_completion/main.cpp b/packages/Python/lldbsuite/test/functionalities/type_completion/main.cpp deleted file mode 100644 index 80329737928e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/type_completion/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <string.h> -#include <vector> -#include <iostream> - -class CustomString -{ -public: - CustomString (const char* buffer) : - m_buffer(nullptr) - { - if (buffer) - { - auto l = strlen(buffer); - m_buffer = new char[1 + l]; - strcpy(m_buffer, buffer); - } - } - - ~CustomString () - { - delete[] m_buffer; - } - - const char* - GetBuffer () - { - return m_buffer; - } - -private: - char *m_buffer; -}; - -class NameAndAddress - { - public: - CustomString& GetName() { return *m_name; } - CustomString& GetAddress() { return *m_address; } - NameAndAddress(const char* N, const char* A) : m_name(new CustomString(N)), m_address(new CustomString(A)) - { - } - ~NameAndAddress() - { - } - - private: - CustomString* m_name; - CustomString* m_address; -}; - -typedef std::vector<NameAndAddress> People; - -int main (int argc, const char * argv[]) -{ - People p; - p.push_back(NameAndAddress("Enrico","123 Main Street")); - p.push_back(NameAndAddress("Foo","10710 Johnson Avenue")); // Set break point at this line. - p.push_back(NameAndAddress("Arpia","6956 Florey Street")); - p.push_back(NameAndAddress("Apple","1 Infinite Loop")); // Set break point at this line. - p.push_back(NameAndAddress("Richard","9500 Gilman Drive")); - p.push_back(NameAndAddress("Bar","3213 Windsor Rd")); - - for (int j = 0; j<p.size(); j++) - { - NameAndAddress guy = p[j]; - std::cout << "Person " << j << " is named " << guy.GetName().GetBuffer() << " and lives at " << guy.GetAddress().GetBuffer() << std::endl; // Set break point at this line. - } - - return 0; - -} - diff --git a/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile b/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile deleted file mode 100644 index 7fb4d7a5ab1b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../make - -OBJCXX_SOURCES := main.mm - -CFLAGS_EXTRAS += -w - -include $(LEVEL)/Makefile.rules - -LDFLAGS += -framework Foundation diff --git a/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py b/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py deleted file mode 100644 index 272634fcab91..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -Test type lookup command. -""" - -from __future__ import print_function - - -import datetime -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TypeLookupTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.mm', '// break here') - - @skipUnlessDarwin - @skipIf(archs=['i386']) - def test_type_lookup(self): - """Test type lookup command.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.mm", 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']) - - self.expect( - 'type lookup NoSuchType', - substrs=['@interface'], - matching=False) - self.expect('type lookup NSURL', substrs=['NSURL']) - self.expect('type lookup NSArray', substrs=['NSArray']) - self.expect('type lookup NSObject', substrs=['NSObject', 'isa']) - self.expect('type lookup PleaseDontBeARealTypeThatExists', substrs=[ - "no type was found matching 'PleaseDontBeARealTypeThatExists'"]) - self.expect('type lookup MyCPPClass', substrs=['setF', 'float getF']) - self.expect('type lookup MyClass', substrs=['setF', 'float getF']) - self.expect('type lookup MyObjCClass', substrs=['@interface MyObjCClass', 'int x', 'int y']) diff --git a/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm b/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm deleted file mode 100644 index f62e5cb5b8c9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm +++ /dev/null @@ -1,58 +0,0 @@ -//===-- main.mm -----------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import <Foundation/Foundation.h> - -class MyCPPClass { -public: - MyCPPClass(float f) : f(f) {} - - float setF(float f) { - float oldf = this->f; - this->f = f; - return oldf; - } - - float getF() { - return f; - } -private: - float f; -}; - -typedef MyCPPClass MyClass; - -@interface MyObjCClass : NSObject { - int x; -} -- (id)init; -- (int)read; -@end - -@implementation MyObjCClass { - int y; -} -- (id)init { - if (self = [super init]) { - self->x = 12; - self->y = 24; - } - return self; -} -- (int)read { - return self->x + self->y; -} -@end - -int main (int argc, const char * argv[]) -{ - MyClass my_cpp(3.1415); - return 0; // break here -} - diff --git a/packages/Python/lldbsuite/test/functionalities/ubsan/basic/Makefile b/packages/Python/lldbsuite/test/functionalities/ubsan/basic/Makefile deleted file mode 100644 index 6e7d19b6f48c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ubsan/basic/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=undefined -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py b/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py deleted file mode 100644 index 5dfa08e78308..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py +++ /dev/null @@ -1,90 +0,0 @@ -""" -Tests basic UndefinedBehaviorSanitizer support (detecting an alignment error). -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class UbsanBasicTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessUndefinedBehaviorSanitizer - def test(self): - self.build() - self.ubsan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.line_align = line_number('main.c', '// align line') - - def ubsan_tests(self): - # Load the test - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("run") - - process = self.dbg.GetSelectedTarget().process - thread = process.GetSelectedThread() - frame = thread.GetSelectedFrame() - - # the stop reason of the thread should be breakpoint. - self.expect("thread list", "A ubsan issue should be detected", - substrs=['stopped', 'stop reason =']) - - stop_reason = thread.GetStopReason() - self.assertEqual(stop_reason, lldb.eStopReasonInstrumentation) - - # test that the UBSan dylib is present - self.expect( - "image lookup -n __ubsan_on_report", - "__ubsan_on_report should be present", - substrs=['1 match found']) - - # We should be stopped in __ubsan_on_report - self.assertTrue("__ubsan_on_report" in frame.GetFunctionName()) - - # The stopped thread backtrace should contain either 'align line' - found = False - for i in range(thread.GetNumFrames()): - frame = thread.GetFrameAtIndex(i) - if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c": - if frame.GetLineEntry().GetLine() == self.line_align: - found = True - self.assertTrue(found) - - backtraces = thread.GetStopReasonExtendedBacktraces( - lldb.eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer) - self.assertTrue(backtraces.GetSize() == 1) - - self.expect( - "thread info -s", - "The extended stop info should contain the UBSan provided fields", - substrs=[ - "instrumentation_class", - "memory_address", - "description", - "filename", - "line", - "col"]) - - output_lines = self.res.GetOutput().split('\n') - json_line = '\n'.join(output_lines[2:]) - data = json.loads(json_line) - - self.assertEqual(data["instrumentation_class"], "UndefinedBehaviorSanitizer") - self.assertEqual(data["description"], "misaligned-pointer-use") - self.assertEqual(os.path.basename(data["filename"]), "main.c") - self.assertEqual(data["line"], self.line_align) - - self.runCmd("continue") diff --git a/packages/Python/lldbsuite/test/functionalities/ubsan/basic/main.c b/packages/Python/lldbsuite/test/functionalities/ubsan/basic/main.c deleted file mode 100644 index 4991fc074d09..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ubsan/basic/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() { - int data[4]; - return *(int *)(((char *)&data[0]) + 2); // align line -} diff --git a/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile b/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile deleted file mode 100644 index 6e7d19b6f48c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS := -fsanitize=undefined -g - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py b/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py deleted file mode 100644 index d0502cc052a5..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Test that hitting a UBSan issue while running user expression doesn't break the evaluation. -""" - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil -import json - - -class UbsanUserExpressionTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessUndefinedBehaviorSanitizer - def test(self): - self.build() - self.ubsan_tests() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - self.line_breakpoint = line_number('main.c', '// breakpoint line') - - def ubsan_tests(self): - # Load the test - exe = self.getBuildArtifact("a.out") - self.expect( - "file " + exe, - patterns=["Current executable set to .*a.out"]) - - self.runCmd("breakpoint set -f main.c -l %d" % self.line_breakpoint) - - self.runCmd("run") - - process = self.dbg.GetSelectedTarget().process - thread = process.GetSelectedThread() - frame = thread.GetSelectedFrame() - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - - self.expect("p foo()", substrs=["(int) $0 = 42"]) - - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) diff --git a/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c b/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c deleted file mode 100644 index 4786aaa89b27..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c +++ /dev/null @@ -1,9 +0,0 @@ -int foo() { - int data[4]; - int x = *(int *)(((char *)&data[0]) + 2); - return 42; -} - -int main() { - return 0; // breakpoint line -} diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/Makefile b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/Makefile deleted file mode 100644 index 289d25698ffb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -CFLAGS ?= -g -fomit-frame-pointer - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py deleted file mode 100644 index 9c87d1759f8c..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Test that we can backtrace correctly from Non ABI functions on the stack -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class EHFrameBasedUnwind(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipUnlessPlatform(['linux']) - @skipIf(archs=["aarch64", "arm", "i386", "i686"]) - def test(self): - """Test that we can backtrace correctly from Non ABI functions on the stack""" - self.build() - self.setTearDownCleanup() - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - - self.assertTrue(target, VALID_TARGET) - - lldbutil.run_break_set_by_symbol(self, "func") - - process = target.LaunchSimple( - ["abc", "xyz"], None, self.get_process_working_directory()) - - if not process: - self.fail("SBTarget.Launch() failed") - - if process.GetState() != lldb.eStateStopped: - self.fail("Process should be in the 'stopped' state, " - "instead the actual state is: '%s'" % - lldbutil.state_type_to_str(process.GetState())) - - stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) - self.expect(stacktraces, exe=False, - substrs=['(int)argc=3']) - - self.runCmd("thread step-inst") - - stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) - self.expect(stacktraces, exe=False, - substrs=['(int)argc=3']) diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c deleted file mode 100644 index 46de1efe6265..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c +++ /dev/null @@ -1,58 +0,0 @@ -void func() { - -#ifdef __powerpc64__ - __asm__ ( - "mflr 0;" - "std 0,16(1);" - "addi 1,1,-24;" - "mr 31,1;" - ".cfi_def_cfa_offset 24;" - "addi 0,0,0;" - "addi 1,1,24;" - "ld 0,16(1);" - ".cfi_def_cfa_offset 0;" - ); -#elif !defined __mips__ - __asm__ ( - "pushq $0x10;" - ".cfi_def_cfa_offset 16;" - "jmp label;" - "movq $0x48, %rax;" -"label: subq $0x38, %rax;" - "movq $0x48, %rcx;" - "movq $0x48, %rdx;" - "movq $0x48, %rax;" - "popq %rax;" - ); -#elif __mips64 - __asm__ ( - "daddiu $sp,$sp,-16;" - ".cfi_def_cfa_offset 16;" - "sd $ra,8($sp);" - ".cfi_offset 31, -8;" - "daddiu $ra,$zero,0;" - "ld $ra,8($sp);" - "daddiu $sp, $sp,16;" - ".cfi_restore 31;" - ".cfi_def_cfa_offset 0;" - ); -#else - // For MIPS32 - __asm__ ( - "addiu $sp,$sp,-8;" - ".cfi_def_cfa_offset 8;" - "sw $ra,4($sp);" - ".cfi_offset 31, -4;" - "addiu $ra,$zero,0;" - "lw $ra,4($sp);" - "addiu $sp,$sp,8;" - ".cfi_restore 31;" - ".cfi_def_cfa_offset 0;" - ); -#endif -} - -int main(int argc, char const *argv[]) -{ - func(); -} diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/Makefile b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/Makefile deleted file mode 100644 index ede25f029bcd..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -CFLAGS ?= -g -Os - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py deleted file mode 100644 index a2558c77789b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Test that we can backtrace correctly with 'noreturn' functions on the stack -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class NoreturnUnwind(TestBase): - mydir = TestBase.compute_mydir(__file__) - - @skipIfWindows # clang-cl does not support gcc style attributes. - # clang does not preserve LR in noreturn functions, making unwinding impossible - @skipIf(compiler="clang", archs=['arm'], oslist=['linux']) - @expectedFailureAll(bugnumber="llvm.org/pr33452", triple='^mips') - def test(self): - """Test that we can backtrace correctly with 'noreturn' functions on the stack""" - self.build() - self.setTearDownCleanup() - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - if not process: - self.fail("SBTarget.Launch() failed") - - if process.GetState() != lldb.eStateStopped: - self.fail("Process should be in the 'stopped' state, " - "instead the actual state is: '%s'" % - lldbutil.state_type_to_str(process.GetState())) - - thread = process.GetThreadAtIndex(0) - abort_frame_number = 0 - for f in thread.frames: - # Some C libraries mangle the abort symbol into __GI_abort. - if f.GetFunctionName() in ["abort", "__GI_abort"]: - break - abort_frame_number = abort_frame_number + 1 - - if self.TraceOn(): - print("Backtrace once we're stopped:") - for f in thread.frames: - print(" %d %s" % (f.GetFrameID(), f.GetFunctionName())) - - # I'm going to assume that abort() ends up calling/invoking another - # function before halting the process. In which case if abort_frame_number - # equals 0, we didn't find abort() in the backtrace. - if abort_frame_number == len(thread.frames): - self.fail("Unable to find abort() in backtrace.") - - func_c_frame_number = abort_frame_number + 1 - if thread.GetFrameAtIndex( - func_c_frame_number).GetFunctionName() != "func_c": - self.fail("Did not find func_c() above abort().") - - # This depends on whether we see the func_b inlined function in the backtrace - # or not. I'm not interested in testing that aspect of the backtrace here - # right now. - - if thread.GetFrameAtIndex( - func_c_frame_number + - 1).GetFunctionName() == "func_b": - func_a_frame_number = func_c_frame_number + 2 - else: - func_a_frame_number = func_c_frame_number + 1 - - if thread.GetFrameAtIndex( - func_a_frame_number).GetFunctionName() != "func_a": - self.fail("Did not find func_a() above func_c().") - - main_frame_number = func_a_frame_number + 1 - - if thread.GetFrameAtIndex( - main_frame_number).GetFunctionName() != "main": - self.fail("Did not find main() above func_a().") diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/main.c b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/main.c deleted file mode 100644 index 4f6525fbf52f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/main.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -static void func_a (void) __attribute__((noinline)); -static void func_b (void) __attribute__((noreturn)); -static void func_c (void) __attribute__((noinline)); - -static void -func_c (void) -{ - abort (); -} - -static void -func_b (void) -{ - func_c (); - while (1) - ; -} - -static void -func_a (void) -{ - func_b (); -} - -int -main (int argc, char *argv[]) -{ - func_a (); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py deleted file mode 100644 index 3aa6a230e8b6..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Test that we properly display the backtrace when a noreturn function happens to -be at the end of the stack. -""" - -from __future__ import print_function - -import shutil -import struct - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestNoreturnModuleEnd(TestBase): - NO_DEBUG_INFO_TESTCASE = True - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - super(TestNoreturnModuleEnd, self).setUp() - self._initial_platform = lldb.DBG.GetSelectedPlatform() - - def tearDown(self): - lldb.DBG.SetSelectedPlatform(self._initial_platform) - super(TestNoreturnModuleEnd, self).tearDown() - - def test(self): - target = self.dbg.CreateTarget("test.out") - process = target.LoadCore("test.core") - self.assertTrue(process.IsValid(), PROCESS_IS_VALID) - self.assertEqual(process.GetNumThreads(), 1) - - thread = process.GetSelectedThread() - self.assertTrue(thread.IsValid()) - - backtrace = [ - ["func2", 3], - ["func1", 8], - ["_start", 8], - ] - self.assertEqual(thread.GetNumFrames(), len(backtrace)) - for i in range(len(backtrace)): - frame = thread.GetFrameAtIndex(i) - self.assertTrue(frame.IsValid()) - symbol = frame.GetSymbol() - self.assertTrue(symbol.IsValid()) - self.assertEqual(symbol.GetName(), backtrace[i][0]) - function_start = symbol.GetStartAddress().GetLoadAddress(target) - self.assertEquals(function_start + backtrace[i][1], frame.GetPC()) - - self.dbg.DeleteTarget(target) diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/a.s b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/a.s deleted file mode 100644 index 119465c132a9..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/a.s +++ /dev/null @@ -1,35 +0,0 @@ -# compile this with: -# as a.s -o a.o --32 && ld a.o -m elf_i386 -# generate core file with: -# ulimit -s 12 && ./a.out - -.text - -.globl func2 -.type func2, @function -func2: - pushl %ebp - movl %esp, %ebp - movl 0, %eax - popl %ebp - ret -.size func2, .-func2 - -.globl _start -.type _start, @function -_start: - pushl %ebp - movl %esp, %ebp - call func1 - popl %ebp - ret -.size _start, .-_start - -.globl func1 -.type func1, @function -func1: - pushl %ebp - movl %esp, %ebp - call func2 -.size func1, .-func1 - diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.core b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.core Binary files differdeleted file mode 100644 index 6717d4ff6471..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.core +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.out b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.out Binary files differdeleted file mode 100755 index 141c61ecbea3..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.out +++ /dev/null diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/Makefile b/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py deleted file mode 100644 index f971942322b1..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Test that we can backtrace correctly with 'sigtramp' functions on the stack -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class SigtrampUnwind(TestBase): - mydir = TestBase.compute_mydir(__file__) - - # On different platforms the "_sigtramp" and "__kill" frames are likely to be different. - # This test could probably be adapted to run on linux/*bsd easily enough. - @skipUnlessDarwin - @expectedFailureAll(oslist=["ios", "watchos", "tvos", "bridgeos"], bugnumber="<rdar://problem/34006863>") # lldb skips 1 frame on arm64 above _sigtramp - def test(self): - """Test that we can backtrace correctly with _sigtramp on the stack""" - self.build() - self.setTearDownCleanup() - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - lldbutil.run_break_set_by_file_and_line(self, "main.c", line_number( - 'main.c', '// Set breakpoint here'), num_expected_locations=1) - - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - if not process: - self.fail("SBTarget.Launch() failed") - - if process.GetState() != lldb.eStateStopped: - self.fail("Process should be in the 'stopped' state, " - "instead the actual state is: '%s'" % - lldbutil.state_type_to_str(process.GetState())) - - self.expect( - "pro handle -n false -p true -s false SIGUSR1", - "Have lldb pass SIGUSR1 signals", - substrs=[ - "SIGUSR1", - "true", - "false", - "false"]) - - lldbutil.run_break_set_by_symbol( - self, - "handler", - num_expected_locations=1, - module_name="a.out") - - self.runCmd("continue") - - thread = process.GetThreadAtIndex(0) - - found_handler = False - found_sigtramp = False - found_kill = False - found_main = False - - for f in thread.frames: - if f.GetFunctionName() == "handler": - found_handler = True - if f.GetFunctionName() == "_sigtramp": - found_sigtramp = True - if f.GetFunctionName() == "__kill": - found_kill = True - if f.GetFunctionName() == "main": - found_main = True - - if self.TraceOn(): - print("Backtrace once we're stopped:") - for f in thread.frames: - print(" %d %s" % (f.GetFrameID(), f.GetFunctionName())) - - if not found_handler: - self.fail("Unable to find handler() in backtrace.") - - if not found_sigtramp: - self.fail("Unable to find _sigtramp() in backtrace.") - - if not found_kill: - self.fail("Unable to find kill() in backtrace.") - - if not found_main: - self.fail("Unable to find main() in backtrace.") diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/main.c b/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/main.c deleted file mode 100644 index aaa03e7aa843..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/main.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <stdlib.h> -#include <signal.h> -#include <stdio.h> -#include <unistd.h> - -void handler (int in) -{ - puts ("in handler routine"); - while (1) - ; -} - -void -foo () -{ - puts ("in foo ()"); - kill (getpid(), SIGUSR1); -} -int main () -{ - puts ("in main"); // Set breakpoint here - signal (SIGUSR1, handler); - puts ("signal handler set up"); - foo(); - puts ("exiting"); - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/standard/Makefile b/packages/Python/lldbsuite/test/functionalities/unwind/standard/Makefile deleted file mode 100644 index 146da30b12cb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/standard/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../../make - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py deleted file mode 100644 index 4bacb0bd9884..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py +++ /dev/null @@ -1,178 +0,0 @@ -""" -Test that we can backtrace correctly from standard functions. - -This test suit is a collection of automatically generated tests from the source files in the -directory. Please DON'T add individual test cases to this file. - -To add a new test case to this test suit please create a simple C/C++ application and put the -source file into the directory of the test cases. The test suit will automatically pick the -file up and generate a test case from it in run time (with name test_standard_unwind_<file_name> -after escaping some special characters). -""" - -from __future__ import print_function - - -import unittest2 -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -test_source_dirs = ["."] - - -class StandardUnwindTest(TestBase): - mydir = TestBase.compute_mydir(__file__) - - def standard_unwind_tests(self): - # The following variables have to be defined for each architecture and OS we testing for: - # base_function_names: List of function names where we accept that the stack unwinding is - # correct if they are on the stack. It should include the bottom most - # function on the stack and a list of functions where we know we can't - # unwind for any reason (list of expected failure functions) - # no_step_function_names: The list of functions where we don't want to step through - # instruction by instruction for any reason. (A valid reason is if - # it is impossible to step through a function instruction by - # instruction because it is special for some reason.) For these - # functions we will immediately do a step-out when we hit them. - - triple = self.dbg.GetSelectedPlatform().GetTriple() - if re.match("arm-.*-.*-android", triple): - base_function_names = [ - "_start", # Base function on the stack - "__memcpy_base", # Function reached by a fall through from the previous function - "__memcpy_base_aligned", - # Function reached by a fall through from the previous function - ] - no_step_function_names = [ - "__sync_fetch_and_add_4", # Calls into a special SO where we can't set a breakpoint - "pthread_mutex_lock", - # Uses ldrex and strex what interferes with the software single - # stepping - "pthread_mutex_unlock", - # Uses ldrex and strex what interferes with the software single - # stepping - "pthread_once", - # Uses ldrex and strex what interferes with the software single - # stepping - ] - elif re.match("aarch64-.*-.*-android", triple): - base_function_names = [ - "do_arm64_start", # Base function on the stack - ] - no_step_function_names = [ - None, - "__cxa_guard_acquire", - # Uses ldxr and stxr what interferes with the software single - # stepping - "__cxa_guard_release", - # Uses ldxr and stxr what interferes with the software single - # stepping - "pthread_mutex_lock", - # Uses ldxr and stxr what interferes with the software single - # stepping - "pthread_mutex_unlock", - # Uses ldxr and stxr what interferes with the software single - # stepping - "pthread_once", - # Uses ldxr and stxr what interferes with the software single - # stepping - ] - else: - self.skipTest("No expectations for the current architecture") - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - target.BreakpointCreateByName("main") - - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process is not None, "SBTarget.Launch() failed") - self.assertEqual( - process.GetState(), - lldb.eStateStopped, - "The process didn't hit main") - - index = 0 - while process.GetState() == lldb.eStateStopped: - index += 1 - if process.GetNumThreads() > 1: - # In case of a multi threaded inferior if one of the thread is stopped in a blocking - # syscall and we try to step it then - # SBThread::StepInstruction() will block forever - self.skipTest( - "Multi threaded inferiors are not supported by this test") - - thread = process.GetThreadAtIndex(0) - - if self.TraceOn(): - print("INDEX: %u" % index) - for f in thread.frames: - print(f) - - if thread.GetFrameAtIndex(0).GetFunctionName() is not None: - found_main = False - for f in thread.frames: - if f.GetFunctionName() in base_function_names: - found_main = True - break - self.assertTrue(found_main, - "Main function isn't found on the backtrace") - - if thread.GetFrameAtIndex( - 0).GetFunctionName() in no_step_function_names: - thread.StepOut() - else: - thread.StepInstruction(False) - -# Collect source files in the specified directories -test_source_files = set([]) -for d in test_source_dirs: - if os.path.isabs(d): - dirname = d - else: - dirname = os.path.join(os.path.dirname(__file__), d) - - for root, _, files in os.walk(dirname): - test_source_files = test_source_files | set( - os.path.abspath(os.path.join(root, f)) for f in files) - -# Generate test cases based on the collected source files -for f in test_source_files: - if f.endswith(".cpp") or f.endswith(".c"): - @add_test_categories(["dwarf"]) - @unittest2.skipIf( - TestBase.skipLongRunningTest(), - "Skip this long running test") - def test_function_dwarf(self, f=f): - if f.endswith(".cpp"): - d = {'CXX_SOURCES': f} - elif f.endswith(".c"): - d = {'C_SOURCES': f} - - # If we can't compile the inferior just skip the test instead of failing it. - # It makes the test suit more robust when testing on several different architecture - # avoid the hassle of skipping tests manually. - try: - self.buildDwarf(dictionary=d) - self.setTearDownCleanup(d) - except: - if self.TraceOn(): - print(sys.exc_info()[0]) - self.skipTest("Inferior not supported") - self.standard_unwind_tests() - - test_name = "test_unwind_" + str(f) - for c in ".=()/\\": - test_name = test_name.replace(c, '_') - - test_function_dwarf.__name__ = test_name - setattr( - StandardUnwindTest, - test_function_dwarf.__name__, - test_function_dwarf) diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/divmod.cpp b/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/divmod.cpp deleted file mode 100644 index 75df6ba89372..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/divmod.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===-- divmod.cpp ----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int -main(int argc, char const *argv[]) -{ - signed long long a = 123456789, b = 12, c = a / b, d = a % b; - unsigned long long e = 123456789, f = 12, g = e / f, h = e % f; -} diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/fprintf.cpp b/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/fprintf.cpp deleted file mode 100644 index 188738cb9bab..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/fprintf.cpp +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <cstdio> - -int -main(int argc, char const *argv[]) -{ - fprintf(stderr, "%d %p %s\n", argc, argv, argv[0]); -} diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/new_delete.cpp b/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/new_delete.cpp deleted file mode 100644 index d240b89e50ab..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/unwind/standard/hand_written/new_delete.cpp +++ /dev/null @@ -1,15 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int -main(int argc, char const *argv[]) -{ - int* p = new int; - delete p; -} diff --git a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/Makefile b/packages/Python/lldbsuite/test/functionalities/value_md5_crash/Makefile deleted file mode 100644 index 8a7102e347af..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../make - -CXX_SOURCES := main.cpp - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py b/packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py deleted file mode 100644 index 1a8fbdf5e2ba..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -Verify that the hash computing logic for ValueObject's values can't crash us. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class ValueMD5CrashTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break at. - self.line = line_number('main.cpp', '// break here') - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663") - def test_with_run_command(self): - """Verify that the hash computing logic for ValueObject's values can't crash us.""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - 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']) - - value = self.frame().FindVariable("a") - value.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) - - v = value.GetValue() - type_name = value.GetTypeName() - self.assertTrue(type_name == "B *", "a is a B*") - - self.runCmd("next") - self.runCmd("process kill") - - # now the process is dead, and value needs updating - v = value.GetValue() - - # if we are here, instead of crashed, the test succeeded diff --git a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/main.cpp b/packages/Python/lldbsuite/test/functionalities/value_md5_crash/main.cpp deleted file mode 100644 index ba596b8653cf..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -class A { -public: - virtual int foo() { return 1; } - virtual ~A () = default; - A() = default; -}; - -class B : public A { -public: - virtual int foo() { return 2; } - virtual ~B () = default; - B() = default; -}; - -int main() { - A* a = new B(); - a->foo(); // break here - return 0; // break here -} - diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories b/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories deleted file mode 100644 index 50c1613cda72..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/.categories +++ /dev/null @@ -1 +0,0 @@ -watchpoint diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/Makefile deleted file mode 100644 index 8817fff55e8c..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py deleted file mode 100644 index d39d35f76883..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -Test lldb watchpoint that uses '-s size' to watch a pointed location with size. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -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']) - @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/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp deleted file mode 100644 index e20a6d988c84..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <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/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py deleted file mode 100644 index 8e19f9b3b5b8..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py +++ /dev/null @@ -1,97 +0,0 @@ -""" -Test my first lldb watchpoint. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/main.c deleted file mode 100644 index 11a738a0de43..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/main.c +++ /dev/null @@ -1,30 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py deleted file mode 100644 index 22dc19ed322f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py +++ /dev/null @@ -1,103 +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 os -import time -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/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c deleted file mode 100644 index fd14a9b353fc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c +++ /dev/null @@ -1,29 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile deleted file mode 100644 index 314f1cb2f077..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py deleted file mode 100644 index a6d77924892b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -Test handling of cases when a single instruction triggers multiple watchpoints -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp deleted file mode 100644 index 430c02cc052a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <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/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/Makefile deleted file mode 100644 index 8817fff55e8c..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py deleted file mode 100644 index 85d6c84d68ff..000000000000 --- a/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 os -import time -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") - 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") - 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/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp deleted file mode 100644 index 1bfc3b2538b2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "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/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py deleted file mode 100644 index e0c77b4ea6be..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/main.c deleted file mode 100644 index 2d87d9a2f73f..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py deleted file mode 100644 index b2f267364dd0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Test that a variable watchpoint should only hit when in scope. -""" - -from __future__ import print_function - - -import unittest2 -import os -import time -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/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/main.c deleted file mode 100644 index 1bf7a00ac837..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py deleted file mode 100644 index 5bb683934c1b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py +++ /dev/null @@ -1,377 +0,0 @@ -""" -Test watchpoint list, enable, disable, and delete commands. -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/Makefile deleted file mode 100644 index ee6b9cc62b40..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py deleted file mode 100644 index cd819f27ec5f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py +++ /dev/null @@ -1,171 +0,0 @@ -""" -Test 'watchpoint command'. -""" - -from __future__ import print_function - - -import os -import time -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"], - bugnumber="llvm.org/pr27710") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - 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"], - bugnumber="llvm.org/pr27710") - @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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py deleted file mode 100644 index d9edd05d3a76..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py +++ /dev/null @@ -1,169 +0,0 @@ -""" -Test 'watchpoint command'. -""" - -from __future__ import print_function - - -import os -import time -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"], - bugnumber="llvm.org/pr27710") - 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"], - bugnumber="llvm.org/pr27710") - 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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/main.cpp deleted file mode 100644 index 6cb80c62217e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py deleted file mode 100644 index ae5913a500e0..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/Makefile deleted file mode 100644 index ee6b9cc62b40..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py deleted file mode 100644 index a77b1e70e3dd..000000000000 --- a/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 os -import time -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"], - bugnumber="llvm.org/pr27710") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") - 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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/main.cpp deleted file mode 100644 index f4c3527f8af2..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/main.c deleted file mode 100644 index b20eaf494fbf..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/main.c +++ /dev/null @@ -1,24 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py deleted file mode 100644 index ea4f06218a0d..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Test that the SBWatchpoint::SetEnable API works. -""" - -import os -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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c deleted file mode 100644 index dcbc766c5949..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py deleted file mode 100644 index cedfad9b566f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py +++ /dev/null @@ -1,118 +0,0 @@ -"""Test that adding, deleting and modifying watchpoints sends the appropriate events.""" - -from __future__ import print_function - - -import os -import time -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"], - 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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/main.c deleted file mode 100644 index 4b917536a161..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py deleted file mode 100644 index 5b72f5edda74..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Test displayed value of a vector variable while doing watchpoint operations -""" - -from __future__ import print_function - - -import os -import time -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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/main.c deleted file mode 100644 index ac2370e32d2a..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/main.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -typedef signed char v4i8 __attribute__ ((vector_size(4))); -v4i8 global_vector = {1, 2, 3, 4}; - -int -main () -{ - return 0; -} diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/Makefile deleted file mode 100644 index 8817fff55e8c..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py deleted file mode 100644 index c7f7d02392eb..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py +++ /dev/null @@ -1,108 +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 os -import time -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") - 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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py deleted file mode 100644 index e6718f0bc6f0..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Test error cases for the 'watchpoint set' command to make sure it errors out when necessary. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class WatchpointSetErrorTestCase(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.') - # Build dictionary to have unique executable names for each test - # method. - - def test_error_cases_with_watchpoint_set(self): - """Test error cases with the 'watchpoint set' command.""" - 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']) - - # Try some error conditions: - - # 'watchpoint set' is now a multiword command. - self.expect("watchpoint set", - substrs=['The following subcommands are supported:', - 'expression', - 'variable']) - self.runCmd("watchpoint set variable -w read_write", check=False) - - # 'watchpoint set expression' with '-w' or '-s' specified now needs - # an option terminator and a raw expression after that. - self.expect("watchpoint set expression -w write --", error=True, - startstr='error: ') - - # It's an error if the expression did not evaluate to an address. - self.expect( - "watchpoint set expression MyAggregateDataType", - error=True, - startstr='error: expression did not evaluate to an address') - - # Wrong size parameter is an error. - self.expect("watchpoint set variable -s -128", error=True, - substrs=['invalid enumeration value']) diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp deleted file mode 100644 index 796c0ef359df..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <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(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) - { - // 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[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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py deleted file mode 100644 index d4f78a5f3ecc..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py +++ /dev/null @@ -1,134 +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 os -import time -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/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/main.c deleted file mode 100644 index ed9fed1e2113..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/main.c +++ /dev/null @@ -1,66 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#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; -} diff --git a/packages/Python/lldbsuite/test/functionalities/wrong_commands/.categories b/packages/Python/lldbsuite/test/functionalities/wrong_commands/.categories deleted file mode 100644 index 3a3f4df6416b..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/wrong_commands/.categories +++ /dev/null @@ -1 +0,0 @@ -cmdline diff --git a/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py b/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py deleted file mode 100644 index c25f9afbfa4e..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -Test how lldb reacts to wrong commands -""" - -from __future__ import print_function - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class UnknownCommandTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @no_debug_info_test - def test_ambiguous_command(self): - command_interpreter = self.dbg.GetCommandInterpreter() - self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) - result = lldb.SBCommandReturnObject() - - command_interpreter.HandleCommand("g", result) - self.assertFalse(result.Succeeded()) - self.assertRegexpMatches(result.GetError(), "Ambiguous command 'g'. Possible matches:") - self.assertRegexpMatches(result.GetError(), "gui") - self.assertRegexpMatches(result.GetError(), "gdb-remote") - self.assertEquals(1, result.GetError().count("gdb-remote")) - - @no_debug_info_test - def test_unknown_command(self): - command_interpreter = self.dbg.GetCommandInterpreter() - self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) - result = lldb.SBCommandReturnObject() - - command_interpreter.HandleCommand("qbert", result) - self.assertFalse(result.Succeeded()) - self.assertEquals(result.GetError(), "error: 'qbert' is not a valid command.\n") |
