diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
commit | f73363f1dd94996356cefbf24388f561891acf0b (patch) | |
tree | e3c31248bdb36eaec5fd833490d4278162dba2a0 /packages/Python/lldbsuite/test/macosx | |
parent | 160ee69dd7ae18978f4068116777639ea98dc951 (diff) |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/macosx')
34 files changed, 323 insertions, 244 deletions
diff --git a/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile b/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile index 3a363ab98c174..5abcf02738c49 100644 --- a/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile +++ b/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile @@ -13,10 +13,10 @@ ifeq "$(OS)" "Darwin" CFLAGS += -arch $(ARCH) endif -all: clean +all: main.c clean mkdir hide.app mkdir hide.app/Contents - $(CC) $(CFLAGS) -g main.c + $(CC) $(CFLAGS) -g $< mv a.out.dSYM hide.app/Contents strip -x a.out diff --git a/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py b/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py index ec20ee2a24c01..be122f4f500d9 100644 --- a/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py +++ b/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py @@ -25,8 +25,8 @@ class AddDsymMidExecutionCommandCase(TestBase): @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.buildDsym(clean=True) - exe = os.path.join(os.getcwd(), "a.out") + self.buildDefault(dictionary={'MAKE_DSYM':'YES'}) + exe = self.getBuildArtifact("a.out") self.target = self.dbg.CreateTarget(exe) self.assertTrue(self.target, VALID_TARGET) @@ -43,7 +43,8 @@ class AddDsymMidExecutionCommandCase(TestBase): self.assertTrue(self.process.GetState() == lldb.eStateStopped, STOPPED_DUE_TO_BREAKPOINT) - self.runCmd("add-dsym hide.app/Contents/a.out.dSYM") + 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/debug-info/apple_types/Makefile b/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/Makefile deleted file mode 100644 index aa3a0fcdcea48..0000000000000 --- a/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -LEVEL = ../../../make - -C_SOURCES := main.c -MAKE_DSYM := NO - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py b/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py deleted file mode 100644 index ff1ca2a9381ed..0000000000000 --- a/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -Test that clang produces the __apple accelerator tables, for example, __apple_types, correctly. -""" - -from __future__ import print_function - - -import os -import time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil -from lldbsuite.test.lldbutil import symbol_type_to_str - - -class AppleTypesTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - # rdar://problem/11166975 - @skipUnlessDarwin - def test_debug_info_for_apple_types(self): - """Test that __apple_types section does get produced by clang.""" - - if not self.getCompiler().endswith('clang'): - self.skipTest("clang compiler only test") - - self.build() - if self.debug_info == "dsym": - exe = os.path.join(os.getcwd(), - "a.out.dSYM/Contents/Resources/DWARF/a.out") - else: - exe = os.path.join(os.getcwd(), "main.o") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - self.assertTrue(target.GetNumModules() > 0) - - # Hide stdout if not running with '-t' option. - if not self.TraceOn(): - self.HideStdout() - - print("Number of modules for the target: %d" % target.GetNumModules()) - for module in target.module_iter(): - print(module) - - # Get the executable module at index 0. - exe_module = target.GetModuleAtIndex(0) - - dwarf_section = exe_module.FindSection("__DWARF") - self.assertTrue(dwarf_section) - print("__DWARF section:", dwarf_section) - print("Number of sub-sections: %d" % dwarf_section.GetNumSubSections()) - INDENT = ' ' * 4 - for subsec in dwarf_section: - print(INDENT + str(subsec)) - - debug_str_sub_section = dwarf_section.FindSubSection("__debug_str") - self.assertTrue(debug_str_sub_section) - print("__debug_str sub-section:", debug_str_sub_section) - - # Find our __apple_types section by name. - apple_types_sub_section = dwarf_section.FindSubSection("__apple_types") - self.assertTrue(apple_types_sub_section) - print("__apple_types sub-section:", apple_types_sub_section) - - # These other three all important subsections should also be present. - self.assertTrue(dwarf_section.FindSubSection("__apple_names") and - dwarf_section.FindSubSection("__apple_namespac") and - dwarf_section.FindSubSection("__apple_objc")) diff --git a/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/main.c b/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/main.c deleted file mode 100644 index cb4bdb9c16b42..0000000000000 --- a/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/main.c +++ /dev/null @@ -1,27 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -int main (int argc, char const *argv[]) -{ - struct point_tag { - int x; - int y; - }; // Set break point at this line. - - struct rect_tag { - struct point_tag bottom_left; - struct point_tag top_right; - }; - struct point_tag pt = { 2, 3 }; // This is the first executable statement. - struct rect_tag rect = {{1,2}, {3,4}}; - pt.x = argc; - pt.y = argc * argc; - rect.top_right.x = rect.top_right.x + argc; - rect.top_right.y = rect.top_right.y + argc; - return 0; -} diff --git a/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/Makefile b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/Makefile new file mode 100644 index 0000000000000..5bb3a3ce3f102 --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/Makefile @@ -0,0 +1,22 @@ +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 new file mode 100644 index 0000000000000..1af2463fe7b84 --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/TestDuplicateMembers.py @@ -0,0 +1,55 @@ +"""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 new file mode 100644 index 0000000000000..402a6270c9c7f --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/a.c @@ -0,0 +1,14 @@ +//===-- 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 new file mode 100644 index 0000000000000..c5b1cc2f0d1c4 --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/main.c @@ -0,0 +1,17 @@ +//===-- 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 new file mode 100644 index 0000000000000..814d4e8b44e81 --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/duplicate-archive-members/sub1/a.c @@ -0,0 +1,14 @@ +//===-- 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 new file mode 100644 index 0000000000000..18a4934cca370 --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile @@ -0,0 +1,21 @@ +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 new file mode 100644 index 0000000000000..a47f72bb14da8 --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist @@ -0,0 +1,30 @@ +<?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 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/MacOS/.empty 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 new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Resources/.empty 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 new file mode 100644 index 0000000000000..af6beeefd391f --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py @@ -0,0 +1,66 @@ +""" +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 new file mode 100644 index 0000000000000..27a0cdc01a9ae --- /dev/null +++ b/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/main.c @@ -0,0 +1,9 @@ +#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 index 7b321e3deae0a..313c83e990d56 100644 --- 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 @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -7,7 +9,7 @@ endif CFLAGS ?= -g -O0 -arch $(ARCH) all: clean - $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd bundle.c + $(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 @@ -15,7 +17,7 @@ all: clean 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 main.c + $(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 index 104e88752ec22..9a046cf0b294d 100644 --- 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 @@ -37,8 +37,9 @@ class BundleWithDotInFilenameTestCase(TestBase): def test_attach_and_check_dsyms(self): """Test attach to binary, see if the bundle dSYM is found""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) self.build() + os.chdir(self.getBuildDir()); popen = self.spawnSubprocess(exe) self.addTearDownHook(self.cleanupSubprocesses) @@ -66,6 +67,7 @@ class BundleWithDotInFilenameTestCase(TestBase): 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/deep-bundle/Makefile b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile index 33b09502378c3..d52d6f1f0d37d 100644 --- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile +++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -7,12 +9,12 @@ endif CFLAGS ?= -g -O0 -arch $(ARCH) all: clean - $(CC) $(CFLAGS) -install_name $(PWD)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework myframework.c + $(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 MyFramework.h MyFramework.framework/Versions/A/Headers - cp Info.plist MyFramework.framework/Versions/A/Resources + 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 . ) @@ -21,8 +23,8 @@ all: clean mkdir hide.app rm -f MyFramework tar cf - MyFramework.framework MyFramework.framework.dSYM | ( cd hide.app;tar xBpf -) - $(CC) $(CFLAGS) -o deep-bundle main.c -F. -framework MyFramework - + $(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/TestDeepBundle.py b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py index 493c4b99d094b..d6123e39c3fef 100644 --- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py +++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py @@ -37,9 +37,9 @@ class DeepBundleTestCase(TestBase): def test_attach_and_check_dsyms(self): """Test attach to binary, see if the framework dSYM is found""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) self.build() - popen = self.spawnSubprocess(exe) + 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 @@ -49,7 +49,6 @@ class DeepBundleTestCase(TestBase): # 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() 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 index 19715216d6cfc..b5ef5cff74a39 100644 --- a/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c +++ b/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c @@ -1,12 +1,17 @@ #include <MyFramework/MyFramework.h> #include <unistd.h> +#include <stdio.h> #include <stdlib.h> int setup_is_complete = 0; -int main() +int main(int argc, const char **argv) { - system ("/bin/rm -rf MyFramework MyFramework.framework MyFramework.framework.dSYM"); + 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; diff --git a/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile b/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile index 07aa39eac3beb..69fd86e575e6d 100644 --- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile +++ b/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile @@ -1,14 +1,6 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif - -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +LEVEL = ../../make -CFLAGS ?= -g -O0 -CWD := $(shell pwd) +include $(LEVEL)/Makefile.rules LIB_PREFIX := lib @@ -28,21 +20,21 @@ 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: main.c - $(CC) $(CFLAGS) -c main.c +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: indirect.c - $(CC) $(CFLAGS) -c indirect.c +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,$(CWD)/alias.list + $(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: reexport.c - $(CC) $(CFLAGS) -c reexport.c -clean: +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 index afca8bcc0ded7..a87a628931093 100644 --- a/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py +++ b/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py @@ -26,14 +26,14 @@ class TestIndirectFunctions(TestBase): def test_with_python_api(self): """Test stepping and setting breakpoints in indirect and re-exported symbols.""" self.build() - exe = os.path.join(os.getcwd(), "a.out") + exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) if self.platformIsDarwin(): - lib1 = os.path.join(os.getcwd(), 'libindirect.dylib') - lib2 = os.path.join(os.getcwd(), 'libreexport.dylib') + lib1 = self.getBuildArtifact('libindirect.dylib') + lib2 = self.getBuildArtifact('libreexport.dylib') self.registerSharedLibrariesWithTarget(target, [lib1, lib2]) self.main_source_spec = lldb.SBFileSpec(self.main_source) diff --git a/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py b/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py index c2a27c5708986..59b325f579842 100644 --- a/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py +++ b/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py @@ -15,21 +15,20 @@ import re import sys from lldbsuite.test.decorators import * -from lldbsuite.test import lldbtest +from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbtest_config -class DarwinNSLogOutputTestCase(lldbtest.TestBase): +class DarwinNSLogOutputTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True - - mydir = lldbtest.TestBase.compute_mydir(__file__) + 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(). - super(DarwinNSLogOutputTestCase, self).setUp() + TestBase.setUp(self) self.child = None self.child_prompt = '(lldb) ' self.strict_sources = False @@ -38,11 +37,11 @@ class DarwinNSLogOutputTestCase(lldbtest.TestBase): self.source = 'main.m' # Output filename. - self.exe_name = 'a.out' + self.exe_name = self.getBuildArtifact("a.out") self.d = {'OBJC_SOURCES': self.source, 'EXE': self.exe_name} # Locate breakpoint. - self.line = lldbtest.line_number(self.source, '// break here') + self.line = line_number(self.source, '// break here') def tearDown(self): # Shut down the process if it's still running. @@ -111,7 +110,7 @@ class DarwinNSLogOutputTestCase(lldbtest.TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.run_lldb_to_breakpoint(exe, self.source, self.line, settings_commands=settings_commands) self.expect_prompt() diff --git a/packages/Python/lldbsuite/test/macosx/order/Makefile b/packages/Python/lldbsuite/test/macosx/order/Makefile index 52fae2d2ca34d..ff5f1886ef561 100644 --- a/packages/Python/lldbsuite/test/macosx/order/Makefile +++ b/packages/Python/lldbsuite/test/macosx/order/Makefile @@ -1,7 +1,7 @@ LEVEL = ../../make C_SOURCES := main.c -LDFLAGS = $(CFLAGS) -Xlinker -order_file -Xlinker ./order-file +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 index a70878f73e2ce..e7a4b20cd6bc0 100644 --- a/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py +++ b/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py @@ -22,12 +22,12 @@ class OrderFileTestCase(TestBase): def test(self): """Test debug symbols follow the correct order by the order file.""" self.build() - exe = os.path.join(os.getcwd(), "a.out") + 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 a.out") + 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) diff --git a/packages/Python/lldbsuite/test/macosx/queues/Makefile b/packages/Python/lldbsuite/test/macosx/queues/Makefile index 93f2f7b2f340d..0d70f25950192 100644 --- a/packages/Python/lldbsuite/test/macosx/queues/Makefile +++ b/packages/Python/lldbsuite/test/macosx/queues/Makefile @@ -1,28 +1,5 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LEVEL = ../../make -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +C_SOURCES := main.c -CFLAGS ?= -g -O0 -CWD := $(shell pwd) - -LIB_PREFIX := lib - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -all: a.out - -a.out: main.o - $(CC) $(CFLAGS) -o a.out main.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c - -clean: - rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM) +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py b/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py index 8eabe9a76637e..ba58372ce5b78 100644 --- a/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py +++ b/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py @@ -105,7 +105,7 @@ class TestQueues(TestBase): def queues(self): """Test queues inspection SB APIs without libBacktraceRecording.""" - exe = os.path.join(os.getcwd(), "a.out") + exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) @@ -246,7 +246,7 @@ class TestQueues(TestBase): def queues_with_libBacktraceRecording(self): """Test queues inspection SB APIs with libBacktraceRecording present.""" - exe = os.path.join(os.getcwd(), "a.out") + exe = self.getBuildArtifact("a.out") if not os.path.isfile( '/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib'): diff --git a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile b/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile index 93f2f7b2f340d..0d70f25950192 100644 --- a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile +++ b/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile @@ -1,28 +1,5 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LEVEL = ../../make -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +C_SOURCES := main.c -CFLAGS ?= -g -O0 -CWD := $(shell pwd) - -LIB_PREFIX := lib - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -all: a.out - -a.out: main.o - $(CC) $(CFLAGS) -o a.out main.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c - -clean: - rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM) +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 index 096064896eaa4..314084d0b1584 100644 --- a/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py +++ b/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py @@ -26,7 +26,7 @@ class TestSafeFuncCalls(TestBase): def test_with_python_api(self): """Test function call thread safety.""" self.build() - exe = os.path.join(os.getcwd(), "a.out") + exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) diff --git a/packages/Python/lldbsuite/test/macosx/thread-names/Makefile b/packages/Python/lldbsuite/test/macosx/thread-names/Makefile index 93f2f7b2f340d..0d70f25950192 100644 --- a/packages/Python/lldbsuite/test/macosx/thread-names/Makefile +++ b/packages/Python/lldbsuite/test/macosx/thread-names/Makefile @@ -1,28 +1,5 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LEVEL = ../../make -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +C_SOURCES := main.c -CFLAGS ?= -g -O0 -CWD := $(shell pwd) - -LIB_PREFIX := lib - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -all: a.out - -a.out: main.o - $(CC) $(CFLAGS) -o a.out main.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c - -clean: - rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM) +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 index ae2916c92de97..925dc92951ced 100644 --- a/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py +++ b/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py @@ -23,7 +23,7 @@ class TestInterruptThreadNames(TestBase): def test_with_python_api(self): """Test that we get thread names when interrupting a process.""" self.build() - exe = os.path.join(os.getcwd(), "a.out") + exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) diff --git a/packages/Python/lldbsuite/test/macosx/universal/Makefile b/packages/Python/lldbsuite/test/macosx/universal/Makefile index 854c78ed8c298..d74ed26f50ab7 100644 --- a/packages/Python/lldbsuite/test/macosx/universal/Makefile +++ b/packages/Python/lldbsuite/test/macosx/universal/Makefile @@ -1,19 +1,21 @@ CC ?= clang +all: testit + testit: testit.i386 testit.x86_64 - lipo -create -o testit testit.i386 testit.x86_64 + lipo -create -o testit $^ testit.i386: testit.i386.o - $(CC) -arch i386 -o testit.i386 testit.i386.o + $(CC) -arch i386 -o testit.i386 $< testit.x86_64: testit.x86_64.o - $(CC) -arch x86_64 -o testit.x86_64 testit.x86_64.o + $(CC) -arch x86_64 -o testit.x86_64 $< testit.i386.o: main.c - $(CC) -g -O0 -arch i386 -c -o testit.i386.o main.c + $(CC) -g -O0 -arch i386 -c -o testit.i386.o $< testit.x86_64.o: main.c - $(CC) -g -O0 -arch x86_64 -c -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 index 9a690e3ebb0ba..ca4f3ce9b1373 100644 --- a/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py +++ b/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py @@ -33,7 +33,7 @@ class UniversalTestCase(TestBase): self.build() # Note that "testit" is a universal binary. - exe = os.path.join(os.getcwd(), "testit") + exe = self.getBuildArtifact("testit") # Create a target by the debugger. target = self.dbg.CreateTargetWithFileAndTargetTriple( @@ -57,7 +57,7 @@ class UniversalTestCase(TestBase): self.build() # Note that "testit" is a universal binary. - exe = os.path.join(os.getcwd(), "testit") + exe = self.getBuildArtifact("testit") # By default, x86_64 is assumed if no architecture is specified. self.expect("file " + exe, CURRENT_EXECUTABLE_SET, @@ -130,7 +130,7 @@ class UniversalTestCase(TestBase): self.build() # Note that "testit" is a universal binary. - exe = os.path.join(os.getcwd(), "testit") + exe = self.getBuildArtifact("testit") # Create a target by the debugger. target = self.dbg.CreateTargetWithFileAndTargetTriple( |