Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2017 21:23:57 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r311828 - in vendor/lldb/dist: packages/Python/lldbsuite/test/python_api/value/empty_class scripts source/Plugins/SymbolFile/DWARF source/Symbol
Message-ID:  <201701092123.v09LNvnT096053@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Jan  9 21:23:57 2017
New Revision: 311828
URL: https://svnweb.freebsd.org/changeset/base/311828

Log:
  Vendor import of lldb trunk r291476:
  https://llvm.org/svn/llvm-project/lldb/trunk@291476

Added:
  vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/
  vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/Makefile   (contents, props changed)
  vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/TestValueAPIEmptyClass.py   (contents, props changed)
  vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/main.cpp   (contents, props changed)
Modified:
  vendor/lldb/dist/scripts/CMakeLists.txt
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  vendor/lldb/dist/source/Symbol/ClangASTContext.cpp

Added: vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/Makefile	Mon Jan  9 21:23:57 2017	(r311828)
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/TestValueAPIEmptyClass.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/TestValueAPIEmptyClass.py	Mon Jan  9 21:23:57 2017	(r311828)
@@ -0,0 +1,60 @@
+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 ValueAPIEmptyClassTestCase(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    @add_test_categories(['pyapi'])
+    def test(self):
+        self.build()
+        exe = os.path.join(os.getcwd(), 'a.out')
+        line = line_number('main.cpp', '// Break at this line')
+
+        # Create a target by the debugger.
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        # Create the breakpoint inside function 'main'.
+        breakpoint = target.BreakpointCreateByLocation('main.cpp', line)
+        self.assertTrue(breakpoint, 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)
+
+        # Get Frame #0.
+        self.assertTrue(process.GetState() == lldb.eStateStopped)
+        thread = lldbutil.get_stopped_thread(
+            process, lldb.eStopReasonBreakpoint)
+        self.assertTrue(
+            thread.IsValid(),
+            "There should be a thread stopped due to breakpoint condition")
+        frame0 = thread.GetFrameAtIndex(0)
+
+        # Verify that we can access to a frame variable with an empty class type
+        e = frame0.FindVariable('e')
+        self.assertTrue(e.IsValid(), VALID_VARIABLE)
+        self.DebugSBValue(e)
+        self.assertEqual(e.GetNumChildren(), 0)
+
+        # Verify that we can acces to a frame variable what is a pointer to an
+        # empty class
+        ep = frame0.FindVariable('ep')
+        self.assertTrue(ep.IsValid(), VALID_VARIABLE)
+        self.DebugSBValue(ep)
+
+        # Verify that we can dereference a pointer to an empty class
+        epd = ep.Dereference()
+        self.assertTrue(epd.IsValid(), VALID_VARIABLE)
+        self.DebugSBValue(epd)
+        self.assertEqual(epd.GetNumChildren(), 0)
+

Added: vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/main.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/value/empty_class/main.cpp	Mon Jan  9 21:23:57 2017	(r311828)
@@ -0,0 +1,16 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+class Empty {};
+
+int main (int argc, char const *argv[]) {
+  Empty e;
+  Empty* ep = new Empty;
+  return 0; // Break at this line
+}

Modified: vendor/lldb/dist/scripts/CMakeLists.txt
==============================================================================
--- vendor/lldb/dist/scripts/CMakeLists.txt	Mon Jan  9 21:23:54 2017	(r311827)
+++ vendor/lldb/dist/scripts/CMakeLists.txt	Mon Jan  9 21:23:57 2017	(r311828)
@@ -11,8 +11,13 @@ set(SWIG_HEADERS
 
 include(FindPythonInterp)
 
-set(SWIG_PYTHON_DIR
-  ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+  set(SWIG_PYTHON_DIR
+    ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+else()
+  set(SWIG_PYTHON_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/site-packages)
+endif()
+
 set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
 
 # Generating the LLDB framework correctly is a bit complicated because the
@@ -48,10 +53,8 @@ set_source_files_properties(${CMAKE_CURR
 
 add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
 
-# Install the LLDB python module on all operating systems (except Windows)
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
-endif()
+# Install the LLDB python module
+install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
 
 # build Python modules
 add_subdirectory(Python/modules)

Modified: vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp	Mon Jan  9 21:23:54 2017	(r311827)
+++ vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp	Mon Jan  9 21:23:57 2017	(r311828)
@@ -2647,7 +2647,7 @@ bool DWARFASTParserClang::ParseChildMemb
 
   // Get the parent byte size so we can verify any members will fit
   const uint64_t parent_byte_size =
-      parent_die.GetAttributeValueAsUnsigned(DW_AT_byte_size, UINT64_MAX) * 8;
+      parent_die.GetAttributeValueAsUnsigned(DW_AT_byte_size, UINT64_MAX);
   const uint64_t parent_bit_size =
       parent_byte_size == UINT64_MAX ? UINT64_MAX : parent_byte_size * 8;
 

Modified: vendor/lldb/dist/source/Symbol/ClangASTContext.cpp
==============================================================================
--- vendor/lldb/dist/source/Symbol/ClangASTContext.cpp	Mon Jan  9 21:23:54 2017	(r311827)
+++ vendor/lldb/dist/source/Symbol/ClangASTContext.cpp	Mon Jan  9 21:23:57 2017	(r311828)
@@ -6752,43 +6752,42 @@ CompilerType ClangASTContext::GetChildCo
     }
     break;
 
-  case clang::Type::Pointer:
-    if (idx_is_valid) {
-      CompilerType pointee_clang_type(GetPointeeType(type));
+  case clang::Type::Pointer: {
+    CompilerType pointee_clang_type(GetPointeeType(type));
 
-      // Don't dereference "void *" pointers
-      if (pointee_clang_type.IsVoidType())
-        return CompilerType();
+    // Don't dereference "void *" pointers
+    if (pointee_clang_type.IsVoidType())
+      return CompilerType();
 
-      if (transparent_pointers && pointee_clang_type.IsAggregateType()) {
-        child_is_deref_of_parent = false;
-        bool tmp_child_is_deref_of_parent = false;
-        return pointee_clang_type.GetChildCompilerTypeAtIndex(
-            exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
-            ignore_array_bounds, child_name, child_byte_size, child_byte_offset,
-            child_bitfield_bit_size, child_bitfield_bit_offset,
-            child_is_base_class, tmp_child_is_deref_of_parent, valobj,
-            language_flags);
-      } else {
-        child_is_deref_of_parent = true;
+    if (transparent_pointers && pointee_clang_type.IsAggregateType()) {
+      child_is_deref_of_parent = false;
+      bool tmp_child_is_deref_of_parent = false;
+      return pointee_clang_type.GetChildCompilerTypeAtIndex(
+          exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
+          ignore_array_bounds, child_name, child_byte_size, child_byte_offset,
+          child_bitfield_bit_size, child_bitfield_bit_offset,
+          child_is_base_class, tmp_child_is_deref_of_parent, valobj,
+          language_flags);
+    } else {
+      child_is_deref_of_parent = true;
 
-        const char *parent_name =
-            valobj ? valobj->GetName().GetCString() : NULL;
-        if (parent_name) {
-          child_name.assign(1, '*');
-          child_name += parent_name;
-        }
+      const char *parent_name =
+          valobj ? valobj->GetName().GetCString() : NULL;
+      if (parent_name) {
+        child_name.assign(1, '*');
+        child_name += parent_name;
+      }
 
-        // We have a pointer to an simple type
-        if (idx == 0) {
-          child_byte_size = pointee_clang_type.GetByteSize(
-              exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL);
-          child_byte_offset = 0;
-          return pointee_clang_type;
-        }
+      // We have a pointer to an simple type
+      if (idx == 0) {
+        child_byte_size = pointee_clang_type.GetByteSize(
+            exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL);
+        child_byte_offset = 0;
+        return pointee_clang_type;
       }
     }
     break;
+  }
 
   case clang::Type::LValueReference:
   case clang::Type::RValueReference:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701092123.v09LNvnT096053>