1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
# TestSwiftDifferentClangFlags.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# ------------------------------------------------------------------------------
"""
Test that we use the right compiler flags when debugging
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import os
import os.path
import unittest2
import sys
if sys.version_info.major == 2:
import commands as subprocess
else:
import subprocess
def execute_command(command):
# print '%% %s' % (command)
(exit_status, output) = subprocess.getstatusoutput(command)
# if output:
# print output
# print 'status = %u' % (exit_status)
return exit_status
class TestSwiftDifferentClangFlags(TestBase):
@skipUnlessDarwin
@swiftTest
@skipIf(
debug_info=decorators.no_match("dsym"),
bugnumber="This test requires a stripped binary and a dSYM")
def test_swift_different_clang_flags(self):
"""Test that we use the right compiler flags when debugging"""
self.build()
target, process, thread, modb_breakpoint = \
lldbutil.run_to_source_breakpoint(
self, 'break here', lldb.SBFileSpec("modb.swift"),
exe_name=self.getBuildArtifact("main"),
extra_images=['moda', 'modb'])
main_breakpoint = target.BreakpointCreateBySourceRegex(
'break here',lldb.SBFileSpec('main.swift'))
self.assertTrue(
modb_breakpoint.GetNumLocations() > 0,
VALID_BREAKPOINT)
var = self.frame().FindVariable("myThree")
three = var.GetChildMemberWithName("three")
lldbutil.check_variable(self, var, False, typename="modb.MyStruct")
lldbutil.check_variable(self, three, False, value="3")
process.Continue()
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, main_breakpoint)
var = self.frame().FindVariable("a")
lldbutil.check_variable(self, var, False, value="2")
var = self.frame().FindVariable("b")
lldbutil.check_variable(self, var, False, value="3")
var = self.frame().EvaluateExpression("fA()")
lldbutil.check_variable(self, var, False, value="2")
|