[Lldb-commits] [PATCH] D114675: [lldb] [Target] Support fallback to file address in ReadMemory()

2021-11-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Well, that's what happens with the core file I have and what you're asking for 
is really above my paygrade. That said, this is kernel core dump, so load 
addresses should probably be the same as vm-addresses in the file. If adding 
something simple to the core file will achieve this, I suppose I can modify the 
generator instead.


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

https://reviews.llvm.org/D114675

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


[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

I'm not sure if this falls into NFC category since I'm changing how flags are 
stored.


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

https://reviews.llvm.org/D114746

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


[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:1
+#include "DWARFASTParser.h"
+#include "DWARFAttribute.h"

bulbazord wrote:
> This file will need a license header.
Yes, my bad. Thanks for noticing it.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:77
+  default:
+  case DW_AT_abstract_origin:
+  case DW_AT_accessibility:

bulbazord wrote:
> ljmf00 wrote:
> > Why we are including just these specific attributes? Maybe we should add a 
> > comment explaining it. According to the DWARF standard, any attribute is 
> > eligible for any tag.
> I'm not sure why. Possibly they were added to make sure the switch was fully 
> covered (potentially to silence a warning)? You could add a `FIXME` or a 
> `TODO` if you feel that these attributes should have functionality associated 
> with them like the ones above.
I don't think it is to mark it as fully covered since there are much more 
attributes, the default label will address it anyway, and according to the 
DWARF standard, any attribute can be in a type tag (realistically, any tag). We 
can take the example of `DW_AT_description` which is just a description 
associated with the symbol. I feel like this can be safely deleted but I'm 
afraid to do it in favour of some other rationale I'm not seeing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D114675: [lldb] [Target] Support fallback to file address in ReadMemory()

2021-11-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Is this the proposal: If you are talking to a live process (including a Core 
File process) and the plugin you are using says it knows nothing about 0x1234, 
then as a fallback you ask some file if it has that address?  Why do you need 
to do this?  Are you guessing that the core file is just busted, and there 
should have been records in it for some loaded section but they were left out, 
and so you are guessing that they are going to be in the same place as if that 
section loaded rigidly in its place in the original file (not necessarily true)?

Once you have a process, the process is the truth of the memory layout.  Unless 
there's a real reason why the process lied to you about what was in the binary, 
I don't think we should be making up other data sources.  And it also seems 
like you would have to understand WHY this particular plugin was lying to you 
to know how to actually recover that memory correctly.

This doesn't seem like a good idea to me, and also seems like it's covering 
some other bug.


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

https://reviews.llvm.org/D114675

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


[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-11-29 Thread David Blaikie via Phabricator via lldb-commits
dblaikie requested changes to this revision.
dblaikie added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/include/lldb/Symbol/Type.h:204-206
+  static bool GetTypeScopeAndBasename(const llvm::StringRef name,
+  llvm::StringRef scope,
+  llvm::StringRef basename,





Comment at: lldb/source/Symbol/Type.cpp:665-667
+bool Type::GetTypeScopeAndBasename(const llvm::StringRef name,
+   llvm::StringRef scope,
+   llvm::StringRef basename,




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113604

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


[Lldb-commits] [lldb] 2e5c47e - Revert "[lldb][NFC] Format lldb/include/lldb/Symbol/Type.h"

2021-11-29 Thread Luís Ferreira via lldb-commits

Author: Luís Ferreira
Date: 2021-11-30T00:52:53Z
New Revision: 2e5c47eda14a547c21e57d869a1e51ffd9938289

URL: 
https://github.com/llvm/llvm-project/commit/2e5c47eda14a547c21e57d869a1e51ffd9938289
DIFF: 
https://github.com/llvm/llvm-project/commit/2e5c47eda14a547c21e57d869a1e51ffd9938289.diff

LOG: Revert "[lldb][NFC] Format lldb/include/lldb/Symbol/Type.h"

This reverts commit 6f99e1aa58e3566fcce689bc986b7676e818c038.

Added: 


Modified: 
lldb/include/lldb/Symbol/Type.h
lldb/source/Symbol/Type.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 5f0afdd94cd60..9e671a565dd14 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -67,27 +67,23 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-/// This type is the type whose UID is m_encoding_uid.
-eEncodingIsUID,
-/// This type is the type whose UID is m_encoding_uid with the const
-/// qualifier added.
-eEncodingIsConstUID,
-/// This type is the type whose UID is m_encoding_uid with the restrict
-/// qualifier added.
-eEncodingIsRestrictUID,
-/// This type is the type whose UID is m_encoding_uid with the volatile
-/// qualifier added.
-eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
-eEncodingIsTypedefUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
-eEncodingIsPointerUID,
-/// This type is L value reference to a type whose UID is m_encoding_uid.
-eEncodingIsLValueReferenceUID,
-/// This type is R value reference to a type whose UID is m_encoding_uid.
-eEncodingIsRValueReferenceUID,
-/// This type is the type whose UID is m_encoding_uid as an atomic type.
-eEncodingIsAtomicUID,
+eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
+eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
+ /// with the const qualifier added
+eEncodingIsRestrictUID, ///< This type is the type whose UID is
+/// m_encoding_uid with the restrict qualifier 
added
+eEncodingIsVolatileUID, ///< This type is the type whose UID is
+/// m_encoding_uid with the volatile qualifier 
added
+eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
+/// m_encoding_uid
+eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
+/// m_encoding_uid
+eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
+   /// whose UID is m_encoding_uid
+eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
+   /// whose UID is m_encoding_uid,
+eEncodingIsAtomicUID,  ///< This type is the type whose UID is
+   /// m_encoding_uid as an atomic type.
 eEncodingIsSyntheticUID
   };
 
@@ -201,9 +197,9 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef name,
-  llvm::StringRef scope,
-  llvm::StringRef basename,
+  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+  llvm::StringRef ,
+  llvm::StringRef ,
   lldb::TypeClass _class);
   void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; 
}
 
@@ -477,8 +473,8 @@ class TypeEnumMemberImpl {
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
- const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
+ ConstString name, const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 

diff  --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 569d1bad165ce..5b4169d256d29 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@ ConstString Type::GetQualifiedName() {
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef name,
-   llvm::StringRef scope,
-   llvm::StringRef basename,
+bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+   

[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-11-29 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added inline comments.



Comment at: lldb/include/lldb/Symbol/Type.h:205-206
+  static bool GetTypeScopeAndBasename(const llvm::StringRef name,
+  llvm::StringRef scope,
+  llvm::StringRef basename,
   lldb::TypeClass _class);

Looks like this could've broken some tests - might be best to revert and retest?

The `const StringRef&` should've been changed to `StringRef` per 
@JDevlieghere's comment, but the non-const `StringRef&` were/are probably 
load-bearing - they're the result of calling this function (using mutable ref 
parameters as "out" parameters) & passing them by value breaks that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113604

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


[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6f99e1aa58e3: [lldb][NFC] Format 
lldb/include/lldb/Symbol/Type.h (authored by ljmf00).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h
  lldb/source/Symbol/Type.cpp


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
-   llvm::StringRef ,
-   llvm::StringRef ,
+bool Type::GetTypeScopeAndBasename(const llvm::StringRef name,
+   llvm::StringRef scope,
+   llvm::StringRef basename,
TypeClass _class) {
   type_class = eTypeClassAny;
 
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,9 +201,9 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
-  llvm::StringRef ,
-  llvm::StringRef ,
+  static bool GetTypeScopeAndBasename(const llvm::StringRef name,
+  llvm::StringRef scope,
+  llvm::StringRef basename,
   lldb::TypeClass _class);
   void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; 
}
 
@@ -473,8 +477,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& 

[Lldb-commits] [lldb] 6f99e1a - [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-11-29 Thread Luís Ferreira via lldb-commits

Author: Luís Ferreira
Date: 2021-11-29T23:55:58Z
New Revision: 6f99e1aa58e3566fcce689bc986b7676e818c038

URL: 
https://github.com/llvm/llvm-project/commit/6f99e1aa58e3566fcce689bc986b7676e818c038
DIFF: 
https://github.com/llvm/llvm-project/commit/6f99e1aa58e3566fcce689bc986b7676e818c038.diff

LOG: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

Reviewed By: teemperor, JDevlieghere

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

Signed-off-by: Luís Ferreira 

Added: 


Modified: 
lldb/include/lldb/Symbol/Type.h
lldb/source/Symbol/Type.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 9e671a565dd14..5f0afdd94cd60 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,9 +201,9 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
-  llvm::StringRef ,
-  llvm::StringRef ,
+  static bool GetTypeScopeAndBasename(const llvm::StringRef name,
+  llvm::StringRef scope,
+  llvm::StringRef basename,
   lldb::TypeClass _class);
   void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; 
}
 
@@ -473,8 +477,8 @@ class TypeEnumMemberImpl {
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 

diff  --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 5b4169d256d29..569d1bad165ce 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@ ConstString Type::GetQualifiedName() {
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
-   llvm::StringRef ,
-   llvm::StringRef ,
+bool Type::GetTypeScopeAndBasename(const llvm::StringRef name,
+ 

[Lldb-commits] [PATCH] D114746: [lldb][NFC] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390489.

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

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
@@ -77,4 +80,79 @@
   collection m_infos;
 };
 
+FLAGS_ENUM(DWARFAttributeFlags)
+{
+  /// Whether it is an artificially generated symbol.
+  eDWARFAttributeIsArtificial = (1u << 0),
+  eDWARFAttributeIsExplicit = (1u << 1),
+  eDWARFAttributeIsForwardDecl = (1u << 2),
+  eDWARFAttributeIsInline = (1u << 3),
+  eDWARFAttributeIsScopedEnum = (1u << 4),
+  eDWARFAttributeIsVector = (1u << 5),
+  eDWARFAttributeIsVirtual = (1u << 6),
+  eDWARFAttributeIsExternal = (1u << 7),
+  eDWARFAttributeExportSymbols = (1u << 8),
+  eDWARFAttributeIsObjCDirect = (1u << 9),
+  eDWARFAttributeIsObjCCompleteType = (1u << 10),
+};
+
+/// Parsed form of all attributes that are relevant for type reconstruction.
+/// Some attributes are relevant for all kinds of types (declaration), while
+/// others are only meaningful to a specific type (is_virtual).
+struct ParsedDWARFTypeAttributes {
+  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
+
+  lldb::AccessType accessibility = lldb::eAccessNone;
+  uint32_t attr_flags = 0;
+  const char *mangled_name = nullptr;
+  lldb_private::ConstString name;
+  lldb_private::Declaration decl;
+  DWARFDIE object_pointer;
+  DWARFFormValue abstract_origin;
+  DWARFFormValue containing_type;
+  DWARFFormValue signature;
+  DWARFFormValue specification;
+  DWARFFormValue type;
+  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
+  llvm::Optional byte_size;
+  size_t calling_convention = llvm::dwarf::DW_CC_normal;
+  uint32_t bit_stride = 0;
+  uint32_t byte_stride = 0;
+  uint32_t encoding = 0;
+
+  inline bool is_artificial() const {
+return attr_flags & eDWARFAttributeIsArtificial;
+  }
+  inline bool is_explicit() const {
+return attr_flags & eDWARFAttributeIsExplicit;
+  }
+  inline bool is_forward_declaration() const {
+return attr_flags & eDWARFAttributeIsForwardDecl;
+  }
+  inline bool is_inline() const {
+return attr_flags & eDWARFAttributeIsInline;
+  }
+  inline bool is_scoped_enum() const {
+return attr_flags 
+  }
+  inline bool is_vector() const {
+return attr_flags & eDWARFAttributeIsVector;
+  }
+  inline bool is_virtual() const {
+return attr_flags & eDWARFAttributeIsVirtual;
+  }
+  inline bool is_external() const {
+return attr_flags & eDWARFAttributeIsExternal;
+  }
+  inline bool exports_symbols() const {
+return attr_flags & eDWARFAttributeExportSymbols;
+  }
+  inline bool is_objc_direct_call() const {
+return attr_flags & eDWARFAttributeIsObjCDirect;
+  }
+  inline bool is_objc_complete_type() const {
+return attr_flags & eDWARFAttributeIsObjCCompleteType;
+  }
+};
+
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -7,8 +7,11 @@
 //===--===//
 
 #include "DWARFAttribute.h"
-#include "DWARFUnit.h"
+#include "DWARFASTParser.h"
 #include "DWARFDebugInfo.h"
+#include "DWARFUnit.h"
+
+using namespace lldb;
 
 DWARFAttributes::DWARFAttributes() : m_infos() {}
 
@@ -61,3 +64,141 @@
 return form_value.Reference();
   return {};
 }
+
+ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
+  DWARFAttributes attributes;
+  size_t num_attributes = die.GetAttributes(attributes);
+  for (size_t i = 0; i < num_attributes; ++i) {
+dw_attr_t attr = attributes.AttributeAtIndex(i);
+DWARFFormValue form_value;
+if (!attributes.ExtractFormValueAtIndex(i, form_value))
+  continue;
+switch (attr) {
+case DW_AT_abstract_origin:
+  abstract_origin = form_value;
+  break;
+
+case DW_AT_accessibility:
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
+  break;
+
+case DW_AT_artificial:
+  if (form_value.Boolean())
+attr_flags 

[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D114719#3159587 , @bulbazord wrote:

> This makes sense to me. Out of curiosity, do you have plans to use this for 
> non-clang-based languages?

Yes. I'm currently working on a D language plugin. You can see my fork, until I 
upstream it https://github.com/ljmf00/lldb-d .


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

https://reviews.llvm.org/D114719

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


[Lldb-commits] [PATCH] D114746: [lldb][NFC] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390487.

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

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
@@ -77,4 +80,79 @@
   collection m_infos;
 };
 
+FLAGS_ENUM(DWARFAttributeFlags)
+{
+  /// Whether it is an artificially generated symbol.
+  eDWARFAttributeIsArtificial = (1u << 0),
+  eDWARFAttributeIsExplicit = (1u << 1),
+  eDWARFAttributeIsForwardDecl = (1u << 2),
+  eDWARFAttributeIsInline = (1u << 3),
+  eDWARFAttributeIsScopedEnum = (1u << 4),
+  eDWARFAttributeIsVector = (1u << 5),
+  eDWARFAttributeIsVirtual = (1u << 6),
+  eDWARFAttributeIsExternal = (1u << 7),
+  eDWARFAttributeExportSymbols = (1u << 8),
+  eDWARFAttributeIsObjCDirect = (1u << 9),
+  eDWARFAttributeIsObjCCompleteType = (1u << 10),
+};
+
+/// Parsed form of all attributes that are relevant for type reconstruction.
+/// Some attributes are relevant for all kinds of types (declaration), while
+/// others are only meaningful to a specific type (is_virtual).
+struct ParsedDWARFTypeAttributes {
+  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
+
+  lldb::AccessType accessibility = lldb::eAccessNone;
+  uint32_t attr_flags = 0;
+  const char *mangled_name = nullptr;
+  lldb_private::ConstString name;
+  lldb_private::Declaration decl;
+  DWARFDIE object_pointer;
+  DWARFFormValue abstract_origin;
+  DWARFFormValue containing_type;
+  DWARFFormValue signature;
+  DWARFFormValue specification;
+  DWARFFormValue type;
+  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
+  llvm::Optional byte_size;
+  size_t calling_convention = llvm::dwarf::DW_CC_normal;
+  uint32_t bit_stride = 0;
+  uint32_t byte_stride = 0;
+  uint32_t encoding = 0;
+
+  inline bool is_artificial() const {
+return attr_flags & eDWARFAttributeIsArtificial;
+  }
+  inline bool is_explicit() const {
+return attr_flags & eDWARFAttributeIsExplicit;
+  }
+  inline bool is_forward_declaration() const {
+return attr_flags & eDWARFAttributeIsForwardDecl;
+  }
+  inline bool is_inline() const {
+return attr_flags & eDWARFAttributeIsInline;
+  }
+  inline bool is_scoped_enum() const {
+return attr_flags 
+  }
+  inline bool is_vector() const {
+return attr_flags & eDWARFAttributeIsVector;
+  }
+  inline bool is_virtual() const {
+return attr_flags & eDWARFAttributeIsVirtual;
+  }
+  inline bool is_external() const {
+return attr_flags & eDWARFAttributeIsExternal;
+  }
+  inline bool exports_symbols() const {
+return attr_flags & eDWARFAttributeExportSymbols;
+  }
+  inline bool is_objc_direct_call() const {
+return attr_flags & eDWARFAttributeIsObjCDirect;
+  }
+  inline bool is_objc_complete_type() const {
+return attr_flags & eDWARFAttributeIsObjCCompleteType;
+  }
+};
+
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -7,8 +7,11 @@
 //===--===//
 
 #include "DWARFAttribute.h"
-#include "DWARFUnit.h"
+#include "DWARFASTParser.h"
 #include "DWARFDebugInfo.h"
+#include "DWARFUnit.h"
+
+using namespace lldb;
 
 DWARFAttributes::DWARFAttributes() : m_infos() {}
 
@@ -61,3 +64,141 @@
 return form_value.Reference();
   return {};
 }
+
+ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
+  DWARFAttributes attributes;
+  size_t num_attributes = die.GetAttributes(attributes);
+  for (size_t i = 0; i < num_attributes; ++i) {
+dw_attr_t attr = attributes.AttributeAtIndex(i);
+DWARFFormValue form_value;
+if (!attributes.ExtractFormValueAtIndex(i, form_value))
+  continue;
+switch (attr) {
+case DW_AT_abstract_origin:
+  abstract_origin = form_value;
+  break;
+
+case DW_AT_accessibility:
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
+  break;
+
+case DW_AT_artificial:
+  if (form_value.Boolean())
+attr_flags 

[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch generalizes the ParsedDWARFTypeAttributes struct to be able to share 
with other DWARF parsers other than clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
@@ -77,4 +80,79 @@
   collection m_infos;
 };
 
+FLAGS_ENUM(DWARFAttributeFlags)
+{
+  /// Whether it is an artificially generated symbol.
+  eDWARFAttributeIsArtificial = (1u << 0),
+  eDWARFAttributeIsExplicit = (1u << 1),
+  eDWARFAttributeIsForwardDecl = (1u << 2),
+  eDWARFAttributeIsInline = (1u << 3),
+  eDWARFAttributeIsScopedEnum = (1u << 4),
+  eDWARFAttributeIsVector = (1u << 5),
+  eDWARFAttributeIsVirtual = (1u << 6),
+  eDWARFAttributeIsExternal = (1u << 7),
+  eDWARFAttributeExportSymbols = (1u << 8),
+  eDWARFAttributeIsObjCDirect = (1u << 9),
+  eDWARFAttributeIsObjCCompleteType = (1u << 10),
+};
+
+/// Parsed form of all attributes that are relevant for type reconstruction.
+/// Some attributes are relevant for all kinds of types (declaration), while
+/// others are only meaningful to a specific type (is_virtual).
+struct ParsedDWARFTypeAttributes {
+  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
+
+  lldb::AccessType accessibility = lldb::eAccessNone;
+  uint32_t attr_flags = 0;
+  const char *mangled_name = nullptr;
+  lldb_private::ConstString name;
+  lldb_private::Declaration decl;
+  DWARFDIE object_pointer;
+  DWARFFormValue abstract_origin;
+  DWARFFormValue containing_type;
+  DWARFFormValue signature;
+  DWARFFormValue specification;
+  DWARFFormValue type;
+  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
+  llvm::Optional byte_size;
+  size_t calling_convention = llvm::dwarf::DW_CC_normal;
+  uint32_t bit_stride = 0;
+  uint32_t byte_stride = 0;
+  uint32_t encoding = 0;
+
+  inline bool is_artificial() const {
+return attr_flags & eDWARFAttributeIsArtificial;
+  }
+  inline bool is_explicit() const {
+return attr_flags & eDWARFAttributeIsExplicit;
+  }
+  inline bool is_forward_declaration() const {
+return attr_flags & eDWARFAttributeIsForwardDecl;
+  }
+  inline bool is_inline() const {
+return attr_flags & eDWARFAttributeIsInline;
+  }
+  inline bool is_scoped_enum() const {
+return attr_flags 
+  }
+  inline bool is_vector() const {
+return attr_flags & eDWARFAttributeIsVector;
+  }
+  inline bool is_virtual() const {
+return attr_flags & eDWARFAttributeIsVirtual;
+  }
+  inline bool is_external() const {
+return attr_flags & eDWARFAttributeIsExternal;
+  }
+  inline bool exports_symbols() const {
+return attr_flags & eDWARFAttributeExportSymbols;
+  }
+  inline bool is_objc_direct_call() const {
+return attr_flags & eDWARFAttributeIsObjCDirect;
+  }
+  inline bool is_objc_complete_type() const {
+return attr_flags & eDWARFAttributeIsObjCCompleteType;
+  }
+};
+
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -7,8 +7,11 @@
 //===--===//
 
 #include "DWARFAttribute.h"
-#include "DWARFUnit.h"
+#include "DWARFASTParser.h"
 #include "DWARFDebugInfo.h"
+#include "DWARFUnit.h"
+
+using namespace lldb;
 
 DWARFAttributes::DWARFAttributes() : m_infos() {}
 
@@ -61,3 +64,141 @@
 return form_value.Reference();
   return {};
 }
+
+ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
+  DWARFAttributes attributes;
+  size_t num_attributes = die.GetAttributes(attributes);
+  for (size_t i = 0; i < num_attributes; ++i) {
+dw_attr_t attr = attributes.AttributeAtIndex(i);
+DWARFFormValue form_value;
+if (!attributes.ExtractFormValueAtIndex(i, form_value))
+  continue;
+switch (attr) {
+case DW_AT_abstract_origin:
+  abstract_origin = form_value;

[Lldb-commits] [PATCH] D114668: [lldb] Move generic DWARFASTParser code out of Clang-specific code

2021-11-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

I think breaking it out of the Clang-specific class makes sense if we want LLDB 
to be more language-agnostic. Do you have an idea of what bits of 
`DWARFASTParserClang` can be moved out other than `ParseChildArrayInfo` and 
`GetAccessTypeFromDWARF` (from the patch on top of this)? What is your end-goal 
with this decoupling? I assume you want to work towards supporting languages 
non-clang-based languages but I'm curious about the motivation.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:1
+#include "DWARFASTParser.h"
+#include "DWARFAttribute.h"

This file will need a license header.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:77
+  default:
+  case DW_AT_abstract_origin:
+  case DW_AT_accessibility:

ljmf00 wrote:
> Why we are including just these specific attributes? Maybe we should add a 
> comment explaining it. According to the DWARF standard, any attribute is 
> eligible for any tag.
I'm not sure why. Possibly they were added to make sure the switch was fully 
covered (potentially to silence a warning)? You could add a `FIXME` or a `TODO` 
if you feel that these attributes should have functionality associated with 
them like the ones above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D114742: [lldb] Search PrivateFrameworks when using an internal SDK

2021-11-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jasonmolenda.
JDevlieghere requested review of this revision.
Herald added a project: LLDB.

Make sure to add the PrivateFrameworks directory to the frameworks path when 
using an internal SDK. This is necessary for the "on-device" test suite.

rdar://84519268


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114742

Files:
  lldb/packages/Python/lldbsuite/test/builders/darwin.py


Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -79,6 +79,12 @@
 if configuration.dsymutil:
 args['DSYMUTIL'] = configuration.dsymutil
 
+if 'internal' in configuration.apple_sdk:
+sdk_root = lldbutil.get_xcode_sdk_root(configuration.apple_sdk)
+if sdk_root:
+private_frameworks = os.path.join(sdk_root, 
'System','Library','PrivateFrameworks')
+args['FRAMEWORK_INCLUDES'] = '-F{}'.format(private_frameworks)
+
 operating_system, env = get_os_and_env()
 if operating_system and operating_system != "macosx":
 builder_dir = os.path.dirname(os.path.abspath(__file__))


Index: lldb/packages/Python/lldbsuite/test/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -79,6 +79,12 @@
 if configuration.dsymutil:
 args['DSYMUTIL'] = configuration.dsymutil
 
+if 'internal' in configuration.apple_sdk:
+sdk_root = lldbutil.get_xcode_sdk_root(configuration.apple_sdk)
+if sdk_root:
+private_frameworks = os.path.join(sdk_root, 'System','Library','PrivateFrameworks')
+args['FRAMEWORK_INCLUDES'] = '-F{}'.format(private_frameworks)
+
 operating_system, env = get_os_and_env()
 if operating_system and operating_system != "macosx":
 builder_dir = os.path.dirname(os.path.abspath(__file__))
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

This makes sense to me. Out of curiosity, do you have plans to use this for 
non-clang-based languages?


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

https://reviews.llvm.org/D114719

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


[Lldb-commits] [lldb] 4f215bf - Update unit test API usage (NFC)

2021-11-29 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-11-29T13:14:35-08:00
New Revision: 4f215bfa6ee525b245b81462d75c3e1e47d18f13

URL: 
https://github.com/llvm/llvm-project/commit/4f215bfa6ee525b245b81462d75c3e1e47d18f13
DIFF: 
https://github.com/llvm/llvm-project/commit/4f215bfa6ee525b245b81462d75c3e1e47d18f13.diff

LOG: Update unit test API usage (NFC)

Added: 


Modified: 
lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp

Removed: 




diff  --git a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp 
b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
index 42549e89cc34a..87c30debfd793 100644
--- a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
+++ b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
@@ -30,10 +30,7 @@ static void 
testSimPlatformArchHasSimEnvironment(llvm::StringRef name) {
   ASSERT_TRUE(platform_sp);
   int num_arches = 0;
 
-  while (true) {
-ArchSpec arch;
-if (!platform_sp->GetSupportedArchitectureAtIndex(num_arches, arch))
-  break;
+  for (auto arch : platform_sp->GetSupportedArchitectures()) {
 EXPECT_EQ(arch.GetTriple().getEnvironment(), llvm::Triple::Simulator);
 num_arches++;
   }



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


[Lldb-commits] [PATCH] D114288: [NFC] Refactor symbol table parsing.

2021-11-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg updated this revision to Diff 390444.
clayborg added a comment.

Let the call_once protect the ObjectFile::m_symtab_up as suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114288

Files:
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/Symbol/Symtab.h
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
  lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
  lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/ObjectFile.cpp
  lldb/source/Symbol/Symtab.cpp

Index: lldb/source/Symbol/Symtab.cpp
===
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -997,10 +997,15 @@
   }
 }
 
-void Symtab::CalculateSymbolSizes() {
+void Symtab::Finalize() {
   std::lock_guard guard(m_mutex);
-  // Size computation happens inside InitAddressIndexes.
+  // Calculate the size of symbols inside InitAddressIndexes.
   InitAddressIndexes();
+  // Shrink to fit the symbols so we don't waste memory
+  if (m_symbols.capacity() > m_symbols.size()) {
+collection new_symbols(m_symbols.begin(), m_symbols.end());
+m_symbols.swap(new_symbols);
+  }
 }
 
 Symbol *Symtab::FindSymbolAtFileAddress(addr_t file_addr) {
Index: lldb/source/Symbol/ObjectFile.cpp
===
--- lldb/source/Symbol/ObjectFile.cpp
+++ lldb/source/Symbol/ObjectFile.cpp
@@ -244,7 +244,7 @@
   m_type(eTypeInvalid), m_strata(eStrataInvalid),
   m_file_offset(file_offset), m_length(length), m_data(), m_process_wp(),
   m_memory_addr(LLDB_INVALID_ADDRESS), m_sections_up(), m_symtab_up(),
-  m_synthetic_symbol_idx(0) {
+  m_symtab_once_up(new llvm::once_flag()) {
   if (file_spec_ptr)
 m_file = *file_spec_ptr;
   if (data_sp)
@@ -265,7 +265,7 @@
 : ModuleChild(module_sp), m_file(), m_type(eTypeInvalid),
   m_strata(eStrataInvalid), m_file_offset(0), m_length(0), m_data(),
   m_process_wp(process_sp), m_memory_addr(header_addr), m_sections_up(),
-  m_symtab_up(), m_synthetic_symbol_idx(0) {
+  m_symtab_up(), m_symtab_once_up(new llvm::once_flag()) {
   if (header_data_sp)
 m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize());
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
@@ -571,11 +571,13 @@
 void ObjectFile::ClearSymtab() {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
-std::lock_guard guard(module_sp->GetMutex());
 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
 LLDB_LOGF(log, "%p ObjectFile::ClearSymtab () symtab = %p",
   static_cast(this),
   static_cast(m_symtab_up.get()));
+// Since we need to clear the symbol table, we need a new llvm::once_flag
+// instance so we can safely create another symbol table
+m_symtab_once_up.reset(new llvm::once_flag());
 m_symtab_up.reset();
   }
 }
@@ -715,3 +717,33 @@
 break;
   }
 }
+
+
+Symtab *ObjectFile::GetSymtab() {
+  ModuleSP module_sp(GetModule());
+  if (module_sp) {
+// We can't take the module lock in ObjectFile::GetSymtab() or we can
+// deadlock in DWARF indexing when any file asks for the symbol table from
+// an object file. This currently happens in the preloading of symbols in
+// SymbolFileDWARF::PreloadSymbols() because the main thread will take the
+// module lock, and then threads will be spun up to index the DWARF and
+// any of those threads might end up trying to relocate items in the DWARF
+// sections which causes ObjectFile::GetSectionData(...) to relocate section
+// data which requires the symbol table.
+//
+// So to work around this, we create the symbol table one time using
+// llvm::once_flag, lock it, and then set the unique pointer. Any other
+// thread that gets ahold of the symbol table before parsing is done, will
+// not be able to access the symbol table contents since all APIs in Symtab
+// are protected by a mutex in the Symtab object itself.
+

[Lldb-commits] [PATCH] D114467: [LLDB][NativePDB] Allow find functions by full names

2021-11-29 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

In D114467#3158960 , 
@stella.stamenova wrote:

> @zequanwu : It looks like the bot is still broken: 
> https://lab.llvm.org/buildbot/#/builders/83/builds/12413

The printed names are different between windows and linux. 
https://reviews.llvm.org/rGfe270ab061fa1200d1f7e121ac6671f7d24b73d6 would 
hopefully fix it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114467

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


[Lldb-commits] [lldb] fe270ab - [LLDB][NativePDB] fix find-functions.cpp failure on windows bots (2)

2021-11-29 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2021-11-29T11:06:06-08:00
New Revision: fe270ab061fa1200d1f7e121ac6671f7d24b73d6

URL: 
https://github.com/llvm/llvm-project/commit/fe270ab061fa1200d1f7e121ac6671f7d24b73d6
DIFF: 
https://github.com/llvm/llvm-project/commit/fe270ab061fa1200d1f7e121ac6671f7d24b73d6.diff

LOG: [LLDB][NativePDB] fix find-functions.cpp failure on windows bots (2)

Added: 


Modified: 
lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp
index 6e93afee0601..5c2332bea66c 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp
@@ -28,8 +28,8 @@ int main(int argc, char **argv) {
 // FIND-MAIN:  Function: id = {{.*}}, name = "main"
 // FIND-MAIN-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, char **)"
 
-// FIND-STATIC:  Function: id = {{.*}}, name = "static_fn"
+// FIND-STATIC:  Function: id = {{.*}}, name = "{{.*}}static_fn{{.*}}"
 // FIND-STATIC-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"
 
-// FIND-VAR:  Function: id = {{.*}}, name = "varargs_fn"
+// FIND-VAR:  Function: id = {{.*}}, name = "{{.*}}varargs_fn{{.*}}"
 // FIND-VAR-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, int, ...)"



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


[Lldb-commits] [PATCH] D114467: [LLDB][NativePDB] Allow find functions by full names

2021-11-29 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

@zequanwu : It looks like the bot is still broken: 
https://lab.llvm.org/buildbot/#/builders/83/builds/12413


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114467

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


[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390412.

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

https://reviews.llvm.org/D114719

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
 
 #include 
 
+#include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
@@ -62,20 +63,6 @@
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
-  switch (dwarf_accessibility) {
-  case DW_ACCESS_public:
-return eAccessPublic;
-  case DW_ACCESS_private:
-return eAccessPrivate;
-  case DW_ACCESS_protected:
-return eAccessProtected;
-  default:
-break;
-  }
-  return eAccessNone;
-}
-
 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
   switch (decl_kind) {
   case clang::Decl::CXXRecord:
@@ -313,7 +300,7 @@
   break;
 
 case DW_AT_accessibility:
-  accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
   break;
 
 case DW_AT_artificial:
@@ -1463,7 +1450,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
 
   case DW_AT_virtuality:
@@ -2532,7 +2519,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
   case DW_AT_artificial:
 is_artificial = form_value.Boolean();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
 
 class DWARFDIE;
 namespace lldb_private {
@@ -54,6 +55,8 @@
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE _die,
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+  static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -100,3 +100,18 @@
   }
   return array_info;
 }
+
+AccessType
+DWARFASTParser::GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+  switch (dwarf_accessibility) {
+  case DW_ACCESS_public:
+return eAccessPublic;
+  case DW_ACCESS_private:
+return eAccessPrivate;
+  case DW_ACCESS_protected:
+return eAccessProtected;
+  default:
+break;
+  }
+  return eAccessNone;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114467: [LLDB][NativePDB] Allow find functions by full names

2021-11-29 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

In D114467#3158778 , 
@stella.stamenova wrote:

> This broke the windows bot:
>
> https://lab.llvm.org/buildbot/#/builders/83/builds/12270
>
> I'd like to get it back to green, so please address this ASAP or I'll follow 
> up with a reverting change later today.

Thanks, https://reviews.llvm.org/rG34d02fada28753221eda576e2f651f9b23c3f1af 
should fix it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114467

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


[Lldb-commits] [lldb] 34d02fa - [LLDB][NativePDB] fix find-functions.cpp failure on windows bots

2021-11-29 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2021-11-29T10:05:09-08:00
New Revision: 34d02fada28753221eda576e2f651f9b23c3f1af

URL: 
https://github.com/llvm/llvm-project/commit/34d02fada28753221eda576e2f651f9b23c3f1af
DIFF: 
https://github.com/llvm/llvm-project/commit/34d02fada28753221eda576e2f651f9b23c3f1af.diff

LOG: [LLDB][NativePDB] fix find-functions.cpp failure on windows bots

Added: 


Modified: 
lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp
index 969ba058a394c..6e93afee0601c 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp
@@ -26,10 +26,10 @@ int main(int argc, char **argv) {
 }
 
 // FIND-MAIN:  Function: id = {{.*}}, name = "main"
-// FIND-MAIN-NEXT: FuncType: id = {{.*}}, byte-size = 0, compiler_type = "int 
(int, char **)"
+// FIND-MAIN-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, char **)"
 
 // FIND-STATIC:  Function: id = {{.*}}, name = "static_fn"
-// FIND-STATIC-NEXT: FuncType: id = {{.*}}, byte-size = 0, compiler_type = 
"int (void)"
+// FIND-STATIC-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"
 
 // FIND-VAR:  Function: id = {{.*}}, name = "varargs_fn"
-// FIND-VAR-NEXT: FuncType: id = {{.*}}, byte-size = 0, compiler_type = "int 
(int, int, ...)"
+// FIND-VAR-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, int, ...)"



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


[Lldb-commits] [PATCH] D77287: Windows: support `DoLoadImage`

2021-11-29 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd marked an inline comment as done.
compnerd added inline comments.



Comment at: lldb/source/Plugins/Platform/Windows/PlatformWindows.h:47-51
+  uint32_t DoLoadImage(lldb_private::Process *process,
+   const lldb_private::FileSpec _file,
+   const std::vector *paths,
+   lldb_private::Status ,
+   lldb_private::FileSpec *loaded_path) override;

JDevlieghere wrote:
> I know it's an `override`, but what a horrible interface...
I completely agree.



Comment at: lldb/test/Shell/Process/Windows/process_load.cpp:3
+
+// REQUIRES: system-windows
+// RUN: %build --compiler=clang-cl -o %t.exe -- %s

JDevlieghere wrote:
> compnerd wrote:
> > JDevlieghere wrote:
> > > We should probably have a `lit.local.cfg` in the Windows directory with 
> > > 
> > > ```
> > > if 'system-windows' not in config.available_features:
> > >   config.unsupported = True
> > > 
> > > ```
> > I think that's a good idea, but, should be a separate change - it isn't 
> > related to the load/unload functionality.
> Fair enough
I already pushed that change, so it's already taken care of, but it is not part 
of the set of changes :)


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

https://reviews.llvm.org/D77287

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


[Lldb-commits] [PATCH] D114722: [LLDB] Fix Python GIL-not-held issues

2021-11-29 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
rupprecht added a reviewer: labath.
rupprecht requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The GIL must be held when calling any Python C API functions. In multithreaded 
applications that use callbacks this requirement can easily be violated by 
accident. A general tool to ensure GIL health is not available, but patching 
Python Py_INCREF to add an assert provides a basic health check:

  +int PyGILState_Check(void); /* Include/internal/pystate.h */
  +
   #define Py_INCREF(op) ( \
  +assert(PyGILState_Check()), \
   _Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA   \
   ((PyObject *)(op))->ob_refcnt++)
  
   #define Py_DECREF(op)   \
   do {\
  +assert(PyGILState_Check()); \
   PyObject *_py_decref_tmp = (PyObject *)(op);\
   if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA   \
   --(_py_decref_tmp)->ob_refcnt != 0) \

Adding this assertion causes around 50 test failures in LLDB. Adjusting the 
scope of things guarded by `py_lock` fixes them.

More background: 
https://docs.python.org/3/glossary.html#term-global-interpreter-lock

Patch by Ralf Grosse-Kunstleve


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114722

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1568,9 +1568,9 @@
Locker::FreeLock);
 ret_val = LLDBSWIGPython_CreateFrameRecognizer(class_name,
m_dictionary_name.c_str());
-  }
 
-  return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+  }
 }
 
 lldb::ValueObjectListSP ScriptInterpreterPythonImpl::GetRecognizedArguments(
@@ -1632,9 +1632,9 @@
Locker::FreeLock);
 ret_val = LLDBSWIGPythonCreateOSPlugin(
 class_name, m_dictionary_name.c_str(), process_sp);
-  }
 
-  return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+  }
 }
 
 StructuredData::DictionarySP ScriptInterpreterPythonImpl::OSPlugin_RegisterInfo(
@@ -1890,9 +1890,9 @@
 args_data, error_str, thread_plan_sp);
 if (!ret_val)
   return {};
-  }
 
-  return StructuredData::ObjectSP(new StructuredPythonObject(ret_val));
+return StructuredData::ObjectSP(new StructuredPythonObject(ret_val));
+  }
 }
 
 bool ScriptInterpreterPythonImpl::ScriptedThreadPlanExplainsStop(
@@ -1992,9 +1992,9 @@
 ret_val = LLDBSwigPythonCreateScriptedBreakpointResolver(
 class_name, python_interpreter->m_dictionary_name.c_str(), args_data,
 bkpt_sp);
-  }
 
-  return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+  }
 }
 
 bool ScriptInterpreterPythonImpl::ScriptedBreakpointResolverSearchCallback(
@@ -2067,9 +2067,9 @@
 ret_val = LLDBSwigPythonCreateScriptedStopHook(
 target_sp, class_name, python_interpreter->m_dictionary_name.c_str(),
 args_data, error);
-  }
 
-  return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+  }
 }
 
 bool ScriptInterpreterPythonImpl::ScriptedStopHookHandleStop(
@@ -2165,9 +2165,9 @@
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
 ret_val = LLDBSwigPythonCreateSyntheticProvider(
 class_name, python_interpreter->m_dictionary_name.c_str(), valobj);
-  }
 
-  return StructuredData::ObjectSP(new StructuredPythonObject(ret_val));
+return StructuredData::ObjectSP(new StructuredPythonObject(ret_val));
+  }
 }
 
 StructuredData::GenericSP
@@ -2187,9 +2187,9 @@
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
 ret_val = LLDBSwigPythonCreateCommandObject(
 class_name, m_dictionary_name.c_str(), debugger_sp);
-  }
 
-  return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+return StructuredData::GenericSP(new StructuredPythonObject(ret_val));
+  }
 }
 
 bool ScriptInterpreterPythonImpl::GenerateTypeScriptFunction(
@@ -2299,8 +2299,11 @@
 return false;
   }
 
-  if (new_callee && old_callee != new_callee)
+  if (new_callee && 

[Lldb-commits] [PATCH] D114467: [LLDB][NativePDB] Allow find functions by full names

2021-11-29 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

This broke the windows bot:

https://lab.llvm.org/buildbot/#/builders/83/builds/12270

I'd like to get it back to green, so please address this ASAP or I'll follow up 
with a reverting change later today.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114467

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


[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390392.

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

https://reviews.llvm.org/D114719

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
 
 #include 
 
+#include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
@@ -62,20 +63,6 @@
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
-  switch (dwarf_accessibility) {
-  case DW_ACCESS_public:
-return eAccessPublic;
-  case DW_ACCESS_private:
-return eAccessPrivate;
-  case DW_ACCESS_protected:
-return eAccessProtected;
-  default:
-break;
-  }
-  return eAccessNone;
-}
-
 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
   switch (decl_kind) {
   case clang::Decl::CXXRecord:
@@ -313,7 +300,7 @@
   break;
 
 case DW_AT_accessibility:
-  accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
   break;
 
 case DW_AT_artificial:
@@ -1463,7 +1450,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
 
   case DW_AT_virtuality:
@@ -2532,7 +2519,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
   case DW_AT_artificial:
 is_artificial = form_value.Boolean();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
 
 class DWARFDIE;
 namespace lldb_private {
@@ -54,6 +55,8 @@
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE _die,
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+  static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -100,3 +100,18 @@
   }
   return array_info;
 }
+
+
+AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+  switch (dwarf_accessibility) {
+  case DW_ACCESS_public:
+return eAccessPublic;
+  case DW_ACCESS_private:
+return eAccessPrivate;
+  case DW_ACCESS_protected:
+return eAccessProtected;
+  default:
+break;
+  }
+  return eAccessNone;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

  This patch renames DW_ACCESS_to_AccessType function and move it to the 
abstract
  DWARFASTParser, since there is no clang-specific code there. This is useful 
for
  plugins other than Clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114719

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
 
 #include 
 
+#include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
@@ -62,20 +63,6 @@
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
-  switch (dwarf_accessibility) {
-  case DW_ACCESS_public:
-return eAccessPublic;
-  case DW_ACCESS_private:
-return eAccessPrivate;
-  case DW_ACCESS_protected:
-return eAccessProtected;
-  default:
-break;
-  }
-  return eAccessNone;
-}
-
 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
   switch (decl_kind) {
   case clang::Decl::CXXRecord:
@@ -313,7 +300,7 @@
   break;
 
 case DW_AT_accessibility:
-  accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
   break;
 
 case DW_AT_artificial:
@@ -1463,7 +1450,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
 
   case DW_AT_virtuality:
@@ -2532,7 +2519,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
   case DW_AT_artificial:
 is_artificial = form_value.Boolean();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
 
 class DWARFDIE;
 namespace lldb_private {
@@ -54,6 +55,8 @@
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE _die,
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+  static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -100,3 +100,18 @@
   }
   return array_info;
 }
+
+
+AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+  switch (dwarf_accessibility) {
+  case DW_ACCESS_public:
+return eAccessPublic;
+  case DW_ACCESS_private:
+return eAccessPrivate;
+  case DW_ACCESS_protected:
+return eAccessProtected;
+  default:
+break;
+  }
+  return eAccessNone;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114369: [lldb] Remove 'extern "C"' from the lldb-swig-python interface

2021-11-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Makes sense. LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114369

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


[Lldb-commits] [PATCH] D114554: Fix TestFileHandle.py. Remove redundant skipIfReproducer annotation

2021-11-29 Thread Levon Ter-Grigoryan via Phabricator via lldb-commits
PatriosTheGreat abandoned this revision.
PatriosTheGreat added a comment.

Closing this revision since Pavel already fixed this in  rGc0e3bb4d4ba306 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114554

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


[Lldb-commits] [PATCH] D114554: Fix TestFileHandle.py. Remove redundant skipIfReproducer annotation

2021-11-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114554

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


[Lldb-commits] [PATCH] D77287: Windows: support `DoLoadImage`

2021-11-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I can't speak to the correctness of the Windows parts, but all the utility 
function stuff looks sane to me. LGTM if Pavel has no outstanding objections.




Comment at: lldb/source/Plugins/Platform/Windows/PlatformWindows.h:47-51
+  uint32_t DoLoadImage(lldb_private::Process *process,
+   const lldb_private::FileSpec _file,
+   const std::vector *paths,
+   lldb_private::Status ,
+   lldb_private::FileSpec *loaded_path) override;

I know it's an `override`, but what a horrible interface...



Comment at: lldb/test/Shell/Process/Windows/process_load.cpp:3
+
+// REQUIRES: system-windows
+// RUN: %build --compiler=clang-cl -o %t.exe -- %s

compnerd wrote:
> JDevlieghere wrote:
> > We should probably have a `lit.local.cfg` in the Windows directory with 
> > 
> > ```
> > if 'system-windows' not in config.available_features:
> >   config.unsupported = True
> > 
> > ```
> I think that's a good idea, but, should be a separate change - it isn't 
> related to the load/unload functionality.
Fair enough


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

https://reviews.llvm.org/D77287

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


[Lldb-commits] [PATCH] D114675: [lldb] [Target] Support fallback to file address in ReadMemory()

2021-11-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

  (lldb) image list
  [  0] 199D1036-3762-54C0-1775-361BD9AF5B17-C58273BB 0x8020 
/home/mgorny/git/libfbsdvmcore/kernel 


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

https://reviews.llvm.org/D114675

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


[Lldb-commits] [PATCH] D114675: [lldb] [Target] Support fallback to file address in ReadMemory()

2021-11-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D114675#3157622 , @mgorny wrote:

> In D114675#3157595 , @labath wrote:
>
>> I don't think this is the right solution to this problem.
>
> If it's not, then the expression parser should probably be changed for 
> consistency.

I don't think we'd want to do that (*), but we could definitely make sure that 
the memory read command produces a meaningful error message instead of a bunch 
of zeroes. But lets wait to see what Jim thinks about that.

(*) My reasoning is that the expression evaluator can be used to view the 
static contents of the module before the process is even launched, whereas the 
memory read command is low level, and has "memory" in its name -- if there's no 
process, then there's no memory.

>> The way I see it, there are two separate questions here:
>>
>> - why is the module containing `hz` not loaded? The core file contains a 
>> proper memory address for it, does it not?
>
> Not sure what you're asking about. The symbol's address (as determined from 
> the kernel executable) is found in one of the PT_LOAD segments.

Yes, but is that information making its way to the right place 
(Target::GetSectionLoadList)? That's the thing which provides load addresses 
for section+offset pairs. What does "image list" say in this case?


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

https://reviews.llvm.org/D114675

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


[Lldb-commits] [PATCH] D114675: [lldb] [Target] Support fallback to file address in ReadMemory()

2021-11-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

In D114675#3157595 , @labath wrote:

> I don't think this is the right solution to this problem.

If it's not, then the expression parser should probably be changed for 
consistency.

> The way I see it, there are two separate questions here:
>
> - why is the module containing `hz` not loaded? The core file contains a 
> proper memory address for it, does it not?

Not sure what you're asking about. The symbol's address (as determined from the 
kernel executable) is found in one of the PT_LOAD segments.


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

https://reviews.llvm.org/D114675

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


[Lldb-commits] [PATCH] D114675: [lldb] [Target] Support fallback to file address in ReadMemory()

2021-11-29 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a reviewer: jingham.
labath added a comment.
This revision now requires changes to proceed.

I don't think this is the right solution to this problem.

The way I see it, there are two separate questions here:

- why is the module containing `hz` not loaded? The core file contains a proper 
memory address for it, does it not? We need to figure out why is that not being 
applied. I took a brief look, but I couldn't actually find the place where elf 
file modules are created and where their load addresses are set. I think the 
first step should be to figure out how this actually works (or why does it not 
work). Without a load address, a lot of things will not operate properly. If it 
helps you can look at ProcessMinidump::ReadModuleList to see how it works 
there, but be aware that this uses a different (I am not saying that it's 
better or worse) approach to create and load modules -- it does it directly, 
whereas the elf class seems to rely on DynamicLoaderStatic to do the loading.

- should "memory read" work on unloaded modules. I think this was deliberately 
disabled because the concept of "memory" only really makes sense on a "running 
process" (a core file is considered a running process here). However, your 
example kinda makes sense even on an unloaded module (a not-yet-started process 
if the typical situation where you get those). So, we could consider making 
this work as well. I'm adding Jim to see what he thinks about this. However, 
**if** we do decide to do that, then the right solution is to use the Target 
version of `ReadMemory` which accepts an Address object directly. D113098 
 might be relevant/interesting here.


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

https://reviews.llvm.org/D114675

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