[Lldb-commits] [PATCH] D132734: [lldb] Fix member access in GetExpressionPath

2022-10-23 Thread Will Hawkins via Phabricator via lldb-commits
hawkinsw added inline comments.



Comment at: lldb/source/Core/ValueObject.cpp:1947
-  // name ([%d]) to the expression path
-  if (m_flags.m_is_array_item_for_pointer &&
-  epformat == eGetExpressionPathFormatHonorPointers)

I am *absolutely* not an expert here but I've spent several hours trying to 
debug why this incredibly thorough, well-written patch does not handle the case 
in `TestArray.py`. It would seem to me that this is the check that we forgot to 
bring over in to the new logic. I was attempting to be able to have an updated 
version of the patch by tonight, but didn't get further than just debugging. I 
will continue to work on it -- I am sure that you gurus have other, more 
important things to work on. 

That said, I am just trying to help so if I am totally off base, please let me 
know!

Sincerely,
Will


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132734

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


[Lldb-commits] [PATCH] D136551: [lldb] Include gtest in standalone build only if LLDB_INCLUDE_TESTS

2022-10-23 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, JDevlieghere, tstellar, MaskRay.
Herald added a subscriber: StephenFan.
Herald added a project: All.
mgorny requested review of this revision.

Build gtest targets when building standalone only if LLDB_INCLUDE_TESTS
is true.  Prior to this change, they were built whenever
LLVM_MAIN_SRC_DIR was available, independently whether tests themselves
would be run.


https://reviews.llvm.org/D136551

Files:
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,16 +97,18 @@
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
-# Build the gtest library needed for unittests, if we have LLVM sources
-# handy.
-if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
-  add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
-endif()
-# LLVMTestingSupport library is needed for Process/gdb-remote.
-if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-AND NOT TARGET LLVMTestingSupport)
-  add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-lib/Testing/Support)
+if(LLDB_INCLUDE_TESTS)
+  # Build the gtest library needed for unittests, if we have LLVM sources
+  # handy.
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
+add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
+  endif()
+  # LLVMTestingSupport library is needed for Process/gdb-remote.
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+  AND NOT TARGET LLVMTestingSupport)
+add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+  lib/Testing/Support)
+  endif()
 endif()
 
 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for 
Express versions." ON)
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -17,6 +17,8 @@
 # Must go below project(..)
 include(GNUInstallDirs)
 
+option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
+
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
@@ -129,7 +131,6 @@
   set(LLDB_INCLUDE_UNITTESTS OFF)
 endif()
 
-option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
 if(LLDB_INCLUDE_TESTS)
   add_subdirectory(test)
   if (LLDB_INCLUDE_UNITTESTS)


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,16 +97,18 @@
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
-# Build the gtest library needed for unittests, if we have LLVM sources
-# handy.
-if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
-  add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
-endif()
-# LLVMTestingSupport library is needed for Process/gdb-remote.
-if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-AND NOT TARGET LLVMTestingSupport)
-  add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-lib/Testing/Support)
+if(LLDB_INCLUDE_TESTS)
+  # Build the gtest library needed for unittests, if we have LLVM sources
+  # handy.
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
+add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
+  endif()
+  # LLVMTestingSupport library is needed for Process/gdb-remote.
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+  AND NOT TARGET LLVMTestingSupport)
+add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+  lib/Testing/Support)
+  endif()
 endif()
 
 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -17,6 +17,8 @@
 # Must go below project(..)
 include(GNUInstallDirs)
 
+option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
+
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
@@ -129,7 +131,6 @@
   set(LLDB_INCLUDE_UNITTESTS OFF)
 endif()
 
-option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
 if(LLDB_INCLUDE_TESTS)
   add_subdirectory(test)
   if (LLDB_INCLUDE_UNITTESTS)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D136552: [lldb] Add LLVM include dirs prior to gtest target in standalone build

2022-10-23 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, JDevlieghere, MaskRay, tstellar.
Herald added a subscriber: StephenFan.
Herald added a project: All.
mgorny requested review of this revision.

Move include_directories() declaration before gtest targets are created
in standalone build.  This fixes build failure due to gtest targets
being unable to find LLVM headers, e.g.:

  
/var/tmp/portage/dev-util/lldb-16.0.0_pre20221023/work/llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h:43:10:
 fatal error: llvm/ADT/Optional.h: No such file or directory


https://reviews.llvm.org/D136552

Files:
  lldb/cmake/modules/LLDBStandalone.cmake


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,6 +97,12 @@
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+include_directories(
+  "${CMAKE_BINARY_DIR}/include"
+  "${LLVM_INCLUDE_DIRS}"
+  "${CLANG_INCLUDE_DIRS}")
+
 if(LLDB_INCLUDE_TESTS)
   # Build the gtest library needed for unittests, if we have LLVM sources
   # handy.
@@ -119,12 +125,6 @@
 set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "lldb misc")
 set_target_properties(intrinsics_gen PROPERTIES FOLDER "lldb misc")
 
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-include_directories(
-  "${CMAKE_BINARY_DIR}/include"
-  "${LLVM_INCLUDE_DIRS}"
-  "${CLANG_INCLUDE_DIRS}")
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,6 +97,12 @@
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+include_directories(
+  "${CMAKE_BINARY_DIR}/include"
+  "${LLVM_INCLUDE_DIRS}"
+  "${CLANG_INCLUDE_DIRS}")
+
 if(LLDB_INCLUDE_TESTS)
   # Build the gtest library needed for unittests, if we have LLVM sources
   # handy.
@@ -119,12 +125,6 @@
 set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "lldb misc")
 set_target_properties(intrinsics_gen PROPERTIES FOLDER "lldb misc")
 
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-include_directories(
-  "${CMAKE_BINARY_DIR}/include"
-  "${LLVM_INCLUDE_DIRS}"
-  "${CLANG_INCLUDE_DIRS}")
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D136552: [lldb] Add LLVM include dirs prior to gtest target in standalone build

2022-10-23 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 469984.
mgorny added a comment.

Rebase to make it independent of D136551 .


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

https://reviews.llvm.org/D136552

Files:
  lldb/cmake/modules/LLDBStandalone.cmake


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,6 +97,12 @@
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+include_directories(
+  "${CMAKE_BINARY_DIR}/include"
+  "${LLVM_INCLUDE_DIRS}"
+  "${CLANG_INCLUDE_DIRS}")
+
 # Build the gtest library needed for unittests, if we have LLVM sources
 # handy.
 if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
@@ -117,12 +123,6 @@
 set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "lldb misc")
 set_target_properties(intrinsics_gen PROPERTIES FOLDER "lldb misc")
 
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-include_directories(
-  "${CMAKE_BINARY_DIR}/include"
-  "${LLVM_INCLUDE_DIRS}"
-  "${CLANG_INCLUDE_DIRS}")
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,6 +97,12 @@
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+include_directories(
+  "${CMAKE_BINARY_DIR}/include"
+  "${LLVM_INCLUDE_DIRS}"
+  "${CLANG_INCLUDE_DIRS}")
+
 # Build the gtest library needed for unittests, if we have LLVM sources
 # handy.
 if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
@@ -117,12 +123,6 @@
 set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "lldb misc")
 set_target_properties(intrinsics_gen PROPERTIES FOLDER "lldb misc")
 
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-include_directories(
-  "${CMAKE_BINARY_DIR}/include"
-  "${LLVM_INCLUDE_DIRS}"
-  "${CLANG_INCLUDE_DIRS}")
-
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D136551: [lldb] Include gtest in standalone build only if LLDB_INCLUDE_TESTS

2022-10-23 Thread Michał Górny via Phabricator via lldb-commits
mgorny added inline comments.



Comment at: lldb/CMakeLists.txt:20
 
+option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
+

To be honest, I don't exactly like moving this `option`. The alternative I can 
think of is moving gtest and LLVMTestingSupport logic from `LLDBStandalone` 
into unittests.


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

https://reviews.llvm.org/D136551

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


[Lldb-commits] [PATCH] D136557: [trace][intel pt] Simple detection of infinite decoding loops

2022-10-23 Thread walter erquinigo via Phabricator via lldb-commits
wallace created this revision.
wallace added reviewers: jj10306, persona0220.
Herald added a project: All.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The low-level decoder might fall into an infinite decoding loop for
various reasons, the simplest being an infinite direct loop reached due
to wrong handling of self-modified in the kernel, e.g.

  0x0A: pause
  0x0C: jump to 0x0A

In this case, all the code is sequential and requires no packets to be
decoded. The low-level decoder would produce an output like the
following

  0x0A: pause
  0x0C: jump to 0x0A
  0x0A: pause
  0x0C: jump to 0x0A
  0x0A: pause
  0x0C: jump to 0x0A
  ... infinite amount of times

These cases are pretty much undecodable, so the least we can do is to
identify if we have found a case like this one and show then an error in
the trace.

- Add a check that breaks decoding of a single PSB once 200k

instructions have been decoding after the last packet was processed.

- Add a `settings` property for tweaking this number. This is nice

because does the basic work needed for future settings.

Some notes are added in the code. I haven't been unable to create a test
case, but it's found in the thread #12 of the trace
72533820-3eb8-4465-b8e4-4e6bf0ccca99 at Meta. We have to figure out how to
artificially create traces with this kind of anomalies.

With this change, that anomalous thread now shows:

  (lldb) thread trace dump instructions 12 -e -i 213100
  
  thread #12: tid = 8
  ...missing instructions
  213100: (error) decoding truncated: possible infinite decoding loop 
detected
vmlinux-5.12.0-0_fbk8_clang_6656_gc85768aa64da`panic_smp_self_stop + 7 at 
panic.c:87:2
  213099: 0x81342787jmp0x81342785; <+5> 
[inlined] rep_nop at processor.h:13:2
vmlinux-5.12.0-0_fbk8_clang_6656_gc85768aa64da`panic_smp_self_stop + 5 
[inlined] rep_nop at processor.h:13:2
  213098: 0x81342785pause
vmlinux-5.12.0-0_fbk8_clang_6656_gc85768aa64da`panic_smp_self_stop + 7 at 
panic.c:87:2
  213097: 0x81342787jmp0x81342785; <+5> 
[inlined] rep_nop at processor.h:13:2
vmlinux-5.12.0-0_fbk8_clang_6656_gc85768aa64da`panic_smp_self_stop + 5 
[inlined] rep_nop at processor.h:13:2
  213096: 0x81342785pause
vmlinux-5.12.0-0_fbk8_clang_6656_gc85768aa64da`panic_smp_self_stop + 7 at 
panic.c:87:2
  213095: 0x81342787jmp0x81342785; <+5> 
[inlined] rep_nop at processor.h:13:2
vmlinux-5.12.0-0_fbk8_clang_6656_gc85768aa64da`panic_smp_self_stop + 5 
[inlined] rep_nop at processor.h:13:2
  213094: 0x81342785pause
vmlinux-5.12.0-0_fbk8_clang_6656_gc85768aa64da`panic_smp_self_stop + 7 at 
panic.c:87:2
  213093: 0x81342787jmp0x81342785; <+5> 
[inlined] rep_nop at processor.h:13:2
...

It used to be in an infinite loop.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136557

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/source/Core/PluginManager.cpp
  lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTProperties.td

Index: lldb/source/Plugins/Trace/intel-pt/TraceIntelPTProperties.td
===
--- /dev/null
+++ lldb/source/Plugins/Trace/intel-pt/TraceIntelPTProperties.td
@@ -0,0 +1,13 @@
+include "../../../../include/lldb/Core/PropertiesBase.td"
+
+let Definition = "traceintelpt" in {
+  def InfiniteDecodingLoopVerificationThreshold:
+  Property<"infinite-decoding-loop-veritication-threshold", "UInt64">,
+Global,
+DefaultUnsignedValue<20>,
+Desc<"Specify how many instructions following an individual Intel PT "
+  "packet must have been decoded before triggering the verification for "
+  "infinite decoding loops, which might happen if the image is corrupted, "
+  "such as with self-modifying code. If an infinite loop is detected, an "
+  "error will be included inside the trace.">;
+}
Index: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
===
--- lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -22,6 +22,21 @@
 
 class TraceIntelPT : public Trace {
 public:
+  /// Properties to be used with the `settings` command.
+  class PluginProperties : public Properties {
+  public:
+static ConstString GetSettingName();
+
+PluginProperties();
+
+~PluginProperties() override = default;
+
+uint64_t GetInfiniteDecodingLoopVerificationThreshold();
+  };
+
+  /// Return the global properties for this trace plug-in.
+  static PluginProperties &

[Lldb-commits] [PATCH] D134604: [clang] Implement sugared substitution changes to infrastructure

2022-10-23 Thread Matheus Izvekov via Phabricator via lldb-commits
mizvekov retitled this revision from "[clang] Instiantiate early substituted 
entities with sugared template arguments" to "[clang] Implement sugared 
substitution changes to infrastructure".
mizvekov edited the summary of this revision.
mizvekov updated this revision to Diff 470008.
Herald added a subscriber: martong.
Herald added a reviewer: shafik.
Herald added a reviewer: libc++.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134604

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/TemplateName.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Sema/Template.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/TemplateName.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaConcept.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Sema/TypeLocBuilder.cpp
  clang/lib/Sema/TypeLocBuilder.h
  clang/test/SemaTemplate/nested-name-spec-template.cpp
  libcxx/DELETE.ME

Index: libcxx/DELETE.ME
===
--- /dev/null
+++ libcxx/DELETE.ME
@@ -0,0 +1 @@
+D134604
Index: clang/test/SemaTemplate/nested-name-spec-template.cpp
===
--- clang/test/SemaTemplate/nested-name-spec-template.cpp
+++ clang/test/SemaTemplate/nested-name-spec-template.cpp
@@ -147,3 +147,10 @@
 
   template void f(); // expected-note{{in instantiation of}}
 }
+
+namespace sugared_template_instantiation {
+  // Test that we ignore local qualifiers.
+  template  struct A {};
+  struct B { typedef int type1; };
+  typedef A type2;
+} // namespace sugated_template_instantiation
Index: clang/lib/Sema/TypeLocBuilder.h
===
--- clang/lib/Sema/TypeLocBuilder.h
+++ clang/lib/Sema/TypeLocBuilder.h
@@ -64,6 +64,10 @@
   /// must be empty for this to work.
   void pushFullCopy(TypeLoc L);
 
+  /// Pushes 'T' with all locations pointing to 'Loc'.
+  /// The builder must be empty for this to work.
+  void pushTrivial(ASTContext &Context, QualType T, SourceLocation Loc);
+
   /// Pushes space for a typespec TypeLoc.  Invalidates any TypeLocs
   /// previously retrieved from this builder.
   TypeSpecTypeLoc pushTypeSpec(QualType T) {
Index: clang/lib/Sema/TypeLocBuilder.cpp
===
--- clang/lib/Sema/TypeLocBuilder.cpp
+++ clang/lib/Sema/TypeLocBuilder.cpp
@@ -41,6 +41,29 @@
   }
 }
 
+void TypeLocBuilder::pushTrivial(ASTContext &Context, QualType T,
+ SourceLocation Loc) {
+  auto L = TypeLoc(T, nullptr);
+  reserve(L.getFullDataSize());
+
+  SmallVector TypeLocs;
+  for (auto CurTL = L; CurTL; CurTL = CurTL.getNextTypeLoc())
+TypeLocs.push_back(CurTL);
+
+  for (const auto &CurTL : llvm::reverse(TypeLocs)) {
+switch (CurTL.getTypeLocClass()) {
+#define ABSTRACT_TYPELOC(CLASS, PARENT)
+#define TYPELOC(CLASS, PARENT) \
+  case TypeLoc::CLASS: {   \
+auto NewTL = push(CurTL.getType());  \
+NewTL.initializeLocal(Context, Loc);   \
+break; \
+  }
+#include "clang/AST/TypeLocNodes.def"
+}
+  }
+}
+
 void TypeLocBuilder::grow(size_t NewCapacity) {
   assert(NewCapacity > Capacity);
 
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -636,6 +636,14 @@
   QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
 #include "clang/AST/TypeLocNodes.def"
 
+  QualType TransformTemplateTypeParmType(TypeLocBuilder &TLB,
+ TemplateTypeParmTypeLoc TL,
+ bool SuppressObjCLifetime);
+  QualType
+  TransformSubstTemplateTypeParmPackType(TypeLocBuilder &TLB,
+ SubstTemplateTypeParmPackTypeLoc TL,
+ bool SuppressObjCLifetime);
+
   template
   QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
   FunctionProtoTypeLoc TL,
@@ -1286,9 +1294,10 @@
   /// template name. Subclasses may override this routine to provide different
   /// behavior.
   TemplateName RebuildTemplateName(const TemplateArgument &ArgPack,
-   Dec

[Lldb-commits] [PATCH] D134604: [clang] Implement sugared substitution changes to infrastructure

2022-10-23 Thread Matheus Izvekov via Phabricator via lldb-commits
mizvekov updated this revision to Diff 470011.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134604

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/TemplateName.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Sema/Template.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/TemplateName.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaConcept.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Sema/TypeLocBuilder.cpp
  clang/lib/Sema/TypeLocBuilder.h
  clang/test/SemaTemplate/nested-name-spec-template.cpp
  libcxx/DELETE.ME

Index: libcxx/DELETE.ME
===
--- /dev/null
+++ libcxx/DELETE.ME
@@ -0,0 +1 @@
+D134604
Index: clang/test/SemaTemplate/nested-name-spec-template.cpp
===
--- clang/test/SemaTemplate/nested-name-spec-template.cpp
+++ clang/test/SemaTemplate/nested-name-spec-template.cpp
@@ -147,3 +147,10 @@
 
   template void f(); // expected-note{{in instantiation of}}
 }
+
+namespace sugared_template_instantiation {
+  // Test that we ignore local qualifiers.
+  template  struct A {};
+  struct B { typedef int type1; };
+  typedef A type2;
+} // namespace sugated_template_instantiation
Index: clang/lib/Sema/TypeLocBuilder.h
===
--- clang/lib/Sema/TypeLocBuilder.h
+++ clang/lib/Sema/TypeLocBuilder.h
@@ -64,6 +64,10 @@
   /// must be empty for this to work.
   void pushFullCopy(TypeLoc L);
 
+  /// Pushes 'T' with all locations pointing to 'Loc'.
+  /// The builder must be empty for this to work.
+  void pushTrivial(ASTContext &Context, QualType T, SourceLocation Loc);
+
   /// Pushes space for a typespec TypeLoc.  Invalidates any TypeLocs
   /// previously retrieved from this builder.
   TypeSpecTypeLoc pushTypeSpec(QualType T) {
Index: clang/lib/Sema/TypeLocBuilder.cpp
===
--- clang/lib/Sema/TypeLocBuilder.cpp
+++ clang/lib/Sema/TypeLocBuilder.cpp
@@ -41,6 +41,29 @@
   }
 }
 
+void TypeLocBuilder::pushTrivial(ASTContext &Context, QualType T,
+ SourceLocation Loc) {
+  auto L = TypeLoc(T, nullptr);
+  reserve(L.getFullDataSize());
+
+  SmallVector TypeLocs;
+  for (auto CurTL = L; CurTL; CurTL = CurTL.getNextTypeLoc())
+TypeLocs.push_back(CurTL);
+
+  for (const auto &CurTL : llvm::reverse(TypeLocs)) {
+switch (CurTL.getTypeLocClass()) {
+#define ABSTRACT_TYPELOC(CLASS, PARENT)
+#define TYPELOC(CLASS, PARENT) \
+  case TypeLoc::CLASS: {   \
+auto NewTL = push(CurTL.getType());  \
+NewTL.initializeLocal(Context, Loc);   \
+break; \
+  }
+#include "clang/AST/TypeLocNodes.def"
+}
+  }
+}
+
 void TypeLocBuilder::grow(size_t NewCapacity) {
   assert(NewCapacity > Capacity);
 
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -636,6 +636,14 @@
   QualType Transform##CLASS##Type(TypeLocBuilder &TLB, CLASS##TypeLoc T);
 #include "clang/AST/TypeLocNodes.def"
 
+  QualType TransformTemplateTypeParmType(TypeLocBuilder &TLB,
+ TemplateTypeParmTypeLoc TL,
+ bool SuppressObjCLifetime);
+  QualType
+  TransformSubstTemplateTypeParmPackType(TypeLocBuilder &TLB,
+ SubstTemplateTypeParmPackTypeLoc TL,
+ bool SuppressObjCLifetime);
+
   template
   QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
   FunctionProtoTypeLoc TL,
@@ -1286,9 +1294,10 @@
   /// template name. Subclasses may override this routine to provide different
   /// behavior.
   TemplateName RebuildTemplateName(const TemplateArgument &ArgPack,
-   Decl *AssociatedDecl, unsigned Index) {
+   Decl *AssociatedDecl, unsigned Index,
+   bool Final) {
 return getSema().Context.getSubstTemplateTemplateParmPack(
-ArgPack, AssociatedDecl, Index);
+ArgPack, AssociatedDecl, Index, Final);
   }
 
   /// Build a ne

[Lldb-commits] [PATCH] D136565: [clang] Instantiate alias templates with sugar

2022-10-23 Thread Matheus Izvekov via Phabricator via lldb-commits
mizvekov created this revision.
Herald added subscribers: jeroen.dobbelaere, kadircet, arphaman.
Herald added a project: All.
mizvekov requested review of this revision.
Herald added projects: clang, LLDB, clang-tools-extra.
Herald added subscribers: cfe-commits, lldb-commits.

This makes use of the changes introduced in D134604 
, in order to
instantiate alias templates witn a final sugared substitution.

This comes at no additional relevant cost.
Since we don't track / unique them in specializations, we wouldn't be
able to resugar them later anyway.

Signed-off-by: Matheus Izvekov 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136565

Files:
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/test/AST/ast-dump-template-decls.cpp
  clang/test/CXX/temp/temp.deduct.guide/p3.cpp
  clang/test/Misc/diag-template-diffing.cpp
  clang/test/SemaCXX/sizeless-1.cpp
  clang/test/SemaTemplate/make_integer_seq.cpp
  clang/test/SemaTemplate/temp_arg_nontype.cpp
  
lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py

Index: lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
===
--- lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
+++ lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
@@ -24,9 +24,9 @@
  result_type="std::weak_ptr",
  result_summary="3 strong=1 weak=2",
  result_children=[ValueCheck(name="__ptr_")])
-self.expect_expr("*w.lock()", result_type="int", result_value="3")
-self.expect_expr("*w.lock() = 5", result_type="int", result_value="5")
-self.expect_expr("*w.lock()", result_type="int", result_value="5")
+self.expect_expr("*w.lock()", result_type="element_type", result_value="3")
+self.expect_expr("*w.lock() = 5", result_type="element_type", result_value="5")
+self.expect_expr("*w.lock()", result_type="element_type", result_value="5")
 self.expect_expr("w.use_count()", result_type="long", result_value="1")
 self.expect("expr w.reset()")
 self.expect_expr("w.use_count()", result_type="long", result_value="0")
Index: lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
===
--- lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
+++ lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
@@ -23,7 +23,7 @@
 self.expect_expr("w",
  result_type="std::weak_ptr",
  result_children=[ValueCheck(name="__ptr_")])
-self.expect_expr("*w.lock()", result_type="Foo")
+self.expect_expr("*w.lock()", result_type="element_type")
 self.expect_expr("w.lock()->a", result_type="int", result_value="3")
 self.expect_expr("w.lock()->a = 5",
  result_type="int",
Index: lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
===
--- lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
+++ lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
@@ -24,9 +24,9 @@
  result_type="std::shared_ptr",
  result_summary="3 strong=1 weak=1",
  result_children=[ValueCheck(name="__ptr_")])
-self.expect_expr("*s", result_type="int", result_value="3")
-self.expect_expr("*s = 5", result_type="int", result_value="5")
-self.expect_expr("*s", result_type="int", result_value="5")
+self.expect_expr("*s", result_type="element_type", result_value="3")
+self.expect_expr("*s = 5", result_type="element_type", result_value="5")
+self.expect_expr("*s", result_type="element_type", result_value="5")
 self.expect_expr("(bool)s", result_type="bool", result_value="true")
 self.expect("expr s.reset()")
 self.expect_expr("(bool)s", result_type="bool", result_value="false")
Index: clang/test/SemaTemplate/temp_arg_nontype.cpp
===
--- clang/test/SemaTemplate/temp_arg_nontype.cpp
+++ clang/test/SemaTemplate/temp_arg_nontype.cpp
@@ -437,7 +437,7 @@
 
   template cl

[Lldb-commits] [PATCH] D136557: [trace][intel pt] Simple detection of infinite decoding loops

2022-10-23 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 470047.
wallace edited the summary of this revision.
wallace added a comment.

.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136557

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/source/Core/PluginManager.cpp
  lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
  lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTProperties.td
  lldb/test/API/commands/trace/TestTraceDumpInfo.py
  lldb/test/API/commands/trace/TestTraceLoad.py

Index: lldb/test/API/commands/trace/TestTraceLoad.py
===
--- lldb/test/API/commands/trace/TestTraceLoad.py
+++ lldb/test/API/commands/trace/TestTraceLoad.py
@@ -37,6 +37,12 @@
   "totalCount": 0,
   "individualCounts": {}
 },
+"errors": {
+  "totalCount": 0,
+  "libiptErrors": {},
+  "fatalErrors": 0,
+  "otherErrors": 0
+},
 "continuousExecutions": 0,
 "PSBBlocks": 0
   },
@@ -72,6 +78,12 @@
 "HW clock tick": 8
   }
 },
+"errors": {
+  "totalCount": 1,
+  "libiptErrors": {},
+  "fatalErrors": 0,
+  "otherErrors": 1
+},
 "continuousExecutions": 1,
 "PSBBlocks": 1
   },
Index: lldb/test/API/commands/trace/TestTraceDumpInfo.py
===
--- lldb/test/API/commands/trace/TestTraceDumpInfo.py
+++ lldb/test/API/commands/trace/TestTraceDumpInfo.py
@@ -78,6 +78,12 @@
 "software disabled tracing": 2,
 "trace synchronization point": 1
   }
+},
+"errors": {
+  "totalCount": 0,
+  "libiptErrors": {},
+  "fatalErrors": 0,
+  "otherErrors": 0
 }
   },
   "globalStats": {
Index: lldb/source/Plugins/Trace/intel-pt/TraceIntelPTProperties.td
===
--- /dev/null
+++ lldb/source/Plugins/Trace/intel-pt/TraceIntelPTProperties.td
@@ -0,0 +1,24 @@
+include "../../../../include/lldb/Core/PropertiesBase.td"
+
+let Definition = "traceintelpt" in {
+  def InfiniteDecodingLoopVerificationThreshold:
+  Property<"infinite-decoding-loop-verification-threshold", "UInt64">,
+Global,
+DefaultUnsignedValue<1>,
+Desc<"Specify how many instructions following an individual Intel PT "
+  "packet must have been decoded before triggering the verification of "
+  "infinite decoding loops. If no decoding loop has been found after this "
+  "threshold T, another attempt will be done after 2T instructions, then "
+  "4T, 8T and so on, which guarantees a total linear time spent checking "
+  "this anomaly. If a loop is found, then decoding of the corresponding "
+  "PSB block is stopped. An error is hence emitted in the trace and "
+  "decoding is resumed in the next PSB block.">;
+  def ExtremelyLargeDecodingThreshold:
+  Property<"extremely-large-decoding-threshold", "UInt64">,
+Global,
+DefaultUnsignedValue<50>,
+Desc<"Specify how many instructions following an individual Intel PT "
+  "packet must have been decoded before stopping the decoding of the "
+  "corresponding PSB block. An error is hence emitted in the trace and "
+  "decoding is resumed in the next PSB block.">;
+}
Index: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
===
--- lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -22,6 +22,23 @@
 
 class TraceIntelPT : public Trace {
 public:
+  /// Properties to be used with the `settings` command.
+  class PluginProperties : public Properties {
+  public:
+static ConstString GetSettingName();
+
+PluginProperties();
+
+~PluginProperties() override = default;
+
+uint64_t GetInfiniteDecodingLoopVerificationThreshold();
+
+uint64_t GetExtremelyLargeDecodingThreshold();
+  };
+
+  /// Return the global properties for this trace plug-in.
+  static PluginProperties &GetGlobalProperties();
+
   void Dump(Stream *s) const override;
 
   llvm::Expected SaveToDisk(FileSpec directory,
@@ -59,6 +76,8 @@
   CreateInstanceForLiveProcess(Process &process);
 
   static llvm::StringRef GetPluginNameStatic() { return "intel-pt"; }
+
+  static void DebuggerInitialize(Debugger &debugger);
   /// \}
 
   lldb::CommandObjectSP
Index: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
===
--- lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
+++ lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
@@ -16,6 +16,7 @@
 #include "TraceIntelPTBundleSa

[Lldb-commits] [PATCH] D136578: [LLDB] [LoongArch] Fix build errors

2022-10-23 Thread Tiezhu Yang via Phabricator via lldb-commits
seehearfeel created this revision.
seehearfeel added reviewers: SixWeining, wangleiat, xen0n, xry111, MaskRay.
Herald added a subscriber: StephenFan.
Herald added a project: All.
seehearfeel requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

When build LLDB on LoongArch used with the following commands:

git clone https://github.com/llvm/llvm-project.git
mkdir -p llvm-project/llvm/build
cd llvm-project/llvm/build
cmake .. -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF" \

  -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="LoongArch" \
  -DLLVM_ENABLE_PROJECTS="clang;lldb" \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_BUILD_RUNTIME=OFF

ninja

there exist some build errors:

undefined reference to 
`lldb_private::process_linux::NativeRegisterContextLinux::DetermineArchitecture(unsigned
 long)'
undefined reference to 
`lldb_private::process_linux::NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(...)'

Add the minimal changes as simple as possible for LoongArch
to fix the above issues, even there are some empty functions,
then the built binary lldb can be found in the build/bin/
directory.

This is the first step, we will submit other more patches
step by step in the future, these small patches make an
easily understood change that can be verified by reviewers.

Signed-off-by: Tiezhu Yang 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136578

Files:
  lldb/source/Plugins/Process/Linux/CMakeLists.txt
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.h
  lldb/source/Plugins/Process/Utility/CMakeLists.txt
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.h

Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.h
===
--- /dev/null
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.h
@@ -0,0 +1,66 @@
+//===-- RegisterInfoPOSIX_loongarch64.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_LOONGARCH64_H
+#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_LOONGARCH64_H
+
+#include "RegisterInfoAndSetInterface.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/lldb-private.h"
+#include 
+
+class RegisterInfoPOSIX_loongarch64
+: public lldb_private::RegisterInfoAndSetInterface {
+public:
+  static const lldb_private::RegisterInfo *
+  GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch);
+  static uint32_t
+  GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch);
+
+public:
+  enum { GPRegSet = 0, FPRegSet };
+
+  struct GPR {
+uint64_t gpr[32];
+
+uint64_t orig_a0;
+uint64_t csr_era;
+uint64_t csr_badv;
+uint64_t reserved[10];
+  };
+
+  struct FPR {
+uint64_t fpr[32];
+uint64_t fcc;
+uint32_t fcsr;
+  };
+
+  RegisterInfoPOSIX_loongarch64(const lldb_private::ArchSpec &target_arch,
+lldb_private::Flags flags);
+
+  size_t GetGPRSize() const override;
+
+  size_t GetFPRSize() const override;
+
+  const lldb_private::RegisterInfo *GetRegisterInfo() const override;
+
+  uint32_t GetRegisterCount() const override;
+
+  const lldb_private::RegisterSet *
+  GetRegisterSet(size_t reg_set) const override;
+
+  size_t GetRegisterSetCount() const override;
+
+  size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override;
+
+private:
+  const lldb_private::RegisterInfo *m_register_info_p;
+  uint32_t m_register_info_count;
+};
+
+#endif
Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp
===
--- /dev/null
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp
@@ -0,0 +1,71 @@
+//===-- RegisterInfoPOSIX_loongarch64.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===-===//
+
+#include 
+#include 
+#include 
+
+#include "lldb/lldb-defines.h"
+#include "llvm/Support/Compiler.h"
+
+#include "RegisterInfoPOSIX_loongarch64.h"
+
+const lldb_private::RegisterInfo *RegisterInfoPOSIX_loongarch64::GetRegisterInfoPtr(
+const lldb_private::ArchSpec &target_arch) {
+  switch (target_arch.GetMachine()) {
+  default:
+assert(false && "Unh

[Lldb-commits] [PATCH] D136578: [LLDB] [LoongArch] Fix build errors

2022-10-23 Thread Lu Weining via Phabricator via lldb-commits
SixWeining added inline comments.



Comment at: lldb/source/Plugins/Process/Linux/CMakeLists.txt:11
   NativeRegisterContextLinux_arm64.cpp
+  NativeRegisterContextLinux_loongarch64.cpp
   NativeRegisterContextLinux_ppc64le.cpp

Had better use `git diff -U99` to generate the patch so that we can get 
more context.
See: 
https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136578

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


[Lldb-commits] [lldb] 38389f3 - [lldb][Test] Add CPlusPlusNameParser unit-test: C-array function arguments

2022-10-23 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2022-10-24T07:45:37+01:00
New Revision: 38389f3109e8c862debdec769026f12cadc85e7b

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

LOG: [lldb][Test] Add CPlusPlusNameParser unit-test: C-array function arguments

Tests that `CPlusPlusLanguage::MethodName` can parse demangled
names that contain references to C-arrays.

Example taken from libcxx API in the wild.

Added: 


Modified: 
lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

Removed: 




diff  --git a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp 
b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
index b5608fb737bef..795c0fad153c0 100644
--- a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -52,6 +52,13 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
   {"llvm::Optional::operator*() const &",
"llvm::Optional", "operator*", "()", "const &",
"llvm::Optional::operator*"},
+  {"auto std::__1::ranges::__begin::__fn::operator()[abi:v16](char const (&) [18ul]) const",
+   "std::__1::ranges::__begin::__fn",
+   "operator()[abi:v16]", "(char const (&) [18ul])",
+   "const",
+   "std::__1::ranges::__begin::__fn::operator()[abi:v16]"},
   // Internal classes
   {"operator<<(Cls, Cls)::Subclass::function()",
"operator<<(Cls, Cls)::Subclass", "function", "()", "",



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


[Lldb-commits] [PATCH] D136578: [LLDB] [LoongArch] Fix build errors

2022-10-23 Thread Tiezhu Yang via Phabricator via lldb-commits
seehearfeel updated this revision to Diff 470059.
seehearfeel added a comment.

Use git diff -U99 to generate the patch so that we can get more context 
suggested by Weining.


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

https://reviews.llvm.org/D136578

Files:
  lldb/source/Plugins/Process/Linux/CMakeLists.txt
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.h
  lldb/source/Plugins/Process/Utility/CMakeLists.txt
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.h

Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.h
===
--- /dev/null
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.h
@@ -0,0 +1,66 @@
+//===-- RegisterInfoPOSIX_loongarch64.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_LOONGARCH64_H
+#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_LOONGARCH64_H
+
+#include "RegisterInfoAndSetInterface.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/lldb-private.h"
+#include 
+
+class RegisterInfoPOSIX_loongarch64
+: public lldb_private::RegisterInfoAndSetInterface {
+public:
+  static const lldb_private::RegisterInfo *
+  GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch);
+  static uint32_t
+  GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch);
+
+public:
+  enum { GPRegSet = 0, FPRegSet };
+
+  struct GPR {
+uint64_t gpr[32];
+
+uint64_t orig_a0;
+uint64_t csr_era;
+uint64_t csr_badv;
+uint64_t reserved[10];
+  };
+
+  struct FPR {
+uint64_t fpr[32];
+uint64_t fcc;
+uint32_t fcsr;
+  };
+
+  RegisterInfoPOSIX_loongarch64(const lldb_private::ArchSpec &target_arch,
+lldb_private::Flags flags);
+
+  size_t GetGPRSize() const override;
+
+  size_t GetFPRSize() const override;
+
+  const lldb_private::RegisterInfo *GetRegisterInfo() const override;
+
+  uint32_t GetRegisterCount() const override;
+
+  const lldb_private::RegisterSet *
+  GetRegisterSet(size_t reg_set) const override;
+
+  size_t GetRegisterSetCount() const override;
+
+  size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override;
+
+private:
+  const lldb_private::RegisterInfo *m_register_info_p;
+  uint32_t m_register_info_count;
+};
+
+#endif
Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp
===
--- /dev/null
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp
@@ -0,0 +1,71 @@
+//===-- RegisterInfoPOSIX_loongarch64.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===-===//
+
+#include 
+#include 
+#include 
+
+#include "lldb/lldb-defines.h"
+#include "llvm/Support/Compiler.h"
+
+#include "RegisterInfoPOSIX_loongarch64.h"
+
+const lldb_private::RegisterInfo *RegisterInfoPOSIX_loongarch64::GetRegisterInfoPtr(
+const lldb_private::ArchSpec &target_arch) {
+  switch (target_arch.GetMachine()) {
+  default:
+assert(false && "Unhandled target architecture.");
+return nullptr;
+  }
+}
+
+uint32_t RegisterInfoPOSIX_loongarch64::GetRegisterInfoCount(
+const lldb_private::ArchSpec &target_arch) {
+  switch (target_arch.GetMachine()) {
+  default:
+assert(false && "Unhandled target architecture.");
+return 0;
+  }
+}
+
+RegisterInfoPOSIX_loongarch64::RegisterInfoPOSIX_loongarch64(
+const lldb_private::ArchSpec &target_arch, lldb_private::Flags flags)
+: lldb_private::RegisterInfoAndSetInterface(target_arch),
+  m_register_info_p(GetRegisterInfoPtr(target_arch)),
+  m_register_info_count(GetRegisterInfoCount(target_arch)) {}
+
+uint32_t RegisterInfoPOSIX_loongarch64::GetRegisterCount() const {
+  return 0;
+}
+
+size_t RegisterInfoPOSIX_loongarch64::GetGPRSize() const {
+  return sizeof(struct RegisterInfoPOSIX_loongarch64::GPR);
+}
+
+size_t RegisterInfoPOSIX_loongarch64::GetFPRSize() const {
+  return sizeof(struct RegisterInfoPOSIX_loongarch64::FPR);
+}
+
+const lldb_private::RegisterInfo *
+RegisterInfoPOSIX_loongarch64::GetRegisterInfo() const {
+  return m_register_info_p;
+}
+
+size_t RegisterInfoPOSIX_loongarch64::GetRegister