Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Dec 2017 01:12:47 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r327137 - in projects/clang600-import/contrib/llvm/tools/lldb: include/lldb/Interpreter include/lldb/Symbol include/lldb/Target include/lldb/Utility source/Interpreter source/Plugins/Di...
Message-ID:  <201712240112.vBO1ClKe082564@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sun Dec 24 01:12:46 2017
New Revision: 327137
URL: https://svnweb.freebsd.org/changeset/base/327137

Log:
  Merge lldb trunk r321414 to contrib/llvm/tools/lldb.

Modified:
  projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
  projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h
  projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Target/Target.h
  projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferLLVM.h
  projects/clang600-import/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  projects/clang600-import/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Target/Target.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/source/Utility/DataBufferLLVM.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
  projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MIUtilString.cpp
Directory Properties:
  projects/clang600-import/contrib/llvm/tools/lldb/   (props changed)

Modified: projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h	Sun Dec 24 01:12:46 2017	(r327137)
@@ -77,7 +77,7 @@ class OptionValueFileSpec : public OptionValue { (publ
 
   void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
 
-  const lldb::DataBufferSP &GetFileContents(bool null_terminate);
+  const lldb::DataBufferSP &GetFileContents();
 
   void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
 

Modified: projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h	Sun Dec 24 01:12:46 2017	(r327137)
@@ -879,6 +879,9 @@ class ObjectFile : public std::enable_shared_from_this
 
   ConstString GetNextSyntheticSymbolName();
 
+  static lldb::DataBufferSP MapFileData(const FileSpec &file, uint64_t Size,
+                                        uint64_t Offset);
+
 private:
   DISALLOW_COPY_AND_ASSIGN(ObjectFile);
 };

Modified: projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Target/Target.h
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Target/Target.h	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Target/Target.h	Sun Dec 24 01:12:46 2017	(r327137)
@@ -161,7 +161,7 @@ class TargetProperties : public Properties { (public)
 
   lldb::LanguageType GetLanguage() const;
 
-  const char *GetExpressionPrefixContentsAsCString();
+  llvm::StringRef GetExpressionPrefixContents();
 
   bool GetUseHexImmediates() const;
 

Modified: projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferLLVM.h
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferLLVM.h	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferLLVM.h	Sun Dec 24 01:12:46 2017	(r327137)
@@ -17,7 +17,7 @@
 #include <stdint.h> // for uint8_t, uint64_t
 
 namespace llvm {
-class MemoryBuffer;
+class WritableMemoryBuffer;
 class Twine;
 }
 
@@ -28,10 +28,10 @@ class DataBufferLLVM : public DataBuffer { (public)
   ~DataBufferLLVM();
 
   static std::shared_ptr<DataBufferLLVM>
-  CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset, bool Private = false);
+  CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset);
 
   static std::shared_ptr<DataBufferLLVM>
-  CreateFromPath(const llvm::Twine &Path, bool NullTerminate = false, bool Private = false);
+  CreateFromPath(const llvm::Twine &Path);
 
   uint8_t *GetBytes() override;
   const uint8_t *GetBytes() const override;
@@ -42,10 +42,9 @@ class DataBufferLLVM : public DataBuffer { (public)
 private:
   /// \brief Construct a DataBufferLLVM from \p Buffer.  \p Buffer must be a
   /// valid pointer.
-  explicit DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> Buffer);
-  const uint8_t *GetBuffer() const;
+  explicit DataBufferLLVM(std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
 
-  std::unique_ptr<llvm::MemoryBuffer> Buffer;
+  std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;
 };
 }
 

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -113,14 +113,12 @@ size_t OptionValueFileSpec::AutoComplete(
   return matches.GetSize();
 }
 
-const lldb::DataBufferSP &
-OptionValueFileSpec::GetFileContents(bool null_terminate) {
+const lldb::DataBufferSP &OptionValueFileSpec::GetFileContents() {
   if (m_current_value) {
     const auto file_mod_time = FileSystem::GetModificationTime(m_current_value);
     if (m_data_sp && m_data_mod_time == file_mod_time)
       return m_data_sp;
-    m_data_sp = DataBufferLLVM::CreateFromPath(m_current_value.GetPath(),
-                                               null_terminate);
+    m_data_sp = DataBufferLLVM::CreateFromPath(m_current_value.GetPath());
     m_data_mod_time = file_mod_time;
   }
   return m_data_sp;

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -1127,6 +1127,11 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &a
       features_str += "+dspr2,";
   }
 
+  // If any AArch64 variant, enable the ARMv8.2 ISA
+  // extensions so we can disassemble newer instructions.
+  if (triple.getArch() == llvm::Triple::aarch64)
+    features_str += "+v8.2a";
+
   m_disasm_ap.reset(new LLVMCDisassembler(triple_str, cpu, features_str.c_str(),
                                           flavor, *this));
   if (!m_disasm_ap->IsValid()) {

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -24,7 +24,6 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataBufferLLVM.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/Stream.h"
@@ -406,8 +405,7 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::
                                           lldb::offset_t file_offset,
                                           lldb::offset_t length) {
   if (!data_sp) {
-    data_sp =
-        DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset, true);
+    data_sp = MapFileData(*file, length, file_offset);
     if (!data_sp)
       return nullptr;
     data_offset = 0;
@@ -424,8 +422,7 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::
 
   // Update the data to contain the entire file if it doesn't already
   if (data_sp->GetByteSize() < length) {
-    data_sp =
-        DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset, true);
+    data_sp = MapFileData(*file, length, file_offset);
     if (!data_sp)
       return nullptr;
     data_offset = 0;
@@ -684,8 +681,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
           size_t section_header_end = header.e_shoff + header.e_shentsize;
           if (header.HasHeaderExtension() &&
             section_header_end > data_sp->GetByteSize()) {
-            data_sp = DataBufferLLVM::CreateSliceFromPath(
-                file.GetPath(), section_header_end, file_offset);
+            data_sp = MapFileData(file, section_header_end, file_offset);
             if (data_sp) {
               data.SetData(data_sp);
               lldb::offset_t header_offset = data_offset;
@@ -698,8 +694,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
           section_header_end =
               header.e_shoff + header.e_shnum * header.e_shentsize;
           if (section_header_end > data_sp->GetByteSize()) {
-            data_sp = DataBufferLLVM::CreateSliceFromPath(
-                file.GetPath(), section_header_end, file_offset);
+            data_sp = MapFileData(file, section_header_end, file_offset);
             if (data_sp)
               data.SetData(data_sp);
           }
@@ -741,8 +736,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
                 size_t program_headers_end =
                     header.e_phoff + header.e_phnum * header.e_phentsize;
                 if (program_headers_end > data_sp->GetByteSize()) {
-                  data_sp = DataBufferLLVM::CreateSliceFromPath(
-                      file.GetPath(), program_headers_end, file_offset);
+                  data_sp = MapFileData(file, program_headers_end, file_offset);
                   if (data_sp)
                     data.SetData(data_sp);
                 }
@@ -757,8 +751,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
                 }
 
                 if (segment_data_end > data_sp->GetByteSize()) {
-                  data_sp = DataBufferLLVM::CreateSliceFromPath(
-                      file.GetPath(), segment_data_end, file_offset);
+                  data_sp = MapFileData(file, segment_data_end, file_offset);
                   if (data_sp)
                     data.SetData(data_sp);
                 }
@@ -767,8 +760,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
                     CalculateELFNotesSegmentsCRC32(program_headers, data);
               } else {
                 // Need to map entire file into memory to calculate the crc.
-                data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), -1,
-                                                         file_offset);
+                data_sp = MapFileData(file, -1, file_offset);
                 if (data_sp) {
                   data.SetData(data_sp);
                   gnu_debuglink_crc = calc_gnu_debuglink_crc32(

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -60,6 +60,7 @@ StateType GDBRemoteClientBase::SendContinuePacketAndWa
         continue;
       if (steady_clock::now() >= m_interrupt_time + kInterruptTimeout)
         return eStateInvalid;
+      break;
     }
     case PacketResult::Success:
       break;

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -1743,8 +1743,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const S
                       "DWARF DW_TAG_array_type DIE at 0x%8.8x has a "
                       "class/union/struct element type DIE 0x%8.8x that is a "
                       "forward declaration, not a complete definition.\nTry "
-                      "compiling the source file with -fno-limit-debug-info or "
-                      "disable -gmodule",
+                      "compiling the source file with -fstandalone-debug or "
+                      "disable -gmodules",
                       die.GetOffset(), type_die_ref.die_offset);
                 else
                   module_sp->ReportError(
@@ -2255,7 +2255,7 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const 
                 if (die.GetCU()->GetProducer() ==
                     DWARFCompileUnit::eProducerClang)
                   module->ReportError(":: Try compiling the source file with "
-                                      "-fno-limit-debug-info.");
+                                      "-fstandalone-debug.");
 
                 // We have no choice other than to pretend that the base class
                 // is complete. If we don't do this, clang will crash when we
@@ -3095,7 +3095,7 @@ bool DWARFASTParserClang::ParseChildMembers(
                       "DWARF DIE at 0x%8.8x (class %s) has a member variable "
                       "0x%8.8x (%s) whose type is a forward declaration, not a "
                       "complete definition.\nTry compiling the source file "
-                      "with -fno-limit-debug-info",
+                      "with -fstandalone-debug",
                       parent_die.GetOffset(), parent_die.GetName(),
                       die.GetOffset(), name);
                 else

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -124,6 +124,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(c
   } else if (auto type_def = llvm::dyn_cast<PDBSymbolTypeTypedef>(&type)) {
     lldb_private::Type *target_type =
         m_ast.GetSymbolFile()->ResolveTypeUID(type_def->getTypeId());
+    if (!target_type)
+      return nullptr;
     std::string name = type_def->getName();
     uint64_t bytes = type_def->getLength();
     if (!target_type)
@@ -179,6 +181,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(c
 
     lldb_private::Type *element_type =
         m_ast.GetSymbolFile()->ResolveTypeUID(element_uid);
+    if (!element_type)
+      return nullptr;
     CompilerType element_ast_type = element_type->GetFullCompilerType();
     CompilerType array_ast_type =
         m_ast.CreateArrayType(element_ast_type, num_elements, false);

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -19,14 +19,18 @@
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/TypeMap.h"
+#include "lldb/Utility/RegularExpression.h"
 
 #include "llvm/DebugInfo/PDB/GenericError.h"
+#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
 #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
+#include "llvm/DebugInfo/PDB/IPDBTable.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
@@ -93,6 +97,10 @@ SymbolFilePDB::SymbolFilePDB(lldb_private::ObjectFile 
 SymbolFilePDB::~SymbolFilePDB() {}
 
 uint32_t SymbolFilePDB::CalculateAbilities() {
+  uint32_t abilities = 0;
+  if (!m_obj_file)
+    return 0;
+
   if (!m_session_up) {
     // Lazily load and match the PDB file, but only do this once.
     std::string exePath = m_obj_file->GetFileSpec().GetPath();
@@ -100,10 +108,46 @@ uint32_t SymbolFilePDB::CalculateAbilities() {
                                 m_session_up);
     if (error) {
       llvm::consumeError(std::move(error));
-      return 0;
+      auto module_sp = m_obj_file->GetModule();
+      if (!module_sp)
+        return 0;
+      // See if any symbol file is specified through `--symfile` option.
+      FileSpec symfile = module_sp->GetSymbolFileFileSpec();
+      if (!symfile)
+        return 0;
+      error = loadDataForPDB(PDB_ReaderType::DIA,
+                             llvm::StringRef(symfile.GetPath()),
+                             m_session_up);
+      if (error) {
+        llvm::consumeError(std::move(error));
+        return 0;
+      }
     }
   }
-  return CompileUnits | LineTables;
+  if (!m_session_up.get())
+    return 0;
+
+  auto enum_tables_up = m_session_up->getEnumTables();
+  if (!enum_tables_up)
+    return 0;
+  while (auto table_up = enum_tables_up->getNext()) {
+    if (table_up->getItemCount() == 0)
+      continue;
+    auto type = table_up->getTableType();
+    switch (type) {
+    case PDB_TableType::Symbols:
+      // This table represents a store of symbols with types listed in
+      // PDBSym_Type
+      abilities |= (CompileUnits | Functions | Blocks |
+                    GlobalVariables | LocalVariables | VariableTypes);
+      break;
+    case PDB_TableType::LineNumbers:
+      abilities |= LineTables;
+      break;
+    default: break;
+    }
+  }
+  return abilities;
 }
 
 void SymbolFilePDB::InitializeObject() {
@@ -250,7 +294,8 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb
     return nullptr;
 
   lldb::TypeSP result = pdb->CreateLLDBTypeFromPDBType(*pdb_type);
-  m_types.insert(std::make_pair(type_uid, result));
+  if (result.get())
+    m_types.insert(std::make_pair(type_uid, result));
   return result.get();
 }
 
@@ -385,19 +430,16 @@ uint32_t SymbolFilePDB::FindTypes(
 
   std::string name_str = name.AsCString();
 
-  // If this might be a regex, we have to return EVERY symbol and process them
-  // one by one, which is going to destroy performance on large PDB files.  So
-  // try really hard not to use a regex match.
-  if (name_str.find_first_of("[]?*.-+\\") != std::string::npos)
-    FindTypesByRegex(name_str, max_matches, types);
-  else
-    FindTypesByName(name_str, max_matches, types);
+  // There is an assumption 'name' is not a regex
+  FindTypesByName(name_str, max_matches, types);
+   
   return types.GetSize();
 }
 
-void SymbolFilePDB::FindTypesByRegex(const std::string &regex,
-                                     uint32_t max_matches,
-                                     lldb_private::TypeMap &types) {
+void
+SymbolFilePDB::FindTypesByRegex(const lldb_private::RegularExpression &regex,
+                                uint32_t max_matches,
+                                lldb_private::TypeMap &types) {
   // When searching by regex, we need to go out of our way to limit the search
   // space as much as possible since this searches EVERYTHING in the PDB,
   // manually doing regex comparisons.  PDB library isn't optimized for regex
@@ -409,8 +451,6 @@ void SymbolFilePDB::FindTypesByRegex(const std::string
   auto global = m_session_up->getGlobalScope();
   std::unique_ptr<IPDBEnumSymbols> results;
 
-  std::regex re(regex);
-
   uint32_t matches = 0;
 
   for (auto tag : tags_to_search) {
@@ -433,7 +473,7 @@ void SymbolFilePDB::FindTypesByRegex(const std::string
         continue;
       }
 
-      if (!std::regex_match(type_name, re))
+      if (!regex.Execute(type_name))
         continue;
 
       // This should cause the type to get cached and stored in the `m_types`

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h	Sun Dec 24 01:12:46 2017	(r327137)
@@ -172,7 +172,8 @@ class SymbolFilePDB : public lldb_private::SymbolFile 
       const llvm::pdb::PDBSymbolCompiland &cu,
       llvm::DenseMap<uint32_t, uint32_t> &index_map) const;
 
-  void FindTypesByRegex(const std::string &regex, uint32_t max_matches,
+  void FindTypesByRegex(const lldb_private::RegularExpression &regex,
+                        uint32_t max_matches,
                         lldb_private::TypeMap &types);
 
   void FindTypesByName(const std::string &name, uint32_t max_matches,

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Symbol/ObjectFile.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -688,3 +688,8 @@ Status ObjectFile::LoadInMemory(Target &target, bool s
 void ObjectFile::RelocateSection(lldb_private::Section *section)
 {
 }
+
+DataBufferSP ObjectFile::MapFileData(const FileSpec &file, uint64_t Size,
+                                     uint64_t Offset) {
+  return DataBufferLLVM::CreateSliceFromPath(file.GetPath(), Size, Offset);
+}

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Target/Target.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Target/Target.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Target/Target.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -2313,7 +2313,7 @@ ExpressionResults Target::EvaluateExpression(
     result_valobj_sp = persistent_var_sp->GetValueObject();
     execution_results = eExpressionCompleted;
   } else {
-    const char *prefix = GetExpressionPrefixContentsAsCString();
+    llvm::StringRef prefix = GetExpressionPrefixContents();
     Status error;
     execution_results = UserExpression::Evaluate(exe_ctx, options, expr, prefix,
                                                  result_valobj_sp, error,
@@ -4046,18 +4046,19 @@ LanguageType TargetProperties::GetLanguage() const {
   return LanguageType();
 }
 
-const char *TargetProperties::GetExpressionPrefixContentsAsCString() {
+llvm::StringRef TargetProperties::GetExpressionPrefixContents() {
   const uint32_t idx = ePropertyExprPrefix;
   OptionValueFileSpec *file =
       m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
                                                                idx);
   if (file) {
-    const bool null_terminate = true;
-    DataBufferSP data_sp(file->GetFileContents(null_terminate));
+    DataBufferSP data_sp(file->GetFileContents());
     if (data_sp)
-      return (const char *)data_sp->GetBytes();
+      return llvm::StringRef(
+          reinterpret_cast<const char *>(data_sp->GetBytes()),
+          data_sp->GetByteSize());
   }
-  return nullptr;
+  return "";
 }
 
 bool TargetProperties::GetBreakpointsConsultPlatformAvoidList() {

Modified: projects/clang600-import/contrib/llvm/tools/lldb/source/Utility/DataBufferLLVM.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/source/Utility/DataBufferLLVM.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/source/Utility/DataBufferLLVM.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -18,7 +18,8 @@
 
 using namespace lldb_private;
 
-DataBufferLLVM::DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> MemBuffer)
+DataBufferLLVM::DataBufferLLVM(
+    std::unique_ptr<llvm::WritableMemoryBuffer> MemBuffer)
     : Buffer(std::move(MemBuffer)) {
   assert(Buffer != nullptr &&
          "Cannot construct a DataBufferLLVM with a null buffer");
@@ -28,13 +29,13 @@ DataBufferLLVM::~DataBufferLLVM() {}
 
 std::shared_ptr<DataBufferLLVM>
 DataBufferLLVM::CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size,
-                               uint64_t Offset, bool Private) {
+                                    uint64_t Offset) {
   // If the file resides non-locally, pass the volatile flag so that we don't
   // mmap it.
-  if (!Private)
-    Private = !llvm::sys::fs::is_local(Path);
+  bool IsVolatile = !llvm::sys::fs::is_local(Path);
 
-  auto Buffer = llvm::MemoryBuffer::getFileSlice(Path, Size, Offset, Private);
+  auto Buffer =
+      llvm::WritableMemoryBuffer::getFileSlice(Path, Size, Offset, IsVolatile);
   if (!Buffer)
     return nullptr;
   return std::shared_ptr<DataBufferLLVM>(
@@ -42,13 +43,12 @@ DataBufferLLVM::CreateSliceFromPath(const llvm::Twine 
 }
 
 std::shared_ptr<DataBufferLLVM>
-DataBufferLLVM::CreateFromPath(const llvm::Twine &Path, bool NullTerminate, bool Private) {
+DataBufferLLVM::CreateFromPath(const llvm::Twine &Path) {
   // If the file resides non-locally, pass the volatile flag so that we don't
   // mmap it.
-  if (!Private)
-    Private = !llvm::sys::fs::is_local(Path);
+  bool IsVolatile = !llvm::sys::fs::is_local(Path);
 
-  auto Buffer = llvm::MemoryBuffer::getFile(Path, -1, NullTerminate, Private);
+  auto Buffer = llvm::WritableMemoryBuffer::getFile(Path, -1, IsVolatile);
   if (!Buffer)
     return nullptr;
   return std::shared_ptr<DataBufferLLVM>(
@@ -56,15 +56,13 @@ DataBufferLLVM::CreateFromPath(const llvm::Twine &Path
 }
 
 uint8_t *DataBufferLLVM::GetBytes() {
-  return const_cast<uint8_t *>(GetBuffer());
+  return reinterpret_cast<uint8_t *>(Buffer->getBufferStart());
 }
 
-const uint8_t *DataBufferLLVM::GetBytes() const { return GetBuffer(); }
+const uint8_t *DataBufferLLVM::GetBytes() const {
+  return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
+}
 
 lldb::offset_t DataBufferLLVM::GetByteSize() const {
   return Buffer->getBufferSize();
-}
-
-const uint8_t *DataBufferLLVM::GetBuffer() const {
-  return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
 }

Modified: projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -18,6 +18,7 @@
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBThread.h"
 #include "lldb/API/SBUnixSignals.h"
+#include "llvm/Support/Compiler.h"
 #ifdef _WIN32
 #include <io.h> // For the ::_access()
 #else
@@ -899,6 +900,7 @@ bool CMICmnLLDBDebuggerHandleEvents::HandleProcessEven
     bOk = HandleProcessEventStateStopped(vEvent, bShouldBrk);
     if (bShouldBrk)
       break;
+    LLVM_FALLTHROUGH;
   case lldb::eStateCrashed:
   case lldb::eStateSuspended:
     pEventType = "eStateSuspended";

Modified: projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MIUtilString.cpp
==============================================================================
--- projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MIUtilString.cpp	Sun Dec 24 01:11:19 2017	(r327136)
+++ projects/clang600-import/contrib/llvm/tools/lldb/tools/lldb-mi/MIUtilString.cpp	Sun Dec 24 01:12:46 2017	(r327137)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // Third party headers
+#include "llvm/Support/Compiler.h"
 #include <cstdlib>
 #include <inttypes.h> // for PRIx8
 #include <limits.h>   // for ULONG_MAX
@@ -890,7 +891,7 @@ CMIUtilString CMIUtilString::ConvertToPrintableASCII(c
   case '"':
     if (bEscapeQuotes)
       return "\\\"";
-  // fall thru
+    LLVM_FALLTHROUGH;
   default:
     if (::isprint(vChar))
       return Format("%c", vChar);
@@ -924,7 +925,7 @@ CMIUtilString::ConvertCharValueToPrintableASCII(char v
   case '"':
     if (bEscapeQuotes)
       return "\\\"";
-  // fall thru
+    LLVM_FALLTHROUGH;
   default:
     if (::isprint(vChar))
       return Format("%c", vChar);



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