summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/macosx
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 18:01:57 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 18:01:57 +0000
commit88c643b6fec27eec436c8d138fee6346e92337d6 (patch)
tree82cd13b2f3cde1c9e5f79689ba4e6ba67694843f /packages/Python/lldbsuite/test/macosx
parent94994d372d014ce4c8758b9605d63fae651bd8aa (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/macosx')
-rw-r--r--packages/Python/lldbsuite/test/macosx/add-dsym/Makefile24
-rw-r--r--packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py50
-rw-r--r--packages/Python/lldbsuite/test/macosx/add-dsym/main.c7
-rw-r--r--packages/Python/lldbsuite/test/macosx/duplicate-archive-members/Makefile22
-rw-r--r--packages/Python/lldbsuite/test/macosx/duplicate-archive-members/TestDuplicateMembers.py55
-rw-r--r--packages/Python/lldbsuite/test/macosx/duplicate-archive-members/a.c14
-rw-r--r--packages/Python/lldbsuite/test/macosx/duplicate-archive-members/main.c17
-rw-r--r--packages/Python/lldbsuite/test/macosx/duplicate-archive-members/sub1/a.c14
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile21
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist30
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/MacOS/.empty0
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Resources/.empty0
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py66
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-app-in-bundle/main.c9
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile23
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py73
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c4
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c28
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist44
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile30
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h1
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py74
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c27
-rw-r--r--packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c4
-rw-r--r--packages/Python/lldbsuite/test/macosx/function-starts/Makefile10
-rw-r--r--packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py76
-rw-r--r--packages/Python/lldbsuite/test/macosx/function-starts/main.cpp26
-rw-r--r--packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile40
-rw-r--r--packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py118
-rw-r--r--packages/Python/lldbsuite/test/macosx/indirect_symbol/alias.list1
-rw-r--r--packages/Python/lldbsuite/test/macosx/indirect_symbol/indirect.c14
-rw-r--r--packages/Python/lldbsuite/test/macosx/indirect_symbol/main.c14
-rw-r--r--packages/Python/lldbsuite/test/macosx/indirect_symbol/reexport.c7
-rw-r--r--packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py38
-rw-r--r--packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml222
-rw-r--r--packages/Python/lldbsuite/test/macosx/nslog/Makefile6
-rw-r--r--packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py153
-rw-r--r--packages/Python/lldbsuite/test/macosx/nslog/main.m18
-rw-r--r--packages/Python/lldbsuite/test/macosx/order/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py39
-rw-r--r--packages/Python/lldbsuite/test/macosx/order/cmds.txt3
-rw-r--r--packages/Python/lldbsuite/test/macosx/order/main.c54
-rw-r--r--packages/Python/lldbsuite/test/macosx/order/order-file4
-rw-r--r--packages/Python/lldbsuite/test/macosx/queues/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/macosx/queues/TestQueues.py365
-rw-r--r--packages/Python/lldbsuite/test/macosx/queues/main.c151
-rw-r--r--packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py73
-rw-r--r--packages/Python/lldbsuite/test/macosx/safe-to-func-call/main.c31
-rw-r--r--packages/Python/lldbsuite/test/macosx/thread-names/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py139
-rw-r--r--packages/Python/lldbsuite/test/macosx/thread-names/main.c36
-rw-r--r--packages/Python/lldbsuite/test/macosx/universal/Makefile25
-rw-r--r--packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py164
-rw-r--r--packages/Python/lldbsuite/test/macosx/universal/main.c21
55 files changed, 0 insertions, 2507 deletions
diff --git a/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile b/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile
deleted file mode 100644
index 5abcf02738c49..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
- OS = $(shell uname -s)
-endif
-
-CFLAGS ?= -g -O0
-
-ifeq "$(OS)" "Darwin"
- CFLAGS += -arch $(ARCH)
-endif
-
-all: main.c clean
- mkdir hide.app
- mkdir hide.app/Contents
- $(CC) $(CFLAGS) -g $<
- mv a.out.dSYM hide.app/Contents
- strip -x a.out
-
-clean:
- rm -rf a.out a.out.dSYM hide.app
diff --git a/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py b/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
deleted file mode 100644
index be122f4f500d9..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
+++ /dev/null
@@ -1,50 +0,0 @@
-"""Test that the 'add-dsym', aka 'target symbols add', succeeds in the middle of debug session."""
-
-from __future__ import print_function
-
-
-import os
-import time
-import lldb
-import sys
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-@skipUnlessDarwin
-class AddDsymMidExecutionCommandCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- self.source = 'main.c'
-
- @no_debug_info_test # Prevent the genaration of the dwarf version of this test
- def test_add_dsym_mid_execution(self):
- """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
- self.buildDefault(dictionary={'MAKE_DSYM':'YES'})
- exe = self.getBuildArtifact("a.out")
-
- self.target = self.dbg.CreateTarget(exe)
- self.assertTrue(self.target, VALID_TARGET)
-
- main_bp = self.target.BreakpointCreateByName("main", "a.out")
- self.assertTrue(main_bp, VALID_BREAKPOINT)
-
- self.runCmd("settings set target.disable-aslr false")
- self.process = self.target.LaunchSimple(
- None, None, self.get_process_working_directory())
- self.assertTrue(self.process, PROCESS_IS_VALID)
-
- # The stop reason of the thread should be breakpoint.
- self.assertTrue(self.process.GetState() == lldb.eStateStopped,
- STOPPED_DUE_TO_BREAKPOINT)
-
- self.runCmd("add-dsym " +
- self.getBuildArtifact("hide.app/Contents/a.out.dSYM"))
-
- self.expect("frame select",
- substrs=['a.out`main at main.c'])
diff --git a/packages/Python/lldbsuite/test/macosx/add-dsym/main.c b/packages/Python/lldbsuite/test/macosx/add-dsym/main.c
deleted file mode 100644
index da9e09f07389b..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/add-dsym/main.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdio.h>
-static int var = 5;
-int main ()
-{
- printf ("%p is %d\n", &var, var); // break on this line
- return ++var;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/Makefile b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/Makefile
deleted file mode 100644
index 5bb3a3ce3f102..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-# Make an archive that has two object files with the same name, but
-# different timestamps. Do it all in one rule so that the timestamps
-# can be controlled without confusing Make.
-libfoo.a: a.c sub1/a.c
- $(CC) $(CFLAGS) -c $(<D)/a.c -o a.o
- mkdir -p sub1
- $(CC) $(CFLAGS) -c $(<D)/sub1/a.c -o sub1/a.o
- touch -t '198001010000.00' a.o
- touch -t '198001010000.01' sub1/a.o
- $(AR) $(ARFLAGS) $@ a.o sub1/a.o
- rm a.o sub1/a.o
-
-include $(LEVEL)/Makefile.rules
-
-# Needs to come after include
-OBJECTS += libfoo.a
-$(EXE) : libfoo.a
-.DEFAULT_GOAL := $(EXE)
diff --git a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/TestDuplicateMembers.py b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/TestDuplicateMembers.py
deleted file mode 100644
index 1af2463fe7b84..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/TestDuplicateMembers.py
+++ /dev/null
@@ -1,55 +0,0 @@
-"""Test breaking inside functions defined within a BSD archive file libfoo.a."""
-
-from __future__ import print_function
-
-
-import os
-import time
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class BSDArchivesTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @expectedFailureAll(
- oslist=["windows"],
- bugnumber="llvm.org/pr24527. Makefile.rules doesn't know how to build static libs on Windows")
- def test(self):
- """Break inside a() and b() defined within libfoo.a."""
- self.build()
-
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Break on a() and b() symbols
- lldbutil.run_break_set_by_symbol(
- self, "a", sym_exact=True)
- lldbutil.run_break_set_by_symbol(
- self, "b", 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'])
-
- # Break at a(int) first.
- self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
- substrs=['(int) arg = 1'])
- self.expect("frame variable __a_global", VARIABLES_DISPLAYED_CORRECTLY,
- substrs=['(int) __a_global = 1'])
-
- # Continue the program, we should break at b(int) next.
- self.runCmd("continue")
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs=['stopped',
- 'stop reason = breakpoint'])
- self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
- substrs=['(int) arg = 2'])
- self.expect("frame variable __b_global", VARIABLES_DISPLAYED_CORRECTLY,
- substrs=['(int) __b_global = 2'])
diff --git a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/a.c b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/a.c
deleted file mode 100644
index 402a6270c9c7f..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/a.c
+++ /dev/null
@@ -1,14 +0,0 @@
-//===-- a.c -----------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-int __a_global = 1;
-
-int a(int arg) {
- int result = arg + __a_global;
- return result;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/main.c b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/main.c
deleted file mode 100644
index c5b1cc2f0d1c4..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/main.c
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-extern int a(int);
-extern int b(int);
-int main (int argc, char const *argv[])
-{
- printf ("a(1) returns %d\n", a(1));
- printf ("b(2) returns %d\n", b(2));
-}
diff --git a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/sub1/a.c b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/sub1/a.c
deleted file mode 100644
index 814d4e8b44e81..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/sub1/a.c
+++ /dev/null
@@ -1,14 +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.
-//
-//===----------------------------------------------------------------------===//
-static int __b_global = 2;
-
-int b(int arg) {
- int result = arg + __b_global;
- return result;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
deleted file mode 100644
index 18a4934cca370..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
-
-CC ?= clang
-
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-CFLAGS ?= -g -O0 -arch $(ARCH)
-
-all: TestApp.app/Contents/MacOS/TestApp
-
-TestApp.app/Contents/MacOS/TestApp: $(SRCDIR)/main.c
- $(CC) $(CFLAGS) -o TestApp $<
- rm -rf TestApp.app
- cp -r $(SRCDIR)/TestApp.app .
- mv TestApp TestApp.app/Contents/MacOS/TestApp
- mv TestApp.dSYM TestApp.app.dSYM
-
-clean:
- rm -rf TestApp.app/Contents/MacOS/TestApp TestApp.app.dSYM
diff --git a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist
deleted file mode 100644
index a47f72bb14da8..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>en</string>
- <key>CFBundleExecutable</key>
- <string>TestApp</string>
- <key>CFBundleIdentifier</key>
- <string>com.lldb.TestApp</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>TestApp</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleSupportedPlatforms</key>
- <array>
- <string>MacOSX</string>
- </array>
- <key>CFBundleVersion</key>
- <string>1</string>
- <key>LSMinimumSystemVersion</key>
- <string>10.8</string>
- <key>NSHumanReadableCopyright</key>
- <string>Copyright © 2018 Jim Ingham. All rights reserved.</string>
-</dict>
-</plist>
diff --git a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/MacOS/.empty b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/MacOS/.empty
deleted file mode 100644
index e69de29bb2d1d..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/MacOS/.empty
+++ /dev/null
diff --git a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Resources/.empty b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Resources/.empty
deleted file mode 100644
index e69de29bb2d1d..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Resources/.empty
+++ /dev/null
diff --git a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py
deleted file mode 100644
index c380d5379962d..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py
+++ /dev/null
@@ -1,66 +0,0 @@
-"""
-Make sure we can find the binary inside an app bundle.
-"""
-
-from __future__ import print_function
-
-
-import os
-import time
-import re
-import lldb
-from lldbsuite.test.decorators import *
-import lldbsuite.test.lldbutil as lldbutil
-import lldbsuite.test.lldbplatformutil as lldbplatformutil
-from lldbsuite.test.lldbtest import *
-
-@decorators.skipUnlessDarwin
-class FindAppInMacOSAppBundle(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- NO_DEBUG_INFO_TESTCASE = True
-
- def test_find_app_in_bundle(self):
- """There can be many tests in a test case - describe this test here."""
- self.build()
- self.main_source_file = lldb.SBFileSpec("main.c")
- self.find_app_in_bundle_test()
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
-
- def find_app_in_bundle_test(self):
- """This reads in the .app, makes sure we get the right binary and can run it."""
-
- # This function starts a process, "a.out" by default, sets a source
- # breakpoint, runs to it, and returns the thread, process & target.
- # It optionally takes an SBLaunchOption argument if you want to pass
- # arguments or environment variables.
- exe = self.getBuildArtifact("TestApp.app")
- error = lldb.SBError()
- target = self.dbg.CreateTarget(exe, None, None, False, error)
- self.assertTrue(error.Success(), "Could not create target: %s"%(error.GetCString()))
- self.assertTrue(target.IsValid(), "Target: TestApp.app is not valid.")
- exe_module_spec = target.GetExecutable()
- self.assertTrue(exe_module_spec.GetFilename(), "TestApp")
-
- bkpt = target.BreakpointCreateBySourceRegex("Set a breakpoint here", self.main_source_file)
- self.assertTrue(bkpt.GetNumLocations() == 1, "Couldn't set a breakpoint in the main app")
-
- if lldbplatformutil.getPlatform() == "macosx":
- launch_info = lldb.SBLaunchInfo(None)
- launch_info.SetWorkingDirectory(self.get_process_working_directory())
-
- error = lldb.SBError()
- process = target.Launch(launch_info, error)
-
- self.assertTrue(process.IsValid(), "Could not create a valid process for TestApp: %s"%(error.GetCString()))
-
- # Frame #0 should be at our breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt)
-
- self.assertTrue(len(threads) == 1, "Expected 1 thread to stop at breakpoint, %d did."%(len(threads)))
-
-
diff --git a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/main.c b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/main.c
deleted file mode 100644
index 27a0cdc01a9ae..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/main.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <stdio.h>
-
-int
-main()
-{
- printf("Set a breakpoint here.\n");
- return 0;
-}
-
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile
deleted file mode 100644
index 313c83e990d56..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
-
-CC ?= clang
-
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-CFLAGS ?= -g -O0 -arch $(ARCH)
-
-all: clean
- $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd $(SRCDIR)/bundle.c
- mkdir com.apple.sbd.xpc
- mv com.apple.sbd com.apple.sbd.xpc/
- mkdir -p com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF
- mv com.apple.sbd.dSYM/Contents/Resources/DWARF/com.apple.sbd com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF/
- rm -rf com.apple.sbd.dSYM
- mkdir hide.app
- tar cf - com.apple.sbd.xpc com.apple.sbd.xpc.dSYM | ( cd hide.app;tar xBpf -)
- $(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn $(SRCDIR)/main.c
-
-clean:
- rm -rf a.out a.out.dSYM hide.app com.apple.sbd com.apple.sbd.dSYM com.apple.sbd.xpc com.apple.sbd.xpc.dSYM find-bundle-with-dots-in-fn find-bundle-with-dots-in-fn.dSYM
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
deleted file mode 100644
index ad90d85ab3f70..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
+++ /dev/null
@@ -1,73 +0,0 @@
-"""Test that a dSYM can be found when a binary is in a bundle hnd has dots in the filename."""
-
-from __future__ import print_function
-
-#import unittest2
-import os.path
-from time import sleep
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-exe_name = 'find-bundle-with-dots-in-fn' # must match Makefile
-
-class BundleWithDotInFilenameTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfRemote
- @skipUnlessDarwin
- # This test is explicitly a dSYM test, it doesn't need to run for any other config, but
- # the following doesn't work, fixme.
- # @skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM")
-
- def setUp(self):
- TestBase.setUp(self)
- self.source = 'main.c'
-
- def tearDown(self):
- # Destroy process before TestBase.tearDown()
- self.dbg.GetSelectedTarget().GetProcess().Destroy()
-
- # Call super's tearDown().
- TestBase.tearDown(self)
-
- def test_attach_and_check_dsyms(self):
- """Test attach to binary, see if the bundle dSYM is found"""
- exe = self.getBuildArtifact(exe_name)
- self.build()
- os.chdir(self.getBuildDir());
- popen = self.spawnSubprocess(exe)
- self.addTearDownHook(self.cleanupSubprocesses)
-
- # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in
- sleep(5)
-
- # Since the library that was dlopen()'ed is now removed, lldb will need to find the
- # binary & dSYM via target.exec-search-paths
- settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app"
- self.runCmd(settings_str)
-
- self.runCmd("process attach -p " + str(popen.pid))
-
- target = self.dbg.GetSelectedTarget()
- self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process')
-
- setup_complete = target.FindFirstGlobalVariable("setup_is_complete")
- self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup')
-
- # Find the bundle module, see if we found the dSYM too (they're both in "hide.app")
- i = 0
- while i < target.GetNumModules():
- mod = target.GetModuleAtIndex(i)
- if mod.GetFileSpec().GetFilename() == 'com.apple.sbd':
- dsym_name = mod.GetSymbolFileSpec().GetFilename()
- self.assertTrue (dsym_name == 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded")
- i=i+1
- os.chdir(self.getSourceDir());
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c
deleted file mode 100644
index c100f9a2c0755..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int foo ()
-{
- return 5;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c b/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c
deleted file mode 100644
index 30761eb1b4091..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <dlfcn.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-int setup_is_complete = 0;
-
-int main()
-{
-
- void *handle = dlopen ("com.apple.sbd.xpc/com.apple.sbd", RTLD_NOW);
- if (handle)
- {
- if (dlsym(handle, "foo"))
- {
- system ("/bin/rm -rf com.apple.sbd.xpc com.apple.sbd.xpc.dSYM");
- setup_is_complete = 1;
-
- // At this point we want lldb to attach to the process. If lldb attaches
- // before we've removed the dlopen'ed bundle, lldb will find the bundle
- // at its actual filepath and not have to do any tricky work, invalidating
- // the test.
-
- for (int loop_limiter = 0; loop_limiter < 100; loop_limiter++)
- sleep (1);
- }
- }
- return 0;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist
deleted file mode 100644
index 82e17116e35e0..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>BuildMachineOSBuild</key>
- <string>16B2657</string>
- <key>CFBundleDevelopmentRegion</key>
- <string>en</string>
- <key>CFBundleExecutable</key>
- <string>MyFramework</string>
- <key>CFBundleIdentifier</key>
- <string>com.apple.test.framework</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>MyFramework</string>
- <key>CFBundlePackageType</key>
- <string>FMWK</string>
- <key>CFBundleShortVersionString</key>
- <string>113</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleSupportedPlatforms</key>
- <array>
- <string>MacOSX</string>
- </array>
- <key>CFBundleVersion</key>
- <string>113</string>
- <key>DTCompiler</key>
- <string>com.apple.compilers.llvm.clang.1_0</string>
- <key>DTPlatformBuild</key>
- <string>9L120i</string>
- <key>DTPlatformVersion</key>
- <string>GM</string>
- <key>DTSDKBuild</key>
- <string>17A261x</string>
- <key>DTSDKName</key>
- <string>macosx10.13</string>
- <key>DTXcode</key>
- <string>0900</string>
- <key>DTXcodeBuild</key>
- <string>9L120i</string>
-</dict>
-</plist>
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
deleted file mode 100644
index d52d6f1f0d37d..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
-
-CC ?= clang
-
-ifeq "$(ARCH)" ""
- ARCH = x86_64
-endif
-
-CFLAGS ?= -g -O0 -arch $(ARCH)
-
-all: clean
- $(CC) $(CFLAGS) -install_name $(shell pwd)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework $(SRCDIR)/myframework.c
- mkdir -p MyFramework.framework/Versions/A/Headers
- mkdir -p MyFramework.framework/Versions/A/Resources
- cp MyFramework MyFramework.framework/Versions/A
- cp $(SRCDIR)/MyFramework.h MyFramework.framework/Versions/A/Headers
- cp $(SRCDIR)/Info.plist MyFramework.framework/Versions/A/Resources
- ( cd MyFramework.framework/Versions ; ln -s A Current )
- ( cd MyFramework.framework/ ; ln -s Versions/Current/Headers . )
- ( cd MyFramework.framework/ ; ln -s Versions/Current/MyFramework . )
- ( cd MyFramework.framework/ ; ln -s Versions/Current/Resources . )
- mv MyFramework.dSYM MyFramework.framework.dSYM
- mkdir hide.app
- rm -f MyFramework
- tar cf - MyFramework.framework MyFramework.framework.dSYM | ( cd hide.app;tar xBpf -)
- $(CC) $(CFLAGS) -o deep-bundle $(SRCDIR)/main.c -F. -framework MyFramework
-
-
-clean:
- rm -rf a.out a.out.dSYM deep-bundle deep-bundle.dSYM MyFramework.framework MyFramework.framework.dSYM MyFramework MyFramework.dSYM hide.app
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h
deleted file mode 100644
index a4536647cfc93..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h
+++ /dev/null
@@ -1 +0,0 @@
-int foo ();
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
deleted file mode 100644
index 2ed7fdfd3fe42..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
+++ /dev/null
@@ -1,74 +0,0 @@
-"""Test that a dSYM can be found when a binary is in a deep bundle with multiple pathname components."""
-
-from __future__ import print_function
-
-#import unittest2
-import os.path
-from time import sleep
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-exe_name = 'deep-bundle' # must match Makefile
-
-class DeepBundleTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipIfRemote
- @skipUnlessDarwin
- # This test is explicitly a dSYM test, it doesn't need to run for any other config, but
- # the following doesn't work, fixme.
- # @skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM")
-
- def setUp(self):
- TestBase.setUp(self)
- self.source = 'main.c'
-
- def tearDown(self):
- # Destroy process before TestBase.tearDown()
- self.dbg.GetSelectedTarget().GetProcess().Destroy()
-
- # Call super's tearDown().
- TestBase.tearDown(self)
-
- def test_attach_and_check_dsyms(self):
- """Test attach to binary, see if the framework dSYM is found"""
- exe = self.getBuildArtifact(exe_name)
- self.build()
- popen = self.spawnSubprocess(exe, [self.getBuildDir()])
- self.addTearDownHook(self.cleanupSubprocesses)
-
- # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in
- sleep(5)
-
- # Since the library that was dlopen()'ed is now removed, lldb will need to find the
- # binary & dSYM via target.exec-search-paths
- settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app"
- self.runCmd(settings_str)
- self.runCmd("process attach -p " + str(popen.pid))
-
- target = self.dbg.GetSelectedTarget()
- self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process')
-
- setup_complete = target.FindFirstGlobalVariable("setup_is_complete")
- self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup')
-
- # Find the bundle module, see if we found the dSYM too (they're both in "hide.app")
- i = 0
- found_module = False
- while i < target.GetNumModules():
- mod = target.GetModuleAtIndex(i)
- if mod.GetFileSpec().GetFilename() == 'MyFramework':
- found_module = True
- dsym_name = mod.GetSymbolFileSpec().GetFilename()
- self.assertTrue (dsym_name == 'MyFramework', "Check that we found the dSYM for the bundle that was loaded")
- i=i+1
-
- self.assertTrue(found_module, "Check that we found the framework loaded in lldb's image list")
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c
deleted file mode 100644
index b5ef5cff74a39..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <MyFramework/MyFramework.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int setup_is_complete = 0;
-
-int main(int argc, const char **argv)
-{
- char command[8192];
- sprintf (command,
- "/bin/rm -rf %s/MyFramework %s/MyFramework.framework %s/MyFramework.framework.dSYM",
- argv[1], argv[1], argv[1]);
- system (command);
-
- setup_is_complete = 1;
-
- // At this point we want lldb to attach to the process. If lldb attaches
- // before we've removed the framework we're running against, it will be
- // easy for lldb to find the binary & dSYM without using target.exec-search-paths,
- // which is the point of this test.
-
- for (int loop_limiter = 0; loop_limiter < 100; loop_limiter++)
- sleep (1);
-
- return foo();
-}
diff --git a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c
deleted file mode 100644
index c100f9a2c0755..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int foo ()
-{
- return 5;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/function-starts/Makefile b/packages/Python/lldbsuite/test/macosx/function-starts/Makefile
deleted file mode 100644
index 091876d51c350..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/function-starts/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-LEVEL = ../../make
-
-CXX_SOURCES := main.cpp
-EXE := StripMe
-MAKE_DSYM := NO
-
-include $(LEVEL)/Makefile.rules
-
-main.o: main.cpp
- $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@
diff --git a/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py b/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py
deleted file mode 100644
index ae3b825f95cbd..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py
+++ /dev/null
@@ -1,76 +0,0 @@
-"""
-Test that we read the function starts section.
-"""
-
-from __future__ import print_function
-
-
-import os
-import time
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-exe_name = "StripMe" # Must match Makefile
-
-class FunctionStartsTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- NO_DEBUG_INFO_TESTCASE = True
-
- @skipIfRemote
- @skipUnlessDarwin
- def test_function_starts_binary(self):
- """Test that we make synthetic symbols when we have the binary."""
- self.build()
- self.do_function_starts(False)
-
- @skipIfRemote
- @skipUnlessDarwin
- def test_function_starts_no_binary(self):
- """Test that we make synthetic symbols when we don't have the binary"""
- self.build()
- self.do_function_starts(True)
-
- def do_function_starts(self, in_memory):
- """Run the binary, stop at our unstripped function,
- make sure the caller has synthetic symbols"""
-
- exe = self.getBuildArtifact(exe_name)
- # Now strip the binary, but leave externals so we can break on dont_strip_me.
- try:
- fail_str = system([["strip", "-u", "-x", "-S", exe]])
- except CalledProcessError as cmd_error:
- self.fail("Strip failed: %d"%(cmd_error.returncode))
-
- popen = self.spawnSubprocess(exe)
- self.addTearDownHook(self.cleanupSubprocesses)
- if in_memory:
- remove_file(exe)
-
- target = self.dbg.CreateTarget(None)
- self.assertTrue(target.IsValid(), "Got a vaid empty target.")
- error = lldb.SBError()
- attach_info = lldb.SBAttachInfo()
- attach_info.SetProcessID(popen.pid)
- attach_info.SetIgnoreExisting(False)
- process = target.Attach(attach_info, error)
- self.assertTrue(error.Success(), "Didn't attach successfully to %d: %s"%(popen.pid, error.GetCString()))
-
- bkpt = target.BreakpointCreateByName("dont_strip_me", exe)
- self.assertTrue(bkpt.GetNumLocations() > 0, "Didn't set the dont_strip_me bkpt.")
-
- threads = lldbutil.continue_to_breakpoint(process, bkpt)
- self.assertEqual(len(threads), 1, "Didn't hit my breakpoint.")
-
- # Our caller frame should have been stripped. Make sure we made a synthetic symbol
- # for it:
- thread = threads[0]
- self.assertTrue(thread.num_frames > 1, "Couldn't backtrace.")
- name = thread.frame[1].GetFunctionName()
- self.assertEqual("___lldb_unnamed_symbol1$$StripMe", name, "Frame name not synthetic")
-
-
-
diff --git a/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp b/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp
deleted file mode 100644
index 5a14506d69133..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/function-starts/main.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-
-#include <chrono>
-#include <thread>
-
-extern void dont_strip_me()
-{
- printf("I wasn't stripped\n");
-}
-
-static void *a_function()
-{
- while (1)
- {
- std::this_thread::sleep_for(std::chrono::microseconds(100));
- dont_strip_me();
- }
- return 0;
-}
-
-int main(int argc, char const *argv[])
-{
- a_function();
- return 0;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile b/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile
deleted file mode 100644
index 69fd86e575e6d..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-LEVEL = ../../make
-
-include $(LEVEL)/Makefile.rules
-
-LIB_PREFIX := lib
-
-ifeq "$(OS)" "Darwin"
- CFLAGS += -arch $(ARCH)
- DS := dsymutil
- LD_FLAGS := -dynamiclib
- LIB_INDIRECT := $(LIB_PREFIX)indirect.dylib
- LIB_REEXPORT := $(LIB_PREFIX)reexport.dylib
- EXEC_PATH := "@executable_path"
- EXEC_PATH_INDIRECT := -install_name $(EXEC_PATH)/$(LIB_INDIRECT)
- EXEC_PATH_REEXPORT := -install_name $(EXEC_PATH)/$(LIB_REEXPORT)
-endif
-
-all: a.out $(LIB_INDIRECT) $(LIB_REEXPORT)
-
-a.out: main.o $(LIB_INDIRECT) $(LIB_REEXPORT)
- $(CC) $(CFLAGS) -o a.out main.o -L. $(LIB_INDIRECT) $(LIB_REEXPORT)
-
-main.o: $(SRCDIR)/main.c
- $(CC) $(CFLAGS) -c $(SRCDIR)/main.c
-
-$(LIB_INDIRECT): indirect.o
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_INDIRECT) -o $(LIB_INDIRECT) indirect.o
- if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_INDIRECT); fi
-
-indirect.o: $(SRCDIR)/indirect.c
- $(CC) $(CFLAGS) -c $(SRCDIR)/indirect.c
-
-$(LIB_REEXPORT): reexport.o $(LIB_INDIRECT)
- $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_REEXPORT) -o $(LIB_REEXPORT) reexport.o -L. -lindirect -Wl,-alias_list,$(SRCDIR)/alias.list
- if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_REEXPORT); fi
-
-reexport.o: $(SRCDIR)/reexport.c
- $(CC) $(CFLAGS) -c $(SRCDIR)/reexport.c
-clean::
- rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)
diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py b/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
deleted file mode 100644
index a87a628931093..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
+++ /dev/null
@@ -1,118 +0,0 @@
-"""Test stepping and setting breakpoints in indirect and re-exported symbols."""
-
-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 TestIndirectFunctions(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"
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test_with_python_api(self):
- """Test stepping and setting breakpoints in indirect and re-exported symbols."""
- self.build()
- exe = self.getBuildArtifact("a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- if self.platformIsDarwin():
- lib1 = self.getBuildArtifact('libindirect.dylib')
- lib2 = self.getBuildArtifact('libreexport.dylib')
- self.registerSharedLibrariesWithTarget(target, [lib1, lib2])
-
- self.main_source_spec = lldb.SBFileSpec(self.main_source)
-
- break1 = target.BreakpointCreateBySourceRegex(
- "Set breakpoint here to step in indirect.", self.main_source_spec)
- self.assertTrue(break1, VALID_BREAKPOINT)
-
- break2 = target.BreakpointCreateBySourceRegex(
- "Set breakpoint here to step in reexported.", self.main_source_spec)
- self.assertTrue(break2, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple(
- None, None, self.get_process_working_directory())
-
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
- if len(threads) != 1:
- self.fail("Failed to stop at breakpoint 1.")
-
- thread = threads[0]
-
- # Now do a step-into, and we should end up in the hidden target of this
- # indirect function.
- thread.StepInto()
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue(
- curr_function == "call_through_indirect_hidden",
- "Stepped into indirect symbols.")
-
- # Now set a breakpoint using the indirect symbol name, and make sure we
- # get to that:
- break_indirect = target.BreakpointCreateByName("call_through_indirect")
- self.assertTrue(break_indirect, VALID_BREAKPOINT)
-
- # Now continue should take us to the second call through the indirect
- # symbol:
-
- threads = lldbutil.continue_to_breakpoint(process, break_indirect)
- self.assertTrue(
- len(threads) == 1,
- "Stopped at breakpoint in indirect function.")
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue(
- curr_function == "call_through_indirect_hidden",
- "Stepped into indirect symbols.")
-
- # Delete this breakpoint so it won't get in the way:
- target.BreakpointDelete(break_indirect.GetID())
-
- # Now continue to the site of the first re-exported function call in
- # main:
- threads = lldbutil.continue_to_breakpoint(process, break2)
-
- # This is stepping Into through a re-exported symbol to an indirect
- # symbol:
- thread.StepInto()
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue(
- curr_function == "call_through_indirect_hidden",
- "Stepped into indirect symbols.")
-
- # And the last bit is to set a breakpoint on the re-exported symbol and
- # make sure we are again in out target function.
- break_reexported = target.BreakpointCreateByName(
- "reexport_to_indirect")
- self.assertTrue(break_reexported, VALID_BREAKPOINT)
-
- # Now continue should take us to the second call through the indirect
- # symbol:
-
- threads = lldbutil.continue_to_breakpoint(process, break_reexported)
- self.assertTrue(
- len(threads) == 1,
- "Stopped at breakpoint in reexported function target.")
- curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue(
- curr_function == "call_through_indirect_hidden",
- "Stepped into indirect symbols.")
diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/alias.list b/packages/Python/lldbsuite/test/macosx/indirect_symbol/alias.list
deleted file mode 100644
index 3232c58883796..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/alias.list
+++ /dev/null
@@ -1 +0,0 @@
-_call_through_indirect _reexport_to_indirect \ No newline at end of file
diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/indirect.c b/packages/Python/lldbsuite/test/macosx/indirect_symbol/indirect.c
deleted file mode 100644
index 48e1459bb59b5..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/indirect.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#define MakeResolver(name) \
- void * name ## Resolver(void) __asm__("_" #name); \
- void * name ## Resolver(void) { \
- __asm__(".symbol_resolver _" #name); \
- return name ## _hidden; \
- }
-
-int
-call_through_indirect_hidden(int arg)
-{
- return arg + 5;
-}
-
-MakeResolver(call_through_indirect)
diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/main.c b/packages/Python/lldbsuite/test/macosx/indirect_symbol/main.c
deleted file mode 100644
index b5af058d00b1c..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/main.c
+++ /dev/null
@@ -1,14 +0,0 @@
-extern int call_through_indirect(int);
-extern int reexport_to_indirect(int);
-
-int
-main ()
-{
- int indirect_result = call_through_indirect(20); // Set breakpoint here to step in indirect.
- indirect_result = call_through_indirect(30);
-
- int reexport_result = reexport_to_indirect (20); // Set breakpoint here to step in reexported.
- reexport_result = reexport_to_indirect (30);
-
- return 0;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/reexport.c b/packages/Python/lldbsuite/test/macosx/indirect_symbol/reexport.c
deleted file mode 100644
index 096a463b3a47d..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/reexport.c
+++ /dev/null
@@ -1,7 +0,0 @@
-extern int call_through_indirect(int);
-
-int
-fake_call_through_reexport(int value)
-{
- return value + 10;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py b/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py
deleted file mode 100644
index 1bd5ec020dbea..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/load-kext/TestLoadKext.py
+++ /dev/null
@@ -1,38 +0,0 @@
-"""
-Test loading of a kext binary.
-"""
-
-from __future__ import print_function
-
-import shutil
-import struct
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class LoadKextTestCase(TestBase):
- NO_DEBUG_INFO_TESTCASE = True
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- TestBase.setUp(self)
- #super(LoadKextTestCase, self).setUp()
- #self._initial_platform = lldb.DBG.GetSelectedPlatform()
-
- def test_load_kext(self):
- """Test that lldb can load a kext binary."""
-
- # Create kext from YAML.
- self.yaml2obj("mykext.yaml", self.getBuildArtifact("mykext"))
-
- target = self.dbg.CreateTarget(self.getBuildArtifact("mykext"))
-
- self.assertTrue(target.IsValid())
-
- self.assertEqual(target.GetNumModules(), 1)
- mod = target.GetModuleAtIndex(0)
- self.assertEqual(mod.GetFileSpec().GetFilename(), "mykext")
diff --git a/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml b/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml
deleted file mode 100644
index ccf016304c848..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/load-kext/mykext.yaml
+++ /dev/null
@@ -1,222 +0,0 @@
---- !mach-o
-FileHeader:
- magic: 0xFEEDFACF
- cputype: 0x01000007
- cpusubtype: 0x00000003
- filetype: 0x0000000B
- ncmds: 7
- sizeofcmds: 520
- flags: 0x00000085
- reserved: 0x00000000
-LoadCommands:
- - cmd: LC_SEGMENT_64
- cmdsize: 152
- segname: __TEXT
- vmaddr: 0
- vmsize: 4096
- fileoff: 0
- filesize: 4096
- maxprot: 7
- initprot: 5
- nsects: 1
- flags: 0
- Sections:
- - sectname: __text
- segname: __TEXT
- addr: 0x0000000000000F60
- size: 158
- offset: 0x00000F60
- align: 4
- reloff: 0x00000000
- nreloc: 0
- flags: 0x80000400
- reserved1: 0x00000000
- reserved2: 0x00000000
- reserved3: 0x00000000
- - cmd: LC_SEGMENT_64
- cmdsize: 152
- segname: __DATA
- vmaddr: 4096
- vmsize: 4096
- fileoff: 4096
- filesize: 4096
- maxprot: 7
- initprot: 3
- nsects: 1
- flags: 0
- Sections:
- - sectname: __data
- segname: __DATA
- addr: 0x0000000000001000
- size: 220
- offset: 0x00001000
- align: 3
- reloff: 0x00000000
- nreloc: 0
- flags: 0x00000000
- reserved1: 0x00000000
- reserved2: 0x00000000
- reserved3: 0x00000000
- - cmd: LC_SEGMENT_64
- cmdsize: 72
- segname: __LINKEDIT
- vmaddr: 8192
- vmsize: 4096
- fileoff: 8192
- filesize: 800
- maxprot: 7
- initprot: 1
- nsects: 0
- flags: 0
- - cmd: LC_SYMTAB
- cmdsize: 24
- symoff: 8224
- nsyms: 19
- stroff: 8528
- strsize: 464
- - cmd: LC_DYSYMTAB
- cmdsize: 80
- ilocalsym: 0
- nlocalsym: 16
- iextdefsym: 16
- nextdefsym: 3
- iundefsym: 19
- nundefsym: 0
- tocoff: 0
- ntoc: 0
- modtaboff: 0
- nmodtab: 0
- extrefsymoff: 0
- nextrefsyms: 0
- indirectsymoff: 0
- nindirectsyms: 0
- extreloff: 0
- nextrel: 0
- locreloff: 8192
- nlocrel: 4
- - cmd: LC_UUID
- cmdsize: 24
- uuid: 17A97B33-09B7-3195-9408-DBD965D578A5
- - cmd: LC_SOURCE_VERSION
- cmdsize: 16
- version: 0
-LinkEditData:
- NameList:
- - n_strx: 40
- n_type: 0x64
- n_sect: 0
- n_desc: 0
- n_value: 0
- - n_strx: 141
- n_type: 0x64
- n_sect: 0
- n_desc: 0
- n_value: 0
- - n_strx: 155
- n_type: 0x66
- n_sect: 3
- n_desc: 1
- n_value: 1543540349
- - n_strx: 276
- n_type: 0x20
- n_sect: 0
- n_desc: 0
- n_value: 0
- - n_strx: 287
- n_type: 0x20
- n_sect: 0
- n_desc: 0
- n_value: 0
- - n_strx: 298
- n_type: 0x20
- n_sect: 0
- n_desc: 0
- n_value: 0
- - n_strx: 309
- n_type: 0x20
- n_sect: 0
- n_desc: 0
- n_value: 0
- - n_strx: 1
- n_type: 0x64
- n_sect: 1
- n_desc: 0
- n_value: 0
- - n_strx: 325
- n_type: 0x1E
- n_sect: 1
- n_desc: 0
- n_value: 3992
- - n_strx: 333
- n_type: 0x1E
- n_sect: 1
- n_desc: 0
- n_value: 4018
- - n_strx: 361
- n_type: 0x1E
- n_sect: 1
- n_desc: 0
- n_value: 4035
- - n_strx: 392
- n_type: 0x1E
- n_sect: 1
- n_desc: 0
- n_value: 4052
- - n_strx: 417
- n_type: 0x1E
- n_sect: 1
- n_desc: 0
- n_value: 4068
- - n_strx: 424
- n_type: 0x1E
- n_sect: 2
- n_desc: 0
- n_value: 4296
- - n_strx: 435
- n_type: 0x1E
- n_sect: 2
- n_desc: 0
- n_value: 4304
- - n_strx: 446
- n_type: 0x1E
- n_sect: 2
- n_desc: 0
- n_value: 4312
- - n_strx: 2
- n_type: 0x0F
- n_sect: 2
- n_desc: 0
- n_value: 4096
- - n_strx: 13
- n_type: 0x0F
- n_sect: 1
- n_desc: 0
- n_value: 3936
- - n_strx: 27
- n_type: 0x0F
- n_sect: 1
- n_desc: 0
- n_value: 3968
- StringTable:
- - ' '
- - _kmod_info
- - _mykext_start
- - _mykext_stop
- - /tmp/mykext/build/mykext/Build/Intermediates.noindex/mykext.build/Debug/mykext.build/DerivedSources/
- - mykext_info.c
- - /tmp/mykext/build/mykext/Build/Intermediates.noindex/mykext.build/Debug/mykext.build/Objects-normal/x86_64/mykext_info.o
- - _kmod_info
- - __realmain
- - __antimain
- - __kext_apple_cc
- - __start
- - _OSKextGetCurrentIdentifier
- - _OSKextGetCurrentVersionString
- - _OSKextGetCurrentLoadTag
- - __stop
- - __realmain
- - __antimain
- - __kext_apple_cc
- - ''
- - ''
-...
diff --git a/packages/Python/lldbsuite/test/macosx/nslog/Makefile b/packages/Python/lldbsuite/test/macosx/nslog/Makefile
deleted file mode 100644
index de2b618b3d707..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/nslog/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-LEVEL = ../../make
-
-OBJC_SOURCES := main.m
-LD_EXTRAS = -framework Foundation
-
-include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py b/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
deleted file mode 100644
index 287c1c1b87b3c..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
+++ /dev/null
@@ -1,153 +0,0 @@
-"""
-Test DarwinLog "source include debug-level" functionality provided by the
-StructuredDataDarwinLog plugin.
-
-These tests are currently only supported when running against Darwin
-targets.
-"""
-
-from __future__ import print_function
-
-import lldb
-import os
-import platform
-import re
-import sys
-
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbtest_config
-
-
-class DarwinNSLogOutputTestCase(TestBase):
- NO_DEBUG_INFO_TESTCASE = True
- mydir = TestBase.compute_mydir(__file__)
-
- @skipUnlessDarwin
- @skipIfRemote # this test is currently written using lldb commands & assumes running on local system
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- self.child = None
- self.child_prompt = '(lldb) '
- self.strict_sources = False
-
- # Source filename.
- self.source = 'main.m'
-
- # Output filename.
- self.exe_name = self.getBuildArtifact("a.out")
- self.d = {'OBJC_SOURCES': self.source, 'EXE': self.exe_name}
-
- # Locate breakpoint.
- self.line = line_number(self.source, '// break here')
-
- def tearDown(self):
- # Shut down the process if it's still running.
- if self.child:
- self.runCmd('process kill')
- self.expect_prompt()
- self.runCmd('quit')
-
- # Let parent clean up
- super(DarwinNSLogOutputTestCase, self).tearDown()
-
- def run_lldb_to_breakpoint(self, exe, source_file, line,
- settings_commands=None):
- # Set self.child_prompt, which is "(lldb) ".
- prompt = self.child_prompt
-
- # So that the child gets torn down after the test.
- import pexpect
- self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec,
- self.lldbOption, exe))
- child = self.child
-
- # Turn on logging for what the child sends back.
- if self.TraceOn():
- child.logfile_read = sys.stdout
-
- # Disable showing of source lines at our breakpoint.
- # This is necessary for the logging tests, because the very
- # text we want to match for output from the running inferior
- # will show up in the source as well. We don't want the source
- # output to erroneously make a match with our expected output.
- self.runCmd("settings set stop-line-count-before 0")
- self.expect_prompt()
- self.runCmd("settings set stop-line-count-after 0")
- self.expect_prompt()
-
- # Run any test-specific settings commands now.
- if settings_commands is not None:
- for setting_command in settings_commands:
- self.runCmd(setting_command)
- self.expect_prompt()
-
- # Set the breakpoint, and run to it.
- child.sendline('breakpoint set -f %s -l %d' % (source_file, line))
- child.expect_exact(prompt)
- child.sendline('run')
- child.expect_exact(prompt)
-
- # Ensure we stopped at a breakpoint.
- self.runCmd("thread list")
- self.expect(re.compile(r"stop reason = breakpoint"))
-
- def runCmd(self, cmd):
- if self.child:
- self.child.sendline(cmd)
-
- def expect_prompt(self, exactly=True):
- self.expect(self.child_prompt, exactly=exactly)
-
- def expect(self, pattern, exactly=False, *args, **kwargs):
- if exactly:
- return self.child.expect_exact(pattern, *args, **kwargs)
- return self.child.expect(pattern, *args, **kwargs)
-
- def do_test(self, expect_regexes=None, settings_commands=None):
- """ Run a test. """
- self.build(dictionary=self.d)
- self.setTearDownCleanup(dictionary=self.d)
-
- exe = self.getBuildArtifact(self.exe_name)
- self.run_lldb_to_breakpoint(exe, self.source, self.line,
- settings_commands=settings_commands)
- self.expect_prompt()
-
- # Now go.
- self.runCmd("process continue")
- self.expect(expect_regexes)
-
- def test_nslog_output_is_displayed(self):
- """Test that NSLog() output shows up in the command-line debugger."""
- self.do_test(expect_regexes=[
- re.compile(r"(This is a message from NSLog)"),
- re.compile(r"Process \d+ exited with status")
- ])
- self.assertIsNotNone(self.child.match)
- self.assertGreater(len(self.child.match.groups()), 0)
- self.assertEqual(
- "This is a message from NSLog",
- self.child.match.group(1))
-
- def test_nslog_output_is_suppressed_with_env_var(self):
- """Test that NSLog() output does not show up with the ignore env var."""
- # This test will only work properly on macOS 10.12+. Skip it on earlier versions.
- # This will require some tweaking on iOS.
- match = re.match(r"^\d+\.(\d+)", platform.mac_ver()[0])
- if match is None or int(match.group(1)) < 12:
- self.skipTest("requires macOS 10.12 or higher")
-
- self.do_test(
- expect_regexes=[
- re.compile(r"(This is a message from NSLog)"),
- re.compile(r"Process \d+ exited with status")
- ],
- settings_commands=[
- "settings set target.env-vars "
- "\"IDE_DISABLED_OS_ACTIVITY_DT_MODE=1\""
- ])
- self.assertIsNotNone(self.child.match)
- self.assertEqual(len(self.child.match.groups()), 0)
diff --git a/packages/Python/lldbsuite/test/macosx/nslog/main.m b/packages/Python/lldbsuite/test/macosx/nslog/main.m
deleted file mode 100644
index dab4089e92734..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/nslog/main.m
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- main.m --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <Foundation/Foundation.h>
-
-int main(int argc, char** argv)
-{
- printf("About to log\n"); // break here
- NSLog(@"This is a message from NSLog");
-
- return 0;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/order/Makefile b/packages/Python/lldbsuite/test/macosx/order/Makefile
deleted file mode 100644
index ff5f1886ef561..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/order/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-LDFLAGS = $(CFLAGS) -Xlinker -order_file -Xlinker $(SRCDIR)/order-file
-MAKE_DSYM := NO
-
-include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py b/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py
deleted file mode 100644
index e7a4b20cd6bc0..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py
+++ /dev/null
@@ -1,39 +0,0 @@
-"""
-Test that debug symbols have the correct order as specified by the order file.
-"""
-
-from __future__ import print_function
-
-
-import os
-import time
-import re
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class OrderFileTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipUnlessDarwin
- def test(self):
- """Test debug symbols follow the correct order by the order file."""
- self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Test that the debug symbols have Function f3 before Function f1.
- # Use "-s address" option to sort by address.
- self.runCmd("image dump symtab -s address %s" % exe)
- output = self.res.GetOutput()
- mo_f3 = re.search("Code +.+f3", output)
- mo_f1 = re.search("Code +.+f1", output)
-
- # Match objects for f3 and f1 must exist and f3 must come before f1.
- self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start(),
- "Symbols have correct order by the order file")
-
- self.runCmd("run", RUN_COMPLETED)
diff --git a/packages/Python/lldbsuite/test/macosx/order/cmds.txt b/packages/Python/lldbsuite/test/macosx/order/cmds.txt
deleted file mode 100644
index 8c51dd763bf49..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/order/cmds.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-b main.c:41
-c
-lines -shlib a.out main.c
diff --git a/packages/Python/lldbsuite/test/macosx/order/main.c b/packages/Python/lldbsuite/test/macosx/order/main.c
deleted file mode 100644
index cd1ea581876f6..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/order/main.c
+++ /dev/null
@@ -1,54 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-
-
-int f1 (char *s);
-int f2 (char *s);
-int f3 (char *s);
-
-
-// We want f1 to start on line 20
-int f1 (char *s)
-{
- return printf("f1: %s\n", s);
-}
-
-
-
-
-
-// We want f2 to start on line 30
-int f2 (char *s)
-{
- return printf("f2: %s\n", s);
-}
-
-
-
-
-
-// We want f3 to start on line 40
-int f3 (char *s)
-{
- return printf("f3: %s\n", s);
-}
-
-
-
-
-
-// We want main to start on line 50
-int main (int argc, const char * argv[])
-{
- f1("carp");
- f2("ding");
- f3("dong");
- return 0;
-}
diff --git a/packages/Python/lldbsuite/test/macosx/order/order-file b/packages/Python/lldbsuite/test/macosx/order/order-file
deleted file mode 100644
index 0cf8ecd2a6392..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/order/order-file
+++ /dev/null
@@ -1,4 +0,0 @@
-main.o:_f3
-main.o:_main
-main.o:_f2
-main.o:_f1
diff --git a/packages/Python/lldbsuite/test/macosx/queues/Makefile b/packages/Python/lldbsuite/test/macosx/queues/Makefile
deleted file mode 100644
index 0d70f25950192..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/queues/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py b/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
deleted file mode 100644
index cdc9606c377a1..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
+++ /dev/null
@@ -1,365 +0,0 @@
-"""Test queues inspection SB APIs."""
-
-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 TestQueues(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test_with_python_api_queues(self):
- """Test queues inspection SB APIs."""
- self.build()
- self.queues()
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test_with_python_api_queues_with_backtrace(self):
- """Test queues inspection SB APIs."""
- self.build()
- self.queues_with_libBacktraceRecording()
-
- 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"
-
- def check_queue_for_valid_queue_id(self, queue):
- self.assertTrue(
- queue.GetQueueID() != 0, "Check queue %s for valid QueueID (got 0x%x)" %
- (queue.GetName(), queue.GetQueueID()))
-
- def check_running_and_pending_items_on_queue(
- self, queue, expected_running, expected_pending):
- self.assertTrue(
- queue.GetNumPendingItems() == expected_pending,
- "queue %s should have %d pending items, instead has %d pending items" %
- (queue.GetName(),
- expected_pending,
- (queue.GetNumPendingItems())))
- self.assertTrue(
- queue.GetNumRunningItems() == expected_running,
- "queue %s should have %d running items, instead has %d running items" %
- (queue.GetName(),
- expected_running,
- (queue.GetNumRunningItems())))
-
- def check_number_of_threads_owned_by_queue(self, queue, number_threads):
- self.assertTrue(
- queue.GetNumThreads() == number_threads,
- "queue %s should have %d thread executing, but has %d" %
- (queue.GetName(),
- number_threads,
- queue.GetNumThreads()))
-
- def check_queue_kind(self, queue, kind):
- expected_kind_string = "Unknown"
- if kind == lldb.eQueueKindSerial:
- expected_kind_string = "Serial queue"
- if kind == lldb.eQueueKindConcurrent:
- expected_kind_string = "Concurrent queue"
- actual_kind_string = "Unknown"
- if queue.GetKind() == lldb.eQueueKindSerial:
- actual_kind_string = "Serial queue"
- if queue.GetKind() == lldb.eQueueKindConcurrent:
- actual_kind_string = "Concurrent queue"
- self.assertTrue(
- queue.GetKind() == kind,
- "queue %s is expected to be a %s but it is actually a %s" %
- (queue.GetName(),
- expected_kind_string,
- actual_kind_string))
-
- def check_queues_threads_match_queue(self, queue):
- for idx in range(0, queue.GetNumThreads()):
- t = queue.GetThreadAtIndex(idx)
- self.assertTrue(
- t.IsValid(), "Queue %s's thread #%d must be valid" %
- (queue.GetName(), idx))
- self.assertTrue(
- t.GetQueueID() == queue.GetQueueID(),
- "Queue %s has a QueueID of %d but its thread #%d has a QueueID of %d" %
- (queue.GetName(),
- queue.GetQueueID(),
- idx,
- t.GetQueueID()))
- self.assertTrue(
- t.GetQueueName() == queue.GetName(),
- "Queue %s has a QueueName of %s but its thread #%d has a QueueName of %s" %
- (queue.GetName(),
- queue.GetName(),
- idx,
- t.GetQueueName()))
- self.assertTrue(
- t.GetQueue().GetQueueID() == queue.GetQueueID(),
- "Thread #%d's Queue's QueueID of %d is not the same as the QueueID of its owning queue %d" %
- (idx,
- t.GetQueue().GetQueueID(),
- queue.GetQueueID()))
-
- def queues(self):
- """Test queues inspection SB APIs without libBacktraceRecording."""
- exe = self.getBuildArtifact("a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec(self.main_source)
- break1 = target.BreakpointCreateByName("stopper", 'a.out')
- self.assertTrue(break1, VALID_BREAKPOINT)
- process = target.LaunchSimple(
- [], None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
- if len(threads) != 1:
- self.fail("Failed to stop at breakpoint 1.")
-
- queue_submittor_1 = lldb.SBQueue()
- queue_performer_1 = lldb.SBQueue()
- queue_performer_2 = lldb.SBQueue()
- queue_performer_3 = lldb.SBQueue()
- for idx in range(0, process.GetNumQueues()):
- q = process.GetQueueAtIndex(idx)
- if q.GetName() == "com.apple.work_submittor_1":
- queue_submittor_1 = q
- if q.GetName() == "com.apple.work_performer_1":
- queue_performer_1 = q
- if q.GetName() == "com.apple.work_performer_2":
- queue_performer_2 = q
- if q.GetName() == "com.apple.work_performer_3":
- queue_performer_3 = q
-
- self.assertTrue(
- queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(),
- "Got all four expected queues: %s %s %s %s" %
- (queue_submittor_1.IsValid(),
- queue_performer_1.IsValid(),
- queue_performer_2.IsValid(),
- queue_performer_3.IsValid()))
-
- self.check_queue_for_valid_queue_id(queue_submittor_1)
- self.check_queue_for_valid_queue_id(queue_performer_1)
- self.check_queue_for_valid_queue_id(queue_performer_2)
- self.check_queue_for_valid_queue_id(queue_performer_3)
-
- self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
- self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
- self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)
- self.check_number_of_threads_owned_by_queue(queue_performer_3, 4)
-
- self.check_queue_kind(queue_submittor_1, lldb.eQueueKindSerial)
- self.check_queue_kind(queue_performer_1, lldb.eQueueKindSerial)
- self.check_queue_kind(queue_performer_2, lldb.eQueueKindSerial)
- self.check_queue_kind(queue_performer_3, lldb.eQueueKindConcurrent)
-
- self.check_queues_threads_match_queue(queue_submittor_1)
- self.check_queues_threads_match_queue(queue_performer_1)
- self.check_queues_threads_match_queue(queue_performer_2)
- self.check_queues_threads_match_queue(queue_performer_3)
-
- # We have threads running with all the different dispatch QoS service
- # levels - find those threads and check that we can get the correct
- # QoS name for each of them.
-
- user_initiated_thread = lldb.SBThread()
- user_interactive_thread = lldb.SBThread()
- utility_thread = lldb.SBThread()
- unspecified_thread = lldb.SBThread()
- background_thread = lldb.SBThread()
- for th in process.threads:
- if th.GetName() == "user initiated QoS":
- user_initiated_thread = th
- if th.GetName() == "user interactive QoS":
- user_interactive_thread = th
- if th.GetName() == "utility QoS":
- utility_thread = th
- if th.GetName() == "unspecified QoS":
- unspecified_thread = th
- if th.GetName() == "background QoS":
- background_thread = th
-
- self.assertTrue(
- user_initiated_thread.IsValid(),
- "Found user initiated QoS thread")
- self.assertTrue(
- user_interactive_thread.IsValid(),
- "Found user interactive QoS thread")
- self.assertTrue(utility_thread.IsValid(), "Found utility QoS thread")
- self.assertTrue(
- unspecified_thread.IsValid(),
- "Found unspecified QoS thread")
- self.assertTrue(
- background_thread.IsValid(),
- "Found background QoS thread")
-
- stream = lldb.SBStream()
- self.assertTrue(
- user_initiated_thread.GetInfoItemByPathAsString(
- "requested_qos.printable_name",
- stream),
- "Get QoS printable string for user initiated QoS thread")
- self.assertTrue(
- stream.GetData() == "User Initiated",
- "user initiated QoS thread name is valid")
- stream.Clear()
- self.assertTrue(
- user_interactive_thread.GetInfoItemByPathAsString(
- "requested_qos.printable_name",
- stream),
- "Get QoS printable string for user interactive QoS thread")
- self.assertTrue(
- stream.GetData() == "User Interactive",
- "user interactive QoS thread name is valid")
- stream.Clear()
- self.assertTrue(
- utility_thread.GetInfoItemByPathAsString(
- "requested_qos.printable_name",
- stream),
- "Get QoS printable string for utility QoS thread")
- self.assertTrue(
- stream.GetData() == "Utility",
- "utility QoS thread name is valid")
- stream.Clear()
- self.assertTrue(
- unspecified_thread.GetInfoItemByPathAsString(
- "requested_qos.printable_name",
- stream),
- "Get QoS printable string for unspecified QoS thread")
- qosName = stream.GetData()
- self.assertTrue(
- qosName == "User Initiated" or qosName == "Default",
- "unspecified QoS thread name is valid")
- stream.Clear()
- self.assertTrue(
- background_thread.GetInfoItemByPathAsString(
- "requested_qos.printable_name",
- stream),
- "Get QoS printable string for background QoS thread")
- self.assertTrue(
- stream.GetData() == "Background",
- "background QoS thread name is valid")
-
- def queues_with_libBacktraceRecording(self):
- """Test queues inspection SB APIs with libBacktraceRecording present."""
- exe = self.getBuildArtifact("a.out")
-
- if not os.path.isfile(
- '/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib'):
- self.skipTest(
- "Skipped because libBacktraceRecording.dylib was present on the system.")
-
- if not os.path.isfile(
- '/usr/lib/system/introspection/libdispatch.dylib'):
- self.skipTest(
- "Skipped because introspection libdispatch dylib is not present.")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- self.main_source_spec = lldb.SBFileSpec(self.main_source)
-
- break1 = target.BreakpointCreateByName("stopper", 'a.out')
- self.assertTrue(break1, VALID_BREAKPOINT)
-
- # Now launch the process, and do not stop at entry point.
- libbtr_path = "/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib"
- if self.getArchitecture() in ['arm', 'arm64', 'arm64e', 'arm64_32', 'armv7', 'armv7k']:
- libbtr_path = "/Developer/usr/lib/libBacktraceRecording.dylib"
-
- process = target.LaunchSimple(
- [],
- [
- 'DYLD_INSERT_LIBRARIES=%s' % (libbtr_path),
- 'DYLD_LIBRARY_PATH=/usr/lib/system/introspection'],
- 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, break1)
- if len(threads) != 1:
- self.fail("Failed to stop at breakpoint 1.")
-
- libbtr_module_filespec = lldb.SBFileSpec("libBacktraceRecording.dylib")
- libbtr_module = target.FindModule(libbtr_module_filespec)
- if not libbtr_module.IsValid():
- self.skipTest(
- "Skipped because libBacktraceRecording.dylib was not loaded into the process.")
-
- self.assertTrue(
- process.GetNumQueues() >= 4,
- "Found the correct number of queues.")
-
- queue_submittor_1 = lldb.SBQueue()
- queue_performer_1 = lldb.SBQueue()
- queue_performer_2 = lldb.SBQueue()
- queue_performer_3 = lldb.SBQueue()
- for idx in range(0, process.GetNumQueues()):
- q = process.GetQueueAtIndex(idx)
- if q.GetName() == "com.apple.work_submittor_1":
- queue_submittor_1 = q
- if q.GetName() == "com.apple.work_performer_1":
- queue_performer_1 = q
- if q.GetName() == "com.apple.work_performer_2":
- queue_performer_2 = q
- if q.GetName() == "com.apple.work_performer_3":
- queue_performer_3 = q
-
- self.assertTrue(
- queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(),
- "Got all four expected queues: %s %s %s %s" %
- (queue_submittor_1.IsValid(),
- queue_performer_1.IsValid(),
- queue_performer_2.IsValid(),
- queue_performer_3.IsValid()))
-
- self.check_queue_for_valid_queue_id(queue_submittor_1)
- self.check_queue_for_valid_queue_id(queue_performer_1)
- self.check_queue_for_valid_queue_id(queue_performer_2)
- self.check_queue_for_valid_queue_id(queue_performer_3)
-
- self.check_running_and_pending_items_on_queue(queue_submittor_1, 1, 0)
- self.check_running_and_pending_items_on_queue(queue_performer_1, 1, 3)
- self.check_running_and_pending_items_on_queue(
- queue_performer_2, 1, 9999)
- self.check_running_and_pending_items_on_queue(queue_performer_3, 4, 0)
-
- self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
- self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
- self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)
- self.check_number_of_threads_owned_by_queue(queue_performer_3, 4)
-
- self.check_queue_kind(queue_submittor_1, lldb.eQueueKindSerial)
- self.check_queue_kind(queue_performer_1, lldb.eQueueKindSerial)
- self.check_queue_kind(queue_performer_2, lldb.eQueueKindSerial)
- self.check_queue_kind(queue_performer_3, lldb.eQueueKindConcurrent)
-
- self.check_queues_threads_match_queue(queue_submittor_1)
- self.check_queues_threads_match_queue(queue_performer_1)
- self.check_queues_threads_match_queue(queue_performer_2)
- self.check_queues_threads_match_queue(queue_performer_3)
-
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
- 0).IsValid(), "queue 2's pending item #0 is valid")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(0).GetAddress().GetSymbol(
- ).GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
- self.assertTrue(
- queue_performer_2.GetNumPendingItems() == 9999,
- "verify that queue 2 still has 9999 pending items")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
- 9998).IsValid(), "queue 2's pending item #9998 is valid")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).GetAddress().GetSymbol(
- ).GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
- 9999).IsValid() == False, "queue 2's pending item #9999 is invalid")
diff --git a/packages/Python/lldbsuite/test/macosx/queues/main.c b/packages/Python/lldbsuite/test/macosx/queues/main.c
deleted file mode 100644
index 3978b92bff1a6..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/queues/main.c
+++ /dev/null
@@ -1,151 +0,0 @@
-#include <stdatomic.h>
-#include <string.h>
-#include <unistd.h>
-#include <dispatch/dispatch.h>
-#include <pthread.h>
-
-atomic_int finished_enqueueing_work = 0;
-atomic_int thread_count = 0;
-
-void
-doing_the_work_1(void *in)
-{
- // This is only counted once because the first job in the queue
- // starves all the others.
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (1);
-}
-
-void
-submit_work_1a(void *in)
-{
- dispatch_queue_t *work_performer_1 = (dispatch_queue_t*) in;
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
-}
-
-void
-submit_work_1b(void *in)
-{
- dispatch_queue_t *work_performer_1 = (dispatch_queue_t*) in;
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
- dispatch_async_f (*work_performer_1, NULL, doing_the_work_1);
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (1);
-}
-
-void
-doing_the_work_2(void *in)
-{
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (1);
-}
-
-void
-submit_work_2(void *in)
-{
- dispatch_queue_t *work_performer_2 = (dispatch_queue_t*) in;
- int i = 0;
- while (i++ < 5000)
- {
- dispatch_async_f (*work_performer_2, NULL, doing_the_work_2);
- dispatch_async_f (*work_performer_2, NULL, doing_the_work_2);
- }
- atomic_fetch_add(&finished_enqueueing_work, 1);
-}
-
-
-void
-doing_the_work_3(void *in)
-{
- // This counts four times, since the queue is marked as CONCURRENT.
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (1);
-}
-
-void
-submit_work_3(void *in)
-{
- dispatch_queue_t *work_performer_3 = (dispatch_queue_t*) in;
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
- dispatch_async_f (*work_performer_3, NULL, doing_the_work_3);
-}
-
-
-void
-stopper ()
-{
- while (1)
- sleep (1);
-}
-
-
-int main (int argc, const char **argv)
-{
- dispatch_queue_t work_submittor_1 = dispatch_queue_create ("com.apple.work_submittor_1", DISPATCH_QUEUE_SERIAL);
- dispatch_queue_t work_submittor_2 = dispatch_queue_create ("com.apple.work_submittor_and_quit_2", DISPATCH_QUEUE_SERIAL);
- dispatch_queue_t work_submittor_3 = dispatch_queue_create ("com.apple.work_submittor_3", DISPATCH_QUEUE_SERIAL);
-
- dispatch_queue_t work_performer_1 = dispatch_queue_create ("com.apple.work_performer_1", DISPATCH_QUEUE_SERIAL);
- dispatch_queue_t work_performer_2 = dispatch_queue_create ("com.apple.work_performer_2", DISPATCH_QUEUE_SERIAL);
-
- dispatch_queue_t work_performer_3 = dispatch_queue_create ("com.apple.work_performer_3", DISPATCH_QUEUE_CONCURRENT);
-
- dispatch_async_f (work_submittor_1, (void*) &work_performer_1, submit_work_1a);
- dispatch_async_f (work_submittor_1, (void*) &work_performer_1, submit_work_1b);
-
- dispatch_async_f (work_submittor_2, (void*) &work_performer_2, submit_work_2);
-
- dispatch_async_f (work_submittor_3, (void*) &work_performer_3, submit_work_3);
-
-
- // Spin up threads with each of the different libdispatch QoS values.
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
- pthread_setname_np ("user initiated QoS");
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
- pthread_setname_np ("user interactive QoS");
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
- pthread_setname_np ("default QoS");
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{
- pthread_setname_np ("utility QoS");
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
- pthread_setname_np ("background QoS");
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (10);
- });
- dispatch_async (dispatch_get_global_queue(QOS_CLASS_UNSPECIFIED, 0), ^{
- pthread_setname_np ("unspecified QoS");
- atomic_fetch_add(&thread_count, 1);
- while (1)
- sleep (10);
- });
-
- // Unfortunately there is no pthread_barrier on darwin.
- while ((atomic_load(&thread_count) < 13) || (finished_enqueueing_work == 0))
- sleep (1);
-
- stopper ();
-}
diff --git a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile b/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile
deleted file mode 100644
index 0d70f25950192..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py b/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
deleted file mode 100644
index 314084d0b1584..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
+++ /dev/null
@@ -1,73 +0,0 @@
-"""Test function call thread safety."""
-
-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 TestSafeFuncCalls(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"
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test_with_python_api(self):
- """Test function call thread safety."""
- 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)
- break1 = target.BreakpointCreateByName("stopper", 'a.out')
- self.assertTrue(break1, 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, break1)
- if len(threads) != 1:
- self.fail("Failed to stop at breakpoint 1.")
-
- self.check_number_of_threads(process)
-
- main_thread = lldb.SBThread()
- select_thread = lldb.SBThread()
- for idx in range(0, process.GetNumThreads()):
- t = process.GetThreadAtIndex(idx)
- if t.GetName() == "main thread":
- main_thread = t
- if t.GetName() == "select thread":
- select_thread = t
-
- self.assertTrue(
- main_thread.IsValid() and select_thread.IsValid(),
- "Got both expected threads")
-
- self.safe_to_call_func_on_main_thread(main_thread)
- self.safe_to_call_func_on_select_thread(select_thread)
-
- def check_number_of_threads(self, process):
- self.assertTrue(
- process.GetNumThreads() == 2,
- "Check that the process has two threads when sitting at the stopper() breakpoint")
-
- def safe_to_call_func_on_main_thread(self, main_thread):
- self.assertTrue(main_thread.SafeToCallFunctions(),
- "It is safe to call functions on the main thread")
-
- def safe_to_call_func_on_select_thread(self, select_thread):
- self.assertTrue(
- select_thread.SafeToCallFunctions() == False,
- "It is not safe to call functions on the select thread")
diff --git a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/main.c b/packages/Python/lldbsuite/test/macosx/safe-to-func-call/main.c
deleted file mode 100644
index 586500876288a..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/main.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <sys/time.h> // work around module map issue with iOS sdk, <rdar://problem/35159346>
-#include <sys/select.h>
-#include <stdio.h>
-#include <pthread.h>
-#include <unistd.h>
-
-void *
-select_thread (void *in)
-{
- pthread_setname_np ("select thread");
- fd_set fdset;
- FD_SET (STDIN_FILENO, &fdset);
- while (1)
- select (2, &fdset, NULL, NULL, NULL);
- return NULL;
-}
-
-void stopper ()
-{
- while (1)
- sleep(1); // break here
-}
-
-int main ()
-{
- pthread_setname_np ("main thread");
- pthread_t other_thread;
- pthread_create (&other_thread, NULL, select_thread, NULL);
- sleep (1);
- stopper();
-}
diff --git a/packages/Python/lldbsuite/test/macosx/thread-names/Makefile b/packages/Python/lldbsuite/test/macosx/thread-names/Makefile
deleted file mode 100644
index 0d70f25950192..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/thread-names/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py b/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
deleted file mode 100644
index 515ab3f2bbd9e..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
+++ /dev/null
@@ -1,139 +0,0 @@
-"""Test that we get thread names when interrupting a process."""
-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 TestInterruptThreadNames(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
-
- @skipUnlessDarwin
- @add_test_categories(['pyapi'])
- def test_with_python_api(self):
- """Test that we get thread names when interrupting a process."""
- self.build()
- exe = self.getBuildArtifact("a.out")
-
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- launch_info = lldb.SBLaunchInfo(None)
- error = lldb.SBError()
- lldb.debugger.SetAsync(True)
- process = target.Launch(launch_info, error)
- self.assertTrue(process, PROCESS_IS_VALID)
-
- listener = lldb.debugger.GetListener()
- broadcaster = process.GetBroadcaster()
- rc = broadcaster.AddListener(listener, lldb.SBProcess.eBroadcastBitStateChanged)
- self.assertTrue(rc != 0, "Unable to add listener to process")
- self.assertTrue(self.wait_for_running(process, listener), "Check that process is up and running")
-
- inferior_set_up = self.wait_until_program_setup_complete(process, listener)
-
- self.assertTrue(inferior_set_up.IsValid() and inferior_set_up.GetValueAsSigned() == 1, "Check that the program was able to create its threads within the allotted time")
-
- self.check_number_of_threads(process)
-
- main_thread = lldb.SBThread()
- second_thread = lldb.SBThread()
- third_thread = lldb.SBThread()
- for idx in range(0, process.GetNumThreads()):
- t = process.GetThreadAtIndex(idx)
- if t.GetName() == "main thread":
- main_thread = t
- if t.GetName() == "second thread":
- second_thread = t
- if t.GetName() == "third thread":
- third_thread = t
-
- self.check_expected_threads_present(main_thread, second_thread, third_thread)
-
- process.Kill()
-
-
- # The process will set a global variable 'threads_up_and_running' to 1 when
- # it has has completed its setup. Sleep for one second, pause the program,
- # check to see if the global has that value, and continue if it does not.
- def wait_until_program_setup_complete(self, process, listener):
- inferior_set_up = lldb.SBValue()
- retry = 5
- while retry > 0:
- arch = self.getArchitecture()
- # when running the testsuite against a remote arm device, it may take
- # a little longer for the process to start up. Use a "can't possibly take
- # longer than this" value.
- if arch == 'arm64' or arch == 'armv7':
- time.sleep(10)
- else:
- time.sleep(1)
- process.SendAsyncInterrupt()
- self.assertTrue(self.wait_for_stop(process, listener), "Check that process is paused")
- inferior_set_up = process.GetTarget().CreateValueFromExpression("threads_up_and_running", "threads_up_and_running")
- if inferior_set_up.IsValid() and inferior_set_up.GetValueAsSigned() == 1:
- retry = 0
- else:
- process.Continue()
- retry = retry - 1
- return inferior_set_up
-
- # Listen to the process events until we get an event saying that the process is
- # running. Retry up to five times in case we get other events that are not
- # what we're looking for.
- def wait_for_running(self, process, listener):
- retry_count = 5
- if process.GetState() == lldb.eStateRunning:
- return True
-
- while retry_count > 0:
- event = lldb.SBEvent()
- listener.WaitForEvent(2, event)
- if event.GetType() == lldb.SBProcess.eBroadcastBitStateChanged:
- if process.GetState() == lldb.eStateRunning:
- return True
- retry_count = retry_count - 1
-
- return False
-
- # Listen to the process events until we get an event saying the process is
- # stopped. Retry up to five times in case we get other events that we are
- # not looking for.
- def wait_for_stop(self, process, listener):
- retry_count = 5
- if process.GetState() == lldb.eStateStopped or process.GetState() == lldb.eStateCrashed or process.GetState() == lldb.eStateDetached or process.GetState() == lldb.eStateExited:
- return True
-
- while retry_count > 0:
- event = lldb.SBEvent()
- listener.WaitForEvent(2, event)
- if event.GetType() == lldb.SBProcess.eBroadcastBitStateChanged:
- if process.GetState() == lldb.eStateStopped or process.GetState() == lldb.eStateCrashed or process.GetState() == lldb.eStateDetached or process.GetState() == lldb.eStateExited:
- return True
- if process.GetState() == lldb.eStateCrashed or process.GetState() == lldb.eStateDetached or process.GetState() == lldb.eStateExited:
- return False
- retry_count = retry_count - 1
-
- return False
-
-
-
- def check_number_of_threads(self, process):
- self.assertTrue(
- process.GetNumThreads() == 3,
- "Check that the process has three threads when sitting at the stopper() breakpoint")
-
- def check_expected_threads_present(self, main_thread, second_thread, third_thread):
- self.assertTrue(
- main_thread.IsValid() and second_thread.IsValid() and third_thread.IsValid(),
- "Got all three expected threads")
diff --git a/packages/Python/lldbsuite/test/macosx/thread-names/main.c b/packages/Python/lldbsuite/test/macosx/thread-names/main.c
deleted file mode 100644
index 6834f064151d6..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/thread-names/main.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <stdio.h>
-#include <pthread.h>
-#include <unistd.h>
-
-int threads_up_and_running = 0;
-
-void *
-second_thread (void *in)
-{
- pthread_setname_np ("second thread");
- while (1)
- sleep (1);
- return NULL;
-}
-
-void *
-third_thread (void *in)
-{
- pthread_setname_np ("third thread");
- while (1)
- sleep (1);
- return NULL;
-}
-
-int main ()
-{
- pthread_setname_np ("main thread");
- pthread_t other_thread;
- pthread_create (&other_thread, NULL, second_thread, NULL);
- pthread_create (&other_thread, NULL, third_thread, NULL);
-
- threads_up_and_running = 1;
-
- while (1)
- sleep (1);
-}
diff --git a/packages/Python/lldbsuite/test/macosx/universal/Makefile b/packages/Python/lldbsuite/test/macosx/universal/Makefile
deleted file mode 100644
index a83de2a6c7e65..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/universal/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-LEVEL := ../../make
-
-EXE := testit
-
-include $(LEVEL)/Makefile.rules
-
-all: testit
-
-testit: testit.x86_64h testit.x86_64
- lipo -create -o testit $^
-
-testit.x86_64h: testit.x86_64h.o
- $(CC) -arch x86_64h -o testit.x86_64h $<
-
-testit.x86_64: testit.x86_64.o
- $(CC) -arch x86_64 -o testit.x86_64 $<
-
-testit.x86_64h.o: main.c
- $(CC) -g -O0 -arch x86_64h -c -o testit.x86_64h.o $<
-
-testit.x86_64.o: main.c
- $(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o $<
-
-clean::
- rm -rf $(wildcard testit* *~)
diff --git a/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py b/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
deleted file mode 100644
index 93fb358f4c846..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
+++ /dev/null
@@ -1,164 +0,0 @@
-"""Test aspects of lldb commands on universal binaries."""
-
-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
-
-def haswellOrLater():
- features = subprocess.check_output(["sysctl", "machdep.cpu"])
- return "AVX2" in features.split()
-
-class UniversalTestCase(TestBase):
-
- NO_DEBUG_INFO_TESTCASE = True
- 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.')
-
- @add_test_categories(['pyapi'])
- @skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in
- ['x86_64'], "requires x86_64")
- @skipIfDarwinEmbedded # this test file assumes we're targetting an x86 system
- def test_sbdebugger_create_target_with_file_and_target_triple(self):
- """Test the SBDebugger.CreateTargetWithFileAndTargetTriple() API."""
- # Invoke the default build rule.
- self.build()
-
- # Note that "testit" is a universal binary.
- exe = self.getBuildArtifact("testit")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple(
- exe, "x86_64-apple-macosx")
- self.assertTrue(target, VALID_TARGET)
- self.expect("image list -A -b", substrs=["x86_64 testit"])
-
- # 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)
-
- @skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in
- ['x86_64'], "requires x86_64")
- @skipIfDarwinEmbedded # this test file assumes we're targetting an x86 system
- def test_process_launch_for_universal(self):
- """Test process launch of a universal binary."""
- from lldbsuite.test.lldbutil import print_registers
-
- if not haswellOrLater():
- return
-
- # Invoke the default build rule.
- self.build()
-
- # Note that "testit" is a universal binary.
- exe = self.getBuildArtifact("testit")
-
- # By default, x86_64 is assumed if no architecture is specified.
- self.expect("file " + exe, CURRENT_EXECUTABLE_SET,
- startstr="Current executable set to ",
- substrs=["testit' (x86_64h)."])
-
- # Break inside the main.
- lldbutil.run_break_set_by_file_and_line(
- self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
-
- # We should be able to launch the x86_64h executable.
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Check whether we have a x86_64h process launched.
- target = self.dbg.GetSelectedTarget()
- process = target.GetProcess()
- self.expect("image list -A -b", substrs=["x86_64h testit"])
- self.runCmd("continue")
-
- # Now specify x86_64 as the architecture for "testit".
- self.expect("file -a x86_64 " + exe, CURRENT_EXECUTABLE_SET,
- startstr="Current executable set to ",
- substrs=["testit' (x86_64)."])
-
- # Break inside the main.
- lldbutil.run_break_set_by_file_and_line(
- self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
-
- # We should be able to launch the x86_64 executable as well.
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Check whether we have a x86_64 process launched.
-
- # FIXME: This wrong. We are expecting x86_64, but spawning a
- # new process currently doesn't allow specifying a *sub*-architecture.
- # <rdar://problem/46101466>
- self.expect("image list -A -b", substrs=["x86_64h testit"])
- self.runCmd("continue")
-
- @skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in
- ['x86_64'], "requires x86_64")
- @skipIfDarwinEmbedded # this test file assumes we're targetting an x86 system
- def test_process_attach_with_wrong_arch(self):
- """Test that when we attach to a binary from the wrong fork of
- a universal binary, we fix up the ABI correctly."""
- if not haswellOrLater():
- return
-
- # Now keep the architecture at x86_64, but switch the binary
- # we launch to x86_64h, and make sure on attach we switch to
- # the correct architecture.
-
- # Invoke the default build rule.
- self.build()
-
- # Note that "testit" is a universal binary.
- exe = self.getBuildArtifact("testit")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple(
- exe, "x86_64-apple-macosx")
- self.assertTrue(target, VALID_TARGET)
- self.expect("image list -A -b", substrs=["x86_64 testit"])
-
- bkpt = target.BreakpointCreateBySourceRegex(
- "sleep", lldb.SBFileSpec("main.c"))
- self.assertTrue(bkpt.IsValid(), "Valid breakpoint")
- self.assertTrue(
- bkpt.GetNumLocations() >= 1,
- "Our main breakpoint has locations.")
-
- popen = self.spawnSubprocess(exe, ["keep_waiting"])
- self.addTearDownHook(self.cleanupSubprocesses)
-
- error = lldb.SBError()
- empty_listener = lldb.SBListener()
- process = target.AttachToProcessWithID(
- empty_listener, popen.pid, error)
- self.assertTrue(error.Success(), "Attached to process.")
-
- self.expect("image list -A -b", substrs=["x86_64h testit"])
-
- # It may seem odd to check the number of frames, but the bug
- # that motivated this test was that we eventually fixed the
- # architecture, but we left the ABI set to the original value.
- # In that case, if you asked the process for its architecture,
- # it would look right, but since the ABI was wrong,
- # backtracing failed.
-
- threads = lldbutil.continue_to_breakpoint(process, bkpt)
- self.assertTrue(len(threads) == 1)
- thread = threads[0]
- self.assertTrue(
- thread.GetNumFrames() > 1,
- "We were able to backtrace.")
diff --git a/packages/Python/lldbsuite/test/macosx/universal/main.c b/packages/Python/lldbsuite/test/macosx/universal/main.c
deleted file mode 100644
index 3edab51b1f6ad..0000000000000
--- a/packages/Python/lldbsuite/test/macosx/universal/main.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-void
-call_me()
-{
- sleep(1);
-}
-
-int
-main (int argc, char **argv)
-{
- printf ("Hello there!\n"); // Set break point at this line.
- if (argc == 2 && strcmp(argv[1], "keep_waiting") == 0)
- while (1)
- {
- call_me();
- }
- return 0;
-}