diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/c')
104 files changed, 0 insertions, 4200 deletions
diff --git a/packages/Python/lldbsuite/test/lang/c/anonymous/Makefile b/packages/Python/lldbsuite/test/lang/c/anonymous/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/anonymous/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py b/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py deleted file mode 100644 index e3ae93d3a5ba..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py +++ /dev/null @@ -1,173 +0,0 @@ -"""Test that anonymous structs/unions are transparent to member access""" - -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 AnonymousTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIf( - compiler="icc", - bugnumber="llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC") - def test_expr_nest(self): - self.build() - self.common_setup(self.line0) - - # These should display correctly. - self.expect("expression n->foo.d", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 4"]) - - self.expect("expression n->b", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 2"]) - - def test_expr_child(self): - self.build() - self.common_setup(self.line1) - - # These should display correctly. - self.expect("expression c->foo.d", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 4"]) - - self.expect( - "expression c->grandchild.b", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 2"]) - - @skipIf( - compiler="icc", - bugnumber="llvm.org/pr15036: This particular regression was introduced by r181498") - def test_expr_grandchild(self): - self.build() - self.common_setup(self.line2) - - # These should display correctly. - self.expect("expression g.child.foo.d", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 4"]) - - self.expect("expression g.child.b", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 2"]) - - def test_expr_parent(self): - 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.common_setup(self.line2) - - # These should display correctly. - self.expect("expression pz", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["(type_z *) $", " = 0x0000"]) - - self.expect("expression z.y", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["(type_y) $", "dummy = 2"]) - - def test_expr_null(self): - self.build() - self.common_setup(self.line2) - - # This should fail because pz is 0, but it succeeds on OS/X. - # This fails on Linux with an upstream error "Couldn't dematerialize struct", as does "p *n" with "int *n = 0". - # Note that this can also trigger llvm.org/pr15036 when run - # interactively at the lldb command prompt. - self.expect("expression *(type_z *)pz", error=True) - - def test_child_by_name(self): - self.build() - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) - - # Create a target - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - break_in_main = target.BreakpointCreateBySourceRegex( - '// Set breakpoint 2 here.', lldb.SBFileSpec(self.source)) - self.assertTrue(break_in_main, VALID_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_in_main) - if len(threads) != 1: - self.fail("Failed to stop at breakpoint in main.") - - thread = threads[0] - frame = thread.frames[0] - - if not frame.IsValid(): - self.fail("Failed to get frame 0.") - - var_n = frame.FindVariable("n") - if not var_n.IsValid(): - self.fail("Failed to get the variable 'n'") - - elem_a = var_n.GetChildMemberWithName("a") - if not elem_a.IsValid(): - self.fail("Failed to get the element a in n") - - error = lldb.SBError() - value = elem_a.GetValueAsSigned(error, 1000) - if not error.Success() or value != 0: - self.fail("failed to get the correct value for element a in n") - - def test_nest_flat(self): - self.build() - self.common_setup(self.line2) - - # These should display correctly. - self.expect('frame variable n --flat', - substrs=['n.a = 0', - 'n.b = 2', - 'n.foo.c = 0', - 'n.foo.d = 4']) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break in main.c. - self.source = 'main.c' - self.line0 = line_number(self.source, '// Set breakpoint 0 here.') - self.line1 = line_number(self.source, '// Set breakpoint 1 here.') - self.line2 = line_number(self.source, '// Set breakpoint 2 here.') - - def common_setup(self, line): - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) - - # Create a target - exe = self.getBuildArtifact("a.out") - 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_file_and_line( - self, self.source, line, num_expected_locations=1, loc_exact=True) - - # 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.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']) diff --git a/packages/Python/lldbsuite/test/lang/c/anonymous/main.c b/packages/Python/lldbsuite/test/lang/c/anonymous/main.c deleted file mode 100644 index 58ac85b7d431..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/anonymous/main.c +++ /dev/null @@ -1,82 +0,0 @@ -#include <stdio.h> - -struct anonymous_nest { - struct { - struct { - int a; - int b; - }; // anonymous - struct { - int c; - int d; - } foo; - }; // anonymous -}; - -struct anonymous_child { - struct { - struct { - int a; - int b; - } grandchild; - struct { - int c; - int d; - } foo; - }; // anonymous -}; - -struct anonymous_grandchild { - struct { - struct { - int a; - int b; - }; // anonymous - struct { - int c; - int d; - } foo; - } child; -}; - -int processor_nest (struct anonymous_nest *n) -{ - return n->foo.d + n->b; // Set breakpoint 0 here. -} - -int processor_child (struct anonymous_child *c) -{ - return c->foo.d + c->grandchild.b; // Set breakpoint 1 here. -} - -int processor_grandchild (struct anonymous_grandchild *g) -{ - return g->child.foo.d + g->child.b; -} - - - -typedef struct { - int dummy; -} type_y; - -typedef struct { - type_y y; -} type_z; - - - -int main() -{ - struct anonymous_nest n = { 0, 2, 0, 4 }; - struct anonymous_child c = { 0, 2, 0, 4 }; - struct anonymous_grandchild g = { 0, 2, 0, 4 }; - type_z *pz = 0; - type_z z = {{2}}; - - printf("%d\n", processor_nest(&n)); - printf("%d\n", processor_child(&c)); - printf("%d\n", processor_grandchild(&g)); // Set breakpoint 2 here. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/array_types/Makefile b/packages/Python/lldbsuite/test/lang/c/array_types/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/array_types/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py b/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py deleted file mode 100644 index d14534db69cf..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py +++ /dev/null @@ -1,228 +0,0 @@ -"""Test breakpoint by file/line number; and list variables with array types.""" - -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 ArrayTypesTestCase(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', '// Set break point at this line.') - - def test_and_run_command(self): - """Test 'frame variable var_name' on some variables with array types.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line, num_expected_locations=1, loc_exact=False) - - self.runCmd("run", RUN_SUCCEEDED) - - # The test suite sometimes shows that the process has exited without stopping. - # - # CC=clang ./dotest.py -v -t array_types - # ... - # Process 76604 exited with status = 0 (0x00000000) - self.runCmd("process status") - - # 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']) - - # Issue 'variable list' command on several array-type variables. - - self.expect( - "frame variable --show-types strings", - VARIABLES_DISPLAYED_CORRECTLY, - startstr='(char *[4])', - substrs=[ - '(char *) [0]', - '(char *) [1]', - '(char *) [2]', - '(char *) [3]', - 'Hello', - 'Hola', - 'Bonjour', - 'Guten Tag']) - - self.expect( - "frame variable --show-types --raw -- char_16", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - '(char) [0]', - '(char) [15]']) - - self.expect( - "frame variable --show-types ushort_matrix", - VARIABLES_DISPLAYED_CORRECTLY, - startstr='(unsigned short [2][3])') - - self.expect( - "frame variable --show-types long_6", - VARIABLES_DISPLAYED_CORRECTLY, - startstr='(long [6])') - - @add_test_categories(['pyapi']) - def test_and_python_api(self): - """Use Python APIs to inspect variables with array types.""" - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - breakpoint = target.BreakpointCreateByLocation("main.c", self.line) - self.assertTrue(breakpoint, VALID_BREAKPOINT) - - # Sanity check the print representation of breakpoint. - bp = str(breakpoint) - self.expect(bp, msg="Breakpoint looks good", exe=False, - substrs=["file = 'main.c'", - "line = %d" % self.line, - "locations = 1"]) - self.expect( - bp, - msg="Breakpoint is not resolved as yet", - exe=False, - matching=False, - substrs=["resolved = 1"]) - - # 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) - - # Sanity check the print representation of process. - proc = str(process) - self.expect(proc, msg="Process looks good", exe=False, - substrs=["state = stopped", - "executable = a.out"]) - - # The stop reason of the thread should be breakpoint. - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - # Sanity check the print representation of thread. - thr = str(thread) - # TODO(zturner): Whether the TID is printed in hex or decimal should be controlled by a setting, - # and this test should read the value of the setting. This check is currently hardcoded to - # match the check in Core/FormatEntity.cpp in the function FormatEntity::Format() for - # the Entry::Type::ThreadID case of the switch statement. - if self.getPlatform() == "linux" or self.getPlatform() == "freebsd": - tidstr = "tid = %u" % thread.GetThreadID() - else: - tidstr = "tid = 0x%4.4x" % thread.GetThreadID() - self.expect( - thr, - "Thread looks good with stop reason = breakpoint", - exe=False, - substrs=[tidstr]) - - # The breakpoint should have a hit count of 1. - self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) - - # The breakpoint should be resolved by now. - bp = str(breakpoint) - self.expect(bp, "Breakpoint looks good and is resolved", exe=False, - substrs=["file = 'main.c'", - "line = %d" % self.line, - "locations = 1"]) - - # Sanity check the print representation of frame. - frame = thread.GetFrameAtIndex(0) - frm = str(frame) - self.expect( - frm, - "Frame looks good with correct index %d" % - frame.GetFrameID(), - exe=False, - substrs=[ - "#%d" % - frame.GetFrameID()]) - - # Lookup the "strings" string array variable and sanity check its print - # representation. - variable = frame.FindVariable("strings") - var = str(variable) - self.expect( - var, - "Variable for 'strings' looks good with correct name", - exe=False, - substrs=[ - "%s" % - variable.GetName()]) - self.DebugSBValue(variable) - self.assertTrue(variable.GetNumChildren() == 4, - "Variable 'strings' should have 4 children") - - child3 = variable.GetChildAtIndex(3) - self.DebugSBValue(child3) - self.assertTrue(child3.GetSummary() == '"Guten Tag"', - 'strings[3] == "Guten Tag"') - - # Lookup the "char_16" char array variable. - variable = frame.FindVariable("char_16") - self.DebugSBValue(variable) - self.assertTrue(variable.GetNumChildren() == 16, - "Variable 'char_16' should have 16 children") - - # Lookup the "ushort_matrix" ushort[] array variable. - # Notice the pattern of int(child0_2.GetValue(), 0). We pass a - # base of 0 so that the proper radix is determined based on the contents - # of the string. Same applies to long(). - variable = frame.FindVariable("ushort_matrix") - self.DebugSBValue(variable) - self.assertTrue(variable.GetNumChildren() == 2, - "Variable 'ushort_matrix' should have 2 children") - child0 = variable.GetChildAtIndex(0) - self.DebugSBValue(child0) - self.assertTrue(child0.GetNumChildren() == 3, - "Variable 'ushort_matrix[0]' should have 3 children") - child0_2 = child0.GetChildAtIndex(2) - self.DebugSBValue(child0_2) - self.assertTrue(int(child0_2.GetValue(), 0) == 3, - "ushort_matrix[0][2] == 3") - - # Lookup the "long_6" char array variable. - variable = frame.FindVariable("long_6") - self.DebugSBValue(variable) - self.assertTrue(variable.GetNumChildren() == 6, - "Variable 'long_6' should have 6 children") - child5 = variable.GetChildAtIndex(5) - self.DebugSBValue(child5) - self.assertTrue(int(child5.GetValue(), 0) == 6, - "long_6[5] == 6") - - # Last, check that "long_6" has a value type of eValueTypeVariableLocal - # and "argc" has eValueTypeVariableArgument. - from lldbsuite.test.lldbutil import value_type_to_str - self.assertTrue( - variable.GetValueType() == lldb.eValueTypeVariableLocal, - "Variable 'long_6' should have '%s' value type." % - value_type_to_str( - lldb.eValueTypeVariableLocal)) - argc = frame.FindVariable("argc") - self.DebugSBValue(argc) - self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument, - "Variable 'argc' should have '%s' value type." % - value_type_to_str(lldb.eValueTypeVariableArgument)) diff --git a/packages/Python/lldbsuite/test/lang/c/array_types/cmds.txt b/packages/Python/lldbsuite/test/lang/c/array_types/cmds.txt deleted file mode 100644 index 8feebe212044..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/array_types/cmds.txt +++ /dev/null @@ -1,3 +0,0 @@ -break main.c:42 -continue -var diff --git a/packages/Python/lldbsuite/test/lang/c/array_types/main.c b/packages/Python/lldbsuite/test/lang/c/array_types/main.c deleted file mode 100644 index 5f0680a43b84..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/array_types/main.c +++ /dev/null @@ -1,51 +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[]) -{ - struct point_tag { - int x; - int y; - }; - - struct rect_tag { - struct point_tag bottom_left; - struct point_tag top_right; - }; - char char_16[16] = "Hello World\n"; - char *strings[] = { "Hello", "Hola", "Bonjour", "Guten Tag" }; - char char_matrix[3][3] = {{'a', 'b', 'c' }, {'d', 'e', 'f' }, {'g', 'h', 'i' }}; - char char_matrix_matrix[3][2][3] = - { {{'a', 'b', 'c' }, {'d', 'e', 'f' }}, - {{'A', 'B', 'C' }, {'D', 'E', 'F' }}, - {{'1', '2', '3' }, {'4', '5', '6' }}}; - short short_4[4] = { 1,2,3,4 }; - short short_matrix[1][2] = { {1,2} }; - unsigned short ushort_4[4] = { 1,2,3,4 }; - unsigned short ushort_matrix[2][3] = { - { 1, 2, 3}, - {11,22,33} - }; - int int_2[2] = { 1, 2 }; - unsigned int uint_2[2] = { 1, 2 }; - long long_6[6] = { 1, 2, 3, 4, 5, 6 }; - unsigned long ulong_6[6] = { 1, 2, 3, 4, 5, 6 }; - struct point_tag points_2[2] = { - {1,2}, - {3,4} - }; - struct point_tag points_2_4_matrix[2][4] = { // Set break point at this line. - {{ 1, 2}, { 3, 4}, { 5, 6}, { 7, 8}}, - {{11,22}, {33,44}, {55,66}, {77,88}} - }; - struct rect_tag rects_2[2] = { - {{1,2}, {3,4}}, - {{5,6}, {7,8}} - }; - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/bitfields/Makefile b/packages/Python/lldbsuite/test/lang/c/bitfields/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/bitfields/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py b/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py deleted file mode 100644 index ba924683ad75..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py +++ /dev/null @@ -1,220 +0,0 @@ -"""Show bitfields and check that they display correctly.""" - -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 BitfieldsTestCase(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', '// Set break point at this line.') - - # BitFields exhibit crashes in record layout on Windows - # (http://llvm.org/pr21800) - @skipIfWindows - def test_and_run_command(self): - """Test 'frame variable ...' on a variable with bitfields.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the 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) - - # 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 should display correctly. - self.expect( - "frame variable --show-types bits", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - '(uint32_t:1) b1 = 1', - '(uint32_t:2) b2 = 3', - '(uint32_t:3) b3 = 7', - '(uint32_t) b4 = 15', - '(uint32_t:5) b5 = 31', - '(uint32_t:6) b6 = 63', - '(uint32_t:7) b7 = 127', - '(uint32_t:4) four = 15']) - - # And so should this. - # rdar://problem/8348251 - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - '(uint32_t:1) b1 = 1', - '(uint32_t:2) b2 = 3', - '(uint32_t:3) b3 = 7', - '(uint32_t) b4 = 15', - '(uint32_t:5) b5 = 31', - '(uint32_t:6) b6 = 63', - '(uint32_t:7) b7 = 127', - '(uint32_t:4) four = 15']) - - self.expect("expr (bits.b1)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '1']) - self.expect("expr (bits.b2)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '3']) - self.expect("expr (bits.b3)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '7']) - self.expect("expr (bits.b4)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '15']) - self.expect("expr (bits.b5)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '31']) - self.expect("expr (bits.b6)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '63']) - self.expect("expr (bits.b7)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '127']) - self.expect("expr (bits.four)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '15']) - - self.expect( - "frame variable --show-types more_bits", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - '(uint32_t:3) a = 3', - '(uint8_t:1) b = \'\\0\'', - '(uint8_t:1) c = \'\\x01\'', - '(uint8_t:1) d = \'\\0\'']) - - self.expect("expr (more_bits.a)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', '3']) - self.expect("expr (more_bits.b)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint8_t', '\\0']) - self.expect("expr (more_bits.c)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint8_t', '\\x01']) - self.expect("expr (more_bits.d)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint8_t', '\\0']) - - self.expect("expr (packed.a)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['char', "'a'"]) - self.expect("expr (packed.b)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', "10"]) - self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint32_t', "7112233"]) - - for bit in range(1,18): - expected = "1" if bit in [1, 5, 7, 13] else "0" - self.expect("expr even_more_bits.b" + str(bit), VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint8_t', expected]) - - for bit in [3, 10, 14]: - self.expect("expr even_more_bits.b" + str(bit) + " = 1", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['uint8_t', "1"]) - - self.expect( - "frame variable --show-types even_more_bits", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - '(uint8_t:1) b1 = \'\\x01\'', - '(uint8_t:1) b2 = \'\\0\'', - '(uint8_t:1) b3 = \'\\x01\'', - '(uint8_t:1) b4 = \'\\0\'', - '(uint8_t:1) b5 = \'\\x01\'', - '(uint8_t:1) b6 = \'\\0\'', - '(uint8_t:1) b7 = \'\\x01\'', - '(uint8_t:1) b8 = \'\\0\'', - '(uint8_t:1) b9 = \'\\0\'', - '(uint8_t:1) b10 = \'\\x01\'', - '(uint8_t:1) b12 = \'\\0\'', - '(uint8_t:1) b13 = \'\\x01\'', - '(uint8_t:1) b14 = \'\\x01\'', - '(uint8_t:1) b15 = \'\\0\'', - '(uint8_t:1) b16 = \'\\0\'', - '(uint8_t:1) b17 = \'\\0\'', - ]) - - - @add_test_categories(['pyapi']) - # BitFields exhibit crashes in record layout on Windows - # (http://llvm.org/pr21800) - @skipIfWindows - def test_and_python_api(self): - """Use Python APIs to inspect a bitfields variable.""" - self.build() - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - breakpoint = target.BreakpointCreateByLocation("main.c", self.line) - self.assertTrue(breakpoint, VALID_BREAKPOINT) - - 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. - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) - self.assertIsNotNone(thread) - - # The breakpoint should have a hit count of 1. - self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) - - # Lookup the "bits" variable which contains 8 bitfields. - frame = thread.GetFrameAtIndex(0) - bits = frame.FindVariable("bits") - self.DebugSBValue(bits) - self.assertTrue( - bits.GetTypeName() == 'Bits', - "bits.GetTypeName() == 'Bits'") - self.assertTrue( - bits.GetNumChildren() == 10, - "bits.GetNumChildren() == 10") - test_compiler = self.getCompiler() - self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32") - - # Notice the pattern of int(b1.GetValue(), 0). We pass a base of 0 - # so that the proper radix is determined based on the contents of the - # string. - b1 = bits.GetChildMemberWithName("b1") - self.DebugSBValue(b1) - self.assertTrue(b1.GetName() == "b1" and - b1.GetTypeName() == "uint32_t:1" and - b1.IsInScope() and - int(b1.GetValue(), 0) == 1, - 'bits.b1 has type uint32_t:1, is in scope, and == 1') - - b7 = bits.GetChildMemberWithName("b7") - self.DebugSBValue(b7) - self.assertTrue(b7.GetName() == "b7" and - b7.GetTypeName() == "uint32_t:7" and - b7.IsInScope() and - int(b7.GetValue(), 0) == 127, - 'bits.b7 has type uint32_t:7, is in scope, and == 127') - - four = bits.GetChildMemberWithName("four") - self.DebugSBValue(four) - self.assertTrue(four.GetName() == "four" and - four.GetTypeName() == "uint32_t:4" and - four.IsInScope() and - int(four.GetValue(), 0) == 15, - 'bits.four has type uint32_t:4, is in scope, and == 15') - - # Now kill the process, and we are done. - rc = target.GetProcess().Kill() - self.assertTrue(rc.Success()) diff --git a/packages/Python/lldbsuite/test/lang/c/bitfields/main.c b/packages/Python/lldbsuite/test/lang/c/bitfields/main.c deleted file mode 100644 index fe972dbbe856..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/bitfields/main.c +++ /dev/null @@ -1,96 +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 <stdint.h> -#include <stdio.h> -#include <string.h> - -int main (int argc, char const *argv[]) -{ - struct Bits - { - uint32_t : 1, // Unnamed bitfield - b1 : 1, - b2 : 2, - : 2, // Unnamed bitfield - b3 : 3, - : 2, // Unnamed bitfield (this will get removed) - b4 __attribute__ ((aligned(16))), - b5 : 5, - b6 : 6, - b7 : 7, - four : 4; - }; - - printf("%lu", sizeof(struct Bits)); - - struct Bits bits; - int i; - for (i=0; i<(1<<1); i++) - bits.b1 = i; //// break $source:$line - for (i=0; i<(1<<2); i++) - bits.b2 = i; //// break $source:$line - for (i=0; i<(1<<3); i++) - bits.b3 = i; //// break $source:$line - for (i=0; i<(1<<4); i++) - bits.b4 = i; //// break $source:$line - for (i=0; i<(1<<5); i++) - bits.b5 = i; //// break $source:$line - for (i=0; i<(1<<6); i++) - bits.b6 = i; //// break $source:$line - for (i=0; i<(1<<7); i++) - bits.b7 = i; //// break $source:$line - for (i=0; i<(1<<4); i++) - bits.four = i; //// break $source:$line - - struct MoreBits - { - uint32_t a : 3; - uint8_t : 1; - uint8_t b : 1; - uint8_t c : 1; - uint8_t d : 1; - }; - - struct MoreBits more_bits; - - more_bits.a = 3; - more_bits.b = 0; - more_bits.c = 1; - more_bits.d = 0; - - struct EvenMoreBits - { - uint8_t b1 : 1, b2 : 1, b3 : 1, b4 : 1, b5 : 1, b6 : 1, - b7 : 1, b8 : 1, b9 : 1, b10 : 1, b11 : 1, b12 : 1, - b13 : 1, b14 : 1, b15 : 1, b16 : 1, b17 : 1; - }; - - struct EvenMoreBits even_more_bits; - memset(&even_more_bits, 0, sizeof(even_more_bits)); - even_more_bits.b1 = 1; - even_more_bits.b5 = 1; - even_more_bits.b7 = 1; - even_more_bits.b13 = 1; - -#pragma pack(1) - struct PackedBits - { - char a; - uint32_t b : 5, - c : 27; - }; -#pragma pack() - struct PackedBits packed; - packed.a = 'a'; - packed.b = 10; - packed.c = 0x7112233; - - return 0; //// Set break point at this line. - -} diff --git a/packages/Python/lldbsuite/test/lang/c/blocks/Makefile b/packages/Python/lldbsuite/test/lang/c/blocks/Makefile deleted file mode 100644 index 752b7aed3970..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/blocks/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -fblocks - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py b/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py deleted file mode 100644 index c7693c98f545..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py +++ /dev/null @@ -1,84 +0,0 @@ -"""Test that lldb can invoke blocks and access variables inside them""" - -from __future__ import print_function - - -import unittest2 -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test.decorators import * -import lldbsuite.test.lldbutil as lldbutil - - -class BlocksTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - lines = [] - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break at. - self.lines.append(line_number('main.c', '// Set breakpoint 0 here.')) - self.lines.append(line_number('main.c', '// Set breakpoint 1 here.')) - - def launch_common(self): - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - self.is_started = False - - # Break inside the foo function which takes a bar_ptr argument. - for line in self.lines: - lldbutil.run_break_set_by_file_and_line( - self, "main.c", line, num_expected_locations=1, loc_exact=True) - - self.wait_for_breakpoint() - - @skipUnlessDarwin - def test_expr(self): - self.launch_common() - - self.expect("expression a + b", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 7"]) - - self.expect("expression c", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 1"]) - - self.wait_for_breakpoint() - - # This should display correctly. - self.expect("expression (int)neg (-12)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["= 12"]) - - @skipUnlessDarwin - def test_define(self): - self.launch_common() - - self.runCmd( - "expression int (^$add)(int, int) = ^int(int a, int b) { return a + b; };") - self.expect( - "expression $add(2,3)", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[" = 5"]) - - self.runCmd("expression int $a = 3") - self.expect( - "expression int (^$addA)(int) = ^int(int b) { return $a + b; };", - "Proper error is reported on capture", - error=True) - - def wait_for_breakpoint(self): - if not self.is_started: - self.is_started = True - self.runCmd("process launch", RUN_SUCCEEDED) - else: - self.runCmd("process continue", 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/lang/c/blocks/main.c b/packages/Python/lldbsuite/test/lang/c/blocks/main.c deleted file mode 100644 index 415e6c6d033d..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/blocks/main.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <stdio.h> - -int main() -{ - int c = 1; - - int (^add)(int, int) = ^int(int a, int b) - { - return a + b + c; // Set breakpoint 0 here. - }; - - int (^neg)(int) = ^int(int a) - { - return -a; - }; - - printf("%d\n", add(3, 4)); - printf("%d\n", neg(-5)); // Set breakpoint 1 here. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile deleted file mode 100644 index 979cefe9b7fe..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -LEVEL := ../../../make - -LD_EXTRAS := -L. -LOne -l$(LIB_PREFIX)One -LTwo -l$(LIB_PREFIX)Two -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules - -.PHONY: -a.out: lib_One lib_Two - -lib_%: - $(MAKE) VPATH=$(SRCDIR)/$* -I $(SRCDIR) -f $(SRCDIR)/$*.mk - -clean:: - $(MAKE) -f $(SRCDIR)/One.mk clean - $(MAKE) -f $(SRCDIR)/Two.mk clean diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk deleted file mode 100644 index 130c7dd511bb..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk +++ /dev/null @@ -1,10 +0,0 @@ -LEVEL := ../../../make - -DYLIB_NAME := One -DYLIB_C_SOURCES := One.c OneConstant.c -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules - -OneConstant.o: OneConstant.c - $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@ diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.c b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.c deleted file mode 100644 index 6bd729f65700..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "One.h" -#include <stdio.h> - -void one() { - printf("One\n"); // break here -} diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.h b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.h deleted file mode 100644 index aae27571bb9c..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef ONE_H -#define ONE_H -LLDB_TEST_API void one(); -#endif diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/OneConstant.c b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/OneConstant.c deleted file mode 100644 index 8255c2fce995..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/OneConstant.c +++ /dev/null @@ -1 +0,0 @@ -int __attribute__ ((visibility("hidden"))) conflicting_symbol = 11111; diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py deleted file mode 100644 index b0fde47a2c0b..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py +++ /dev/null @@ -1,124 +0,0 @@ -"""Test that conflicting symbols in different shared libraries work correctly""" - -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 TestConflictingSymbols(TestBase): - - mydir = TestBase.compute_mydir(__file__) - NO_DEBUG_INFO_TESTCASE = True - - def setUp(self): - TestBase.setUp(self) - lldbutil.mkdir_p(self.getBuildArtifact("One")) - lldbutil.mkdir_p(self.getBuildArtifact("Two")) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489") - def test_conflicting_symbols(self): - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Register our shared libraries for remote targets so they get - # automatically uploaded - environment = self.registerSharedLibrariesWithTarget( - target, ['One', 'Two']) - - lldbutil.run_break_set_by_source_regexp(self, '// break here', - extra_options='-f One.c', num_expected_locations=-2) - lldbutil.run_break_set_by_source_regexp(self, '// break here', - extra_options='-f Two.c', num_expected_locations=-2) - lldbutil.run_break_set_by_source_regexp(self, '// break here', - extra_options='-f main.c', num_expected_locations=1) - - process = target.LaunchSimple( - None, environment, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - # This should display correctly. - self.expect( - "expr (unsigned long long)conflicting_symbol", - "Symbol from One should be found", - substrs=[ - "11111"]) - - self.runCmd("continue", 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("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - self.expect( - "expr (unsigned long long)conflicting_symbol", - "Symbol from Two should be found", - substrs=[ - "22222"]) - - self.runCmd("continue", 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("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - self.expect( - "expr (unsigned long long)conflicting_symbol", - "An error should be printed when symbols can't be ordered", - error=True, - substrs=[ - "Multiple internal symbols"]) - - @expectedFailureAll(bugnumber="llvm.org/pr35043") - @skipIfWindows # This test is "passing" on Windows, but it is a false positive. - def test_shadowed(self): - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Register our shared libraries for remote targets so they get - # automatically uploaded - environment = self.registerSharedLibrariesWithTarget( - target, ['One', 'Two']) - - lldbutil.run_break_set_by_source_regexp(self, '// break here', - extra_options='-f main.c', num_expected_locations=1) - - process = target.LaunchSimple( - None, environment, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # As we are shadowing the conflicting symbol, there should be no - # ambiguity in this expression. - self.expect( - "expr int conflicting_symbol = 474747; conflicting_symbol", - substrs=[ "474747"]) diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk deleted file mode 100644 index ebe58cc743fc..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk +++ /dev/null @@ -1,10 +0,0 @@ -LEVEL := ../../../make - -DYLIB_NAME := Two -DYLIB_C_SOURCES := Two.c TwoConstant.c -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules - -TwoConstant.o: TwoConstant.c - $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@ diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/Two.c b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/Two.c deleted file mode 100644 index 8d8d668b8c31..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/Two.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "Two.h" -#include <stdio.h> - -void two() { - printf("Two\n"); // break here -} diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/Two.h b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/Two.h deleted file mode 100644 index 450fe5a3551f..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/Two.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TWO_H -#define TWO_H -LLDB_TEST_API void two(); -#endif diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/TwoConstant.c b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/TwoConstant.c deleted file mode 100644 index 9fc7c4b79515..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/TwoConstant.c +++ /dev/null @@ -1 +0,0 @@ -int __attribute__ ((visibility("hidden"))) conflicting_symbol = 22222; diff --git a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/main.c b/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/main.c deleted file mode 100644 index 4dcd443c0492..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "One/One.h" -#include "Two/Two.h" - -#include <stdio.h> - -int main() { - one(); - two(); - printf("main\n"); // break here - return(0); -} diff --git a/packages/Python/lldbsuite/test/lang/c/const_variables/Makefile b/packages/Python/lldbsuite/test/lang/c/const_variables/Makefile deleted file mode 100644 index 51adad1d0622..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/const_variables/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c functions.c - -CFLAGS_EXTRAS += -O3 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py b/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py deleted file mode 100644 index bf86e03035ff..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py +++ /dev/null @@ -1,76 +0,0 @@ -"""Check that compiler-generated constant values work correctly""" - -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 ConstVariableTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll( - oslist=["freebsd", "linux"], - compiler="clang", compiler_version=["<", "3.5"]) - @expectedFailureAll( - oslist=["freebsd", "linux"], - compiler="clang", compiler_version=["=", "3.7"]) - @expectedFailureAll( - oslist=["freebsd", "linux"], - compiler="clang", compiler_version=["=", "3.8"]) - @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc") - @expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el']) - @expectedFailureAll( - oslist=["linux"], - archs=[ - 'arm', - 'aarch64'], - bugnumber="llvm.org/pr27883") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows") - def test_and_run_command(self): - """Test interpreted and JITted expressions on constant values.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the 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']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - self.runCmd("next") - self.runCmd("next") - - # Try frame variable. - self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(int32_t) index = 512']) - - # Try an interpreted expression. - self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['1024']) - - # Try a JITted expression. - self.expect( - "expr (int)getpid(); (index - 256)", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=['256']) - - self.runCmd("kill") diff --git a/packages/Python/lldbsuite/test/lang/c/const_variables/functions.c b/packages/Python/lldbsuite/test/lang/c/const_variables/functions.c deleted file mode 100644 index c9ea63837c8b..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/const_variables/functions.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <stdio.h> - -void foo() -{ - printf("foo()\n"); -} - -int bar() -{ - int ret = 3; - printf("bar()->%d\n", ret); - return ret; -} - -void baaz(int i) -{ - printf("baaz(%d)\n", i); -} diff --git a/packages/Python/lldbsuite/test/lang/c/const_variables/main.c b/packages/Python/lldbsuite/test/lang/c/const_variables/main.c deleted file mode 100644 index 50a924e01d94..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/const_variables/main.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <stdint.h> -#include <stdio.h> - -extern int foo(); -extern int bar(); -extern int baaz(int i); - -int main() -{ - int32_t index; - - foo(); - - index = 512; - - if (bar()) - { - printf("COMPILER PLEASE STOP HERE\n"); - index = 256; - } - - baaz(index); -} diff --git a/packages/Python/lldbsuite/test/lang/c/enum_types/Makefile b/packages/Python/lldbsuite/test/lang/c/enum_types/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/enum_types/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py b/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py deleted file mode 100644 index 53ee2196aa42..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py +++ /dev/null @@ -1,105 +0,0 @@ -"""Look up enum type information and check for correct display.""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * - - -class EnumTypesTestCase(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', '// Set break point at this line.') - - def test(self): - """Test 'image lookup -t days' and check for correct display and enum value printing.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the main. - bkpt_id = 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) - - # 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']) - - # Look up information about the 'days' enum type. - # Check for correct display. - self.expect("image lookup -t days", DATA_TYPES_DISPLAYED_CORRECTLY, - substrs=['enum days {', - 'Monday', - 'Tuesday', - 'Wednesday', - 'Thursday', - 'Friday', - 'Saturday', - 'Sunday', - 'kNumDays', - '}']) - - enum_values = ['-4', - 'Monday', - 'Tuesday', - 'Wednesday', - 'Thursday', - 'Friday', - 'Saturday', - 'Sunday', - 'kNumDays', - '5'] - - # Make sure a pointer to an anonymous enum type does crash LLDB and displays correctly using - # frame variable and expression commands - self.expect( - 'frame variable f.op', - DATA_TYPES_DISPLAYED_CORRECTLY, - substrs=[ - 'ops *', - 'f.op'], - patterns=['0x0+$']) - self.expect( - 'frame variable *f.op', - DATA_TYPES_DISPLAYED_CORRECTLY, - substrs=[ - 'ops', - '*f.op', - '<parent is NULL>']) - self.expect( - 'expr f.op', - DATA_TYPES_DISPLAYED_CORRECTLY, - substrs=[ - 'ops *', - '$'], - patterns=['0x0+$']) - self.expect( - 'expr *f.op', - DATA_TYPES_DISPLAYED_CORRECTLY, - substrs=['error:'], - error=True) - - bkpt = self.target().FindBreakpointByID(bkpt_id) - for enum_value in enum_values: - self.expect( - "frame variable day", - 'check for valid enumeration value', - substrs=[enum_value]) - lldbutil.continue_to_breakpoint(self.process(), bkpt) diff --git a/packages/Python/lldbsuite/test/lang/c/enum_types/main.c b/packages/Python/lldbsuite/test/lang/c/enum_types/main.c deleted file mode 100644 index 59ea21300693..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/enum_types/main.c +++ /dev/null @@ -1,40 +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 <stdio.h> - -// Forward declare an enumeration (only works in C, not C++) -typedef enum ops ops; - -struct foo { - ops *op; -}; - -int main (int argc, char const *argv[]) -{ - enum days { - Monday = -3, - Tuesday, - Wednesday, - Thursday, - Friday, - Saturday, - Sunday, - kNumDays - }; - enum days day; - struct foo f; - f.op = NULL; - for (day = Monday - 1; day <= kNumDays + 1; day++) - { - printf("day as int is %i\n", (int)day); // Set break point at this line. - } - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/find_struct_type/Makefile b/packages/Python/lldbsuite/test/lang/c/find_struct_type/Makefile deleted file mode 100644 index cd9ca5c86d84..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/find_struct_type/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../../make -C_SOURCES := main.c -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/find_struct_type/TestFindStructTypes.py b/packages/Python/lldbsuite/test/lang/c/find_struct_type/TestFindStructTypes.py deleted file mode 100644 index 6827fb4af0e6..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/find_struct_type/TestFindStructTypes.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Make sure FindTypes finds struct types with the struct prefix. -""" - -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 TestFindTypesOnStructType(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_find_types_struct_type(self): - """Make sure FindTypes actually finds 'struct typename' not just 'typename'.""" - self.build() - self.do_test() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def do_test(self): - """Make sure FindTypes actually finds 'struct typename' not just 'typename'.""" - exe = self.getBuildArtifact("a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Make sure this works with struct - type_list = target.FindTypes("struct mytype") - self.assertEqual(type_list.GetSize(), 1, "Found one instance of the type with struct") - - # Make sure this works without the struct: - type_list = target.FindTypes("mytype") - self.assertEqual(type_list.GetSize(), 1, "Found one instance of the type without struct") - - # Make sure it works with union - type_list = target.FindTypes("union myunion") - self.assertEqual(type_list.GetSize(), 1, "Found one instance of the type with union") - - # Make sure this works without the union: - type_list = target.FindTypes("myunion") - self.assertEqual(type_list.GetSize(), 1, "Found one instance of the type without union") - - # Make sure it works with typedef - type_list = target.FindTypes("typedef MyType") - self.assertEqual(type_list.GetSize(), 1, "Found one instance of the type with typedef") - - # Make sure this works without the typedef: - type_list = target.FindTypes("MyType") - self.assertEqual(type_list.GetSize(), 1, "Found one instance of the type without typedef") - - - diff --git a/packages/Python/lldbsuite/test/lang/c/find_struct_type/main.c b/packages/Python/lldbsuite/test/lang/c/find_struct_type/main.c deleted file mode 100644 index fa009af27e17..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/find_struct_type/main.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -struct mytype { - int c; - int d; -}; - -union myunion { - int num; - char *str; -}; - -typedef struct mytype MyType; - -int main() -{ - struct mytype v; - MyType *v_ptr = &v; - - union myunion u = {5}; - v.c = u.num; - v.d = 10; - return v.c + v.d; -} - diff --git a/packages/Python/lldbsuite/test/lang/c/forward/Makefile b/packages/Python/lldbsuite/test/lang/c/forward/Makefile deleted file mode 100644 index 1db43ab479b2..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/forward/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c foo.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/forward/README.txt b/packages/Python/lldbsuite/test/lang/c/forward/README.txt deleted file mode 100644 index b7b66f75162b..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/forward/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -This example has a function call in foo.c named "foo" that takes a forward -declaration to "struct bar" and uses it as a pointer argument. In main.c -we have a real declaration for "struct bar". We want to be able to find the -real definition of "struct bar" when we are stopped in foo in foo.c such that -when we stop in "foo" we see the contents of the "bar_ptr". diff --git a/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py b/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py deleted file mode 100644 index 2537beb87df7..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py +++ /dev/null @@ -1,68 +0,0 @@ -"""Test that forward declaration of a data structure gets resolved correctly.""" - -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 ForwardDeclarationTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def do_test(self, dictionary=None): - """Display *bar_ptr when stopped on a function with forward declaration of struct bar.""" - self.build(dictionary=dictionary) - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the foo function which takes a bar_ptr argument. - lldbutil.run_break_set_by_symbol( - self, "foo", num_expected_locations=1, sym_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 should display correctly. - # Note that the member fields of a = 1 and b = 2 is by design. - self.expect( - "frame variable --show-types *bar_ptr", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - '(bar) *bar_ptr = ', - '(int) a = 1', - '(int) b = 2']) - - # And so should this. - self.expect( - "expression --show-types -- *bar_ptr", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - '(bar)', - '(int) a = 1', - '(int) b = 2']) - - def test(self): - self.do_test() - - @no_debug_info_test - @skipIfDarwin - @skipIf(compiler=no_match("clang")) - @skipIf(compiler_version=["<", "7.0"]) - def test_debug_names(self): - """Test that we are able to find complete types when using DWARF v5 - accelerator tables""" - self.do_test(dict(CFLAGS_EXTRAS="-mllvm -accel-tables=Dwarf")) diff --git a/packages/Python/lldbsuite/test/lang/c/forward/foo.c b/packages/Python/lldbsuite/test/lang/c/forward/foo.c deleted file mode 100644 index 2e050e77778d..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/forward/foo.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <stdio.h> -#include "foo.h" - -int -foo (struct bar *bar_ptr) -{ - return printf ("bar_ptr = %p\n", bar_ptr); -} diff --git a/packages/Python/lldbsuite/test/lang/c/forward/foo.h b/packages/Python/lldbsuite/test/lang/c/forward/foo.h deleted file mode 100644 index 3040927cb47a..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/forward/foo.h +++ /dev/null @@ -1,4 +0,0 @@ - -struct bar; - -int foo (struct bar *bar_ptr); diff --git a/packages/Python/lldbsuite/test/lang/c/forward/main.c b/packages/Python/lldbsuite/test/lang/c/forward/main.c deleted file mode 100644 index 6f9787c30a36..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/forward/main.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <stdio.h> -#include "foo.h" - -struct bar -{ - int a; - int b; -}; - -int -main (int argc, char const *argv[]) -{ - struct bar b= { 1, 2 }; - - foo (&b); - - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/function_types/Makefile b/packages/Python/lldbsuite/test/lang/c/function_types/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/function_types/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py b/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py deleted file mode 100644 index 7ed8a28546cb..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py +++ /dev/null @@ -1,85 +0,0 @@ -"""Test variable with function ptr type and that break on the function works.""" - -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 FunctionTypesTestCase(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', '// Set break point at this line.') - - def test(self): - """Test 'callback' has function ptr type, then break on the function.""" - self.build() - self.runToBreakpoint() - - # Check that the 'callback' variable display properly. - self.expect( - "frame variable --show-types callback", - VARIABLES_DISPLAYED_CORRECTLY, - startstr='(int (*)(const char *)) callback =') - - # And that we can break on the callback function. - lldbutil.run_break_set_by_symbol( - self, - "string_not_empty", - num_expected_locations=1, - sym_exact=True) - self.runCmd("continue") - - # Check that we do indeed stop on the string_not_empty function. - self.expect("process status", STOPPED_DUE_TO_BREAKPOINT, - substrs=['a.out`string_not_empty', - 'stop reason = breakpoint']) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") - def test_pointers(self): - """Test that a function pointer to 'printf' works and can be called.""" - self.build() - self.runToBreakpoint() - - self.expect("expr string_not_empty", - substrs=['(int (*)(const char *)) $0 = ', '(a.out`']) - - if self.platformIsDarwin(): - regexps = ['lib.*\.dylib`printf'] - else: - regexps = ['printf'] - self.expect("expr (int (*)(const char*, ...))printf", - substrs=['(int (*)(const char *, ...)) $1 = '], - patterns=regexps) - - self.expect("expr $1(\"Hello world\\n\")", - startstr='(int) $2 = 12') - - def runToBreakpoint(self): - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the 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) - - # 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']) diff --git a/packages/Python/lldbsuite/test/lang/c/function_types/main.c b/packages/Python/lldbsuite/test/lang/c/function_types/main.c deleted file mode 100644 index 8be3c4d46b3c..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/function_types/main.c +++ /dev/null @@ -1,22 +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 string_not_empty (const char *s) -{ - if (s && s[0]) - return 1; - return 0; -} - -int main (int argc, char const *argv[]) -{ - int (*callback)(const char *) = string_not_empty; - - return callback(0); // Set break point at this line. -} diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/Makefile b/packages/Python/lldbsuite/test/lang/c/global_variables/Makefile deleted file mode 100644 index b1b77dacc01e..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/global_variables/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -DYLIB_NAME := a -DYLIB_C_SOURCES := a.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py b/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py deleted file mode 100644 index 36b684b60fb2..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py +++ /dev/null @@ -1,124 +0,0 @@ -"""Show global variables and check that they do indeed have global scopes.""" - -from __future__ import print_function - - -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class GlobalVariablesTestCase(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.source = 'main.c' - self.line = line_number( - self.source, '// Set break point at this line.') - self.shlib_names = ["a"] - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764") - @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr37301") - def test_without_process(self): - """Test that static initialized variables can be inspected without - process.""" - self.build() - - # Create a target by the debugger. - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - - self.assertTrue(target, VALID_TARGET) - self.expect("target variable g_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(int *)']) - self.expect("target variable *g_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['42']) - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764") - def test_c_global_variables(self): - """Test 'frame variable --scope --no-args' which omits args and shows scopes.""" - self.build() - - # Create a target by the debugger. - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.assertTrue(target, VALID_TARGET) - - # Break inside the main. - lldbutil.run_break_set_by_file_and_line( - self, self.source, self.line, num_expected_locations=1, loc_exact=True) - - # Register our shared libraries for remote targets so they get - # automatically uploaded - environment = self.registerSharedLibrariesWithTarget( - target, self.shlib_names) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, environment, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # 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 that the statically initialized variable can also be - # inspected *with* a process. - self.expect("target variable g_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(int *)']) - self.expect("target variable *g_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['42']) - - # Check that GLOBAL scopes are indicated for the variables. - self.expect( - "frame variable --show-types --scope --show-globals --no-args", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'STATIC: (const int) g_file_static_int = 2', - 'STATIC: (const char *) g_func_static_cstr', - 'GLOBAL: (const char *) g_file_global_cstr', - '"g_file_global_cstr"', - 'GLOBAL: (int) g_file_global_int = 42', - 'GLOBAL: (int) g_common_1 = 21', - 'GLOBAL: (int *) g_ptr', - 'STATIC: (const char *) g_file_static_cstr', - '"g_file_static_cstr"' - ]) - - # 'frame variable' should support address-of operator. - self.runCmd("frame variable &g_file_global_int") - - # Exercise the 'target variable' command to display globals in a.c - # file. - self.expect("target variable g_a", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['g_a', '123']) - self.expect( - "target variable g_marked_spot.x", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'g_marked_spot.x', - '20']) - - # rdar://problem/9747668 - # runCmd: target variable g_marked_spot.y - # output: (int) g_marked_spot.y = <a.o[0x214] can't be resolved, in not currently loaded. - # > - self.expect( - "target variable g_marked_spot.y", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - 'g_marked_spot.y', - '21']) - self.expect( - "target variable g_marked_spot.y", - VARIABLES_DISPLAYED_CORRECTLY, - matching=False, - substrs=["can't be resolved"]) - diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/a.c b/packages/Python/lldbsuite/test/lang/c/global_variables/a.c deleted file mode 100644 index d169d5d63240..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/global_variables/a.c +++ /dev/null @@ -1,15 +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 g_a = 123; -struct Point { - int x; - int y; -}; -struct Point g_marked_spot = { 20, 21 }; - diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/cmds.txt b/packages/Python/lldbsuite/test/lang/c/global_variables/cmds.txt deleted file mode 100644 index 6906a0729aeb..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/global_variables/cmds.txt +++ /dev/null @@ -1,3 +0,0 @@ -break main.c:5 -continue -var -global g_a -global g_global_int diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/main.c b/packages/Python/lldbsuite/test/lang/c/global_variables/main.c deleted file mode 100644 index b37c97bad9db..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/global_variables/main.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> - -int g_common_1; // Not initialized on purpose to cause it to be undefined external in .o file -int g_file_global_int = 42; -static const int g_file_static_int = 2; -const char *g_file_global_cstr = "g_file_global_cstr"; -static const char *g_file_static_cstr = "g_file_static_cstr"; -int *g_ptr = &g_file_global_int; - -extern int g_a; -int main (int argc, char const *argv[]) -{ - g_common_1 = g_file_global_int / g_file_static_int; - static const char *g_func_static_cstr = "g_func_static_cstr"; - printf ("%s %s\n", g_file_global_cstr, g_file_static_cstr); - return g_file_global_int + g_a + g_common_1 + *g_ptr; // Set break point at this line. //// break $source:$line; continue; var -global g_a -global g_global_int -} diff --git a/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py b/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py deleted file mode 100644 index 311c5ec8e120..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py +++ /dev/null @@ -1,9 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, - globals(), - [decorators.expectedFailureAll(compiler="clang", - compiler_version=["<", - "3.5"], - bugnumber="llvm.org/pr27845")]) diff --git a/packages/Python/lldbsuite/test/lang/c/inlines/main.c b/packages/Python/lldbsuite/test/lang/c/inlines/main.c deleted file mode 100644 index 8fe49180800b..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/inlines/main.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <stdio.h> - -inline void test1(int) __attribute__ ((always_inline)); -inline void test2(int) __attribute__ ((always_inline)); - -void test2(int b) { - printf("test2(%d)\n", b); //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"]) - { - int c = b * 2; - printf("c=%d\n", c); //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"]) - //% self.expect("expression c", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["84"]) - } -} - -void test1(int a) { - printf("test1(%d)\n", a); - test2(a+1);//% self.runCmd("step") - //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["24"]) -} - -int main() { - test2(42); - test1(23); - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile b/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile deleted file mode 100644 index fd7201886586..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -CFLAGS_EXTRAS += -O1 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py b/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py deleted file mode 100644 index 7071b675f3bc..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py +++ /dev/null @@ -1,55 +0,0 @@ -"""Show local variables and check that they can be inspected. - -This test was added after we made a change in clang to normalize -DW_OP_constu(X < 32) to DW_OP_litX which broke the debugger because -it didn't read the value as an unsigned. -""" - -from __future__ import print_function - - -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class LocalVariablesTestCase(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.source = 'main.c' - self.line = line_number( - self.source, '// Set break point at this line.') - - def test_c_local_variables(self): - """Test local variable value.""" - self.build() - - # Create a target by the debugger. - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.assertTrue(target, VALID_TARGET) - - # Break inside the main. - lldbutil.run_break_set_by_file_and_line( - self, self.source, self.line, num_expected_locations=1, loc_exact=True) - - # 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.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.expect("frame variable i", VARIABLES_DISPLAYED_CORRECTLY, - substrs=['(unsigned int) i = 10']) diff --git a/packages/Python/lldbsuite/test/lang/c/local_variables/main.c b/packages/Python/lldbsuite/test/lang/c/local_variables/main.c deleted file mode 100644 index 2ab579a71a75..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/local_variables/main.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <stdio.h> - -void bar(unsigned i) -{ - printf("%d\n", i); -} - -void foo(unsigned j) -{ - unsigned i = j; - bar(i); - i = 10; - bar(i); // Set break point at this line. -} - -int main(int argc, char** argv) -{ - foo(argc); -} diff --git a/packages/Python/lldbsuite/test/lang/c/modules/Makefile b/packages/Python/lldbsuite/test/lang/c/modules/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/modules/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py b/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py deleted file mode 100644 index 8d8d57bc9ca3..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py +++ /dev/null @@ -1,80 +0,0 @@ -"""Test that importing modules in C works as expected.""" - -from __future__ import print_function - - -from distutils.version import StrictVersion -import os -import time -import platform - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CModulesTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfFreeBSD - @expectedFailureAll( - oslist=["linux"], - bugnumber="http://llvm.org/pr23456 'fopen' has unknown return type") - @expectedFailureAll( - oslist=["windows"], - bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows") - @skipIf(macos_version=["<", "10.12"]) - def test_expr(self): - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the foo function which takes a bar_ptr argument. - 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) - - # 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.expect( - "expr -l objc++ -- @import Darwin; 3", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "int", - "3"]) - - self.expect( - "expr *fopen(\"/dev/zero\", \"w\")", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "FILE", - "_close"]) - - self.expect("expr *myFile", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["a", "5", "b", "9"]) - - self.expect( - "expr MIN((uint64_t)2, (uint64_t)3)", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "uint64_t", - "2"]) - - self.expect("expr stdin", VARIABLES_DISPLAYED_CORRECTLY, - substrs=["(FILE *)", "0x"]) - - 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 breakpoint 0 here.') diff --git a/packages/Python/lldbsuite/test/lang/c/modules/main.c b/packages/Python/lldbsuite/test/lang/c/modules/main.c deleted file mode 100644 index 2b244bc38d02..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/modules/main.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <stdlib.h> - -int printf(const char * __restrict format, ...); - -typedef struct { - int a; - int b; -} FILE; - -int main() -{ - FILE *myFile = malloc(sizeof(FILE)); - - myFile->a = 5; - myFile->b = 9; - - printf("%d\n", myFile->a + myFile->b); // Set breakpoint 0 here. - - free(myFile); -} diff --git a/packages/Python/lldbsuite/test/lang/c/recurse/Makefile b/packages/Python/lldbsuite/test/lang/c/recurse/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/recurse/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/recurse/main.c b/packages/Python/lldbsuite/test/lang/c/recurse/main.c deleted file mode 100644 index 1159669ebf15..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/recurse/main.c +++ /dev/null @@ -1,28 +0,0 @@ -#include <stdint.h> -#include <stdio.h> - -uint32_t -recurse_crash (uint32_t depth) -{ - if (depth > 0) - return recurse_crash (depth - 1); - return 0; -} - -int -main (int argc, char const *argv[]) -{ - // If we have more than one argument, then it should a depth to recurse to. - // If we have just the program name as an argument, use UINT32_MAX so we - // eventually crash the program by overflowing the stack - uint32_t depth = UINT32_MAX; - if (argc > 1) - { - char *end = NULL; - depth = strtoul (argv[1], &end, 0); - if (end == NULL || *end != '\0') - depth = UINT32_MAX; - } - recurse_crash (depth); - return 0; -}
\ No newline at end of file diff --git a/packages/Python/lldbsuite/test/lang/c/register_variables/Makefile b/packages/Python/lldbsuite/test/lang/c/register_variables/Makefile deleted file mode 100644 index a98622100ff4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/register_variables/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := test.c - -CFLAGS_EXTRAS += -O1 -D_FORTIFY_SOURCE=0 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py b/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py deleted file mode 100644 index 8221148c29af..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py +++ /dev/null @@ -1,206 +0,0 @@ -"""Check that compiler-generated register values 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 - -# This method attempts to figure out if a given variable -# is in a register. -# -# Return: -# True if the value has a readable value and is in a register -# False otherwise - - -def is_variable_in_register(frame, var_name): - # Ensure we can lookup the variable. - var = frame.FindVariable(var_name) - # print("\nchecking {}...".format(var_name)) - if var is None or not var.IsValid(): - # print("{} cannot be found".format(var_name)) - return False - - # Check that we can get its value. If not, this - # may be a variable that is just out of scope at this point. - value = var.GetValue() - # print("checking value...") - if value is None: - # print("value is invalid") - return False - # else: - # print("value is {}".format(value)) - - # We have a variable and we can get its value. The variable is in - # a register if we cannot get an address for it, assuming it is - # not a struct pointer. (This is an approximation - compilers can - # do other things with spitting up a value into multiple parts of - # multiple registers, but what we're verifying here is much more - # than it was doing before). - var_addr = var.GetAddress() - # print("checking address...") - if var_addr.IsValid(): - # We have an address, it must not be in a register. - # print("var {} is not in a register: has a valid address {}".format(var_name, var_addr)) - return False - else: - # We don't have an address but we can read the value. - # It is likely stored in a register. - # print("var {} is in a register (we don't have an address for it)".format(var_name)) - return True - - -def is_struct_pointer_in_register(frame, var_name, trace): - # Ensure we can lookup the variable. - var = frame.FindVariable(var_name) - if trace: - print("\nchecking {}...".format(var_name)) - - if var is None or not var.IsValid(): - # print("{} cannot be found".format(var_name)) - return False - - # Check that we can get its value. If not, this - # may be a variable that is just out of scope at this point. - value = var.GetValue() - # print("checking value...") - if value is None: - if trace: - print("value is invalid") - return False - else: - if trace: - print("value is {}".format(value)) - - var_loc = var.GetLocation() - if trace: - print("checking location: {}".format(var_loc)) - if var_loc is None or var_loc.startswith("0x"): - # The frame var is not in a register but rather a memory location. - # print("frame var {} is not in a register".format(var_name)) - return False - else: - # print("frame var {} is in a register".format(var_name)) - return True - - -def re_expr_equals(val_type, val): - # Match ({val_type}) ${sum_digits} = {val} - return re.compile(r'\(' + val_type + '\) \$\d+ = ' + str(val)) - - -class RegisterVariableTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(compiler="clang", compiler_version=['<', '3.5']) - @expectedFailureAll(compiler="gcc", compiler_version=[ - '>=', '4.8.2'], archs=["i386"]) - @expectedFailureAll(compiler="gcc", compiler_version=[ - '<', '4.9'], archs=["x86_64"]) - def test_and_run_command(self): - """Test expressions on register values.""" - - # This test now ensures that each probable - # register variable location is actually a register, and - # if so, whether we can print out the variable there. - # It only requires one of them to be handled in a non-error - # way. - register_variables_count = 0 - - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the main. - lldbutil.run_break_set_by_source_regexp( - self, "break", num_expected_locations=3) - - #################### - # First breakpoint - - 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']) - - # Try some variables that should be visible - frame = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame() - if is_variable_in_register(frame, 'a'): - register_variables_count += 1 - self.expect("expr a", VARIABLES_DISPLAYED_CORRECTLY, - patterns=[re_expr_equals('int', 2)]) - - if is_struct_pointer_in_register(frame, 'b', self.TraceOn()): - register_variables_count += 1 - self.expect("expr b->m1", VARIABLES_DISPLAYED_CORRECTLY, - patterns=[re_expr_equals('int', 3)]) - - ##################### - # Second breakpoint - - 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']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - # Try some variables that should be visible - frame = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame() - if is_struct_pointer_in_register(frame, 'b', self.TraceOn()): - register_variables_count += 1 - self.expect("expr b->m2", VARIABLES_DISPLAYED_CORRECTLY, - patterns=[re_expr_equals('int', 5)]) - - if is_variable_in_register(frame, 'c'): - register_variables_count += 1 - self.expect("expr c", VARIABLES_DISPLAYED_CORRECTLY, - patterns=[re_expr_equals('int', 5)]) - - ##################### - # Third breakpoint - - 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']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs=[' resolved, hit count = 1']) - - # Try some variables that should be visible - frame = self.dbg.GetSelectedTarget().GetProcess( - ).GetSelectedThread().GetSelectedFrame() - if is_variable_in_register(frame, 'f'): - register_variables_count += 1 - self.expect("expr f", VARIABLES_DISPLAYED_CORRECTLY, - patterns=[re_expr_equals('float', '3.1')]) - - # Validate that we verified at least one register variable - self.assertTrue( - register_variables_count > 0, - "expected to verify at least one variable in a register") - # print("executed {} expressions with values in registers".format(register_variables_count)) - - self.runCmd("kill") diff --git a/packages/Python/lldbsuite/test/lang/c/register_variables/test.c b/packages/Python/lldbsuite/test/lang/c/register_variables/test.c deleted file mode 100644 index 2c69039d40a2..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/register_variables/test.c +++ /dev/null @@ -1,44 +0,0 @@ -#include <stdio.h> - -#if defined(__arm__) || defined(__aarch64__) || defined (__mips__) || defined(__powerpc64__) -// Clang does not accept regparm attribute on these platforms. -// Fortunately, the default calling convention passes arguments in registers -// anyway. -#define REGPARM(N) -#else -#define REGPARM(N) __attribute__((regparm(N))) -#endif - -struct bar { - int m1; - int m2; -}; - -void f1(int a, struct bar *b) __attribute__((noinline)) REGPARM(2); -void f1(int a, struct bar *b) -{ - b->m2 = b->m1 + a; // set breakpoint here -} - -void f2(struct bar *b) __attribute__((noinline)) REGPARM(1); -void f2(struct bar *b) -{ - int c = b->m2; - printf("%d\n", c); // set breakpoint here -} - -float f3() __attribute__((noinline)); -float f3() { - return 3.14f; -} - -int main() -{ - struct bar myBar = { 3, 4 }; - f1(2, &myBar); - f2(&myBar); - - float f = f3(); - printf("%f\n", f); // set breakpoint here - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/set_values/Makefile b/packages/Python/lldbsuite/test/lang/c/set_values/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/set_values/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py b/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py deleted file mode 100644 index 14677fc548a2..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py +++ /dev/null @@ -1,142 +0,0 @@ -"""Test settings and readings of program variables.""" - -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 SetValuesTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break inside main(). - self.line1 = line_number('main.c', '// Set break point #1.') - self.line2 = line_number('main.c', '// Set break point #2.') - self.line3 = line_number('main.c', '// Set break point #3.') - self.line4 = line_number('main.c', '// Set break point #4.') - self.line5 = line_number('main.c', '// Set break point #5.') - - def test(self): - """Test settings and readings of program variables.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Set breakpoints on several places to set program variables. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line1, num_expected_locations=1, loc_exact=True) - - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line2, num_expected_locations=1, loc_exact=True) - - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line3, num_expected_locations=1, loc_exact=True) - - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line4, num_expected_locations=1, loc_exact=True) - - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line5, 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']) - - # main.c:15 - # Check that 'frame variable --show-types' displays the correct data - # type and value. - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(char) i = 'a'") - - # Now set variable 'i' and check that it is correctly displayed. - self.runCmd("expression i = 'b'") - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(char) i = 'b'") - - self.runCmd("continue") - - # main.c:36 - # Check that 'frame variable --show-types' displays the correct data - # type and value. - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - patterns=["\((short unsigned int|unsigned short)\) i = 33"]) - - # Now set variable 'i' and check that it is correctly displayed. - self.runCmd("expression i = 333") - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - patterns=["\((short unsigned int|unsigned short)\) i = 333"]) - - self.runCmd("continue") - - # main.c:57 - # Check that 'frame variable --show-types' displays the correct data - # type and value. - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(long) i = 33") - - # Now set variable 'i' and check that it is correctly displayed. - self.runCmd("expression i = 33333") - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(long) i = 33333") - - self.runCmd("continue") - - # main.c:78 - # Check that 'frame variable --show-types' displays the correct data - # type and value. - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(double) i = 2.25") - - # Now set variable 'i' and check that it is correctly displayed. - self.runCmd("expression i = 1.5") - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(double) i = 1.5") - - self.runCmd("continue") - - # main.c:85 - # Check that 'frame variable --show-types' displays the correct data - # type and value. - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(long double) i = 2.25") - - # Now set variable 'i' and check that it is correctly displayed. - self.runCmd("expression i = 1.5") - self.expect( - "frame variable --show-types", - VARIABLES_DISPLAYED_CORRECTLY, - startstr="(long double) i = 1.5") diff --git a/packages/Python/lldbsuite/test/lang/c/set_values/main.c b/packages/Python/lldbsuite/test/lang/c/set_values/main.c deleted file mode 100644 index 64f01a97a286..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/set_values/main.c +++ /dev/null @@ -1,116 +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> - -void set_char(void) -{ - char i = 'a'; - printf("before (char) i = %c\n", i); - printf("after (char) i = %c\n", i); // Set break point #1. //// break $source:$line -} - -void set_uchar(void) -{ - unsigned char i = 'a'; - printf("before (unsigned char) i = %c\n", i); - printf("after (unsigned char) i = %c\n", i); //// break $source:$line -} - -void set_short(void) -{ - short i = 33; - printf("before (short) i = %i\n", i); - printf("after (short) i = %i\n", i); //// break $source:$line -} - -void set_ushort(void) -{ - unsigned short i = 33; - printf("before (unsigned short) i = %i\n", i); - printf("after (unsigned short) i = %i\n", i); // Set break point #2. //// break $source:$line -} - -void set_int(void) -{ - int i = 33; - printf("before (int) i = %i\n", i); - printf("after (int) i = %i\n", i); //// break $source:$line -} - -void set_uint(void) -{ - unsigned int i = 33; - printf("before (unsigned int) i = %u\n", i); - printf("after (unsigned int) i = %u\n", i); //// break $source:$line -} - -void set_long(void) -{ - long i = 33; - printf("before (long) i = %li\n", i); - printf("after (long) i = %li\n", i); // Set break point #3. //// break $source:$line -} - -void set_ulong(void) -{ - unsigned long i = 33; - printf("before (unsigned long) i = %lu\n", i); - printf("after (unsigned long) i = %lu\n", i); //// break $source:$line -} - -void set_float(void) -{ - float i = 2.25; - printf("before (float) i = %g\n", i); - printf("after (float) i = %g\n", i); //// break $source:$line -} - -void set_double(void) -{ - double i = 2.25; - printf("before (double) i = %g\n", i); - printf("after (double) i = %g\n", i); // Set break point #4. //// break $source:$line -} - -void set_long_double(void) -{ - long double i = 2.25; - printf("before (long double) i = %Lg\n", i); - printf("after (long double) i = %Lg\n", i); // Set break point #5. //// break $source:$line -} - -void set_point (void) -{ - struct point_tag { - int x; - int y; - }; - struct point_tag points_2[2] = { - {1,2}, - {3,4} - }; -} - -int main (int argc, char const *argv[]) -{ - // Continue to the breakpoint in set_char() - set_char(); //// continue; var i; val -set 99 1 - set_uchar(); //// continue; var i; val -set 99 2 - set_short(); //// continue; var i; val -set -42 3 - set_ushort(); //// continue; var i; val -set 42 4 - set_int(); //// continue; var i; val -set -42 5 - set_uint(); //// continue; var i; val -set 42 6 - set_long(); //// continue; var i; val -set -42 7 - set_ulong(); //// continue; var i; val -set 42 8 - set_float(); //// continue; var i; val -set 123.456 9 - set_double(); //// continue; var i; val -set 123.456 10 - set_long_double(); //// continue; var i; val -set 123.456 11 - set_point (); //// continue - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile b/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile deleted file mode 100644 index 35d712c3f17f..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL = ../../../make - -DYLIB_NAME := foo -DYLIB_C_SOURCES := foo.c -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py deleted file mode 100644 index d1595163f6e3..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py +++ /dev/null @@ -1,100 +0,0 @@ -"""Test that types defined in shared libraries work correctly.""" - -from __future__ import print_function - - -import unittest2 -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class SharedLibTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def common_test_expr(self, preload_symbols): - 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.build() - self.common_setup(preload_symbols) - - # This should display correctly. - self.expect( - "expression --show-types -- *my_foo_ptr", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "(foo)", - "(sub_foo)", - "other_element = 3"]) - - self.expect( - "expression GetMeASubFoo(my_foo_ptr)", - startstr="(sub_foo *) $") - - def test_expr(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.common_test_expr(True) - - def test_expr_no_preload(self): - """Test that types work when defined in a shared library and forward-declared in the main executable, but with preloading disabled""" - self.common_test_expr(False) - - @unittest2.expectedFailure("llvm.org/PR36712") - def test_frame_variable(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.build() - self.common_setup() - - # This should display correctly. - self.expect( - "frame variable --show-types -- *my_foo_ptr", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "(foo)", - "(sub_foo)", - "other_element = 3"]) - - 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 breakpoint 0 here.') - self.shlib_names = ["foo"] - - def common_setup(self, preload_symbols = True): - # Run in synchronous mode - self.dbg.SetAsync(False) - - # Create a target by the debugger. - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.assertTrue(target, VALID_TARGET) - - self.runCmd("settings set target.preload-symbols " + str(preload_symbols).lower()) - - # Break inside the foo function which takes a bar_ptr argument. - lldbutil.run_break_set_by_file_and_line( - self, self.source, self.line, num_expected_locations=1, loc_exact=True) - - # Register our shared libraries for remote targets so they get - # automatically uploaded - environment = self.registerSharedLibrariesWithTarget( - target, self.shlib_names) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, environment, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # 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']) diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/foo.c b/packages/Python/lldbsuite/test/lang/c/shared_lib/foo.c deleted file mode 100644 index 6431bc496c30..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib/foo.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "foo.h" -#include <stdlib.h> - -struct foo -{ - struct sub_foo sub_element; - int other_element; -}; - -struct foo * -GetMeAFoo() -{ - struct foo *ret_val = (struct foo *) malloc (sizeof (struct foo)); - ret_val->other_element = 3; - return ret_val; -} - -struct sub_foo * -GetMeASubFoo (struct foo *in_foo) -{ - return &(in_foo->sub_element); -} diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/foo.h b/packages/Python/lldbsuite/test/lang/c/shared_lib/foo.h deleted file mode 100644 index 78b9e3f9c0d9..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib/foo.h +++ /dev/null @@ -1,10 +0,0 @@ -struct foo; - -struct sub_foo -{ - int sub_1; - char *sub_2; -}; - -LLDB_TEST_API struct foo *GetMeAFoo(); -LLDB_TEST_API struct sub_foo *GetMeASubFoo(struct foo *in_foo); diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/main.c b/packages/Python/lldbsuite/test/lang/c/shared_lib/main.c deleted file mode 100644 index b4377de18c16..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib/main.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <stdio.h> -#include "foo.h" - -int -main () -{ - struct foo *my_foo_ptr; - my_foo_ptr = GetMeAFoo(); - - printf ("My sub foo has: %d.\n", GetMeASubFoo(my_foo_ptr)->sub_1); // Set breakpoint 0 here. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile deleted file mode 100644 index 6d1f1071bf2f..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -LEVEL = ../../../make - -DYLIB_NAME := foo -DYLIB_C_SOURCES := foo.c -C_SOURCES := main.c - -SPLIT_DEBUG_SYMBOLS = YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py deleted file mode 100644 index 3731d1a1eb65..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py +++ /dev/null @@ -1,89 +0,0 @@ -"""Test that types defined in shared libraries with stripped symbols work 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 SharedLibStrippedTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(oslist=["windows"]) - def test_expr(self): - """Test that types work when defined in a shared library and forwa/d-declared in the main executable""" - 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.build() - self.common_setup() - - # This should display correctly. - self.expect( - "expression --show-types -- *my_foo_ptr", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "(foo)", - "(sub_foo)", - "other_element = 3"]) - - @expectedFailureAll(oslist=["windows"]) - @unittest2.expectedFailure("llvm.org/PR36712") - def test_frame_variable(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.build() - self.common_setup() - - # This should display correctly. - self.expect( - "frame variable --show-types -- *my_foo_ptr", - VARIABLES_DISPLAYED_CORRECTLY, - substrs=[ - "(foo)", - "(sub_foo)", - "other_element = 3"]) - - 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 breakpoint 0 here.') - self.shlib_names = ["foo"] - - def common_setup(self): - # Run in synchronous mode - self.dbg.SetAsync(False) - - # Create a target by the debugger. - target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) - self.assertTrue(target, VALID_TARGET) - - # Break inside the foo function which takes a bar_ptr argument. - lldbutil.run_break_set_by_file_and_line( - self, self.source, self.line, num_expected_locations=1, loc_exact=True) - - # Register our shared libraries for remote targets so they get - # automatically uploaded - environment = self.registerSharedLibrariesWithTarget( - target, self.shlib_names) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, environment, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - # 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']) diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/foo.c b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/foo.c deleted file mode 100644 index 6431bc496c30..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/foo.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "foo.h" -#include <stdlib.h> - -struct foo -{ - struct sub_foo sub_element; - int other_element; -}; - -struct foo * -GetMeAFoo() -{ - struct foo *ret_val = (struct foo *) malloc (sizeof (struct foo)); - ret_val->other_element = 3; - return ret_val; -} - -struct sub_foo * -GetMeASubFoo (struct foo *in_foo) -{ - return &(in_foo->sub_element); -} diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/foo.h b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/foo.h deleted file mode 100644 index 78b3c1245387..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/foo.h +++ /dev/null @@ -1,12 +0,0 @@ -struct foo; - -struct sub_foo -{ - int sub_1; - char *sub_2; -}; - -struct foo *GetMeAFoo(); -struct sub_foo *GetMeASubFoo (struct foo *in_foo); - - diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/main.c b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/main.c deleted file mode 100644 index b4377de18c16..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/main.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <stdio.h> -#include "foo.h" - -int -main () -{ - struct foo *my_foo_ptr; - my_foo_ptr = GetMeAFoo(); - - printf ("My sub foo has: %d.\n", GetMeASubFoo(my_foo_ptr)->sub_1); // Set breakpoint 0 here. - - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/.categories b/packages/Python/lldbsuite/test/lang/c/step-target/.categories deleted file mode 100644 index c00c25822e4c..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/step-target/.categories +++ /dev/null @@ -1 +0,0 @@ -basic_process diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/Makefile b/packages/Python/lldbsuite/test/lang/c/step-target/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/step-target/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py b/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py deleted file mode 100644 index aeda9ff41eb2..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py +++ /dev/null @@ -1,127 +0,0 @@ -"""Test the 'step target' feature.""" - -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 TestStepTarget(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.end_line = line_number(self.main_source, "All done") - - @add_test_categories(['pyapi']) - def get_to_start(self): - 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( - 'Break here to try targetted stepping', self.main_source_spec) - self.assertTrue(break_in_main, VALID_BREAKPOINT) - self.assertTrue(break_in_main.GetNumLocations() > 0, "Has locations.") - - # 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] - return thread - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_with_end_line(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - - thread = self.get_to_start() - - error = lldb.SBError() - thread.StepInto("lotsOfArgs", self.end_line, error) - frame = thread.frames[0] - - self.assertTrue(frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.") - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_with_end_line_bad_name(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - - thread = self.get_to_start() - - error = lldb.SBError() - thread.StepInto("lotsOfArgssss", self.end_line, error) - frame = thread.frames[0] - self.assertTrue( - frame.line_entry.line == self.end_line, - "Stepped to the block end.") - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_with_end_line_deeper(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - - thread = self.get_to_start() - - error = lldb.SBError() - thread.StepInto("modifyInt", self.end_line, error) - frame = thread.frames[0] - self.assertTrue(frame.name == "modifyInt", "Stepped to modifyInt.") - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_with_command_and_block(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - - thread = self.get_to_start() - - result = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand( - 'thread step-in -t "lotsOfArgs" -e block', result) - self.assertTrue( - result.Succeeded(), - "thread step-in command succeeded.") - - frame = thread.frames[0] - self.assertTrue(frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.") - - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") - def test_with_command_and_block_and_bad_name(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - - thread = self.get_to_start() - - result = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand( - 'thread step-in -t "lotsOfArgsssss" -e block', result) - self.assertTrue( - result.Succeeded(), - "thread step-in command succeeded.") - - frame = thread.frames[0] - - self.assertTrue(frame.name == "main", "Stepped back out to main.") - # end_line is set to the line after the containing block. Check that - # we got there: - self.assertTrue( - frame.line_entry.line == self.end_line, - "Got out of the block") diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/main.c b/packages/Python/lldbsuite/test/lang/c/step-target/main.c deleted file mode 100644 index 86a26c4d47a4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/step-target/main.c +++ /dev/null @@ -1,40 +0,0 @@ -#include <stdio.h> - -void -lotsOfArgs -( - int firstArg, - int secondArg, - int thirdArg, - int fourthArg -) -{ - printf ("First: %d Second: %d Third: %d Fourth: %d.\n", - firstArg, - secondArg, - thirdArg, - fourthArg); -} - -int -modifyInt(int incoming) -{ - return incoming % 2; -} - -int -main (int argc, char **argv) -{ - if (argc > 0) - { - int var_makes_block = argc + 1; - printf ("Break here to try targetted stepping.\n"); - lotsOfArgs(var_makes_block, - modifyInt(20), - 30, - modifyInt(40)); - printf ("Done calling lotsOfArgs."); - } - printf ("All done.\n"); - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/Makefile b/packages/Python/lldbsuite/test/lang/c/stepping/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/stepping/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py b/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py deleted file mode 100644 index 4a4052cfa335..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py +++ /dev/null @@ -1,298 +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 TestCStepping(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', 'basic_process']) - @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17932') - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr14437") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24777") - def test_and_python_api(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - 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) - - breakpoints_to_disable = [] - - break_1_in_main = target.BreakpointCreateBySourceRegex( - '// frame select 2, thread step-out while stopped at .c.1..', - self.main_source_spec) - self.assertTrue(break_1_in_main, VALID_BREAKPOINT) - breakpoints_to_disable.append(break_1_in_main) - - break_in_a = target.BreakpointCreateBySourceRegex( - '// break here to stop in a before calling b', self.main_source_spec) - self.assertTrue(break_in_a, VALID_BREAKPOINT) - breakpoints_to_disable.append(break_in_a) - - break_in_b = target.BreakpointCreateBySourceRegex( - '// thread step-out while stopped at .c.2..', self.main_source_spec) - self.assertTrue(break_in_b, VALID_BREAKPOINT) - breakpoints_to_disable.append(break_in_b) - - break_in_c = target.BreakpointCreateBySourceRegex( - '// Find the line number of function .c. here.', self.main_source_spec) - self.assertTrue(break_in_c, VALID_BREAKPOINT) - breakpoints_to_disable.append(break_in_c) - - # 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_1_in_main) - - if len(threads) != 1: - self.fail("Failed to stop at first breakpoint in main.") - - thread = threads[0] - - # Get the stop id and for fun make sure it increases: - old_stop_id = process.GetStopID() - - # Now step over, which should cause us to hit the breakpoint in "a" - thread.StepOver() - - # The stop reason of the thread should be breakpoint. - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, break_in_a) - if len(threads) != 1: - self.fail("Failed to stop at breakpoint in a.") - - # Check that the stop ID increases: - new_stop_id = process.GetStopID() - self.assertTrue( - new_stop_id > old_stop_id, - "Stop ID increases monotonically.") - - thread = threads[0] - - # Step over, and we should hit the breakpoint in b: - thread.StepOver() - - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, break_in_b) - if len(threads) != 1: - self.fail("Failed to stop at breakpoint in b.") - thread = threads[0] - - # Now try running some function, and make sure that we still end up in the same place - # and with the same stop reason. - frame = thread.GetFrameAtIndex(0) - current_line = frame.GetLineEntry().GetLine() - current_file = frame.GetLineEntry().GetFileSpec() - current_bp = [] - current_bp.append(thread.GetStopReasonDataAtIndex(0)) - current_bp.append(thread.GetStopReasonDataAtIndex(1)) - - stop_id_before_expression = process.GetStopID() - stop_id_before_including_expressions = process.GetStopID(True) - - frame.EvaluateExpression("(int) printf (print_string)") - - frame = thread.GetFrameAtIndex(0) - self.assertTrue( - current_line == frame.GetLineEntry().GetLine(), - "The line stayed the same after expression.") - self.assertTrue( - current_file == frame.GetLineEntry().GetFileSpec(), - "The file stayed the same after expression.") - self.assertTrue( - thread.GetStopReason() == lldb.eStopReasonBreakpoint, - "We still say we stopped for a breakpoint.") - self.assertTrue(thread.GetStopReasonDataAtIndex(0) == current_bp[ - 0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.") - - # Also make sure running the expression didn't change the public stop id - # but did change if we are asking for expression stops as well. - stop_id_after_expression = process.GetStopID() - stop_id_after_including_expressions = process.GetStopID(True) - - self.assertTrue( - stop_id_before_expression == stop_id_after_expression, - "Expression calling doesn't change stop ID") - - self.assertTrue( - stop_id_after_including_expressions > stop_id_before_including_expressions, - "Stop ID including expressions increments over expression call.") - - # Do the same thing with an expression that's going to crash, and make - # sure we are still unchanged. - - frame.EvaluateExpression("((char *) 0)[0] = 'a'") - - frame = thread.GetFrameAtIndex(0) - self.assertTrue( - current_line == frame.GetLineEntry().GetLine(), - "The line stayed the same after expression.") - self.assertTrue( - current_file == frame.GetLineEntry().GetFileSpec(), - "The file stayed the same after expression.") - self.assertTrue( - thread.GetStopReason() == lldb.eStopReasonBreakpoint, - "We still say we stopped for a breakpoint.") - self.assertTrue(thread.GetStopReasonDataAtIndex(0) == current_bp[ - 0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.") - - # Now continue and make sure we just complete the step: - # Disable all our breakpoints first - sometimes the compiler puts two line table entries in for the - # breakpoint a "b" and we don't want to hit that. - for bkpt in breakpoints_to_disable: - bkpt.SetEnabled(False) - - process.Continue() - - self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "a") - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) - - # And one more time should get us back to main: - process.Continue() - - self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main") - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) - - # Now make sure we can call a function, break in the called function, - # then have "continue" get us back out again: - frame = thread.GetFrameAtIndex(0) - frame = thread.GetFrameAtIndex(0) - current_line = frame.GetLineEntry().GetLine() - current_file = frame.GetLineEntry().GetFileSpec() - - break_in_b.SetEnabled(True) - options = lldb.SBExpressionOptions() - options.SetIgnoreBreakpoints(False) - options.SetFetchDynamicValue(False) - options.SetUnwindOnError(False) - frame.EvaluateExpression("b (4)", options) - - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, break_in_b) - - if len(threads) != 1: - self.fail("Failed to stop at breakpoint in b when calling b.") - thread = threads[0] - - # So do a step over here to make sure we can still do that: - - thread.StepOver() - - # See that we are still in b: - func_name = thread.GetFrameAtIndex(0).GetFunctionName() - self.assertTrue( - func_name == "b", - "Should be in 'b', were in %s" % - (func_name)) - - # Okay, now if we continue, we will finish off our function call and we - # should end up back in "a" as if nothing had happened: - process.Continue() - - self.assertTrue(thread.GetFrameAtIndex( - 0).GetLineEntry().GetLine() == current_line) - self.assertTrue(thread.GetFrameAtIndex( - 0).GetLineEntry().GetFileSpec() == current_file) - - # Now we are going to test step in targeting a function: - - break_in_b.SetEnabled(False) - - break_before_complex_1 = target.BreakpointCreateBySourceRegex( - '// Stop here to try step in targeting b.', self.main_source_spec) - self.assertTrue(break_before_complex_1, VALID_BREAKPOINT) - - break_before_complex_2 = target.BreakpointCreateBySourceRegex( - '// Stop here to try step in targeting complex.', self.main_source_spec) - self.assertTrue(break_before_complex_2, VALID_BREAKPOINT) - - break_before_complex_3 = target.BreakpointCreateBySourceRegex( - '// Stop here to step targeting b and hitting breakpoint.', self.main_source_spec) - self.assertTrue(break_before_complex_3, VALID_BREAKPOINT) - - break_before_complex_4 = target.BreakpointCreateBySourceRegex( - '// Stop here to make sure bogus target steps over.', self.main_source_spec) - self.assertTrue(break_before_complex_4, VALID_BREAKPOINT) - - threads = lldbutil.continue_to_breakpoint( - process, break_before_complex_1) - self.assertTrue(len(threads) == 1) - thread = threads[0] - break_before_complex_1.SetEnabled(False) - - thread.StepInto("b") - self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b") - - # Now continue out and stop at the next call to complex. This time - # step all the way into complex: - threads = lldbutil.continue_to_breakpoint( - process, break_before_complex_2) - self.assertTrue(len(threads) == 1) - thread = threads[0] - break_before_complex_2.SetEnabled(False) - - thread.StepInto("complex") - self.assertTrue(thread.GetFrameAtIndex( - 0).GetFunctionName() == "complex") - - # Now continue out and stop at the next call to complex. This time - # enable breakpoints in a and c and then step targeting b: - threads = lldbutil.continue_to_breakpoint( - process, break_before_complex_3) - self.assertTrue(len(threads) == 1) - thread = threads[0] - break_before_complex_3.SetEnabled(False) - - break_at_start_of_a = target.BreakpointCreateByName('a') - break_at_start_of_c = target.BreakpointCreateByName('c') - - thread.StepInto("b") - threads = lldbutil.get_stopped_threads( - process, lldb.eStopReasonBreakpoint) - - self.assertTrue(len(threads) == 1) - thread = threads[0] - stop_break_id = thread.GetStopReasonDataAtIndex(0) - self.assertTrue(stop_break_id == break_at_start_of_a.GetID() - or stop_break_id == break_at_start_of_c.GetID()) - - break_at_start_of_a.SetEnabled(False) - break_at_start_of_c.SetEnabled(False) - - process.Continue() - self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b") - - # Now continue out and stop at the next call to complex. This time - # enable breakpoints in a and c and then step targeting b: - threads = lldbutil.continue_to_breakpoint( - process, break_before_complex_4) - self.assertTrue(len(threads) == 1) - thread = threads[0] - break_before_complex_4.SetEnabled(False) - - thread.StepInto("NoSuchFunction") - self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main") diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py b/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py deleted file mode 100644 index 62a0bf8e33eb..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -Test thread stepping features in combination with frame select. -""" - -from __future__ import print_function - - -import os -import time -import re -import lldb -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class ThreadSteppingTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - 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', '// frame select 2, thread step-out while stopped at "c(1)"') - self.line3 = line_number( - 'main.c', '// thread step-out while stopped at "c(2)"') - self.line4 = line_number( - 'main.c', '// frame select 1, thread step-out while stopped at "c(3)"') - - def test_step_out_with_run_command(self): - """Exercise thread step-out and frame select followed by thread step-out.""" - self.build() - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Create a breakpoint inside function 'c'. - lldbutil.run_break_set_by_file_and_line( - self, "main.c", self.line1, 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']) - - # The frame #0 should correspond to main.c:32, the executable statement - # in function name 'c'. And frame #3 should point to main.c:37. - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs=["stop reason = breakpoint"], - patterns=["frame #0.*main.c:%d" % self.line1, - "frame #3.*main.c:%d" % self.line2]) - - # We want to move the pc to frame #3. This can be accomplished by - # 'frame select 2', followed by 'thread step-out'. - self.runCmd("frame select 2") - self.runCmd("thread step-out") - self.expect("thread backtrace", STEP_OUT_SUCCEEDED, - substrs=["stop reason = step out"], - patterns=["frame #0.*main.c:%d" % self.line2]) - - # Let's move on to a single step-out case. - self.runCmd("process continue") - - # The process should be stopped at this point. - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* stopped']) - self.runCmd("thread step-out") - self.expect("thread backtrace", STEP_OUT_SUCCEEDED, - substrs=["stop reason = step out"], - patterns=["frame #0.*main.c:%d" % self.line3]) - - # Do another frame selct, followed by thread step-out. - self.runCmd("process continue") - - # The process should be stopped at this point. - self.expect("process status", PROCESS_STOPPED, - patterns=['Process .* stopped']) - self.runCmd("frame select 1") - self.runCmd("thread step-out") - self.expect("thread backtrace", STEP_OUT_SUCCEEDED, - substrs=["stop reason = step out"], - patterns=["frame #0.*main.c:%d" % self.line4]) diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/main.c b/packages/Python/lldbsuite/test/lang/c/stepping/main.c deleted file mode 100644 index d8b4a2da761e..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/stepping/main.c +++ /dev/null @@ -1,69 +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 a(int); -int b(int); -int c(int); -const char *print_string = "aaaaaaaaaa\n"; - -int a(int val) -{ - int return_value = val; // basic break at the start of b - - if (val <= 1) - { - return_value = b(val); // break here to stop in a before calling b - } - else if (val >= 3) - { - return_value = c(val); - } - - return return_value; -} - -int b(int val) -{ - int rc = c(val); // thread step-out while stopped at "c(2)" - return rc; -} - -int c(int val) -{ - return val + 3; // Find the line number of function "c" here. -} - -int complex (int first, int second, int third) -{ - return first + second + third; // Step in targeting complex should stop here -} - -int main (int argc, char const *argv[]) -{ - int A1 = a(1); // frame select 2, thread step-out while stopped at "c(1)" - printf("a(1) returns %d\n", A1); - - int B2 = b(2); - printf("b(2) returns %d\n", B2); - - int A3 = a(3); // frame select 1, thread step-out while stopped at "c(3)" - printf("a(3) returns %d\n", A3); - - int A4 = complex (a(1), b(2), c(3)); // Stop here to try step in targeting b. - - int A5 = complex (a(2), b(3), c(4)); // Stop here to try step in targeting complex. - - int A6 = complex (a(4), b(5), c(6)); // Stop here to step targeting b and hitting breakpoint. - - int A7 = complex (a(5), b(6), c(7)); // Stop here to make sure bogus target steps over. - - printf ("I am using print_string: %s.\n", print_string); - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/strings/Makefile b/packages/Python/lldbsuite/test/lang/c/strings/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/strings/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py b/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py deleted file mode 100644 index 597a247178e4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -Tests that C strings work as expected in expressions -""" -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class CStringsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_with_run_command(self): - """Tests that C strings work as expected in expressions""" - self.build() - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - line = line_number('main.c', '// breakpoint 1') - lldbutil.run_break_set_by_file_and_line( - self, "main.c", line, num_expected_locations=1, loc_exact=True) - - self.runCmd("process launch", RUN_SUCCEEDED) - - self.expect("expression -- a[2]", - patterns=["\((const )?char\) \$0 = 'c'"]) - - self.expect("expression -- z[2]", - startstr="(const char) $1 = 'x'") - - # On Linux, the expression below will test GNU indirect function calls. - self.expect("expression -- (int)strlen(\"hello\")", - startstr="(int) $2 = 5") - - self.expect("expression -- \"world\"[2]", - startstr="(const char) $3 = 'r'") - - self.expect("expression -- \"\"[0]", - startstr="(const char) $4 = '\\0'") - - self.expect("expr --raw -- \"hello\"", - substrs=['[0] = \'h\'', - '[5] = \'\\0\'']) - - self.expect("p \"hello\"", - substrs=['[6]) $', 'hello']) - - self.expect("p (char*)\"hello\"", - substrs=['(char *) $', ' = 0x', - 'hello']) - - self.expect("p (int)strlen(\"\")", - substrs=['(int) $', ' = 0']) - - self.expect("expression !z", - substrs=['false']) diff --git a/packages/Python/lldbsuite/test/lang/c/strings/main.c b/packages/Python/lldbsuite/test/lang/c/strings/main.c deleted file mode 100644 index e02580b407f5..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/strings/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> - -int main() -{ - const char a[] = "abcde"; - const char *z = "vwxyz"; - - printf("%s %s", a, z); // breakpoint 1 -} diff --git a/packages/Python/lldbsuite/test/lang/c/struct_types/Makefile b/packages/Python/lldbsuite/test/lang/c/struct_types/Makefile deleted file mode 100644 index cd9ca5c86d84..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/struct_types/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LEVEL = ../../../make -C_SOURCES := main.c -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py b/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py deleted file mode 100644 index c8308c16011e..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py +++ /dev/null @@ -1,4 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals()) diff --git a/packages/Python/lldbsuite/test/lang/c/struct_types/main.c b/packages/Python/lldbsuite/test/lang/c/struct_types/main.c deleted file mode 100644 index 29ac10cb94a8..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/struct_types/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. -// -//===----------------------------------------------------------------------===// - -struct things_to_sum { - int a; - int b; - int c; -}; - -int sum_things(struct things_to_sum tts) -{ - return tts.a + tts.b + tts.c; -} - -int main (int argc, char const *argv[]) -{ - struct point_tag { - int x; - int y; - char padding[0]; - }; //% self.expect("frame variable pt.padding[0]", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["pt.padding[0] = "]) - //% self.expect("frame variable pt.padding[1]", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["pt.padding[1] = "]) - //% self.expect("expression -- (pt.padding[0])", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["(char)", " = "]) - //% self.expect("image lookup -t point_tag", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['padding[]']) # Once rdar://problem/12566646 is fixed, this should display correctly - - struct rect_tag { - struct point_tag bottom_left; - struct point_tag top_right; - }; - struct point_tag pt = { 2, 3, {} }; - struct rect_tag rect = {{1, 2, {}}, {3, 4, {}}}; - struct things_to_sum tts = { 2, 3, 4 }; - - int sum = sum_things(tts); //% self.expect("expression -- &pt == (struct point_tag*)0", substrs = ['false']) - //% self.expect("expression -- sum_things(tts)", substrs = ['9']) - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile b/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile deleted file mode 100644 index 0faad10b24af..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -DYLIB_NAME := a -DYLIB_C_SOURCES := a.c - -ENABLE_THREADS := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py deleted file mode 100644 index b76cd411b5ca..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py +++ /dev/null @@ -1,97 +0,0 @@ -"""Test that thread-local storage can be read correctly.""" - -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 TlsGlobalTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def setUp(self): - TestBase.setUp(self) - - if self.getPlatform() == "freebsd" or self.getPlatform() == "linux": - # LD_LIBRARY_PATH must be set so the shared libraries are found on - # startup - if "LD_LIBRARY_PATH" in os.environ: - self.runCmd( - "settings set target.env-vars " + - self.dylibPath + - "=" + - os.environ["LD_LIBRARY_PATH"] + - ":" + - self.getBuildDir()) - else: - self.runCmd("settings set target.env-vars " + - self.dylibPath + "=" + self.getBuildDir()) - self.addTearDownHook( - lambda: self.runCmd( - "settings remove target.env-vars " + - self.dylibPath)) - - # TLS works differently on Windows, this would need to be implemented - # separately. - @skipIfWindows - @expectedFailureAll( - bugnumber="llvm.org/pr28392", - oslist=no_match( - lldbplatformutil.getDarwinOSTriples())) - def test(self): - """Test thread-local storage.""" - self.build() - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - if self.platformIsDarwin(): - self.registerSharedLibrariesWithTarget(target, ['liba.dylib']) - - line1 = line_number('main.c', '// thread breakpoint') - lldbutil.run_break_set_by_file_and_line( - self, "main.c", line1, num_expected_locations=1, loc_exact=True) - self.runCmd("run", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.runCmd("process status", "Get process status") - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # BUG: sometimes lldb doesn't change threads to the stopped thread. - # (unrelated to this test). - self.runCmd("thread select 2", "Change thread") - - # Check that TLS evaluates correctly within the thread. - self.expect("expr var_static", VARIABLES_DISPLAYED_CORRECTLY, - patterns=["\(int\) \$.* = 88"]) - self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY, - patterns=["\(int\) \$.* = 66"]) - - # Continue on the main thread - line2 = line_number('main.c', '// main breakpoint') - lldbutil.run_break_set_by_file_and_line( - self, "main.c", line2, num_expected_locations=1, loc_exact=True) - self.runCmd("continue", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.runCmd("process status", "Get process status") - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) - - # BUG: sometimes lldb doesn't change threads to the stopped thread. - # (unrelated to this test). - self.runCmd("thread select 1", "Change thread") - - # Check that TLS evaluates correctly within the main thread. - self.expect("expr var_static", VARIABLES_DISPLAYED_CORRECTLY, - patterns=["\(int\) \$.* = 44"]) - self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY, - patterns=["\(int\) \$.* = 33"]) diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/a.c b/packages/Python/lldbsuite/test/lang/c/tls_globals/a.c deleted file mode 100644 index ab1022514d1e..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/tls_globals/a.c +++ /dev/null @@ -1,24 +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. -// -//===----------------------------------------------------------------------===// - -#include <unistd.h> - -__thread int var_shared = 33; - -int -touch_shared() -{ - return var_shared; -} - -void shared_check() -{ - var_shared *= 2; - usleep(1); // shared thread breakpoint -} diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/main.c b/packages/Python/lldbsuite/test/lang/c/tls_globals/main.c deleted file mode 100644 index 73e32ca39a58..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/tls_globals/main.c +++ /dev/null @@ -1,42 +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 <pthread.h> -#include <unistd.h> - -void shared_check(); -// On some OS's (darwin) you must actually access a thread local variable -// before you can read it -int -touch_shared(); - -// Create some TLS storage within the static executable. -__thread int var_static = 44; - -void *fn_static(void *param) -{ - var_static *= 2; - shared_check(); - usleep(1); // thread breakpoint - for(;;) - usleep(1); -} - -int main (int argc, char const *argv[]) -{ - pthread_t handle; - pthread_create(&handle, NULL, &fn_static, NULL); - touch_shared(); - for (; var_static;) - { - usleep(1); // main breakpoint - } - - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/typedef/Makefile b/packages/Python/lldbsuite/test/lang/c/typedef/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/typedef/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py b/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py deleted file mode 100644 index bbae76b5752a..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py +++ /dev/null @@ -1,55 +0,0 @@ -"""Look up type information for typedefs of same name at different lexical scope and check for correct display.""" - -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 TypedefTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(compiler="clang", bugnumber="llvm.org/pr19238") - @expectedFailureAll( - oslist=["freebsd"], - bugnumber="llvm.org/pr25626 expectedFailureClang fails on FreeBSD") - def test_typedef(self): - """Test 'image lookup -t a' and check for correct display at different scopes.""" - self.build() - self.image_lookup_for_multiple_typedefs() - - def image_lookup_for_multiple_typedefs(self): - """Test 'image lookup -t a' at different scopes and check for correct display.""" - exe = self.getBuildArtifact("a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - typearray = ( - "float", - "float", - "char", - "double *", - "float", - "int", - "double", - "float", - "float") - arraylen = len(typearray) + 1 - for i in range(1, arraylen): - loc_line = line_number( - 'main.c', '// Set break point ' + str(i) + '.') - lldbutil.run_break_set_by_file_and_line( - self, "main.c", loc_line, num_expected_locations=1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - for t in typearray: - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', 'stop reason = breakpoint']) - self.expect("image lookup -t a", DATA_TYPES_DISPLAYED_CORRECTLY, - substrs=['name = "' + t + '"']) - self.runCmd("continue") diff --git a/packages/Python/lldbsuite/test/lang/c/typedef/main.c b/packages/Python/lldbsuite/test/lang/c/typedef/main.c deleted file mode 100644 index 62f8a00e6644..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/typedef/main.c +++ /dev/null @@ -1,46 +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 test() -{ - typedef double * a; - a b = 0; // Set break point 4. -} -int main (int argc, char const *argv[]) -{ - typedef float a; - int i = 0; // Set break point 1. - i++; - a floatvariable = 2.7; // Set break point 2. - { - typedef char a; - i++; - a charvariable = 'a'; // Set break point 3. - test(); - } - { - int c = 0; - c++; // Set break point 5. - for(i = 0 ; i < 1 ; i++) - { - typedef int a; - a b; - b = 7; // Set break point 6. - } - for(i = 0 ; i < 1 ; i++) - { - typedef double a; - a b; - b = 3.14; // Set break point 7. - } - c = 1; // Set break point 8. - } - floatvariable = 2.5; - floatvariable = 2.8; // Set break point 9. - return 0; -} diff --git a/packages/Python/lldbsuite/test/lang/c/unicode/Makefile b/packages/Python/lldbsuite/test/lang/c/unicode/Makefile deleted file mode 100644 index efabc4d4335c..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/unicode/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -CFLAGS_EXTRAS += -finput-charset=UTF-8 -fextended-identifiers -std=c99 - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/unicode/TestUnicodeSymbols.py b/packages/Python/lldbsuite/test/lang/c/unicode/TestUnicodeSymbols.py deleted file mode 100644 index 9eb25e4d1050..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/unicode/TestUnicodeSymbols.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf8 -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil -from lldbsuite.test.decorators import * - - -class TestUnicodeSymbols(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIf(compiler="clang", compiler_version=['<', '7.0']) - def test_union_members(self): - self.build() - spec = lldb.SBModuleSpec() - spec.SetFileSpec(lldb.SBFileSpec(self.getBuildArtifact("a.out"))) - module = lldb.SBModule(spec) - self.assertTrue(module.IsValid()) - mytype = module.FindFirstType("foobár") - self.assertTrue(mytype.IsValid()) - self.assertTrue(mytype.IsPointerType()) diff --git a/packages/Python/lldbsuite/test/lang/c/unicode/main.c b/packages/Python/lldbsuite/test/lang/c/unicode/main.c deleted file mode 100644 index ae44dd0edfa8..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/unicode/main.c +++ /dev/null @@ -1,5 +0,0 @@ -typedef void *foob\u00E1r; -foob\u00E1r X = 0; -int main() { - return (long)X; -} diff --git a/packages/Python/lldbsuite/test/lang/c/unions/Makefile b/packages/Python/lldbsuite/test/lang/c/unions/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/unions/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py b/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py deleted file mode 100644 index 4965df2d8091..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py +++ /dev/null @@ -1,52 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil - - -class TestUnionMembers(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def test_union_members(self): - self._load_exe() - - # Set breakpoints - bp = self.target.BreakpointCreateBySourceRegex( - "Break here", self.src_file_spec) - self.assertTrue( - bp.IsValid() and bp.GetNumLocations() >= 1, - VALID_BREAKPOINT) - - # Launch the process - self.process = self.target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID) - self.assertTrue( - self.process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - - thread = lldbutil.get_stopped_thread( - self.process, lldb.eStopReasonBreakpoint) - self.assertTrue(thread.IsValid()) - frame = thread.GetSelectedFrame() - self.assertTrue(frame.IsValid()) - - val = frame.EvaluateExpression("u") - self.assertTrue(val.IsValid()) - val = frame.EvaluateExpression("u.s") - self.assertTrue(val.IsValid()) - self.assertEqual(val.GetNumChildren(), 2) - - def _load_exe(self): - self.build() - - src_file = os.path.join(self.getSourceDir(), "main.c") - self.src_file_spec = lldb.SBFileSpec(src_file) - self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file") - - # Get the path of the executable - exe_path = self.getBuildArtifact("a.out") - - # Load the executable - self.target = self.dbg.CreateTarget(exe_path) - self.assertTrue(self.target.IsValid(), VALID_TARGET) diff --git a/packages/Python/lldbsuite/test/lang/c/unions/main.c b/packages/Python/lldbsuite/test/lang/c/unions/main.c deleted file mode 100644 index 2c6a7d1e7821..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/unions/main.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <stdint.h> - -union S -{ - int32_t n; // occupies 4 bytes - uint16_t s[2]; // occupies 4 bytes - uint8_t c; // occupies 1 byte -}; // the whole union occupies 4 bytes - -int main() -{ - union S u; - - u.s[0] = 1234; - u.s[1] = 4321; - - return 0; // Break here -} diff --git a/packages/Python/lldbsuite/test/lang/c/vla/Makefile b/packages/Python/lldbsuite/test/lang/c/vla/Makefile deleted file mode 100644 index b09a579159d4..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/vla/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/c/vla/TestVLA.py b/packages/Python/lldbsuite/test/lang/c/vla/TestVLA.py deleted file mode 100644 index f6341ec24fa6..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/vla/TestVLA.py +++ /dev/null @@ -1,27 +0,0 @@ -import lldb -from lldbsuite.test.lldbtest import * -from lldbsuite.test import decorators -import lldbsuite.test.lldbutil as lldbutil - - -class TestVLA(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @decorators.skipIf(compiler="clang", compiler_version=['<', '8.0']) - def test_vla(self): - self.build() - _, process, _, _ = lldbutil.run_to_source_breakpoint( - self, "break here", lldb.SBFileSpec('main.c')) - - def test(a, array): - for i in range(a): - self.expect("fr v vla[%d]"%i, substrs=["int", "%d"%(a-i)]) - self.expect("expr vla[%d]"%i, substrs=["int", "%d"%(a-i)]) - self.expect("frame var vla", substrs=array) - self.expect("expr vla", error=True, substrs=["incomplete"]) - - test(2, ["int []", "[0] = 2, [1] = 1"]) - process.Continue() - test(4, ["int []", "[0] = 4, [1] = 3, [2] = 2, [3] = 1"]) - diff --git a/packages/Python/lldbsuite/test/lang/c/vla/main.c b/packages/Python/lldbsuite/test/lang/c/vla/main.c deleted file mode 100644 index ba9cc1855607..000000000000 --- a/packages/Python/lldbsuite/test/lang/c/vla/main.c +++ /dev/null @@ -1,15 +0,0 @@ -void pause() {} - -int foo(int a) { - int vla[a]; - - for (int i = 0; i < a; ++i) - vla[i] = a-i; - - pause(); // break here - return vla[a-1]; -} - -int main (void) { - return foo(2) + foo(4); -} |
