[Lldb-commits] [lldb] r335612 - Represent invalid UUIDs as UUIDs with length zero

2018-06-26 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Jun 26 08:12:20 2018
New Revision: 335612

URL: http://llvm.org/viewvc/llvm-project?rev=335612&view=rev
Log:
Represent invalid UUIDs as UUIDs with length zero

Summary:
During the previous attempt to generalize the UUID class, it was
suggested that we represent invalid UUIDs as length zero (previously, we
used an all-zero UUID for that). This meant that some valid build-ids
could not be represented (it's possible however unlikely that a checksum of
some file would be zero) and complicated adding support for variable
length build-ids (should a 16-byte empty UUID compare equal to a 20-byte
empty UUID?).

This patch resolves these issues by introducing a canonical
representation for an invalid UUID. The slight complication here is that
some clients (MachO) actually use the all-zero notation to mean "no UUID
has been set". To keep this use case working (while making it very
explicit about which construction semantices are wanted), replaced the
UUID constructors and the SetBytes functions with named factory methods.
- "fromData" creates a UUID from the given data, and it treats all bytes
  equally.
- "fromOptionalData" first checks the data contents - if all bytes are
  zero, it treats this as an invalid/empty UUID.

Reviewers: clayborg, sas, lemo, davide, espindola

Subscribers: emaste, lldb-commits, arichardson

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

Modified:
lldb/trunk/include/lldb/Utility/DataExtractor.h
lldb/trunk/include/lldb/Utility/UUID.h
lldb/trunk/source/API/SBModuleSpec.cpp

lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/trunk/source/Utility/DataExtractor.cpp
lldb/trunk/source/Utility/UUID.cpp
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
lldb/trunk/unittests/Utility/UUIDTest.cpp

Modified: lldb/trunk/include/lldb/Utility/DataExtractor.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/DataExtractor.h?rev=335612&r1=335611&r2=335612&view=diff
==
--- lldb/trunk/include/lldb/Utility/DataExtractor.h (original)
+++ lldb/trunk/include/lldb/Utility/DataExtractor.h Tue Jun 26 08:12:20 2018
@@ -223,22 +223,6 @@ public:
   const char *type_format = nullptr) const;
 
   //--
-  /// Dump a UUID value at \a offset.
-  ///
-  /// Dump a UUID starting at \a offset bytes into this object's data. If the
-  /// stream \a s is nullptr, the output will be sent to Log().
-  ///
-  /// @param[in] s
-  /// The stream to dump the output to. If nullptr the output will
-  /// be dumped to Log().
-  ///
-  /// @param[in] offset
-  /// The offset into the data at which to extract and dump a
-  /// UUID value.
-  //--
-  void DumpUUID(Stream *s, lldb::offset_t offset) const;
-
-  //--
   /// Extract an arbitrary number of bytes in the specified byte order.
   ///
   /// Attemps to extract \a length bytes starting at \a offset bytes into this

Modified: lldb/trunk/include/lldb/Utility/UUID.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/UUID.h?rev=335612&r1=335611&r2=335612&view=diff
==
--- lldb/trunk/include/lldb/Utility/UUID.h (original)
+++ lldb/trunk/include/lldb/Utility/UUID.h Tue Jun 26 08:12:20 2018
@@ -33,15 +33,38 @@ public:
   //--
   // Constructors and Destructors
   //--
-  UUID();
-  UUID(const UUID &rhs);
-  UUID(const void *uuid_bytes, uint32_t num_uuid_bytes);
+  UUID() = default;
 
-  ~UUID();
+  /// Creates a UUID from the data pointed to by the bytes argument. No special
+  /// significance is attached to any of the values.
+  static UUID fromData(const void *bytes, uint32_t num_bytes) {
+if (bytes)
+  return fromData({reinterpret_cast(bytes), num_bytes});
+return UUID();
+  }
+
+  /// Creates a uuid from the data pointed to by the bytes argument. No special
+  /// significance is attached to any of the values.
+  static UUID fromData(llvm::ArrayRef bytes) { return UUID(bytes); }
+
+  /// Creates a UUID from the data pointed to by the bytes argument. Data
+  /// consisting purely of zero bytes is treated as an invalid UUID.
+  static UUID fromOptionalData(const void *bytes, uint32_t num_bytes) {
+if (bytes)
+  retu

[Lldb-commits] [PATCH] D48479: Represent invalid UUIDs as UUIDs with length zero

2018-06-26 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL335612: Represent invalid UUIDs as UUIDs with length zero 
(authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D48479?vs=152699&id=152893#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48479

Files:
  lldb/trunk/include/lldb/Utility/DataExtractor.h
  lldb/trunk/include/lldb/Utility/UUID.h
  lldb/trunk/source/API/SBModuleSpec.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
  lldb/trunk/source/Utility/DataExtractor.cpp
  lldb/trunk/source/Utility/UUID.cpp
  lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  lldb/trunk/unittests/Utility/UUIDTest.cpp

Index: lldb/trunk/unittests/Utility/UUIDTest.cpp
===
--- lldb/trunk/unittests/Utility/UUIDTest.cpp
+++ lldb/trunk/unittests/Utility/UUIDTest.cpp
@@ -15,10 +15,10 @@
 
 TEST(UUIDTest, RelationalOperators) {
   UUID empty;
-  UUID a16("1234567890123456", 16);
-  UUID b16("1234567890123457", 16);
-  UUID a20("12345678901234567890", 20);
-  UUID b20("12345678900987654321", 20);
+  UUID a16 = UUID::fromData("1234567890123456", 16);
+  UUID b16 = UUID::fromData("1234567890123457", 16);
+  UUID a20 = UUID::fromData("12345678901234567890", 20);
+  UUID b20 = UUID::fromData("12345678900987654321", 20);
 
   EXPECT_EQ(empty, empty);
   EXPECT_EQ(a16, a16);
@@ -34,3 +34,40 @@
   EXPECT_LT(a16, b16);
   EXPECT_GT(a20, b20);
 }
+
+TEST(UUIDTest, Validity) {
+  UUID empty;
+  std::vector zeroes(20, 0);
+  UUID a16 = UUID::fromData(zeroes.data(), 16);
+  UUID a20 = UUID::fromData(zeroes.data(), 20);
+  UUID a16_0 = UUID::fromOptionalData(zeroes.data(), 16);
+  UUID a20_0 = UUID::fromOptionalData(zeroes.data(), 20);
+  EXPECT_FALSE(empty);
+  EXPECT_TRUE(a16);
+  EXPECT_TRUE(a20);
+  EXPECT_FALSE(a16_0);
+  EXPECT_FALSE(a20_0);
+}
+
+TEST(UUIDTest, SetFromStringRef) {
+  UUID u;
+  EXPECT_EQ(32u, u.SetFromStringRef("404142434445464748494a4b4c4d4e4f"));
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16), u);
+
+  EXPECT_EQ(36u, u.SetFromStringRef("40-41-42-43-4445464748494a4b4c4d4e4f"));
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16), u);
+
+  EXPECT_EQ(45u, u.SetFromStringRef(
+ "40-41-42-43-4445464748494a4b4c4d4e4f-50515253", 20));
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNOPQRS", 20), u);
+
+  EXPECT_EQ(0u, u.SetFromStringRef("40-41-42-43-4445464748494a4b4c4d4e4f", 20));
+  EXPECT_EQ(0u, u.SetFromStringRef("40x"));
+  EXPECT_EQ(0u, u.SetFromStringRef(""));
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNOPQRS", 20), u)
+  << "uuid was changed by failed parse calls";
+
+  EXPECT_EQ(
+  32u, u.SetFromStringRef("404142434445464748494a4b4c4d4e4f-50515253", 16));
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16), u);
+}
Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -194,7 +194,8 @@
   ASSERT_EQ(1u, result->size());
   EXPECT_EQ("/foo/bar.so", result.getValue()[0].GetFileSpec().GetPath());
   EXPECT_EQ(triple, result.getValue()[0].GetArchitecture().GetTriple());
-  EXPECT_EQ(UUID("@ABCDEFGHIJKLMNO", 16), result.getValue()[0].GetUUID());
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16),
+result.getValue()[0].GetUUID());
   EXPECT_EQ(0u, result.getValue()[0].GetObjectOffset());
   EXPECT_EQ(1234u, result.getValue()[0].GetObjectSize());
 }
@@ -218,7 +219,8 @@
   ASSERT_EQ(1u, result->size());
   EXPECT_EQ("/foo/bar.so", result.getValue()[0].GetFileSpec().GetPath());
   EXPECT_EQ(triple, result.getValue()[0].GetArchitecture().GetTriple());
-  EXPECT_EQ(UUID("@ABCDEFGHIJKLMNOPQRS", 20), result.getValue()[0].GetUUID());
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNOPQRS", 20),
+result.getValue()[0].GetUUID());
   EXPECT_EQ(0u, result.getValue()[0].GetObjectOffset());
   EXPECT_EQ(1234u, result.getValue()[0].GetObjectSize());
 }
Index: lldb/trunk/source/Utility/UUID.cpp
===
--- lldb/trunk/source/Utility/UUID.cpp
+++ lldb/trunk/source/Utility/UUID.cpp
@@ -21,29 +21,12 @@
 
 using namespace lldb_private;
 
-UUID::UUID() { Clear(); }
+UUID::UUID(llvm::ArrayRef bytes) {
+  if (bytes.size() != 20 && bytes.size() != 16)
+bytes = {};
 
-UUID::UUID(const UUID &rhs) {
-  SetBytes(rhs.m_uuid, rhs.m_num_uuid_bytes);
-}
-
-UUID::

[Lldb-commits] [PATCH] D48596: [SymbolFile] Implement GetCompleteObjCClass for .debug_names

2018-06-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, aprantl, clayborg.

When running the test suite with .debug_names a bunch of tests were failing. 
Part of that is solved by implementing the missing GetCompleteObjCClass in 
DebugNamesDWARFIndex.


Repository:
  rL LLVM

https://reviews.llvm.org/D48596

Files:
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h


Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -31,7 +31,7 @@
   void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
   void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
   void GetCompleteObjCClass(ConstString class_name, bool 
must_be_implementation,
-DIEArray &offsets) override {}
+DIEArray &offsets) override;
   void GetTypes(ConstString name, DIEArray &offsets) override;
   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
   void GetNamespaces(ConstString name, DIEArray &offsets) override;
Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -146,6 +146,39 @@
   }
 }
 
+void DebugNamesDWARFIndex::GetCompleteObjCClass(ConstString class_name,
+bool must_be_implementation,
+DIEArray &offsets) {
+  m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, offsets);
+
+  for (const DebugNames::Entry &entry :
+   m_debug_names_up->equal_range(class_name.GetStringRef())) {
+if (entry.tag() != DW_TAG_structure_type &&
+entry.tag() != DW_TAG_class_type)
+  continue;
+
+DIERef ref = ToDIERef(entry);
+if (!ref)
+  continue;
+
+DWARFUnit *cu = m_debug_info.GetCompileUnit(ref.cu_offset);
+if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
+  offsets.push_back(ref);
+  continue;
+}
+
+// FIXME: We should return DWARFDIEs so we don't have to resolve it twice.
+DWARFDIE die = m_debug_info.GetDIE(ref);
+if (!die) {
+  offsets.push_back(ref);
+  continue;
+}
+
+if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 1))
+  offsets.push_back(ref);
+  }
+}
+
 void DebugNamesDWARFIndex::GetTypes(ConstString name, DIEArray &offsets) {
   m_fallback.GetTypes(name, offsets);
 


Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -31,7 +31,7 @@
   void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
   void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
   void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
-DIEArray &offsets) override {}
+DIEArray &offsets) override;
   void GetTypes(ConstString name, DIEArray &offsets) override;
   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
   void GetNamespaces(ConstString name, DIEArray &offsets) override;
Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -146,6 +146,39 @@
   }
 }
 
+void DebugNamesDWARFIndex::GetCompleteObjCClass(ConstString class_name,
+bool must_be_implementation,
+DIEArray &offsets) {
+  m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, offsets);
+
+  for (const DebugNames::Entry &entry :
+   m_debug_names_up->equal_range(class_name.GetStringRef())) {
+if (entry.tag() != DW_TAG_structure_type &&
+entry.tag() != DW_TAG_class_type)
+  continue;
+
+DIERef ref = ToDIERef(entry);
+if (!ref)
+  continue;
+
+DWARFUnit *cu = m_debug_info.GetCompileUnit(ref.cu_offset);
+if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
+  offsets.push_back(ref);
+  continue;
+}
+
+// FIXME: We should return DWARFDIEs so we don't have to resolve it twice.
+DWARFDIE die = m_debug_info.GetDIE(ref);
+if (!die) {
+  offsets.push_back(ref);
+  continue;
+}
+
+if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 1))
+  offsets.push_back(ref);
+ 

[Lldb-commits] [PATCH] D48596: [SymbolFile] Implement GetCompleteObjCClass for .debug_names

2018-06-26 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:157
+if (entry.tag() != DW_TAG_structure_type &&
+entry.tag() != DW_TAG_class_type)
+  continue;

Wait.. we accept both structs and classes in LLDB? Should we also switch over 
to using DW_TAG_class in clang since that sounds more appropriate anyway?


Repository:
  rL LLVM

https://reviews.llvm.org/D48596



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


[Lldb-commits] [PATCH] D48596: [SymbolFile] Implement GetCompleteObjCClass for .debug_names

2018-06-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

The function is looking for the complete objective C type. The code needs to be 
modified to return the complete type only if one is found, else just one of the 
other incomplete versions is needed, not many.




Comment at: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:166
+if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
+  offsets.push_back(ref);
+  continue;

Why are we pushing a potentially incomplete ObjC type here? We should keep a 
list of incomplete types and if we don't find a complete one, then return that 
as a fallback.



Comment at: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:173
+if (!die) {
+  offsets.push_back(ref);
+  continue;

Why are pushing a DIERef that doesn't produce a DIE? Remove the push_back.



Comment at: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:178
+if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 1))
+  offsets.push_back(ref);
+  }

If we find this, return right away with only one result: the complete version.



Comment at: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:180
+  }
+}
+

We need to add code here to return an incomplete version of the ObjC type from 
line 166 if no complete versions are found.


Repository:
  rL LLVM

https://reviews.llvm.org/D48596



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


[Lldb-commits] [PATCH] D48596: [SymbolFile] Implement GetCompleteObjCClass for .debug_names

2018-06-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In https://reviews.llvm.org/D48596#1143666, @clayborg wrote:

> The function is looking for the complete objective C type. The code needs to 
> be modified to return the complete type only if one is found, else just one 
> of the other incomplete versions is needed, not many.


Thanks Greg, looks like I misunderstood the code. I'll update the patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D48596



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


[Lldb-commits] [PATCH] D48596: [SymbolFile] Implement GetCompleteObjCClass for .debug_names

2018-06-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:157
+if (entry.tag() != DW_TAG_structure_type &&
+entry.tag() != DW_TAG_class_type)
+  continue;

aprantl wrote:
> Wait.. we accept both structs and classes in LLDB? Should we also switch over 
> to using DW_TAG_class in clang since that sounds more appropriate anyway?
I'm probably not the right person to answer this. I copied this from 
HashedNameToDIE:

```
611   // We don't only want the one true definition, so try and see what we 
can 


 612   // find, and only return class or struct DIEs.
...
616   DWARFMappedHash::ExtractClassOrStructDIEArray(



   
```



https://reviews.llvm.org/D48596



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


[Lldb-commits] [PATCH] D48596: [SymbolFile] Implement GetCompleteObjCClass for .debug_names

2018-06-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 152912.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

- Feedback Greg


https://reviews.llvm.org/D48596

Files:
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h


Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -31,7 +31,7 @@
   void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
   void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
   void GetCompleteObjCClass(ConstString class_name, bool 
must_be_implementation,
-DIEArray &offsets) override {}
+DIEArray &offsets) override;
   void GetTypes(ConstString name, DIEArray &offsets) override;
   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
   void GetNamespaces(ConstString name, DIEArray &offsets) override;
Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -146,6 +146,49 @@
   }
 }
 
+void DebugNamesDWARFIndex::GetCompleteObjCClass(ConstString class_name,
+bool must_be_implementation,
+DIEArray &offsets) {
+  m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, offsets);
+
+  // Keep a list of incomplete types as fallback for when we don't find the
+  // complete type.
+  DIEArray incomplete_types;
+
+  for (const DebugNames::Entry &entry :
+   m_debug_names_up->equal_range(class_name.GetStringRef())) {
+if (entry.tag() != DW_TAG_structure_type &&
+entry.tag() != DW_TAG_class_type)
+  continue;
+
+DIERef ref = ToDIERef(entry);
+if (!ref)
+  continue;
+
+DWARFUnit *cu = m_debug_info.GetCompileUnit(ref.cu_offset);
+if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
+  incomplete_types.push_back(ref);
+  continue;
+}
+
+// FIXME: We should return DWARFDIEs so we don't have to resolve it twice.
+DWARFDIE die = m_debug_info.GetDIE(ref);
+if (!die)
+  continue;
+
+if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 0)) {
+  // If we find the complete version we're done.
+  offsets.push_back(ref);
+  return;
+} else {
+  incomplete_types.push_back(ref);
+}
+  }
+
+  offsets.insert(offsets.end(), incomplete_types.begin(),
+ incomplete_types.end());
+}
+
 void DebugNamesDWARFIndex::GetTypes(ConstString name, DIEArray &offsets) {
   m_fallback.GetTypes(name, offsets);
 


Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -31,7 +31,7 @@
   void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
   void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
   void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
-DIEArray &offsets) override {}
+DIEArray &offsets) override;
   void GetTypes(ConstString name, DIEArray &offsets) override;
   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
   void GetNamespaces(ConstString name, DIEArray &offsets) override;
Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -146,6 +146,49 @@
   }
 }
 
+void DebugNamesDWARFIndex::GetCompleteObjCClass(ConstString class_name,
+bool must_be_implementation,
+DIEArray &offsets) {
+  m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, offsets);
+
+  // Keep a list of incomplete types as fallback for when we don't find the
+  // complete type.
+  DIEArray incomplete_types;
+
+  for (const DebugNames::Entry &entry :
+   m_debug_names_up->equal_range(class_name.GetStringRef())) {
+if (entry.tag() != DW_TAG_structure_type &&
+entry.tag() != DW_TAG_class_type)
+  continue;
+
+DIERef ref = ToDIERef(entry);
+if (!ref)
+  continue;
+
+DWARFUnit *cu = m_debug_info.GetCompileUnit(ref.cu_offset);
+if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
+  incomplete_types.push_back(ref);
+  con

[Lldb-commits] [lldb] r335659 - Reverting r335656, SWIG doesn't like "enum class".

2018-06-26 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue Jun 26 13:40:29 2018
New Revision: 335659

URL: http://llvm.org/viewvc/llvm-project?rev=335659&view=rev
Log:
Reverting r335656, SWIG doesn't like "enum class".

Modified:
lldb/trunk/include/lldb/lldb-enumerations.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=335659&r1=335658&r2=335659&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Jun 26 13:40:29 2018
@@ -823,7 +823,7 @@ enum FrameComparison {
 // relative data and the object file might be able to tell us that an address
 // in code is data.
 //--
-enum class AddressClass {
+enum AddressClass {
   eInvalid,
   eUnknown,
   eCode,


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


[Lldb-commits] [lldb] r335688 - This is not a debug info sensitive test.

2018-06-26 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue Jun 26 16:31:44 2018
New Revision: 335688

URL: http://llvm.org/viewvc/llvm-project?rev=335688&view=rev
Log:
This is not a debug info sensitive test.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py?rev=335688&r1=335687&r2=335688&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
 Tue Jun 26 16:31:44 2018
@@ -19,6 +19,8 @@ class LoadUnloadTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+NO_DEBUG_INFO_TESTCASE = True
+   
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)


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


[Lldb-commits] [lldb] r335689 - The Process class ivar ivar was changed to a weak pointer, but was still _sp.

2018-06-26 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue Jun 26 16:38:58 2018
New Revision: 335689

URL: http://llvm.org/viewvc/llvm-project?rev=335689&view=rev
Log:
The Process class ivar ivar was changed to a weak pointer, but was still _sp.
Fix that to _wp.

Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=335689&r1=335688&r2=335689&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Jun 26 16:38:58 2018
@@ -1461,7 +1461,7 @@ public:
   /// A Target object pointer to the target that owns this
   /// module.
   //--
-  Target &GetTarget() { return *m_target_sp.lock(); }
+  Target &GetTarget() { return *m_target_wp.lock(); }
 
   //--
   /// Get the const target object pointer for this module.
@@ -1470,7 +1470,7 @@ public:
   /// A const Target object pointer to the target that owns this
   /// module.
   //--
-  const Target &GetTarget() const { return *m_target_sp.lock(); }
+  const Target &GetTarget() const { return *m_target_wp.lock(); }
 
   //--
   /// Flush all data in the process.
@@ -2994,7 +2994,7 @@ protected:
   //--
   // Member variables
   //--
-  std::weak_ptr m_target_sp; ///< The target that owns this process.
+  std::weak_ptr m_target_wp; ///< The target that owns this process.
   ThreadSafeValue m_public_state;
   ThreadSafeValue
   m_private_state; // The actual state of our process

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=335689&r1=335688&r2=335689&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Jun 26 16:38:58 2018
@@ -725,7 +725,7 @@ Process::Process(lldb::TargetSP target_s
 : ProcessProperties(this), UserID(LLDB_INVALID_PROCESS_ID),
   Broadcaster((target_sp->GetDebugger().GetBroadcasterManager()),
   Process::GetStaticBroadcasterClass().AsCString()),
-  m_target_sp(target_sp), m_public_state(eStateUnloaded),
+  m_target_wp(target_sp), m_public_state(eStateUnloaded),
   m_private_state(eStateUnloaded),
   m_private_state_broadcaster(nullptr,
   "lldb.process.internal_state_broadcaster"),
@@ -4377,7 +4377,7 @@ bool Process::ProcessEventData::SetUpdat
   return false;
 }
 
-lldb::TargetSP Process::CalculateTarget() { return m_target_sp.lock(); }
+lldb::TargetSP Process::CalculateTarget() { return m_target_wp.lock(); }
 
 void Process::CalculateExecutionContext(ExecutionContext &exe_ctx) {
   exe_ctx.SetTargetPtr(&GetTarget());


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


Re: [Lldb-commits] Adding a test for split-dwarf

2018-06-26 Thread Adrian Prantl via lldb-commits
We just use reviews.llvm.org  and CC lldb-commits.

-- adrian

> On Jun 25, 2018, at 9:09 PM, Puyan Lotfi via lldb-commits 
>  wrote:
> 
> This is a first draft. Just trying to do some basic breakpoint and line 
> number checks on a split dwarf compiled binary for now.
> 
> 
> Also, is there an LLDB phabricator? I didn't notice it in the project listing 
> in reviews.llvm.org .
> 
> PL
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] r335690 - Use the API's to get the TargetSP.

2018-06-26 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue Jun 26 16:54:50 2018
New Revision: 335690

URL: http://llvm.org/viewvc/llvm-project?rev=335690&view=rev
Log:
Use the API's to get the TargetSP.

Modified:
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=335690&r1=335689&r2=335690&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Tue Jun 
26 16:54:50 2018
@@ -787,7 +787,7 @@ void ProcessWindows::OnExitProcess(uint3
   Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
   LLDB_LOG(log, "Process {0} exited with code {1}", GetID(), exit_code);
 
-  TargetSP target = m_target_sp.lock();
+  TargetSP target = CalculateTarget();
   if (target) {
 ModuleSP executable_module = target->GetExecutableModule();
 ModuleList unloaded_modules;


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


[Lldb-commits] [PATCH] D48620: Fix a single typo in SBSymbolContext

2018-06-26 Thread Dave Lee via Phabricator via lldb-commits
kastiglione created this revision.
kastiglione added a reviewer: xiaobai.

Fix a "Manay" in SBSymbolContext.i


https://reviews.llvm.org/D48620

Files:
  scripts/interface/SBSymbolContext.i


Index: scripts/interface/SBSymbolContext.i
===
--- scripts/interface/SBSymbolContext.i
+++ scripts/interface/SBSymbolContext.i
@@ -12,7 +12,7 @@
 %feature("docstring",
 "A context object that provides access to core debugger entities.
 
-Manay debugger functions require a context when doing lookups. This class
+Many debugger functions require a context when doing lookups. This class
 provides a common structure that can be used as the result of a query that
 can contain a single result.
 


Index: scripts/interface/SBSymbolContext.i
===
--- scripts/interface/SBSymbolContext.i
+++ scripts/interface/SBSymbolContext.i
@@ -12,7 +12,7 @@
 %feature("docstring",
 "A context object that provides access to core debugger entities.
 
-Manay debugger functions require a context when doing lookups. This class
+Many debugger functions require a context when doing lookups. This class
 provides a common structure that can be used as the result of a query that
 can contain a single result.
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48620: Fix a single typo in SBSymbolContext

2018-06-26 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

Woohoo!


https://reviews.llvm.org/D48620



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


[Lldb-commits] [lldb] r335709 - Fix a single typo in SBSymbolContext

2018-06-26 Thread Dave Lee via lldb-commits
Author: kastiglione
Date: Tue Jun 26 23:46:09 2018
New Revision: 335709

URL: http://llvm.org/viewvc/llvm-project?rev=335709&view=rev
Log:
Fix a single typo in SBSymbolContext

Summary: Fix a "Manay" in SBSymbolContext.i

Reviewers: xiaobai

Reviewed By: xiaobai

Subscribers: lldb-commits

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

Modified:
lldb/trunk/scripts/interface/SBSymbolContext.i

Modified: lldb/trunk/scripts/interface/SBSymbolContext.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBSymbolContext.i?rev=335709&r1=335708&r2=335709&view=diff
==
--- lldb/trunk/scripts/interface/SBSymbolContext.i (original)
+++ lldb/trunk/scripts/interface/SBSymbolContext.i Tue Jun 26 23:46:09 2018
@@ -12,7 +12,7 @@ namespace lldb {
 %feature("docstring",
 "A context object that provides access to core debugger entities.
 
-Manay debugger functions require a context when doing lookups. This class
+Many debugger functions require a context when doing lookups. This class
 provides a common structure that can be used as the result of a query that
 can contain a single result.
 


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


[Lldb-commits] [PATCH] D48620: Fix a single typo in SBSymbolContext

2018-06-26 Thread Dave Lee via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL335709: Fix a single typo in SBSymbolContext (authored by 
kastiglione, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D48620

Files:
  lldb/trunk/scripts/interface/SBSymbolContext.i


Index: lldb/trunk/scripts/interface/SBSymbolContext.i
===
--- lldb/trunk/scripts/interface/SBSymbolContext.i
+++ lldb/trunk/scripts/interface/SBSymbolContext.i
@@ -12,7 +12,7 @@
 %feature("docstring",
 "A context object that provides access to core debugger entities.
 
-Manay debugger functions require a context when doing lookups. This class
+Many debugger functions require a context when doing lookups. This class
 provides a common structure that can be used as the result of a query that
 can contain a single result.
 


Index: lldb/trunk/scripts/interface/SBSymbolContext.i
===
--- lldb/trunk/scripts/interface/SBSymbolContext.i
+++ lldb/trunk/scripts/interface/SBSymbolContext.i
@@ -12,7 +12,7 @@
 %feature("docstring",
 "A context object that provides access to core debugger entities.
 
-Manay debugger functions require a context when doing lookups. This class
+Many debugger functions require a context when doing lookups. This class
 provides a common structure that can be used as the result of a query that
 can contain a single result.
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits