diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-05 19:33:59 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-05 19:33:59 +0000 |
commit | 77198bc79b54267f2ce981c3a6c9c0d6384cac01 (patch) | |
tree | 1bd65fa94b3e566a6e17c315d11eb00ee0378794 /lldb/packages/Python/lldbsuite/test/lang/go | |
parent | 115209ece5c55dedf2ce4fb40beca79803c7676e (diff) | |
download | bcm5719-llvm-77198bc79b54267f2ce981c3a6c9c0d6384cac01.tar.gz bcm5719-llvm-77198bc79b54267f2ce981c3a6c9c0d6384cac01.zip |
Remove Go debugger plugin
In January Davide sent an e-mail to the mailing list to suggest removing
unmaintained language plugins such as Go and Java. The plan was to have
some cool down period to allow users to speak up, however after that the
plugins were never actually removed.
This patch removes the Go debugger plugin.
The plugin can be added again in the future if it is mature enough both
in terms of testing and maintenance commitment.
Discussion on the mailing list:
http://lists.llvm.org/pipermail/lldb-dev/2018-January/013171.html
Differential revision: https://reviews.llvm.org/D54057
llvm-svn: 346157
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/go')
10 files changed, 0 insertions, 732 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py b/lldb/packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py deleted file mode 100644 index 963e0676100..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py +++ /dev/null @@ -1,123 +0,0 @@ -"""Test the go expression parser/interpreter.""" - -import os -import time -import unittest2 -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestGoUserExpression(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @skipIfRemote # Not remote test suit ready - @skipIfFreeBSD # Test hanging on FreeBSD - llvm.org/pr37194 - @skipUnlessGoInstalled - def test_with_dsym_and_python_api(self): - """Test GoASTUserExpress.""" - self.buildGo() - self.launchProcess() - self.go_expressions() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break inside main(). - self.main_source = "main.go" - self.break_line = line_number( - self.main_source, '// Set breakpoint here.') - - def check_builtin(self, name, size=0, typeclass=lldb.eTypeClassBuiltin): - tl = self.target().FindTypes(name) - self.assertEqual(1, len(tl)) - t = list(tl)[0] - self.assertEqual(name, t.name) - self.assertEqual(typeclass, t.type) - if size > 0: - self.assertEqual(size, t.size) - - def launchProcess(self): - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - bpt = target.BreakpointCreateByLocation( - self.main_source, self.break_line) - self.assertTrue(bpt, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt) - - # Make sure we stopped at the first breakpoint. - self.assertTrue( - len(thread_list) != 0, - "No thread stopped at our breakpoint.") - self.assertTrue(len(thread_list) == 1, - "More than one thread stopped at our breakpoint.") - - frame = thread_list[0].GetFrameAtIndex(0) - self.assertTrue(frame, "Got a valid frame 0 frame.") - - def go_expressions(self): - frame = self.frame() - v = frame.EvaluateExpression("1") - self.assertEqual(1, v.GetValueAsSigned()) - x = frame.EvaluateExpression("x") - self.assertEqual(22, x.GetValueAsSigned()) - - a = frame.EvaluateExpression("a") - self.assertEqual(3, a.GetNumChildren()) - a0 = a.GetChildAtIndex(0) - self.assertEqual(8, a0.GetValueAsSigned()) - - # Array indexing - a0 = frame.EvaluateExpression("a[0]") - self.assertEqual(8, a0.GetValueAsSigned()) - - # Slice indexing - b1 = frame.EvaluateExpression("b[1]") - self.assertEqual(9, b1.GetValueAsSigned()) - - # Test global in this package - g = frame.EvaluateExpression("myGlobal") - self.assertEqual(17, g.GetValueAsSigned(), str(g)) - - # Global with package name - g = frame.EvaluateExpression("main.myGlobal") - self.assertEqual(17, g.GetValueAsSigned(), str(g)) - - # Global with quoted package name - g = frame.EvaluateExpression('"main".myGlobal') - self.assertEqual(17, g.GetValueAsSigned(), str(g)) - - # Casting with package local type - s = frame.EvaluateExpression("*(*myStruct)(i.data)") - sb = s.GetChildMemberWithName("a") - self.assertEqual(2, sb.GetValueAsSigned()) - - # casting with explicit package - s = frame.EvaluateExpression("*(*main.myStruct)(i.data)") - sb = s.GetChildMemberWithName("a") - self.assertEqual(2, sb.GetValueAsSigned()) - - # Casting quoted package - s = frame.EvaluateExpression('*(*"main".myStruct)(i.data)') - sb = s.GetChildMemberWithName("b") - self.assertEqual(-1, sb.GetValueAsSigned()) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/expressions/main.go b/lldb/packages/Python/lldbsuite/test/lang/go/expressions/main.go deleted file mode 100644 index c8b97fe07d7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/expressions/main.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import "fmt" - -type myStruct struct { - a, b int -} - -var myGlobal = 17 - -func myFunc(i interface{}) { - a := [...]int{8, 9, 10} - b := a[:] - x := 22 - fmt.Println(a, b, x, i, myGlobal) // Set breakpoint here. -} - -func main() { - s := myStruct {2, -1} - myFunc(s) -}
\ No newline at end of file diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py b/lldb/packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py deleted file mode 100644 index b31ac35be46..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py +++ /dev/null @@ -1,76 +0,0 @@ -"""Test the Go Data Formatter Plugin.""" - -import os -import time -import unittest2 -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestGoLanguage(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure - @skipIfRemote # Not remote test suite ready - @no_debug_info_test - @skipUnlessGoInstalled - def test_go_formatter_plugin(self): - """Test go data formatters.""" - self.buildGo() - self.launchProcess() - self.check_formatters() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break inside main(). - self.main_source = "main.go" - self.break_line = line_number(self.main_source, '// stop here') - - def launchProcess(self): - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - self.bpt = target.BreakpointCreateByLocation( - self.main_source, self.break_line) - self.assertTrue(self.bpt, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - thread_list = lldbutil.get_threads_stopped_at_breakpoint( - process, self.bpt) - - # Make sure we stopped at the first breakpoint. - self.assertTrue( - len(thread_list) != 0, - "No thread stopped at our breakpoint.") - self.assertTrue(len(thread_list) == 1, - "More than one thread stopped at our breakpoint.") - - frame = thread_list[0].GetFrameAtIndex(0) - self.assertTrue(frame, "Got a valid frame 0 frame.") - - def check_formatters(self): - a = self.frame().FindVariable('a') - self.assertEqual('(string) a = "my string"', str(a)) - b = self.frame().FindVariable('b') - self.assertEqual( - "([]int) b = (len 2, cap 7) {\n [0] = 0\n [1] = 0\n}", - str(b)) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/formatters/main.go b/lldb/packages/Python/lldbsuite/test/lang/go/formatters/main.go deleted file mode 100644 index 7956ad66bcb..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/formatters/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import "fmt" - -func main() { - a := "my string" - b := make([]int, 2, 7) - fmt.Println(a, b) // stop here -}
\ No newline at end of file diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py b/lldb/packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py deleted file mode 100644 index 027fb3adc0c..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py +++ /dev/null @@ -1,104 +0,0 @@ -"""Test the Go OS Plugin.""" - -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 TestGoASTContext(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure - @skipIfRemote # Not remote test suite ready - @no_debug_info_test - @skipUnlessGoInstalled - def test_goroutine_plugin(self): - """Test goroutine as threads support.""" - self.buildGo() - self.launchProcess() - self.check_goroutines() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break inside main(). - self.main_source = "main.go" - self.break_line1 = line_number(self.main_source, '// stop1') - self.break_line2 = line_number(self.main_source, '// stop2') - self.break_line3 = line_number(self.main_source, '// stop3') - - def launchProcess(self): - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - self.bpt1 = target.BreakpointCreateByLocation( - self.main_source, self.break_line1) - self.assertTrue(self.bpt1, VALID_BREAKPOINT) - self.bpt2 = target.BreakpointCreateByLocation( - self.main_source, self.break_line2) - self.assertTrue(self.bpt2, VALID_BREAKPOINT) - self.bpt3 = target.BreakpointCreateByLocation( - self.main_source, self.break_line3) - self.assertTrue(self.bpt3, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - thread_list = lldbutil.get_threads_stopped_at_breakpoint( - process, self.bpt1) - - # Make sure we stopped at the first breakpoint. - self.assertTrue( - len(thread_list) != 0, - "No thread stopped at our breakpoint.") - self.assertTrue(len(thread_list) == 1, - "More than one thread stopped at our breakpoint.") - - frame = thread_list[0].GetFrameAtIndex(0) - self.assertTrue(frame, "Got a valid frame 0 frame.") - - def check_goroutines(self): - self.assertLess(len(self.process().threads), 20) - self.process().Continue() - - # Make sure we stopped at the 2nd breakpoint - thread_list = lldbutil.get_threads_stopped_at_breakpoint( - self.process(), self.bpt2) - self.assertTrue( - len(thread_list) != 0, - "No thread stopped at our breakpoint.") - self.assertTrue(len(thread_list) == 1, - "More than one thread stopped at our breakpoint.") - - # There's (at least) 21 goroutines. - self.assertGreater(len(self.process().threads), 20) - # self.dbg.HandleCommand("log enable lldb os") - - # Now test that stepping works if the memory thread moves to a - # different backing thread. - for i in list(range(11)): - self.thread().StepOver() - self.assertEqual( - lldb.eStopReasonPlanComplete, - self.thread().GetStopReason(), - self.thread().GetStopDescription(100)) - - # Disable the plugin and make sure the goroutines disappear - self.dbg.HandleCommand( - "settings set plugin.os.goroutines.enable false") - self.thread().StepInstruction(False) - self.assertLess(len(self.process().threads), 20) diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/goroutines/main.go b/lldb/packages/Python/lldbsuite/test/lang/go/goroutines/main.go deleted file mode 100644 index bb44f7b8b71..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/goroutines/main.go +++ /dev/null @@ -1,89 +0,0 @@ -package main - -import ( - "fmt" - "runtime" -) - -type philosopher struct { - i int - forks [2]chan bool - eating chan int - done chan struct{} -} - -func (p philosopher) run() { - for { - select { - case <-p.done: - return - case <-p.forks[0]: - p.eat() - } - } -} - -func (p philosopher) eat() { - select { - case <-p.done: - return - case <-p.forks[1]: - p.eating <- p.i - p.forks[0] <- true - p.forks[1] <- true - runtime.Gosched() - } -} - -func startPhilosophers(n int) (chan struct{}, chan int) { - philosophers := make([]*philosopher, n) - chans := make([]chan bool, n) - for i := range chans { - chans[i] = make(chan bool, 1) - chans[i] <- true - } - eating := make(chan int, n) - done := make(chan struct{}) - for i := range philosophers { - var min, max int - if i == n - 1 { - min = 0 - max = i - } else { - min = i - max = i + 1 - } - philosophers[i] = &philosopher{i: i, forks: [2]chan bool{chans[min], chans[max]}, eating: eating, done: done} - go philosophers[i].run() - } - return done, eating -} - -func wait(c chan int) { - fmt.Println(<- c) - runtime.Gosched() -} - -func main() { - // Restrict go to 1 real thread so we can be sure we're seeing goroutines - // and not threads. - runtime.GOMAXPROCS(1) - // Create a bunch of goroutines - done, eating := startPhilosophers(20) // stop1 - // Now turn up the number of threads so this goroutine is likely to get - // scheduled on a different thread. - runtime.GOMAXPROCS(runtime.NumCPU()) // stop2 - // Now let things run. Hopefully we'll bounce around - wait(eating) - wait(eating) - wait(eating) - wait(eating) - wait(eating) - wait(eating) - wait(eating) - wait(eating) - wait(eating) - wait(eating) - close(done) - fmt.Println("done") // stop3 -} diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/runtime/TestGoLanguageRuntime b/lldb/packages/Python/lldbsuite/test/lang/go/runtime/TestGoLanguageRuntime deleted file mode 100644 index b06aa656aaa..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/runtime/TestGoLanguageRuntime +++ /dev/null @@ -1,80 +0,0 @@ -"""Test the go dynamic type handling.""" - -import os, time -import unittest2 -import lldb -import lldbutil -from lldbtest import * - -class TestGoLanguageRuntime(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @python_api_test - @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr24895') - @skipIfRemote # Not remote test suite ready - @skipUnlessGoInstalled - def test_with_dsym_and_python_api(self): - """Test GoASTContext dwarf parsing.""" - self.buildGo() - self.launchProcess() - self.go_interface_types() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break inside main(). - self.main_source = "main.go" - self.break_line1 = line_number(self.main_source, '// Set breakpoint 1') - self.break_line2 = line_number(self.main_source, '// Set breakpoint 2') - - - def launchProcess(self): - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - bpt1 = target.BreakpointCreateByLocation(self.main_source, self.break_line1) - self.assertTrue(bpt1, VALID_BREAKPOINT) - bpt2 = target.BreakpointCreateByLocation(self.main_source, self.break_line2) - self.assertTrue(bpt2, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple (None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt1) - - # Make sure we stopped at the first breakpoint. - self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.") - self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.") - - frame = thread_list[0].GetFrameAtIndex(0) - self.assertTrue (frame, "Got a valid frame 0 frame.") - - def go_interface_types(self): - f = self.frame() - v = f.FindVariable("a", lldb.eDynamicCanRunTarget) - self.assertEqual("*int", v.GetType().name) - self.assertEqual(1, v.Dereference().GetValueAsSigned()) - v = f.FindVariable("b", lldb.eDynamicCanRunTarget) - self.assertEqual("*float64", v.GetType().name) - err = lldb.SBError() - self.assertEqual(2.0, v.Dereference().GetData().GetDouble(err, 0)) - v = f.FindVariable("c", lldb.eDynamicCanRunTarget) - self.assertEqual("*main.SomeFooer", v.GetType().name) - self.assertEqual(9, v.Dereference().GetChildAtIndex(0).GetValueAsSigned()) - v = f.FindVariable("d", lldb.eDynamicCanRunTarget) - self.assertEqual("*main.AnotherFooer", v.GetType().name) - self.assertEqual(-1, v.Dereference().GetChildAtIndex(0).GetValueAsSigned()) - self.assertEqual(-2, v.Dereference().GetChildAtIndex(1).GetValueAsSigned()) - self.assertEqual(-3, v.Dereference().GetChildAtIndex(2).GetValueAsSigned()) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/runtime/main.go b/lldb/packages/Python/lldbsuite/test/lang/go/runtime/main.go deleted file mode 100644 index 227c8c377ed..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/runtime/main.go +++ /dev/null @@ -1,38 +0,0 @@ -package main - -import "fmt" - -type Fooer interface { - Foo() int -} - -type SomeFooer struct { - val int -} - -func (s SomeFooer) Foo() int { - return s.val -} - -type AnotherFooer struct { - a, b, c int -} - -func (s AnotherFooer) Foo() int { - return s.a -} - - -func printEface(a, b, c, d interface{}) { - fmt.Println(a, b, c, d) // Set breakpoint 1 -} - -func printIface(a, b Fooer) { - fmt.Println(a, b) // Set breakpoint 2 -} -func main() { - sf := SomeFooer{9} - af := AnotherFooer{-1, -2, -3} - printEface(1,2.0, sf, af) - printIface(sf, af) -}
\ No newline at end of file diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py b/lldb/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py deleted file mode 100644 index 8fb56b9577a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py +++ /dev/null @@ -1,145 +0,0 @@ -"""Test the go DWARF type parsing.""" - -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 TestGoASTContext(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - @add_test_categories(['pyapi']) - @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure - @skipIfRemote # Not remote test suit ready - @no_debug_info_test - @skipUnlessGoInstalled - @expectedFailureAll(bugnumber="llvm.org/pr33643") - def test_with_dsym_and_python_api(self): - """Test GoASTContext dwarf parsing.""" - self.buildGo() - self.launchProcess() - self.go_builtin_types() - self.check_main_vars() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line numbers to break inside main(). - self.main_source = "main.go" - self.break_line = line_number( - self.main_source, '// Set breakpoint here.') - - def check_builtin(self, name, size=0, typeclass=lldb.eTypeClassBuiltin): - tl = self.target().FindTypes(name) - self.assertEqual(1, len(tl)) - t = list(tl)[0] - self.assertEqual(name, t.name) - self.assertEqual(typeclass, t.type) - if size > 0: - self.assertEqual(size, t.size) - - def launchProcess(self): - exe = self.getBuildArtifact("a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - bpt = target.BreakpointCreateByLocation( - self.main_source, self.break_line) - self.assertTrue(bpt, VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - # The stop reason of the thread should be breakpoint. - thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt) - - # Make sure we stopped at the first breakpoint. - self.assertTrue( - len(thread_list) != 0, - "No thread stopped at our breakpoint.") - self.assertTrue(len(thread_list) == 1, - "More than one thread stopped at our breakpoint.") - - frame = thread_list[0].GetFrameAtIndex(0) - self.assertTrue(frame, "Got a valid frame 0 frame.") - - def go_builtin_types(self): - address_size = self.target().GetAddressByteSize() - self.check_builtin('bool') - self.check_builtin('uint8', 1) - self.check_builtin('int8', 1) - self.check_builtin('uint16', 2) - self.check_builtin('int16', 2) - self.check_builtin('uint32', 4) - self.check_builtin('int32', 4) - self.check_builtin('uint64', 8) - self.check_builtin('int64', 8) - self.check_builtin('uintptr', address_size) - self.check_builtin('int', address_size) - self.check_builtin('uint', address_size) - self.check_builtin('float32', 4) - self.check_builtin('float64', 8) - self.check_builtin('complex64', 8, lldb.eTypeClassComplexFloat) - self.check_builtin('complex128', 16, lldb.eTypeClassComplexFloat) - - def var(self, name): - var = self.frame().FindVariable(name) - self.assertTrue(var.IsValid(), "%s %s" % (VALID_VARIABLE, name)) - return var - - def check_main_vars(self): - v = self.var('theBool') - self.assertEqual('true', v.value) - - v = self.var('theInt') - self.assertEqual('-7', v.value) - - v = self.var('theComplex') - self.assertEqual('1 + 2i', v.value) - - v = self.var('thePointer') - self.assertTrue(v.TypeIsPointerType()) - self.assertEqual('-10', v.Dereference().value) - self.assertEqual(1, v.GetNumChildren()) - self.assertEqual('-10', v.GetChildAtIndex(0).value) - - # print() - # print(os.getpid()) - # time.sleep(60) - v = self.var('theStruct') - if v.TypeIsPointerType(): - v = v.Dereference() - self.assertEqual(2, v.GetNumChildren()) - self.assertEqual('7', v.GetChildAtIndex(0).value) - self.assertEqual('7', v.GetChildMemberWithName('myInt').value) - self.assertEqual( - v.load_addr, - v.GetChildAtIndex(1).GetValueAsUnsigned()) - self.assertEqual(v.load_addr, v.GetChildMemberWithName( - 'myPointer').GetValueAsUnsigned()) - - # Test accessing struct fields through pointers. - v = v.GetChildMemberWithName('myPointer') - self.assertTrue(v.TypeIsPointerType()) - self.assertEqual(2, v.GetNumChildren()) - self.assertEqual('7', v.GetChildAtIndex(0).value) - c = v.GetChildMemberWithName('myPointer') - self.assertTrue(c.TypeIsPointerType()) - self.assertEqual(2, c.GetNumChildren()) - self.assertEqual('7', c.GetChildAtIndex(0).value) - - v = self.var('theArray') - self.assertEqual(5, v.GetNumChildren()) - for i in list(range(5)): - self.assertEqual(str(i + 1), v.GetChildAtIndex(i).value) diff --git a/lldb/packages/Python/lldbsuite/test/lang/go/types/main.go b/lldb/packages/Python/lldbsuite/test/lang/go/types/main.go deleted file mode 100644 index c74650721d7..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/go/types/main.go +++ /dev/null @@ -1,47 +0,0 @@ -package main - -import "fmt" - -type Fooer interface { - Foo() int -} - -type SomeFooer struct { - val int -} - -func (s SomeFooer) Foo() int { - return s.val -} - -type mystruct struct { - myInt int - myPointer *mystruct -} - -func main() { - theBool := true - theInt := -7 - theComplex := 1 + 2i - pointee := -10 - thePointer := &pointee - theStruct := &mystruct { myInt: 7} - theStruct.myPointer = theStruct - theArray := [5]byte{1, 2, 3, 4, 5} - theSlice := theArray[1:2] - theString := "abc" - - f := SomeFooer {9} - var theEface interface{} = f - var theFooer Fooer = f - - theChan := make(chan int) - theMap := make(map[int]string) - theMap[1] = "1" - - fmt.Println(theBool) // Set breakpoint here. - // Reference all the variables so the compiler is happy. - fmt.Println(theInt, theComplex, thePointer, theStruct.myInt) - fmt.Println(theArray[0], theSlice[0], theString) - fmt.Println(theEface, theFooer, theChan, theMap) -}
\ No newline at end of file |