[Lldb-commits] [lldb] r351541 - Breakpad: Extract parsing code into a separate file

2019-01-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Jan 18 02:37:04 2019
New Revision: 351541

URL: http://llvm.org/viewvc/llvm-project?rev=351541&view=rev
Log:
Breakpad: Extract parsing code into a separate file

Summary:
This centralizes parsing of breakpad records, which was previously
spread out over ObjectFileBreakpad and SymbolFileBreakpad.

For each record type X there is a separate breakpad::XRecord class, and
an associated parse function. The classes just store the information in
the breakpad records in a more accessible form. It is up to the users to
determine what to do with that data.

This separation also made it possible to write some targeted tests for
the parsing code, which was previously unaccessible, so I write a couple
of those too.

Reviewers: clayborg, lemo, zturner

Reviewed By: clayborg

Subscribers: mgorny, fedor.sergeev, lldb-commits

Differential Revision: https://reviews.llvm.org/D56844

Added:
lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
lldb/trunk/unittests/ObjectFile/Breakpad/
lldb/trunk/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
lldb/trunk/unittests/ObjectFile/Breakpad/CMakeLists.txt
Modified:
lldb/trunk/source/Plugins/ObjectFile/Breakpad/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/unittests/ObjectFile/CMakeLists.txt

Added: lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp?rev=351541&view=auto
==
--- lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp (added)
+++ lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp Fri Jan 
18 02:37:04 2019
@@ -0,0 +1,253 @@
+//===-- BreakpadRecords.cpp --- -*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Plugins/ObjectFile/Breakpad/BreakpadRecords.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace lldb_private;
+using namespace lldb_private::breakpad;
+
+namespace {
+enum class Token { Unknown, Module, Info, CodeID, File, Func, Public, Stack };
+}
+
+static Token toToken(llvm::StringRef str) {
+  return llvm::StringSwitch(str)
+  .Case("MODULE", Token::Module)
+  .Case("INFO", Token::Info)
+  .Case("CODE_ID", Token::CodeID)
+  .Case("FILE", Token::File)
+  .Case("FUNC", Token::Func)
+  .Case("PUBLIC", Token::Public)
+  .Case("STACK", Token::Stack)
+  .Default(Token::Unknown);
+}
+
+static llvm::Triple::OSType toOS(llvm::StringRef str) {
+  using llvm::Triple;
+  return llvm::StringSwitch(str)
+  .Case("Linux", Triple::Linux)
+  .Case("mac", Triple::MacOSX)
+  .Case("windows", Triple::Win32)
+  .Default(Triple::UnknownOS);
+}
+
+static llvm::Triple::ArchType toArch(llvm::StringRef str) {
+  using llvm::Triple;
+  return llvm::StringSwitch(str)
+  .Case("arm", Triple::arm)
+  .Case("arm64", Triple::aarch64)
+  .Case("mips", Triple::mips)
+  .Case("ppc", Triple::ppc)
+  .Case("ppc64", Triple::ppc64)
+  .Case("s390", Triple::systemz)
+  .Case("sparc", Triple::sparc)
+  .Case("sparcv9", Triple::sparcv9)
+  .Case("x86", Triple::x86)
+  .Case("x86_64", Triple::x86_64)
+  .Default(Triple::UnknownArch);
+}
+
+static llvm::StringRef consume_front(llvm::StringRef &str, size_t n) {
+  llvm::StringRef result = str.take_front(n);
+  str = str.drop_front(n);
+  return result;
+}
+
+static UUID parseModuleId(llvm::Triple::OSType os, llvm::StringRef str) {
+  struct uuid_data {
+llvm::support::ulittle32_t uuid1;
+llvm::support::ulittle16_t uuid2[2];
+uint8_t uuid3[8];
+llvm::support::ulittle32_t age;
+  } data;
+  static_assert(sizeof(data) == 20, "");
+  // The textual module id encoding should be between 33 and 40 bytes long,
+  // depending on the size of the age field, which is of variable length.
+  // The first three chunks of the id are encoded in big endian, so we need to
+  // byte-swap those.
+  if (str.size() < 33 || str.size() > 40)
+return UUID();
+  uint32_t t;
+  if (to_integer(consume_front(str, 8), t, 16))
+data.uuid1 = t;
+  else
+return UUID();
+  for (int i = 0; i < 2; ++i) {
+if (to_integer(consume_front(str, 4), t, 16))
+  data.uuid2[i] = t;
+else
+  return UUID();
+  }
+  for (int i = 0; i < 8; 

[Lldb-commits] [PATCH] D56844: Breakpad: Extract parsing code into a separate file

2019-01-18 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL351541: Breakpad: Extract parsing code into a separate file 
(authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56844/new/

https://reviews.llvm.org/D56844

Files:
  lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
  lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
  lldb/trunk/source/Plugins/ObjectFile/Breakpad/CMakeLists.txt
  lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
  lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/trunk/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
  lldb/trunk/unittests/ObjectFile/Breakpad/CMakeLists.txt
  lldb/trunk/unittests/ObjectFile/CMakeLists.txt

Index: lldb/trunk/unittests/ObjectFile/CMakeLists.txt
===
--- lldb/trunk/unittests/ObjectFile/CMakeLists.txt
+++ lldb/trunk/unittests/ObjectFile/CMakeLists.txt
@@ -1 +1,2 @@
+add_subdirectory(Breakpad)
 add_subdirectory(ELF)
Index: lldb/trunk/unittests/ObjectFile/Breakpad/CMakeLists.txt
===
--- lldb/trunk/unittests/ObjectFile/Breakpad/CMakeLists.txt
+++ lldb/trunk/unittests/ObjectFile/Breakpad/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_lldb_unittest(ObjectFileBreakpadTests
+  BreakpadRecordsTest.cpp
+
+  LINK_LIBS
+lldbPluginObjectFileBreakpad
+  )
Index: lldb/trunk/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
===
--- lldb/trunk/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
+++ lldb/trunk/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
@@ -0,0 +1,64 @@
+//===-- BreakpadRecordsTest.cpp -*- C++ -*-===//
+//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Plugins/ObjectFile/Breakpad/BreakpadRecords.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+using namespace lldb_private::breakpad;
+
+TEST(Record, classify) {
+  EXPECT_EQ(Record::Module, Record::classify("MODULE"));
+  EXPECT_EQ(Record::Info, Record::classify("INFO"));
+  EXPECT_EQ(Record::File, Record::classify("FILE"));
+  EXPECT_EQ(Record::Func, Record::classify("FUNC"));
+  EXPECT_EQ(Record::Public, Record::classify("PUBLIC"));
+  EXPECT_EQ(Record::Stack, Record::classify("STACK"));
+
+  // Any line which does not start with a known keyword will be classified as a
+  // line record, as those are the only ones that start without a keyword.
+  EXPECT_EQ(Record::Line, Record::classify("deadbeef"));
+  EXPECT_EQ(Record::Line, Record::classify("12"));
+  EXPECT_EQ(Record::Line, Record::classify("CODE_ID"));
+}
+
+TEST(ModuleRecord, parse) {
+  EXPECT_EQ(ModuleRecord(llvm::Triple::Linux, llvm::Triple::x86_64,
+ UUID::fromData("@ABCDEFGHIJKLMNO", 16)),
+ModuleRecord::parse(
+"MODULE Linux x86_64 434241404544474648494a4b4c4d4e4f0 a.out"));
+
+  EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE"));
+  EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE Linux"));
+  EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE Linux x86_64"));
+  EXPECT_EQ(llvm::None,
+ModuleRecord::parse("MODULE Linux x86_64 deadbeefbaadf00d"));
+}
+
+TEST(InfoRecord, parse) {
+  EXPECT_EQ(InfoRecord(UUID::fromData("@ABCDEFGHIJKLMNO", 16)),
+InfoRecord::parse("INFO CODE_ID 404142434445464748494a4b4c4d4e4f"));
+  EXPECT_EQ(InfoRecord(UUID()), InfoRecord::parse("INFO CODE_ID 47 a.exe"));
+
+  EXPECT_EQ(llvm::None, InfoRecord::parse("INFO"));
+  EXPECT_EQ(llvm::None, InfoRecord::parse("INFO CODE_ID"));
+}
+
+TEST(PublicRecord, parse) {
+  EXPECT_EQ(PublicRecord(true, 0x47, 0x8, "foo"),
+PublicRecord::parse("PUBLIC m 47 8 foo"));
+  EXPECT_EQ(PublicRecord(false, 0x47, 0x8, "foo"),
+PublicRecord::parse("PUBLIC 47 8 foo"));
+
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47 8"));
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47"));
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC m"));
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC"));
+}
Index: lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
@@ -8,11 +8,10 @@
 //===--===//
 
 #include "Plugins/ObjectFile/Breakpad/Object

[Lldb-commits] [PATCH] D56904: [NativePDB] Process virtual bases in the correct order

2019-01-18 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov created this revision.
aleksandr.urakov added reviewers: zturner, rnk, stella.stamenova.
aleksandr.urakov added a project: LLDB.
Herald added subscribers: lldb-commits, teemperor, abidh.

This patch makes virtual bases to be added in the correct order to the bases 
list. It is important because `VTableContext` (`MicrosoftVTableContext` in our 
case) uses then the order of virtual bases in the list to restore the virtual 
table indexes. These indexes are used then to resolve the layout of the virtual 
bases.

We haven't enough information about offsets of virtual bases regarding to the 
object (moreover, in a common case we can't rely on such information, see the 
example here: https://reviews.llvm.org/D53506#1272306 ), but there should be 
enough information to restore the layout of the virtual bases from the indexes 
in runtime. After D53506  this information is 
used whenever possible, so there should be no problems with virtual bases' 
fields reading.

I have some problems with the test, I'll describe them exactly in the test's 
text below. Do you have them too or is this a specific problem with my setup?


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D56904

Files:
  lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit
  lit/SymbolFile/NativePDB/tag-types.cpp
  source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
  source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h

Index: source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
===
--- source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
+++ source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
@@ -49,6 +49,7 @@
   PdbAstBuilder &m_ast_builder;
   llvm::pdb::TpiStream &m_tpi;
   std::vector> m_bases;
+  std::map> m_vbases;
   ClangASTImporter::LayoutInfo m_layout;
 
 public:
@@ -66,7 +67,9 @@
 
 private:
   clang::QualType AddBaseClassForTypeIndex(llvm::codeview::TypeIndex ti,
-   llvm::codeview::MemberAccess access);
+   llvm::codeview::MemberAccess access,
+   bool is_virtual,
+   uint64_t vtable_idx);
 };
 
 } // namespace npdb
Index: source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
===
--- source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
+++ source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
@@ -50,7 +50,8 @@
 }
 
 clang::QualType UdtRecordCompleter::AddBaseClassForTypeIndex(
-llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access) {
+llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
+bool is_virtual, uint64_t vtable_idx) {
   PdbTypeSymId type_id(ti);
   clang::QualType qt = m_ast_builder.GetOrCreateType(type_id);
 
@@ -58,17 +59,24 @@
 
   std::unique_ptr base_spec =
   m_ast_builder.clang().CreateBaseClassSpecifier(
-  qt.getAsOpaquePtr(), TranslateMemberAccess(access), false,
+  qt.getAsOpaquePtr(), TranslateMemberAccess(access), is_virtual,
   udt_cvt.kind() == LF_CLASS);
   lldbassert(base_spec);
-  m_bases.push_back(std::move(base_spec));
+
+  // Process virtual bases separately because their order in the result vector
+  // must correspond to the indexes in the vbtable.
+  if (is_virtual)
+m_vbases[vtable_idx] = std::move(base_spec);
+  else
+m_bases.push_back(std::move(base_spec));
+
   return qt;
 }
 
 Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
BaseClassRecord &base) {
   clang::QualType base_qt =
-  AddBaseClassForTypeIndex(base.Type, base.getAccess());
+  AddBaseClassForTypeIndex(base.Type, base.getAccess(), false, 0);
 
   auto decl =
   m_ast_builder.clang().GetAsCXXRecordDecl(base_qt.getAsOpaquePtr());
@@ -82,9 +90,9 @@
 
 Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
VirtualBaseClassRecord &base) {
-  AddBaseClassForTypeIndex(base.BaseType, base.getAccess());
+  AddBaseClassForTypeIndex(base.BaseType, base.getAccess(), true,
+   base.VTableIndex);
 
-  // FIXME: Handle virtual base offsets.
   return Error::success();
 }
 
@@ -177,6 +185,10 @@
 }
 
 void UdtRecordCompleter::complete() {
+  // Flush all virtual bases using the correct order.
+  for (auto &pair : m_vbases)
+m_bases.push_back(std::move(pair.second));
+
   ClangASTContext &clang = m_ast_builder.clang();
   clang.TransferBaseClasses(m_derived_ct.GetOpaqueQualType(),
 std::move(m_bases));
Index: lit/SymbolFile/NativePDB/tag-types.cpp
===
--- lit/SymbolFile/NativePDB/tag-types.cpp
+++ lit/SymbolFile/NativePDB/tag-types.cpp
@@ -115,6 +115,12 @@
 
 unsigned Derive

[Lldb-commits] [PATCH] D56904: [NativePDB] Process virtual bases in the correct order

2019-01-18 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov marked 2 inline comments as done.
aleksandr.urakov added inline comments.



Comment at: lit/SymbolFile/NativePDB/tag-types.cpp:5
 // Test that we can display tag types.
 // RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \

Clang gives me an error about char16_t, char32_t etc., but if I use MSVC here, 
then the test compiles ok.



Comment at: lit/SymbolFile/NativePDB/tag-types.cpp:238-247
 // CHECK-NEXT: (lldb) type lookup -- EnumInt
 // CHECK-NEXT: enum EnumInt {
 // CHECK-NEXT: A,
 // CHECK-NEXT: B
 // CHECK-NEXT: }
 // CHECK-NEXT: (lldb) type lookup -- EnumShort
 // CHECK-NEXT: enum EnumShort {

For both enums I have a "no type was found matching" error (both for Clang and 
MSVC).


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56904/new/

https://reviews.llvm.org/D56904



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-18 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 182499.
tatyana-krasnukha added a comment.

After all, I moved ARC configuring routines to the ArchitechtureArc plug-in.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55718/new/

https://reviews.llvm.org/D55718

Files:
  include/lldb/Core/Architecture.h
  include/lldb/Utility/ArchSpec.h
  source/API/SystemInitializerFull.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.cpp
  source/Plugins/Architecture/Arc/ArchitectureArc.h
  source/Plugins/Architecture/Arc/CMakeLists.txt
  source/Plugins/Architecture/CMakeLists.txt
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Thread.cpp
  source/Utility/ArchSpec.cpp

Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -221,7 +221,8 @@
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba4,
  "kalimba4"},
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba5,
- "kalimba5"}};
+ "kalimba5"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arc, ArchSpec::eCore_arc, "arc"}};
 
 // Ensure that we have an entry in the g_core_definitions for each core. If you
 // comment out an entry above, you will need to comment out the corresponding
@@ -458,7 +459,9 @@
 {ArchSpec::eCore_kalimba4, llvm::ELF::EM_CSR_KALIMBA,
  llvm::Triple::KalimbaSubArch_v4, 0xu, 0xu}, // KALIMBA
 {ArchSpec::eCore_kalimba5, llvm::ELF::EM_CSR_KALIMBA,
- llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu} // KALIMBA
+ llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu}, // KALIMBA
+{ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu } // ARC
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2061,6 +2061,7 @@
 switch (machine) {
 case llvm::Triple::x86_64:
 case llvm::Triple::x86:
+case llvm::Triple::arc:
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
 case llvm::Triple::thumb:
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1869,6 +1869,12 @@
   size_t trap_opcode_size = 0;
 
   switch (arch.GetMachine()) {
+  case llvm::Triple::arc: {
+static const uint8_t g_hex_opcode[] = { 0xff, 0x7f };
+trap_opcode = g_hex_opcode;
+trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::aarch64: {
 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};
 trap_opcode = g_aarch64_opcode;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1198,6 +1198,34 @@
   }
 }
 
+auto arch_plugin = GetTarget().GetArchitecturePlugin();
+if (nullptr != arch_plugin && arch_plugin->SupportsFeatures()) {
+  auto reg_reader = [this](ConstString reg_name, bool case_sensitive)
+  -> llvm::Optional {
+auto reg_info = m_register_info.GetRegisterInfo(reg_name,
+case_sensitive);
+if(nullptr == reg_info)
+  return llvm::None;
+
+// Feature registers are not context-dependent.
+const auto tid = LLDB_INVALID_THREAD_ID;
+// Cannot use GDBRemoteRegisterContext here, it is not created yet.
+DataBufferSP buffer_sp = GetGDBRemote().ReadRegister(tid,
+reg_info->kinds[eRegisterKindProcessPlugin]);
+if (!buffer_sp || buffer_sp->GetByteSize() < reg_info->byte_size)
+  return llvm::None;
+
+return RegisterValue(buffer_sp->GetBytes(), buffer_sp->GetByteSize(),
+ GetByteOrder());
+  };
+  
+  if (!arch_plugin->SetFeatures(reg_reader) && log)
+log->PutCString("Failed to set architecture features");
+
+  if (!arch_plugin->MatchFeatures(GetTarget().GetArchitecture()))
+log->PutCString("The architecture has incompatible features");
+}
+
 // Find out which StructuredDataPlugins are supported by the debug monitor.
 // These plugins transmit data over async $J packets.
 auto supported_packets_array =
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/P

[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-18 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.



Comment at: include/lldb/Core/Architecture.h:118-127
+  static constexpr uint8_t max_features_count = 32u;
+  virtual std::bitset GetFeatures() const { return 0; }
+
+  using ReadRegister = std::function(
+  ConstString /*name*/, bool /*case_sensitive*/)>;
+  virtual bool SetFeatures(const ReadRegister &func) { return true; }
+

We currently have been using the lldb_private::Flags class for this kind of 
stuff. Best to use that here. 



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:29
+  PluginManager::RegisterPlugin(GetPluginNameStatic(),
+"ARC-specific algorithms",
+&ArchitectureArc::Create);

Not a great human readable architecture name here. All other plug-ins use the 
short architecture name ("arm", "mipc", "ppc64"). Best to just use "arc"?



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.cpp:46-78
+bool ArchitectureArc::SetFeatures(const ReadRegister &func) {
+
+  auto set_feature = [&func, this](
+  ConstString reg_name, uint_least32_t field_mask, size_t feature_position)
+  -> llvm::Optional {
+const bool case_sensitive = false;
+auto opt_value = func(reg_name, case_sensitive);

All this code belongs elsewhere. SetFeatures probably needs to be changed to 
be: Architecture::GetFlags().XXX() where XXX is a method on the 
lldb_private::Flags class, so this code should go where the code that was 
calling it was. Kind of weird to have  register reading function passed in.



Comment at: source/Plugins/Architecture/Arc/ArchitectureArc.h:32-40
+  std::bitset GetFeatures() const override {
+return m_features;
+  }
+
+  bool SetFeatures(const ReadRegister &func) override;
+
+  bool MatchFeatures(const ArchSpec &spec) const override;

Use lldb_private::Flags



Comment at: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp:642-669
+  switch (reg.kinds[eRegisterKindDWARF]) {
+  case 0:
+reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_ARG1;
+break;
+  case 1:
+reg.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_ARG2;
+break;

Magic numbers? Can we use enums?



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:1222-1223
+  
+  if (!arch_plugin->SetFeatures(reg_reader) && log)
+log->PutCString("Failed to set architecture features");
+

All this work should be done in this function then use 
arch_plug->GetFlags().Set(mask);


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55718/new/

https://reviews.llvm.org/D55718



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r351564 - Make sure to fill in the compiler register number so when we try to backtrace using EH frame, it works.

2019-01-18 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri Jan 18 09:06:01 2019
New Revision: 351564

URL: http://llvm.org/viewvc/llvm-project?rev=351564&view=rev
Log:
Make sure to fill in the compiler register number so when we try to backtrace 
using EH frame, it works.

Prior to this, backtraces could fail due to not being able to convert a EH 
frame register number to LLDB register number.


Modified:
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp

Modified: 
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp?rev=351564&r1=351563&r2=351564&view=diff
==
--- lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp 
Fri Jan 18 09:06:01 2019
@@ -30,33 +30,35 @@ using namespace minidump;
 #define DEF_R(i)   
\
   {
\
 "r" #i, nullptr, 4, OFFSET(r) + i * 4, eEncodingUint, eFormatHex,  
\
-{INV, dwarf_r##i, INV, INV, reg_r##i}, nullptr, nullptr, nullptr, 0
\
+{dwarf_r##i, dwarf_r##i, INV, INV, reg_r##i},  
\
+nullptr, nullptr, nullptr, 0\
   }
 
 #define DEF_R_ARG(i, n)
\
   {
\
 "r" #i, "arg" #n, 4, OFFSET(r) + i * 4, eEncodingUint, eFormatHex, 
\
-{INV, dwarf_r##i, LLDB_REGNUM_GENERIC_ARG1 + i, INV, reg_r##i},
\
+{dwarf_r##i, dwarf_r##i, LLDB_REGNUM_GENERIC_ARG1 + i, INV, reg_r##i}, 
\
 nullptr, nullptr, nullptr, 0   
\
   }
 
 #define DEF_D(i)   
\
   {
\
 "d" #i, nullptr, 8, OFFSET(d) + i * 8, eEncodingVector,
\
-eFormatVectorOfUInt8, {INV, dwarf_d##i, INV, INV, reg_d##i},   
\
+eFormatVectorOfUInt8, {dwarf_d##i, dwarf_d##i, INV, INV, reg_d##i},
\
 nullptr, nullptr, nullptr, 0\
   }
 
 #define DEF_S(i)   
\
   {
\
 "s" #i, nullptr, 4, OFFSET(s) + i * 4, eEncodingIEEE754, eFormatFloat, 
\
-{INV, dwarf_s##i, INV, INV, reg_s##i}, nullptr, nullptr, nullptr, 0
\
+{dwarf_s##i, dwarf_s##i, INV, INV, reg_s##i},  
\
+nullptr, nullptr, nullptr, 0   
\
   }
 
 #define DEF_Q(i)   
\
   {
\
 "q" #i, nullptr, 16, OFFSET(q) + i * 16, eEncodingVector,  
\
-eFormatVectorOfUInt8, {INV, dwarf_q##i, INV, INV, reg_q##i},   
\
+eFormatVectorOfUInt8, {dwarf_q##i, dwarf_q##i, INV, INV, reg_q##i},
\
 nullptr, nullptr, nullptr, 0\
   }
 

Modified: 
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp?rev=351564&r1=351563&r2=351564&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp 
Fri Jan 18 09:06:01 2019
@@ -29,8 +29,8 @@ using namespace minidump;
 #define DEF_X(i)   
\
   {
\
 "x" #i, nullptr, 8, OFFSET(x) + i * 8, eEncodingUint, eFormatHex,  
\
-{INV, arm64_dwarf::x##i, INV, INV, reg_x##i}, nullptr, nullptr,
\
-nullptr, 0 
\
+{arm64_dwarf::x##i, arm64_dwarf::x##i, INV, INV, reg_x##i},
\
+nullptr, nullptr, nullptr, 0   
\
   }
 
 #define DEF_W(i)   
\
@@ -42,15 +42,15 @@ using namespace minidump;
 #define DEF_X_ARG(i, n)
\
   {
\
 "x" #i, "arg" #n, 8, OFFSET(x

[Lldb-commits] [PATCH] D56844: Breakpad: Extract parsing code into a separate file

2019-01-18 Thread Leonard Mosescu via Phabricator via lldb-commits
lemo added a comment.

Looks good. A few questions/suggestions inline.




Comment at: lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp:74
+  static_assert(sizeof(data) == 20, "");
+  // The textual module id encoding should be between 33 and 40 bytes long,
+  // depending on the size of the age field, which is of variable length.

the comment is great, but I think we should still have symbolic constants for 
all these magic values



Comment at: lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h:34
+
+  ~Record() = default;
+

should this be virtual? (even though the class doesn't have other virtual 
members, the class hierarchy introduces the possibility for consumers to treat 
them a polymorphic types - ex. storing as Record* and use the kind type to 
figure out the concrete type)



Comment at: lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h:40
+private:
+  Kind TheKind;
+};

Just curious, what is the definitive convention for naming data members? A lot 
of LLDB code uses the m_camelCase convention.



Comment at: lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h:84
+
+class PublicRecord : public Record {
+public:

most of these types are just plain data containers, so why not make them 
structs? (and avoid all the boilerplate associated with public accessors, 
repetitive constructors, ...)


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56844/new/

https://reviews.llvm.org/D56844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r351585 - Add BreakpadRecords to the Xcode project.

2019-01-18 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Jan 18 12:20:40 2019
New Revision: 351585

URL: http://llvm.org/viewvc/llvm-project?rev=351585&view=rev
Log:
Add BreakpadRecords to the Xcode project.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=351585&r1=351584&r2=351585&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jan 18 12:20:40 2019
@@ -120,6 +120,7 @@
AFC2DCE91E6E2F2C00283714 /* Baton.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = AFC2DCE81E6E2F2C00283714 /* Baton.cpp */; };
268900D013353E6F00698AC0 /* Block.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7F1310F1B8EC00F91463 /* Block.cpp */; };
49DEF1251CD7C6DF006A7C7D /* BlockPointer.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 49DEF11F1CD7BD90006A7C7D /* BlockPointer.cpp */; 
};
+   4CAEC6A821F26D15007C3DD5 /* BreakpadRecords.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CAEC6A621F26D15007C3DD5 /* BreakpadRecords.cpp 
*/; };
2689FFEF13353DB600698AC0 /* Breakpoint.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 26BC7E0A10F1B83100F91463 /* Breakpoint.cpp */; };
2660387E211CA98200329572 /* BreakpointBase.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 2660387D211CA98200329572 /* BreakpointBase.cpp 
*/; };
2689FFF113353DB600698AC0 /* BreakpointID.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E0B10F1B83100F91463 /* BreakpointID.cpp */; 
};
@@ -1459,6 +1460,8 @@
26BC7C5510F1B6E900F91463 /* Block.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
Block.h; path = include/lldb/Symbol/Block.h; sourceTree = ""; };
49DEF11F1CD7BD90006A7C7D /* BlockPointer.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = BlockPointer.cpp; path = Language/CPlusPlus/BlockPointer.cpp; sourceTree 
= ""; };
49DEF1201CD7BD90006A7C7D /* BlockPointer.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
BlockPointer.h; path = Language/CPlusPlus/BlockPointer.h; sourceTree = 
""; };
+   4CAEC6A621F26D15007C3DD5 /* BreakpadRecords.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = BreakpadRecords.cpp; sourceTree = ""; };
+   4CAEC6A721F26D15007C3DD5 /* BreakpadRecords.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BreakpadRecords.h; sourceTree = ""; };
26BC7E0A10F1B83100F91463 /* Breakpoint.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = Breakpoint.cpp; path = source/Breakpoint/Breakpoint.cpp; sourceTree = 
""; };
26BC7CEE10F1B71400F91463 /* Breakpoint.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
Breakpoint.h; path = include/lldb/Breakpoint/Breakpoint.h; sourceTree = 
""; };
2660387D211CA98200329572 /* BreakpointBase.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = BreakpointBase.cpp; path = "tools/lldb-vscode/BreakpointBase.cpp"; 
sourceTree = ""; };
@@ -6185,6 +6188,8 @@
4C9BF11621C0467700FA4036 /* Breakpad */ = {
isa = PBXGroup;
children = (
+   4CAEC6A721F26D15007C3DD5 /* BreakpadRecords.h 
*/,
+   4CAEC6A621F26D15007C3DD5 /* BreakpadRecords.cpp 
*/,
4C9BF11821C0467700FA4036 /* 
ObjectFileBreakpad.h */,
4C9BF11921C0467700FA4036 /* 
ObjectFileBreakpad.cpp */,
);
@@ -8211,6 +8216,7 @@
232CB61B191E00CD00EF39FC /* 
NativeThreadProtocol.cpp in Sources */,
4CD44CFB20B37C440003557C /* DWARFIndex.cpp in 
Sources */,
2689010113353E6F00698AC0 /* 
ThreadPlanStepOut.cpp in Sources */,
+   4CAEC6A821F26D15007C3DD5 /* BreakpadRecords.cpp 
in Sources */,
2689010213353E6F00698AC0 /* 
ThreadPlanStepOverBreakpoint.cpp in Sources */,
3FDFED2919BA6D96009756A7 /* ThreadLauncher.cpp 
in Sources */,
4C719395207D235400FDF430 /* OptionArgParser.cpp 
in Sources */,


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r351611 - [dotest] Add logging to investigate CI issue.

2019-01-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Jan 18 15:05:19 2019
New Revision: 351611

URL: http://llvm.org/viewvc/llvm-project?rev=351611&view=rev
Log:
[dotest] Add logging to investigate CI issue.

We're seeing an odd issue on GreenDragon's lldb-cmake-matrix. Dotest is
unable to move a log file (OSError: [Errno 2] No such file or
directory). The os.rename call is guarded with a check that the source
file and destination directory exist.

This wraps the call in a try-except that prints the source and
destination path to see which component seemingly doesn't exist.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=351611&r1=351610&r2=351611&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Jan 18 15:05:19 
2019
@@ -1228,7 +1228,12 @@ class Base(unittest2.TestCase):
 remove_file(dst)
 
 lldbutil.mkdir_p(os.path.dirname(dst))
-os.rename(src, dst)
+try:
+os.rename(src, dst)
+except OSError:
+print("src (exists={}): 
{}".format(os.path.exists(src), src))
+print("dst (exists={}): 
{}".format(os.path.exists(dst), dst))
+raise
 else:
 # success!  (and we don't want log files) delete log files
 for log_file in log_files_for_this_test:


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r351631 - Install new LLVM license structure and new developer policy.

2019-01-18 Thread Chandler Carruth via lldb-commits
Author: chandlerc
Date: Fri Jan 18 22:14:24 2019
New Revision: 351631

URL: http://llvm.org/viewvc/llvm-project?rev=351631&view=rev
Log:
Install new LLVM license structure and new developer policy.

This installs the new developer policy and moves all of the license
files across all LLVM projects in the monorepo to the new license
structure. The remaining projects will be moved independently.

Note that I've left odd formatting and other idiosyncracies of the
legacy license structure text alone to make the diff easier to read.
Critically, note that we do not in any case *remove* the old license
notice or terms, as that remains necessary until we finish the
relicensing process.

I've updated a few license files that refer to the LLVM license to
instead simply refer generically to whatever license the LLVM project is
under, basically trying to minimize confusion.

This is really the culmination of so many people. Chris led the
community discussions, drafted the policy update and organized the
multi-year string of meeting between lawyers across the community to
figure out the strategy. Numerous lawyers at companies in the community
spent their time figuring out initial answers, and then the Foundation's
lawyer Heather Meeker has done *so* much to help refine and get us ready
here. I could keep going on, but I just want to make sure everyone
realizes what a huge community effort this has been from the begining.

Differential Revision: https://reviews.llvm.org/D56897

Modified:
lldb/trunk/LICENSE.TXT

Modified: lldb/trunk/LICENSE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/LICENSE.TXT?rev=351631&r1=351630&r2=351631&view=diff
==
--- lldb/trunk/LICENSE.TXT (original)
+++ lldb/trunk/LICENSE.TXT Fri Jan 18 22:14:24 2019
@@ -1,3 +1,241 @@
+==
+The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
+==
+
+ Apache License
+   Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+  "License" shall mean the terms and conditions for use, reproduction,
+  and distribution as defined by Sections 1 through 9 of this document.
+
+  "Licensor" shall mean the copyright owner or entity authorized by
+  the copyright owner that is granting the License.
+
+  "Legal Entity" shall mean the union of the acting entity and all
+  other entities that control, are controlled by, or are under common
+  control with that entity. For the purposes of this definition,
+  "control" means (i) the power, direct or indirect, to cause the
+  direction or management of such entity, whether by contract or
+  otherwise, or (ii) ownership of fifty percent (50%) or more of the
+  outstanding shares, or (iii) beneficial ownership of such entity.
+
+  "You" (or "Your") shall mean an individual or Legal Entity
+  exercising permissions granted by this License.
+
+  "Source" form shall mean the preferred form for making modifications,
+  including but not limited to software source code, documentation
+  source, and configuration files.
+
+  "Object" form shall mean any form resulting from mechanical
+  transformation or translation of a Source form, including but
+  not limited to compiled object code, generated documentation,
+  and conversions to other media types.
+
+  "Work" shall mean the work of authorship, whether in Source or
+  Object form, made available under the License, as indicated by a
+  copyright notice that is included in or attached to the work
+  (an example is provided in the Appendix below).
+
+  "Derivative Works" shall mean any work, whether in Source or Object
+  form, that is based on (or derived from) the Work and for which the
+  editorial revisions, annotations, elaborations, or other modifications
+  represent, as a whole, an original work of authorship. For the purposes
+  of this License, Derivative Works shall not include works that remain
+  separable from, or merely link (or bind by name) to the interfaces of,
+  the Work and Derivative Works thereof.
+
+  "Contribution" shall mean any work of authorship, including
+  the original version of the Work and any modifications or additions
+  to that Work or Derivative Works thereof, that is intentionally
+  submitted to Licensor for inclusion in the Work by the copyright owner
+  or by an individual or Legal Entity authorized to submit on behalf of
+  the copyright owner. For the purposes of this definition, "submitted"
+  means any form of electronic, verbal, or written communication sent
+ 

[Lldb-commits] [PATCH] D56897: Install new LLVM license structure and new developer policy.

2019-01-18 Thread Chandler Carruth via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB351631: Install new LLVM license structure and new 
developer policy. (authored by chandlerc, committed by ).
Herald added a subscriber: lldb-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56897?vs=182492&id=182667#toc

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56897/new/

https://reviews.llvm.org/D56897

Files:
  LICENSE.TXT

Index: LICENSE.TXT
===
--- LICENSE.TXT
+++ LICENSE.TXT
@@ -1,3 +1,241 @@
+==
+The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
+==
+
+ Apache License
+   Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+  "License" shall mean the terms and conditions for use, reproduction,
+  and distribution as defined by Sections 1 through 9 of this document.
+
+  "Licensor" shall mean the copyright owner or entity authorized by
+  the copyright owner that is granting the License.
+
+  "Legal Entity" shall mean the union of the acting entity and all
+  other entities that control, are controlled by, or are under common
+  control with that entity. For the purposes of this definition,
+  "control" means (i) the power, direct or indirect, to cause the
+  direction or management of such entity, whether by contract or
+  otherwise, or (ii) ownership of fifty percent (50%) or more of the
+  outstanding shares, or (iii) beneficial ownership of such entity.
+
+  "You" (or "Your") shall mean an individual or Legal Entity
+  exercising permissions granted by this License.
+
+  "Source" form shall mean the preferred form for making modifications,
+  including but not limited to software source code, documentation
+  source, and configuration files.
+
+  "Object" form shall mean any form resulting from mechanical
+  transformation or translation of a Source form, including but
+  not limited to compiled object code, generated documentation,
+  and conversions to other media types.
+
+  "Work" shall mean the work of authorship, whether in Source or
+  Object form, made available under the License, as indicated by a
+  copyright notice that is included in or attached to the work
+  (an example is provided in the Appendix below).
+
+  "Derivative Works" shall mean any work, whether in Source or Object
+  form, that is based on (or derived from) the Work and for which the
+  editorial revisions, annotations, elaborations, or other modifications
+  represent, as a whole, an original work of authorship. For the purposes
+  of this License, Derivative Works shall not include works that remain
+  separable from, or merely link (or bind by name) to the interfaces of,
+  the Work and Derivative Works thereof.
+
+  "Contribution" shall mean any work of authorship, including
+  the original version of the Work and any modifications or additions
+  to that Work or Derivative Works thereof, that is intentionally
+  submitted to Licensor for inclusion in the Work by the copyright owner
+  or by an individual or Legal Entity authorized to submit on behalf of
+  the copyright owner. For the purposes of this definition, "submitted"
+  means any form of electronic, verbal, or written communication sent
+  to the Licensor or its representatives, including but not limited to
+  communication on electronic mailing lists, source code control systems,
+  and issue tracking systems that are managed by, or on behalf of, the
+  Licensor for the purpose of discussing and improving the Work, but
+  excluding communication that is conspicuously marked or otherwise
+  designated in writing by the copyright owner as "Not a Contribution."
+
+  "Contributor" shall mean Licensor and any individual or Legal Entity
+  on behalf of whom a Contribution has been received by Licensor and
+  subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+  this License, each Contributor hereby grants to You a perpetual,
+  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+  copyright license to reproduce, prepare Derivative Works of,
+  publicly display, publicly perform, sublicense, and distribute the
+  Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of