From owner-svn-src-vendor@freebsd.org Wed May 3 20:26:57 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EB3FD5C83D; Wed, 3 May 2017 20:26:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A93C1EB2; Wed, 3 May 2017 20:26:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43KQuDI049192; Wed, 3 May 2017 20:26:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43KQtGk049179; Wed, 3 May 2017 20:26:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705032026.v43KQtGk049179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 3 May 2017 20:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317769 - in vendor/lldb/dist: packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers packages/Python/lldbsuite/test/functionalities/register/intel_xtended_regi... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:26:57 -0000 Author: dim Date: Wed May 3 20:26:55 2017 New Revision: 317769 URL: https://svnweb.freebsd.org/changeset/base/317769 Log: Vendor import of lldb trunk r302069: https://llvm.org/svn/llvm-project/lldb/trunk@302069 Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Foo.h (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.h (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.m vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/Foo.h (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.h (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.m vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/main.m Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp vendor/lldb/dist/source/Symbol/Symtab.cpp Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp Wed May 3 20:26:51 2017 (r317768) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp Wed May 3 20:26:55 2017 (r317769) @@ -14,6 +14,11 @@ int main(int argc, char const *argv[]) { +// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 3.19 +#ifndef PR_MPX_ENABLE_MANAGEMENT + return -1; +#endif + // This call returns 0 only if the CPU and the kernel support Intel(R) MPX. if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0) return -1; Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp Wed May 3 20:26:51 2017 (r317768) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp Wed May 3 20:26:55 2017 (r317769) @@ -29,6 +29,11 @@ main(int argc, char const *argv[]) unsigned int rax, rbx, rcx, rdx; int array[5]; +// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 3.19 +#ifndef PR_MPX_ENABLE_MANAGEMENT + return -1; +#endif + // This call returns 0 only if the CPU and the kernel support Intel(R) MPX. if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0) return -1; Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,24 @@ +LEVEL = ../../../make + +CFLAGS = -g -O0 +LDFLAGS = $(CFLAGS) -lobjc -framework Foundation + +all: a.out libTest.dylib libTestExt.dylib + +libTest.dylib: Test/Test.m + $(CC) $(CFLAGS) -I. -c -o Test.o Test/Test.m + $(CC) $(LDFLAGS) -shared -o libTest.dylib Test.o + dsymutil libTest.dylib + +libTestExt.dylib: TestExt/TestExt.m + $(CC) $(CFLAGS) -I. -c -o TestExt.o TestExt/TestExt.m + $(CC) $(LDFLAGS) -L. -lTest -shared -o libTestExt.dylib TestExt.o + dsymutil libTestExt.dylib + +a.out: main.m libTest.dylib libTestExt.dylib + $(CC) $(LDFLAGS) -I. -L. -lTest -lTestExt -o a.out main.m + +.PHONY: clean + +clean: + rm -rf libTest.dylib libTestExt.dylib a.out Test.o TestExt.o libTest.dylib.dSYM libTest.dylib.dSYM Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Foo.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Foo.h Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,9 @@ +#ifndef __Foo_h__ +#define __Foo_h__ + +typedef struct { + float start; + float duration; +} CMTimeRange; + +#endif Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.h Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,10 @@ +#import +#import + +@interface Test : NSObject { +@public + CMTimeRange _range; +} +- (void) doTest; +@end + Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.m Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,8 @@ +#import "Test.h" + +@implementation Test +- (void) doTest { + NSLog(@"-[Test doTest]"); +} +@end + Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,49 @@ +"""Test that types defined in shared libraries work correctly.""" + +from __future__ import print_function + + +import os +import time +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestRealDefinition(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + def test_frame_var_after_stop_at_implementation(self): + """Test that we can find the implementation for an objective C type""" + if self.getArchitecture() == 'i386': + self.skipTest("requires modern objc runtime") + self.build() + self.common_setup() + + line = line_number('TestExt/TestExt.m', '// break here') + lldbutil.run_break_set_by_file_and_line( + self, 'TestExt.m', line, num_expected_locations=1, loc_exact=True) + + self.runCmd("run", RUN_SUCCEEDED) + + # The stop reason of the thread should be breakpoint. + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs=['stopped', + 'stop reason = breakpoint']) + + self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, + substrs=[' resolved, hit count = 1']) + + # This should display correctly. + self.expect( + "expr 42", + "A simple expression should execute correctly", + substrs=[ + "42"]) + + def common_setup(self): + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/Foo.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/Foo.h Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,9 @@ +#ifndef __Foo_h__ +#define __Foo_h__ + +typedef struct { + float s; + float d; +} CMTimeRange; + +#endif Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.h Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,7 @@ +#import +#import +struct CMTimeRange; + +@interface Test (Stuff) +- (void)doSomethingElse: (CMTimeRange *)range_ptr; +@end Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.m Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,8 @@ +#import "TestExt.h" +#import "Foo.h" + +@implementation Test (Stuff) +- (void)doSomethingElse: (CMTimeRange *)range_ptr { + NSLog(@"doSomethingElse: %p", range_ptr); // break here +} +@end Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/main.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/main.m Wed May 3 20:26:55 2017 (r317769) @@ -0,0 +1,10 @@ +#import +#import + +int main() { + @autoreleasepool { + Test *test = [[Test alloc] init]; + [test doSomethingElse:&test->_range]; + } +} + Modified: vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Wed May 3 20:26:51 2017 (r317768) +++ vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Wed May 3 20:26:55 2017 (r317769) @@ -348,7 +348,7 @@ void ClangASTSource::CompleteType(clang: GetCompleteObjCInterface(original_iface_decl); if (complete_iface_decl && (complete_iface_decl != original_iface_decl)) { - m_ast_importer_sp->SetDeclOrigin(interface_decl, original_iface_decl); + m_ast_importer_sp->SetDeclOrigin(interface_decl, complete_iface_decl); } } } @@ -472,7 +472,7 @@ void ClangASTSource::FindExternalLexical original_decl = complete_iface_decl; original_ctx = &complete_iface_decl->getASTContext(); - m_ast_importer_sp->SetDeclOrigin(context_decl, original_iface_decl); + m_ast_importer_sp->SetDeclOrigin(context_decl, complete_iface_decl); } } Modified: vendor/lldb/dist/source/Symbol/Symtab.cpp ============================================================================== --- vendor/lldb/dist/source/Symbol/Symtab.cpp Wed May 3 20:26:51 2017 (r317768) +++ vendor/lldb/dist/source/Symbol/Symtab.cpp Wed May 3 20:26:55 2017 (r317769) @@ -299,17 +299,24 @@ void Symtab::InitNameIndexes() { const char *const_context = ConstString(cxx_method.GetContext()).GetCString(); - entry_ref = entry.cstring.GetStringRef(); - if (entry_ref[0] == '~' || - !cxx_method.GetQualifiers().empty()) { - // The first character of the demangled basename is '~' which - // means we have a class destructor. We can use this information - // to help us know what is a class and what isn't. - if (class_contexts.find(const_context) == class_contexts.end()) - class_contexts.insert(const_context); - m_method_to_index.Append(entry); + if (!const_context || const_context[0] == 0) { + // No context for this function so this has to be a basename + m_basename_to_index.Append(entry); + // If there is no context (no namespaces or class scopes that + // come before the function name) then this also could be a + // fullname. + m_name_to_index.Append(entry); } else { - if (const_context && const_context[0]) { + entry_ref = entry.cstring.GetStringRef(); + if (entry_ref[0] == '~' || + !cxx_method.GetQualifiers().empty()) { + // The first character of the demangled basename is '~' which + // means we have a class destructor. We can use this information + // to help us know what is a class and what isn't. + if (class_contexts.find(const_context) == class_contexts.end()) + class_contexts.insert(const_context); + m_method_to_index.Append(entry); + } else { if (class_contexts.find(const_context) != class_contexts.end()) { // The current decl context is in our "class_contexts" which @@ -326,14 +333,6 @@ void Symtab::InitNameIndexes() { mangled_name_to_index.Append(entry); symbol_contexts[entry.value] = const_context; } - } else { - // No context for this function so this has to be a basename - m_basename_to_index.Append(entry); - // If there is no context (no namespaces or class scopes that - // come before the function name) then this also could be a - // fullname. - if (cxx_method.GetContext().empty()) - m_name_to_index.Append(entry); } } }