[Lldb-commits] [lldb] r359538 - Instantiate 'std' templates explicitly in the expression evaluator

2019-04-30 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Apr 30 01:41:35 2019
New Revision: 359538

URL: http://llvm.org/viewvc/llvm-project?rev=359538&view=rev
Log:
Instantiate 'std' templates explicitly in the expression evaluator

Summary:
This patch is a follow-up for D58125. It implements the manual instantiation 
and merging of 'std' templates like
`std::vector` and `std::shared_ptr` with information from the debug info AST. 
This (finally) allows using these classes
in the expression evaluator like every other class (i.e. things like 
`vec.size()` and shared_ptr debugging now works, yay!).

The main logic is the `CxxModuleHandler` which intercept the ASTImporter import 
process and replaces any `std` decls
by decls from the C++ module. The decls from the C++ module are "imported" by 
just deserializing them directly in
the expression evaluation context. This is mostly because we don't want to rely 
on the ASTImporter to correctly import
these declarations, but in the future we should also move to the ASTImporter 
for that.

This patch doesn't contain the automatic desugaring for result variables. This 
means that if you call for example
`size` of `std::vector` you maybe get some very verbose typedef'd type as the 
variable type, e.g.
`std::vector>::value_type`.

This is not only unreadable, it also means that our ASTImporter has to import 
all these types and associated
decls into the persisent variable context. This currently usually leads to some 
assertion getting triggered
in Clang when the ASTImporter either makes a mistake during importing or our 
debug info AST is inconsitent.
The current workaround I use in the tests is to just cast the result to it's 
actual type (e.g. `size_t` or `int`) to prevent
the ASTImporter from having to handle all these complicated decls.

The automatic desugaring will be a future patch because I'm not happy yet with 
the current code for that and because
I anticipate that this will be a controversial patch.

Reviewers: aprantl, shafik, jingham, martong, serge-sans-paille

Reviewed By: martong

Subscribers: balazske, rnkovacs, mgorny, mgrang, abidh, jdoerfert, lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

Added:
lldb/trunk/include/lldb/Symbol/CxxModuleHandler.h

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-basic/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-basic/TestBasicDeque.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-basic/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-basic/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-basic/TestBasicForwardList.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-basic/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-basic/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-basic/TestBasicList.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-basic/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-dbg-info-content/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-dbg-info-content/TestDbgInfoContentList.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-dbg-info

[Lldb-commits] [PATCH] D59537: Instantiate 'std' templates explicitly in the expression evaluator

2019-04-30 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359538: Instantiate 'std' templates explicitly in 
the expression evaluator (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59537?vs=197170&id=197273#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D59537

Files:
  lldb/trunk/include/lldb/Symbol/ClangASTContext.h
  lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
  lldb/trunk/include/lldb/Symbol/CxxModuleHandler.h
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-basic/TestBasicDeque.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-basic/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/deque-dbg-info-content/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-basic/TestBasicForwardList.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-basic/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/forward_list-dbg-info-content/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-basic/TestBasicList.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-basic/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-dbg-info-content/TestDbgInfoContentList.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/list-dbg-info-content/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/shared_ptr-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContent.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/shared_ptr-dbg-info-content/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/shared_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/shared_ptr/TestSharedPtr.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/shared_ptr/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/unique_ptr-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/unique_ptr-dbg-info-content/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/unique_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/unique_ptr/TestUniquePtr.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/unique_ptr/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-basic/TestBasicVector.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-basic/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-bool/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-bool/TestBoolVector.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-bool/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-dbg-info-content/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import-std-module/vector-dbg-info-content/TestDbgInfoContentVecto

[Lldb-commits] [PATCH] D59537: Instantiate 'std' templates explicitly in the expression evaluator

2019-04-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor marked an inline comment as done.
teemperor added inline comments.



Comment at: lldb/include/lldb/Symbol/ClangASTImporter.h:249
+/// it at the end of the scope. Supports being used multiple times on the
+/// same Minion instance in nested scopes.
+class CxxModuleScope {

aprantl wrote:
> teemperor wrote:
> > aprantl wrote:
> > > I really wish we could rename Minion with something actually 
> > > descriptive...
> > I'm still trying to come up with a good name. The whole purpose of the 
> > class is to actually extend and listen to the actual ASTImporter. So what 
> > about `ASTImporterDecorator`?
> ASTImporterDelegate perhaps? https://en.wikipedia.org/wiki/Delegation_pattern
Sounds good to me, even though we technically inherit from ASTImporter. But 
everything is better than Minion :)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59537



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


[Lldb-commits] [PATCH] D61299: Rename Minion to ASTImporterDelegate

2019-04-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: aprantl, shafik.
Herald added a reviewer: martong.
Herald added a reviewer: a.sidorin.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.

I think there universal agreement that Minion isn't the best name for this 
class. This patch renames the class
 to ASTImporterDelegate to better reflect it's goal of monitoring and extending 
the ASTImporter.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61299

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

Index: lldb/source/Symbol/ClangASTImporter.cpp
===
--- lldb/source/Symbol/ClangASTImporter.cpp
+++ lldb/source/Symbol/ClangASTImporter.cpp
@@ -58,12 +58,12 @@
 clang::QualType ClangASTImporter::CopyType(clang::ASTContext *dst_ast,
clang::ASTContext *src_ast,
clang::QualType type) {
-  MinionSP minion_sp(GetMinion(dst_ast, src_ast));
+  ImporterDelegateSP delegate_sp(GetDelegate(dst_ast, src_ast));
 
-  Minion::CxxModuleScope std_scope(*minion_sp, dst_ast);
+  ASTImporterDelegate::CxxModuleScope std_scope(*delegate_sp, dst_ast);
 
-  if (minion_sp)
-return minion_sp->Import(type);
+  if (delegate_sp)
+return delegate_sp->Import(type);
 
   return QualType();
 }
@@ -99,14 +99,14 @@
 clang::Decl *ClangASTImporter::CopyDecl(clang::ASTContext *dst_ast,
 clang::ASTContext *src_ast,
 clang::Decl *decl) {
-  MinionSP minion_sp;
+  ImporterDelegateSP delegate_sp;
 
-  minion_sp = GetMinion(dst_ast, src_ast);
+  delegate_sp = GetDelegate(dst_ast, src_ast);
 
-  Minion::CxxModuleScope std_scope(*minion_sp, dst_ast);
+  ASTImporterDelegate::CxxModuleScope std_scope(*delegate_sp, dst_ast);
 
-  if (minion_sp) {
-clang::Decl *result = minion_sp->Import(decl);
+  if (delegate_sp) {
+clang::Decl *result = delegate_sp->Import(decl);
 
 if (!result) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
@@ -254,9 +254,9 @@
 (unsigned long long)type, static_cast(src_ctx),
 static_cast(dst_ctx));
 
-  MinionSP minion_sp(GetMinion(dst_ctx, src_ctx));
+  ImporterDelegateSP delegate_sp(GetDelegate(dst_ctx, src_ctx));
 
-  if (!minion_sp)
+  if (!delegate_sp)
 return nullptr;
 
   std::set decls_to_deport;
@@ -270,11 +270,11 @@
 tag_type->getDecl());
   }
 
-  minion_sp->InitDeportWorkQueues(&decls_to_deport, &decls_already_deported);
+  delegate_sp->InitDeportWorkQueues(&decls_to_deport, &decls_already_deported);
 
   lldb::opaque_compiler_type_t result = CopyType(dst_ctx, src_ctx, type);
 
-  minion_sp->ExecuteDeportWorkQueues();
+  delegate_sp->ExecuteDeportWorkQueues();
 
   if (!result)
 return nullptr;
@@ -293,9 +293,9 @@
 decl->getDeclKindName(), static_cast(decl),
 static_cast(src_ctx), static_cast(dst_ctx));
 
-  MinionSP minion_sp(GetMinion(dst_ctx, src_ctx));
+  ImporterDelegateSP delegate_sp(GetDelegate(dst_ctx, src_ctx));
 
-  if (!minion_sp)
+  if (!delegate_sp)
 return nullptr;
 
   std::set decls_to_deport;
@@ -305,11 +305,11 @@
 
   decl_context_override.OverrideAllDeclsFromContainingFunction(decl);
 
-  minion_sp->InitDeportWorkQueues(&decls_to_deport, &decls_already_deported);
+  delegate_sp->InitDeportWorkQueues(&decls_to_deport, &decls_already_deported);
 
   clang::Decl *result = CopyDecl(dst_ctx, src_ctx, decl);
 
-  minion_sp->ExecuteDeportWorkQueues();
+  delegate_sp->ExecuteDeportWorkQueues();
 
   if (!result)
 return nullptr;
@@ -561,11 +561,13 @@
   if (!ClangASTContext::GetCompleteDecl(decl_origin.ctx, decl_origin.decl))
 return false;
 
-  MinionSP minion_sp(GetMinion(&decl->getASTContext(), decl_origin.ctx));
+  ImporterDelegateSP delegate_sp(
+  GetDelegate(&decl->getASTContext(), decl_origin.ctx));
 
-  Minion::CxxModuleScope std_scope(*minion_sp, &decl->getASTContext());
-  if (minion_sp)
-minion_sp->ImportDefinitionTo(decl, decl_origin.decl);
+  ASTImporterDelegate::CxxModuleScope std_scope(*delegate_sp,
+&decl->getASTContext());
+  if (delegate_sp)
+delegate_sp->ImportDefinitionTo(decl, decl_origin.decl);
 
   return true;
 }
@@ -579,10 +581,11 @@
   if (!ClangASTContext::GetCompleteDecl(origin_ast_ctx, origin_decl))
 return false;
 
-  MinionSP minion_sp(GetMinion(&decl->getASTContext(), origin_ast_ctx));
+  ImporterDelegateSP delegate_sp(
+  GetDelegate(&decl->getASTContext(), origin_ast_ctx));
 
-  if (minion_sp)
-minion_sp->ImportDefinitionTo(decl, origin_decl);
+  if (delegate_sp)
+delegate_sp->ImportDefinitionTo(decl, origin_decl);
 
   ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
 
@@ -605,11 +608,11 @@
   if (!ClangASTContext::GetCo

[Lldb-commits] [lldb] r359546 - Sort containers alphabetically in CxxModuleHandler [NFC]

2019-04-30 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Apr 30 03:27:31 2019
New Revision: 359546

URL: http://llvm.org/viewvc/llvm-project?rev=359546&view=rev
Log:
Sort containers alphabetically in CxxModuleHandler [NFC]

Modified:
lldb/trunk/source/Symbol/CxxModuleHandler.cpp

Modified: lldb/trunk/source/Symbol/CxxModuleHandler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CxxModuleHandler.cpp?rev=359546&r1=359545&r2=359546&view=diff
==
--- lldb/trunk/source/Symbol/CxxModuleHandler.cpp (original)
+++ lldb/trunk/source/Symbol/CxxModuleHandler.cpp Tue Apr 30 03:27:31 2019
@@ -21,10 +21,10 @@ CxxModuleHandler::CxxModuleHandler(ASTIm
 
   std::initializer_list supported_names = {
   // containers
-  "vector",
-  "list",
-  "forward_list",
   "deque",
+  "forward_list",
+  "list",
+  "vector",
   // pointers
   "shared_ptr",
   "unique_ptr",


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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM registers

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, JDevlieghere, krytarowski.

NB: this time clang complained that I'm using too many registers (and gcc was 
happy) when I tried using separate operands for every value. So I learned how 
to use memory ;-). Since this isn't really educated assembly, please lemme know 
if there's a more elegant way of doing this.


https://reviews.llvm.org/D61303

Files:
  lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
  lldb/lit/Register/x86-mm-xmm-write.test

Index: lldb/lit/Register/x86-mm-xmm-write.test
===
--- /dev/null
+++ lldb/lit/Register/x86-mm-xmm-write.test
@@ -0,0 +1,45 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
+# RUN: %clangxx %p/Inputs/x86-mm-xmm-write.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register write mm0 0x0102030405060708
+register write mm1 0x1112131415161718
+register write mm2 0x2122232425262728
+register write mm3 0x3132333435363738
+register write mm4 0x4142434445464748
+register write mm5 0x5152535455565758
+register write mm6 0x6162636465666768
+register write mm7 0x7172737475767778
+
+register write xmm0 "{0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}"
+register write xmm1 "{0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}"
+register write xmm2 "{0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}"
+register write xmm3 "{0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}"
+register write xmm4 "{0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}"
+register write xmm5 "{0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}"
+register write xmm6 "{0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}"
+register write xmm7 "{0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}"
+
+process continue
+# CHECK-DAG: mm0 = 0x0102030405060708
+# CHECK-DAG: mm1 = 0x1112131415161718
+# CHECK-DAG: mm2 = 0x2122232425262728
+# CHECK-DAG: mm3 = 0x3132333435363738
+# CHECK-DAG: mm4 = 0x4142434445464748
+# CHECK-DAG: mm5 = 0x5152535455565758
+# CHECK-DAG: mm6 = 0x6162636465666768
+# CHECK-DAG: mm7 = 0x7172737475767778
+
+# CHECK-DAG: xmm0 = 0x030507090b0d0f00020406080a0c0e01
+# CHECK-DAG: xmm1 = 0x131517191b1d1f10121416181a1c1e11
+# CHECK-DAG: xmm2 = 0x232527292b2d2f20222426282a2c2e21
+# CHECK-DAG: xmm3 = 0x333537393b3d3f30323436383a3c3e31
+# CHECK-DAG: xmm4 = 0x434547494b4d4f40424446484a4c4e41
+# CHECK-DAG: xmm5 = 0x535557595b5d5f50525456585a5c5e51
+# CHECK-DAG: xmm6 = 0x636567696b6d6f60626466686a6c6e61
+# CHECK-DAG: xmm7 = 0x737577797b7d7f70727476787a7c7e71
+
+# CHECK: Process {{[0-9]+}} exited with status = 0
Index: lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
===
--- /dev/null
+++ lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
@@ -0,0 +1,68 @@
+#include 
+#include 
+#include 
+
+struct alignas(16) xmm_t {
+  uint64_t a, b;
+};
+
+int main() {
+  constexpr uint64_t mm_fill = 0x0F0F0F0F0F0F0F0F;
+  constexpr xmm_t xmm_fill = { mm_fill, mm_fill };
+
+  uint64_t mm[8];
+  xmm_t xmm[8];
+
+  asm volatile(
+"movq%2, %%mm0\n\t"
+"movq%2, %%mm1\n\t"
+"movq%2, %%mm2\n\t"
+"movq%2, %%mm3\n\t"
+"movq%2, %%mm4\n\t"
+"movq%2, %%mm5\n\t"
+"movq%2, %%mm6\n\t"
+"movq%2, %%mm7\n\t"
+"\n\t"
+"movaps  %2, %%xmm0\n\t"
+"movaps  %2, %%xmm1\n\t"
+"movaps  %2, %%xmm2\n\t"
+"movaps  %2, %%xmm3\n\t"
+"movaps  %2, %%xmm4\n\t"
+"movaps  %2, %%xmm5\n\t"
+"movaps  %2, %%xmm6\n\t"
+"movaps  %2, %%xmm7\n\t"
+"\n\t"
+"int3\n\t"
+"\n\t"
+"lea %0, %%rbx\n\t"
+"movq%%mm0, (%%rbx)\n\t"
+"movq%%mm1, 8(%%rbx)\n\t"
+"movq%%mm2, 16(%%rbx)\n\t"
+"movq%%mm3, 24(%%rbx)\n\t"
+"movq%%mm4, 32(%%rbx)\n\t"
+"movq%%mm5, 40(%%rbx)\n\t"
+"movq%%mm6, 48(%%rbx)\n\t"
+"movq%%mm7, 56(%%rbx)\n\t"
+"\n\t"
+"lea %1, %%rbx\n\t"
+"movaps  %%xmm0, (%%rbx)\n\t"
+"movaps  %%xmm1, 16(%%rbx)\n\t"
+"movaps  %%xmm2, 32(%%rbx)\n\t"
+"movaps  %%xmm3, 48(%%rbx)\n\t"
+"movaps  %%xmm4, 64(%%rbx)\n\t"
+"movaps  %%xmm5, 80(%%rbx)\n\t"
+"movaps  %%xmm6, 96(%%rbx)\n\t"
+"movaps  %%xmm7, 112(%%rbx)\n\t"
+: "=m"(mm), "=m"(xmm)
+: "m"(xmm_fill)
+: "%rbx", "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7",
+  "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7"
+  );
+
+  for (int i = 0; i < 8; ++i)
+printf("mm%d = 0x%016" PRIx64 "\n", i, mm[i]);
+  for (int i = 0; i < 8; ++i)
+printf("xmm%d = 0x%016" PRIx64 "%016" PRIx64 "\n", i, xmm[i].b, xmm[i].a);
+
+  return 0;
+}

[Lldb-commits] [PATCH] D61305: Add std::stack and std::queue support to CxxModuleHandler

2019-04-30 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: aprantl, shafik.
teemperor added a project: C++ modules in LLDB.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61305

Files:
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/TestQueue.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/main.cpp
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/TestStack.py
  
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/main.cpp
  lldb/source/Symbol/CxxModuleHandler.cpp

Index: lldb/source/Symbol/CxxModuleHandler.cpp
===
--- lldb/source/Symbol/CxxModuleHandler.cpp
+++ lldb/source/Symbol/CxxModuleHandler.cpp
@@ -24,6 +24,8 @@
   "deque",
   "forward_list",
   "list",
+  "queue",
+  "stack",
   "vector",
   // pointers
   "shared_ptr",
Index: lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/main.cpp
@@ -0,0 +1,17 @@
+#include 
+#include 
+#include 
+
+struct C {
+  // Constructor for testing emplace.
+  C(int i) : i(i) {};
+  int i;
+};
+
+int main(int argc, char **argv) {
+  // std::deque is the default container.
+  std::stack s_deque({{1}, {2}, {3}});
+  std::stack> s_vector({{1}, {2}, {3}});
+  std::stack> s_list({{1}, {2}, {3}});
+  return 0; // Set break point at this line.
+}
Index: lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/TestStack.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/TestStack.py
@@ -0,0 +1,49 @@
+"""
+Tests std::stack functionality.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestStack(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+# FIXME: This should work on more setups, so remove these
+# skipIf's in the future.
+@add_test_categories(["libc++"])
+@skipIf(compiler=no_match("clang"))
+@skipIf(oslist=no_match(["linux"]))
+@skipIf(debug_info=no_match(["dwarf"]))
+def test(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self,
+"// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+
+self.runCmd("settings set target.import-std-module true")
+
+# Test std::stack functionality with a std::deque.
+self.expect("expr s_deque.pop()")
+self.expect("expr s_deque.push({4})")
+self.expect("expr (size_t)s_deque.size()", substrs=['(size_t) $0 = 3'])
+self.expect("expr (int)s_deque.top().i", substrs=['(int) $1 = 4'])
+self.expect("expr s_deque.emplace(5)")
+self.expect("expr (int)s_deque.top().i", substrs=['(int) $2 = 5'])
+
+# Test std::stack functionality with a std::vector.
+self.expect("expr s_vector.pop()")
+self.expect("expr s_vector.push({4})")
+self.expect("expr (size_t)s_vector.size()", substrs=['(size_t) $3 = 3'])
+self.expect("expr (int)s_vector.top().i", substrs=['(int) $4 = 4'])
+self.expect("expr s_vector.emplace(5)")
+self.expect("expr (int)s_vector.top().i", substrs=['(int) $5 = 5'])
+
+# Test std::stack functionality with a std::list.
+self.expect("expr s_list.pop()")
+self.expect("expr s_list.push({4})")
+self.expect("expr (size_t)s_list.size()", substrs=['(size_t) $6 = 3'])
+self.expect("expr (int)s_list.top().i", substrs=['(int) $7 = 4'])
+self.expect("expr s_list.emplace(5)")
+self.expect("expr (int)s_list.top().i", substrs=['(int) $8 = 5'])
Index: lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/stack/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+USE_LIBCPP := 1
+CXXFLAGS += $(MANDATORY_CXXMODULE_BUILD_CFLAGS)
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/queue/main.cpp
@@ -0,0 +1,16 @@
+#include 
+#include 
+#include 
+
+struct C {
+  // Construct

[Lldb-commits] [PATCH] D61235: Add more information to the log timer dump

2019-04-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/unittests/Utility/TimerTest.cpp:100-101
+  << "String: " << ss.GetData();
+  EXPECT_GT(total1 - child1, seconds1 - 0.001);
+  EXPECT_LT(total1 - child1, seconds1 + 0.001);
+  EXPECT_EQ(1, count1);

aadsm wrote:
> labath wrote:
> > aadsm wrote:
> > > davide wrote:
> > > > this seems ... very fragile.
> > > that's a good point. I'm not that familiar with the ieee754 to know 
> > > what's a safe interval here, do you know?
> > I think you want to use `EXPECT_DOUBLE_EQ` here.
> It still doesn't help me :(
> 
> ```
> Expected: total1 - child1
>   Which is: 0.02
> To be equal to: seconds1
>   Which is: 0.10054
> ```
Ah, ok I see now.. You need smaller precision because two of the numbers are 
only printed with three decimal spaces. In that case, you can do 
`EXPECT_NEAR(a-b, c, 0.002)`. ( I chose 0.002 instead of 0.001 just in case 
it's possible for rounding errors to add up to over 0.001 --- cca. 0.0005 for 
`a`, ~0.0005 for `b` and ~0.0...05 for `c`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61235



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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM registers

2019-04-30 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

The assembly looks perfectly fine to me. The only thing I'd consider changing 
is writing the displacements in the `movq ... (%rbx)` instructions in hex.




Comment at: lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp:10
+int main() {
+  constexpr uint64_t mm_fill = 0x0F0F0F0F0F0F0F0F;
+  constexpr xmm_t xmm_fill = { mm_fill, mm_fill };

It looks like `mm_fill` is unused.



Comment at: lldb/lit/Register/x86-mm-xmm-write.test:27
+process continue
+# CHECK-DAG: mm0 = 0x0102030405060708
+# CHECK-DAG: mm1 = 0x1112131415161718

When looking at the jenkins output from the failed gp-write run, I realized 
that the failure message isn't very helpful because FileCheck suggests the 
"register write" line above as a "possible intended match". 

I think it may be possible to improve on that by adding a `CHECK: process 
continue` here so that all subsequent checks only look at the process output, 
and not the commands setting the values.


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

https://reviews.llvm.org/D61303



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


[Lldb-commits] [PATCH] D61244: Re-enable gmodules tests on Linux

2019-04-30 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D61244#1482196 , @teemperor wrote:

> In D61244#1482146 , @labath wrote:
>
> > LG, but note that this has no effect on the overall set of tests which will 
> > run as long as gmodules remains disabled in 
> > `test_categories.is_supported_on_platform`.
>
>
> Oh, true, thanks for the hint! With the current categories it seems the test 
> always just get's marked as PASS (TM) on Linux... But luckily it actually 
> passes even when I enable linux in the category filter.


Yeah, we really ought to do something about that test situation... I tried to 
fix that by teaching lit to consider every flavour as a separate test, but it 
turned out that had pretty big performance hit, so I'm currently out of ideas...

> 
> 
>> The other thing to note is that the effect of enabling gmodules extremely 
>> strongly depends on how your system is configured. (Almost) none of our test 
>> define their own modules, so the only modules that lldb might end up using 
>> are the ones from the system libraries. Which is kind of way I think our way 
>> of testing module debugging support is broken. We have enough problems with 
>> people reporting tests which only break for them because of some quirk in 
>> their system libraries without us throwing modules into the mix.
> 
> It's true that the `gmodules-templates` test touches system modules. I'm fine 
> with rewriting them to not use system modules (or disable the ones that 
> really have to use system modules on LInux) as long as we have some gmodules 
> coverage on Linux.

The fact that they touch the system modules is not my main concern. After all, 
other tests also read the debug info of system libraries (*). The difference 
may be that module debugging is less mature, and so more likely to break 
unrelated stuff, but the principle is the same. The problem I have is that most 
of the tests don't touch *anything except* system modules. So, if you don't 
happen to have a system with module-capable system libraries (which most linux 
systems don't), the test will test absolutely nothing, yet you'll be burning 
cpu cycles running all these "gmodules" tests and thinking how great this 
module debugging stuff works.

(*) Note that we're slowly clamping down on those as well. We have already 
replaced a bunch of tests that verify that you can e.g. backtrace out of a 
random place in libc with something more deterministic.

In D61244#1483030 , @teemperor wrote:

> I looked into this a bit further and I think the best way forward is to 
> enable gmodules on Linux but exclude all tests that rely on system modules 
> (i.e. std or libc) as that really seems to be a messy situation. I'll update 
> the patch accordingly.


Yeah, it would certainly be great to run the tests that go through the trouble 
of creating their own modules (thank you for that). We should have more of 
those.


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

https://reviews.llvm.org/D61244



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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM registers

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 197306.
mgorny marked 2 inline comments as done.
mgorny added a comment.

Switched to hex offsets, and added match for 'process continue'.


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

https://reviews.llvm.org/D61303

Files:
  lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
  lldb/lit/Register/x86-mm-xmm-write.test

Index: lldb/lit/Register/x86-mm-xmm-write.test
===
--- /dev/null
+++ lldb/lit/Register/x86-mm-xmm-write.test
@@ -0,0 +1,47 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
+# RUN: %clangxx %p/Inputs/x86-mm-xmm-write.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register write mm0 0x0102030405060708
+register write mm1 0x1112131415161718
+register write mm2 0x2122232425262728
+register write mm3 0x3132333435363738
+register write mm4 0x4142434445464748
+register write mm5 0x5152535455565758
+register write mm6 0x6162636465666768
+register write mm7 0x7172737475767778
+
+register write xmm0 "{0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}"
+register write xmm1 "{0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}"
+register write xmm2 "{0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}"
+register write xmm3 "{0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}"
+register write xmm4 "{0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}"
+register write xmm5 "{0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}"
+register write xmm6 "{0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}"
+register write xmm7 "{0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}"
+
+process continue
+# CHECK: process continue
+
+# CHECK-DAG: mm0 = 0x0102030405060708
+# CHECK-DAG: mm1 = 0x1112131415161718
+# CHECK-DAG: mm2 = 0x2122232425262728
+# CHECK-DAG: mm3 = 0x3132333435363738
+# CHECK-DAG: mm4 = 0x4142434445464748
+# CHECK-DAG: mm5 = 0x5152535455565758
+# CHECK-DAG: mm6 = 0x6162636465666768
+# CHECK-DAG: mm7 = 0x7172737475767778
+
+# CHECK-DAG: xmm0 = 0x030507090b0d0f00020406080a0c0e01
+# CHECK-DAG: xmm1 = 0x131517191b1d1f10121416181a1c1e11
+# CHECK-DAG: xmm2 = 0x232527292b2d2f20222426282a2c2e21
+# CHECK-DAG: xmm3 = 0x333537393b3d3f30323436383a3c3e31
+# CHECK-DAG: xmm4 = 0x434547494b4d4f40424446484a4c4e41
+# CHECK-DAG: xmm5 = 0x535557595b5d5f50525456585a5c5e51
+# CHECK-DAG: xmm6 = 0x636567696b6d6f60626466686a6c6e61
+# CHECK-DAG: xmm7 = 0x737577797b7d7f70727476787a7c7e71
+
+# CHECK: Process {{[0-9]+}} exited with status = 0
Index: lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
===
--- /dev/null
+++ lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
@@ -0,0 +1,68 @@
+#include 
+#include 
+#include 
+
+struct alignas(16) xmm_t {
+  uint64_t a, b;
+};
+
+int main() {
+  constexpr uint64_t mm_fill = 0x0F0F0F0F0F0F0F0F;
+  constexpr xmm_t xmm_fill = { mm_fill, mm_fill };
+
+  uint64_t mm[8];
+  xmm_t xmm[8];
+
+  asm volatile(
+"movq%2, %%mm0\n\t"
+"movq%2, %%mm1\n\t"
+"movq%2, %%mm2\n\t"
+"movq%2, %%mm3\n\t"
+"movq%2, %%mm4\n\t"
+"movq%2, %%mm5\n\t"
+"movq%2, %%mm6\n\t"
+"movq%2, %%mm7\n\t"
+"\n\t"
+"movaps  %2, %%xmm0\n\t"
+"movaps  %2, %%xmm1\n\t"
+"movaps  %2, %%xmm2\n\t"
+"movaps  %2, %%xmm3\n\t"
+"movaps  %2, %%xmm4\n\t"
+"movaps  %2, %%xmm5\n\t"
+"movaps  %2, %%xmm6\n\t"
+"movaps  %2, %%xmm7\n\t"
+"\n\t"
+"int3\n\t"
+"\n\t"
+"lea %0, %%rbx\n\t"
+"movq%%mm0, 0x00(%%rbx)\n\t"
+"movq%%mm1, 0x08(%%rbx)\n\t"
+"movq%%mm2, 0x10(%%rbx)\n\t"
+"movq%%mm3, 0x18(%%rbx)\n\t"
+"movq%%mm4, 0x20(%%rbx)\n\t"
+"movq%%mm5, 0x28(%%rbx)\n\t"
+"movq%%mm6, 0x30(%%rbx)\n\t"
+"movq%%mm7, 0x38(%%rbx)\n\t"
+"\n\t"
+"lea %1, %%rbx\n\t"
+"movaps  %%xmm0, 0x00(%%rbx)\n\t"
+"movaps  %%xmm1, 0x10(%%rbx)\n\t"
+"movaps  %%xmm2, 0x20(%%rbx)\n\t"
+"movaps  %%xmm3, 0x30(%%rbx)\n\t"
+"movaps  %%xmm4, 0x40(%%rbx)\n\t"
+"movaps  %%xmm5, 0x50(%%rbx)\n\t"
+"movaps  %%xmm6, 0x60(%%rbx)\n\t"
+"movaps  %%xmm7, 0x70(%%rbx)\n\t"
+: "=m"(mm), "=m"(xmm)
+: "m"(xmm_fill)
+: "%rbx", "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7",
+  "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7"
+  );
+
+  for (int i = 0; i < 8; ++i)
+printf("mm%d = 0x%016" PRIx64 "\n", i, mm[i]);
+  for (int i = 0; i < 8; ++i)
+printf("xmm%d = 0x%016" PRIx64 "%016" PRIx64 "\n", i, xmm[i].b, xmm[i].a);
+
+  return 0;
+}
___
lldb-commits mailing list
lldb-comm

[Lldb-commits] [lldb] r359560 - PostfixExpression: Introduce InitialValueNode

2019-04-30 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Apr 30 06:33:18 2019
New Revision: 359560

URL: http://llvm.org/viewvc/llvm-project?rev=359560&view=rev
Log:
PostfixExpression: Introduce InitialValueNode

Summary:
This node represents can be used to refer to the initial value, which is
sometimes pushed onto the DWARF stack as the "input" to the DWARF
expression. The typical use case (and the reason why I'm introducing it)
is that the "Canonical Frame Address" is passed this way to the DWARF
expressions computing the values of registers during frame unwind.

The nodes are converted into dwarf by keeping track of DWARF stack depth
an any given point, and then copying the initial value from the bottom
of the stack via the DW_OP_pick opcode. This could be made more
efficient for simple expressions, but here I chose to start with the
most general implementation possible.

Reviewers: amccarth, clayborg, aleksandr.urakov

Subscribers: aprantl, jasonmolenda, lldb-commits, markmentovai

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

Modified:
lldb/trunk/include/lldb/Symbol/PostfixExpression.h
lldb/trunk/source/Symbol/PostfixExpression.cpp
lldb/trunk/unittests/Symbol/PostfixExpressionTest.cpp

Modified: lldb/trunk/include/lldb/Symbol/PostfixExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/PostfixExpression.h?rev=359560&r1=359559&r2=359560&view=diff
==
--- lldb/trunk/include/lldb/Symbol/PostfixExpression.h (original)
+++ lldb/trunk/include/lldb/Symbol/PostfixExpression.h Tue Apr 30 06:33:18 2019
@@ -29,6 +29,7 @@ class Node {
 public:
   enum Kind {
 BinaryOp,
+InitialValue,
 Integer,
 Register,
 Symbol,
@@ -73,6 +74,16 @@ private:
   Node *m_right;
 };
 
+/// A node representing the canonical frame address.
+class InitialValueNode: public Node {
+public:
+  InitialValueNode() : Node(InitialValue) {}
+
+  static bool classof(const Node *node) {
+return node->GetKind() == InitialValue;
+  }
+};
+
 /// A node representing an integer literal.
 class IntegerNode : public Node {
 public:
@@ -153,6 +164,7 @@ protected:
   virtual ~Visitor() = default;
 
   virtual ResultT Visit(BinaryOpNode &binary, Node *&ref) = 0;
+  virtual ResultT Visit(InitialValueNode &val, Node *&ref) = 0;
   virtual ResultT Visit(IntegerNode &integer, Node *&) = 0;
   virtual ResultT Visit(RegisterNode ®, Node *&) = 0;
   virtual ResultT Visit(SymbolNode &symbol, Node *&ref) = 0;
@@ -164,6 +176,8 @@ protected:
 switch (node->GetKind()) {
 case Node::BinaryOp:
   return Visit(llvm::cast(*node), node);
+case Node::InitialValue:
+  return Visit(llvm::cast(*node), node);
 case Node::Integer:
   return Visit(llvm::cast(*node), node);
 case Node::Register:
@@ -200,7 +214,10 @@ inline T *MakeNode(llvm::BumpPtrAllocato
 Node *Parse(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
 
 /// Serialize the given expression tree as DWARF. The result is written into 
the
-/// given stream. The AST should not contain any SymbolNodes.
+/// given stream. The AST should not contain any SymbolNodes. If the expression
+/// contains InitialValueNodes, the generated expression will assume that their
+/// value will be provided as the top value of the initial evaluation stack (as
+/// is the case with the CFA value in register eh_unwind rules).
 void ToDWARF(Node &node, Stream &stream);
 
 } // namespace postfix

Modified: lldb/trunk/source/Symbol/PostfixExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/PostfixExpression.cpp?rev=359560&r1=359559&r2=359560&view=diff
==
--- lldb/trunk/source/Symbol/PostfixExpression.cpp (original)
+++ lldb/trunk/source/Symbol/PostfixExpression.cpp Tue Apr 30 06:33:18 2019
@@ -96,8 +96,9 @@ private:
 return Dispatch(binary.Left()) && Dispatch(binary.Right());
   }
 
-  bool Visit(IntegerNode &integer, Node *&) override { return true; }
-  bool Visit(RegisterNode ®, Node *&) override { return true; }
+  bool Visit(InitialValueNode &, Node *&) override { return true; }
+  bool Visit(IntegerNode &, Node *&) override { return true; }
+  bool Visit(RegisterNode &, Node *&) override { return true; }
 
   bool Visit(SymbolNode &symbol, Node *&ref) override {
 if (Node *replacement = m_replacer(symbol)) {
@@ -125,9 +126,12 @@ public:
 private:
   void Visit(BinaryOpNode &binary, Node *&);
 
+  void Visit(InitialValueNode &val, Node *&);
+
   void Visit(IntegerNode &integer, Node *&) {
 m_out_stream.PutHex8(DW_OP_constu);
 m_out_stream.PutULEB128(integer.GetValue());
+++m_stack_depth;
   }
 
   void Visit(RegisterNode ®, Node *&);
@@ -139,6 +143,15 @@ private:
   void Visit(UnaryOpNode &unary, Node *&);
 
   Stream &m_out_stream;
+
+  /// The number keeping track of the evaluation stack depth at any given
+  /// moment. Used for implementing InitialValueNode

[Lldb-commits] [PATCH] D61183: PostfixExpression: Introduce CFANode

2019-04-30 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359560: PostfixExpression: Introduce InitialValueNode 
(authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61183?vs=197086&id=197311#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61183

Files:
  lldb/trunk/include/lldb/Symbol/PostfixExpression.h
  lldb/trunk/source/Symbol/PostfixExpression.cpp
  lldb/trunk/unittests/Symbol/PostfixExpressionTest.cpp

Index: lldb/trunk/unittests/Symbol/PostfixExpressionTest.cpp
===
--- lldb/trunk/unittests/Symbol/PostfixExpressionTest.cpp
+++ lldb/trunk/unittests/Symbol/PostfixExpressionTest.cpp
@@ -44,6 +44,8 @@
  Dispatch(binary.Left()), Dispatch(binary.Right()));
   }
 
+  std::string Visit(InitialValueNode &, Node *&) override { return "InitialValue"; }
+
   std::string Visit(IntegerNode &integer, Node *&) override {
 return llvm::formatv("int({0})", integer.GetValue());
   }
@@ -105,6 +107,9 @@
   if (!ast)
 return "Parse failed.";
   if (!ResolveSymbols(ast, [&](SymbolNode &symbol) -> Node * {
+if (symbol.GetName() == "INIT")
+  return MakeNode(alloc);
+
 uint32_t num;
 if (to_integer(symbol.GetName().drop_front(), num))
   return MakeNode(alloc, num);
@@ -138,6 +143,17 @@
 
   EXPECT_EQ("DW_OP_bregx 65 0", ParseAndGenerateDWARF("R65"));
 
+  EXPECT_EQ("DW_OP_pick 0x00", ParseAndGenerateDWARF("INIT"));
+
+  EXPECT_EQ("DW_OP_pick 0x00, DW_OP_pick 0x01, DW_OP_plus ",
+ParseAndGenerateDWARF("INIT INIT +"));
+
+  EXPECT_EQ("DW_OP_breg1 +0, DW_OP_pick 0x01, DW_OP_plus ",
+ParseAndGenerateDWARF("R1 INIT +"));
+
+  EXPECT_EQ("DW_OP_constu 0x1, DW_OP_pick 0x01, DW_OP_deref , DW_OP_plus ",
+ParseAndGenerateDWARF("1 INIT ^ +"));
+
   EXPECT_EQ("DW_OP_constu 0x4, DW_OP_constu 0x5, DW_OP_plus ",
 ParseAndGenerateDWARF("4 5 +"));
 
Index: lldb/trunk/source/Symbol/PostfixExpression.cpp
===
--- lldb/trunk/source/Symbol/PostfixExpression.cpp
+++ lldb/trunk/source/Symbol/PostfixExpression.cpp
@@ -96,8 +96,9 @@
 return Dispatch(binary.Left()) && Dispatch(binary.Right());
   }
 
-  bool Visit(IntegerNode &integer, Node *&) override { return true; }
-  bool Visit(RegisterNode ®, Node *&) override { return true; }
+  bool Visit(InitialValueNode &, Node *&) override { return true; }
+  bool Visit(IntegerNode &, Node *&) override { return true; }
+  bool Visit(RegisterNode &, Node *&) override { return true; }
 
   bool Visit(SymbolNode &symbol, Node *&ref) override {
 if (Node *replacement = m_replacer(symbol)) {
@@ -125,9 +126,12 @@
 private:
   void Visit(BinaryOpNode &binary, Node *&);
 
+  void Visit(InitialValueNode &val, Node *&);
+
   void Visit(IntegerNode &integer, Node *&) {
 m_out_stream.PutHex8(DW_OP_constu);
 m_out_stream.PutULEB128(integer.GetValue());
+++m_stack_depth;
   }
 
   void Visit(RegisterNode ®, Node *&);
@@ -139,6 +143,15 @@
   void Visit(UnaryOpNode &unary, Node *&);
 
   Stream &m_out_stream;
+
+  /// The number keeping track of the evaluation stack depth at any given
+  /// moment. Used for implementing InitialValueNodes. We start with
+  /// m_stack_depth = 1, assuming that the initial value is already on the
+  /// stack. This initial value will be the value of all InitialValueNodes. If
+  /// the expression does not contain InitialValueNodes, then m_stack_depth is
+  /// not used, and the generated expression will run correctly even without an
+  /// initial value.
+  size_t m_stack_depth = 1;
 };
 } // namespace
 
@@ -166,6 +179,16 @@
 m_out_stream.PutHex8(DW_OP_and);
 break;
   }
+  --m_stack_depth; // Two pops, one push.
+}
+
+void DWARFCodegen::Visit(InitialValueNode &, Node *&) {
+  // We never go below the initial stack, so we can pick the initial value from
+  // the bottom of the stack at any moment.
+  assert(m_stack_depth >= 1);
+  m_out_stream.PutHex8(DW_OP_pick);
+  m_out_stream.PutHex8(m_stack_depth - 1);
+  ++m_stack_depth;
 }
 
 void DWARFCodegen::Visit(RegisterNode ®, Node *&) {
@@ -179,6 +202,7 @@
 m_out_stream.PutHex8(DW_OP_breg0 + reg_num);
 
   m_out_stream.PutSLEB128(0);
+  ++m_stack_depth;
 }
 
 void DWARFCodegen::Visit(UnaryOpNode &unary, Node *&) {
@@ -189,6 +213,7 @@
 m_out_stream.PutHex8(DW_OP_deref);
 break;
   }
+  // Stack depth unchanged.
 }
 
 bool postfix::ResolveSymbols(
Index: lldb/trunk/include/lldb/Symbol/PostfixExpression.h
===
--- lldb/trunk/include/lldb/Symbol/PostfixExpression.h
+++ lldb/trunk/include/lldb/Symbol/PostfixExpression.h
@@ -29,6 +29,7 @@
 public:
   enum Kind {
 BinaryOp,
+InitialVa

[Lldb-commits] [PATCH] D61183: PostfixExpression: Introduce CFANode

2019-04-30 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: source/Symbol/PostfixExpression.cpp:150
+  /// InitialValueNodes in our input expression, we assume the initial stack
+  /// will contain their value (hence we start with m_stack_depth = 1). If we
+  /// don't have InitialValueNodes, this value is not used, and so its starting

amccarth wrote:
> I'm having trouble understanding this comment.
> 
> "will contain their value" -- What does "their" refer to here?  I guessed 
> InitialValueNodes, but then I'd expect "value" to be "values" (plural), and 
> I'm not sure how that relates to the stack depth.
I've rephrased this so that it is (hopefully) more understandable. The reason 
for the singular-plural schism is that the expression can theoretically contain 
multiple InitialValueNodes (I'm not sure why would anyone want to do that in 
practice, but the option is there), but they will all refer to the same value, 
which is the value pushed onto the dwarf stack before the expression evaluation 
began.


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

https://reviews.llvm.org/D61183



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


[Lldb-commits] [PATCH] D61311: PostfixExpression: Use signed integers in IntegerNode

2019-04-30 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: amccarth, clayborg, aleksandr.urakov.

This is necessary to support parsing expressions like ".cfa -16 + ^", as
that format is used in breakpad STACK CFI expressions.

Since the PDB expressions use the same parser, this change will affect
them too, but I don't believe that should be a problem in practice. If
PDBs do contain the negative values, it's very likely that they are
intended to be parsed the same way, and if they don't, then it doesn't
matter.

In case that we do ever need to handle this differently, we can always
make the parser behavior customizable, or just use a different parser.

To make sure that the integer size is big enough for everyone, I switch
from using a (unsigned) 32-bit integer to a 64-bit (signed) one.


https://reviews.llvm.org/D61311

Files:
  include/lldb/Symbol/PostfixExpression.h
  source/Symbol/PostfixExpression.cpp
  unittests/Symbol/PostfixExpressionTest.cpp
  unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp

Index: unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
===
--- unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
+++ unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
@@ -58,20 +58,20 @@
 }
 
 TEST(PDBFPOProgramToDWARFExpressionTests, MultipleIndependentAssignments) {
-  CheckValidProgramTranslation("$T1 1 = $T0 0 =", "$T0", "DW_OP_constu 0x0");
+  CheckValidProgramTranslation("$T1 1 = $T0 0 =", "$T0", "DW_OP_consts +0");
 }
 
 TEST(PDBFPOProgramToDWARFExpressionTests, MultipleDependentAssignments) {
   CheckValidProgramTranslation(
   "$T1 $ebp 4 + = $T0 $T1 8 - 128 @ = ", "$T0",
-  "DW_OP_breg6 +0, DW_OP_constu 0x4, DW_OP_plus , DW_OP_constu 0x8, "
-  "DW_OP_minus , DW_OP_constu 0x80, DW_OP_lit1 , DW_OP_minus , DW_OP_not , "
+  "DW_OP_breg6 +0, DW_OP_consts +4, DW_OP_plus , DW_OP_consts +8, "
+  "DW_OP_minus , DW_OP_consts +128, DW_OP_lit1 , DW_OP_minus , DW_OP_not , "
   "DW_OP_and ");
 }
 
 TEST(PDBFPOProgramToDWARFExpressionTests, DependencyChain) {
   CheckValidProgramTranslation("$T1 0 = $T0 $T1 = $ebp $T0 =", "$ebp",
-   "DW_OP_constu 0x0");
+   "DW_OP_consts +0");
 }
 
 /// Invalid programs tests
Index: unittests/Symbol/PostfixExpressionTest.cpp
===
--- unittests/Symbol/PostfixExpressionTest.cpp
+++ unittests/Symbol/PostfixExpressionTest.cpp
@@ -88,6 +88,7 @@
   EXPECT_EQ("^(^(int(1)))", ParseAndStringify("1 ^ ^"));
   EXPECT_EQ("^(+(int(1), ^(int(2", ParseAndStringify("1 2 ^ + ^"));
   EXPECT_EQ("-($foo, int(47))", ParseAndStringify("$foo 47 -"));
+  EXPECT_EQ("+(int(47), int(-42))", ParseAndStringify("47 -42 +"));
 
   EXPECT_EQ("nullptr", ParseAndStringify("+"));
   EXPECT_EQ("nullptr", ParseAndStringify("^"));
@@ -137,7 +138,7 @@
 }
 
 TEST(PostfixExpression, ToDWARF) {
-  EXPECT_EQ("DW_OP_constu 0x0", ParseAndGenerateDWARF("0"));
+  EXPECT_EQ("DW_OP_consts +0", ParseAndGenerateDWARF("0"));
 
   EXPECT_EQ("DW_OP_breg1 +0", ParseAndGenerateDWARF("R1"));
 
@@ -151,18 +152,18 @@
   EXPECT_EQ("DW_OP_breg1 +0, DW_OP_pick 0x01, DW_OP_plus ",
 ParseAndGenerateDWARF("R1 INIT +"));
 
-  EXPECT_EQ("DW_OP_constu 0x1, DW_OP_pick 0x01, DW_OP_deref , DW_OP_plus ",
+  EXPECT_EQ("DW_OP_consts +1, DW_OP_pick 0x01, DW_OP_deref , DW_OP_plus ",
 ParseAndGenerateDWARF("1 INIT ^ +"));
 
-  EXPECT_EQ("DW_OP_constu 0x4, DW_OP_constu 0x5, DW_OP_plus ",
+  EXPECT_EQ("DW_OP_consts +4, DW_OP_consts +5, DW_OP_plus ",
 ParseAndGenerateDWARF("4 5 +"));
 
-  EXPECT_EQ("DW_OP_constu 0x4, DW_OP_constu 0x5, DW_OP_minus ",
+  EXPECT_EQ("DW_OP_consts +4, DW_OP_consts +5, DW_OP_minus ",
 ParseAndGenerateDWARF("4 5 -"));
 
-  EXPECT_EQ("DW_OP_constu 0x4, DW_OP_deref ", ParseAndGenerateDWARF("4 ^"));
+  EXPECT_EQ("DW_OP_consts +4, DW_OP_deref ", ParseAndGenerateDWARF("4 ^"));
 
-  EXPECT_EQ("DW_OP_breg6 +0, DW_OP_constu 0x80, DW_OP_lit1 "
+  EXPECT_EQ("DW_OP_breg6 +0, DW_OP_consts +128, DW_OP_lit1 "
 ", DW_OP_minus , DW_OP_not , DW_OP_and ",
 ParseAndGenerateDWARF("R6 128 @"));
 }
Index: source/Symbol/PostfixExpression.cpp
===
--- source/Symbol/PostfixExpression.cpp
+++ source/Symbol/PostfixExpression.cpp
@@ -67,7 +67,7 @@
   continue;
 }
 
-uint32_t value;
+int64_t value;
 if (to_integer(token, value, 10)) {
   // token is integer literal
   stack.push_back(MakeNode(alloc, value));
@@ -129,8 +129,8 @@
   void Visit(InitialValueNode &val, Node *&);
 
   void Visit(IntegerNode &integer, Node *&) {
-m_out_stream.PutHex8(DW_OP_constu);
-m_out_stream.PutULEB128(integer.GetValue());
+m_out_stream.PutHex8(DW_OP_consts);
+m_out_stream.PutSLEB128(integer.GetValue());
 ++m_sta

[Lldb-commits] [PATCH] D61310: [lldb] [Process/NetBSD] Fix handling EOF in PT_IO when reading memory

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, krytarowski, joerg.

Fix NativeProcessNetBSD::ReadMemory() to account for the possibility
of the ptrace() PT_IO call returning piod_len == 0, to indicate EOF.
This could happen if LLDB attempts to read past vm.maxaddress,
e.g. as a result of RBP containing large (invalid) value.  Previously,
the 0 return caused the function to retry reading via PT_IO
indefinitely, effectively deadlooping lldb-server.


https://reviews.llvm.org/D61310

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -700,7 +700,7 @@
 
 bytes_read = io.piod_len;
 io.piod_len = size - bytes_read;
-  } while (bytes_read < size);
+  } while (bytes_read < size && bytes_read != 0);
 
   return Status();
 }


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -700,7 +700,7 @@
 
 bytes_read = io.piod_len;
 io.piod_len = size - bytes_read;
-  } while (bytes_read < size);
+  } while (bytes_read < size && bytes_read != 0);
 
   return Status();
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61310: [lldb] [Process/NetBSD] Fix handling EOF in PT_IO when reading memory

2019-04-30 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski requested changes to this revision.
krytarowski added a comment.
This revision now requires changes to proceed.

I think there is a bug thought in the code.

1. bytes_read should return the bytes transferred from the function, it returns 
the value from the previous iteration only
2. `bytes_read != 0` should be replaced with `io.piod_len != 0`


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

https://reviews.llvm.org/D61310



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


[Lldb-commits] [PATCH] D61310: [lldb] [Process/NetBSD] Fix handling piod_len when reading memory

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 197325.
mgorny retitled this revision from "[lldb] [Process/NetBSD] Fix handling EOF in 
PT_IO when reading memory" to "[lldb] [Process/NetBSD] Fix handling piod_len 
when reading memory".
mgorny edited the summary of this revision.

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

https://reviews.llvm.org/D61310

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -695,10 +695,10 @@
 io.piod_addr = dst + bytes_read;
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_read = io.piod_len;
+bytes_read += io.piod_len;
 io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -695,10 +695,10 @@
 io.piod_addr = dst + bytes_read;
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_read = io.piod_len;
+bytes_read += io.piod_len;
 io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61311: PostfixExpression: Use signed integers in IntegerNode

2019-04-30 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth accepted this revision.
amccarth added a comment.
This revision is now accepted and ready to land.

This looks fine to me, and the rationale sounds right.  I'll be curious to see 
if any other reviewers see a potential problem with this.


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

https://reviews.llvm.org/D61311



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


[Lldb-commits] [PATCH] D61310: [lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 197326.
mgorny retitled this revision from "[lldb] [Process/NetBSD] Fix handling 
piod_len when reading memory" to "[lldb] [Process/NetBSD] Fix handling piod_len 
from PT_IO calls".
mgorny edited the summary of this revision.
mgorny added a comment.

Also included fixes for `WriteMemory()`.


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

https://reviews.llvm.org/D61310

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -695,10 +695,10 @@
 io.piod_addr = dst + bytes_read;
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_read = io.piod_len;
+bytes_read += io.piod_len;
 io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 
@@ -723,10 +723,10 @@
 io.piod_offs = (void *)(addr + bytes_written);
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_written = io.piod_len;
+bytes_written += io.piod_len;
 io.piod_len = size - bytes_written;
   } while (bytes_written < size);
 


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -695,10 +695,10 @@
 io.piod_addr = dst + bytes_read;
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_read = io.piod_len;
+bytes_read += io.piod_len;
 io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 
@@ -723,10 +723,10 @@
 io.piod_offs = (void *)(addr + bytes_written);
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_written = io.piod_len;
+bytes_written += io.piod_len;
 io.piod_len = size - bytes_written;
   } while (bytes_written < size);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61299: Rename Minion to ASTImporterDelegate

2019-04-30 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: rnkovacs.

yay :)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61299



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


[Lldb-commits] [PATCH] D61299: Rename Minion to ASTImporterDelegate

2019-04-30 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added inline comments.



Comment at: lldb/include/lldb/Symbol/ClangASTImporter.h:238
 
-  class Minion : public clang::ASTImporter {
+  class ASTImporterDelegate : public clang::ASTImporter {
   public:

Is there some sort of doxygen comment we could add here?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61299



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


[Lldb-commits] [lldb] r359572 - [lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls

2019-04-30 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Apr 30 09:30:32 2019
New Revision: 359572

URL: http://llvm.org/viewvc/llvm-project?rev=359572&view=rev
Log:
[lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls

Fix bugs in piod_len return value processing in ReadMemory()
and WriteMemory() methods.  In particular, add support for piod_len == 0
indicating EOF, and fix summing bytes_read/bytes_written when PT_IO does
partial reads/writes.

The EOF condition could happen if LLDB attempts to read past
vm.maxaddress, e.g. as a result of RBP containing large (invalid) value.
Previously, the 0 return caused the function to retry reading via PT_IO
indefinitely, effectively deadlooping lldb-server.

Partial reads probably did not occur in practice, yet they would cause
ReadMemory() to return incorrect bytes_read and/or overwrite previously
read data.

WriteMemory() suffered from analoguous problems.

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

Modified:
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp?rev=359572&r1=359571&r2=359572&view=diff
==
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp Tue Apr 30 
09:30:32 2019
@@ -695,10 +695,10 @@ Status NativeProcessNetBSD::ReadMemory(l
 io.piod_addr = dst + bytes_read;
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_read = io.piod_len;
+bytes_read += io.piod_len;
 io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 
@@ -723,10 +723,10 @@ Status NativeProcessNetBSD::WriteMemory(
 io.piod_offs = (void *)(addr + bytes_written);
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_written = io.piod_len;
+bytes_written += io.piod_len;
 io.piod_len = size - bytes_written;
   } while (bytes_written < size);
 


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


[Lldb-commits] [PATCH] D61310: [lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359572: [lldb] [Process/NetBSD] Fix handling piod_len from 
PT_IO calls (authored by mgorny, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61310?vs=197326&id=197352#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61310

Files:
  lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp


Index: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -695,10 +695,10 @@
 io.piod_addr = dst + bytes_read;
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_read = io.piod_len;
+bytes_read += io.piod_len;
 io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 
@@ -723,10 +723,10 @@
 io.piod_offs = (void *)(addr + bytes_written);
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_written = io.piod_len;
+bytes_written += io.piod_len;
 io.piod_len = size - bytes_written;
   } while (bytes_written < size);
 


Index: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -695,10 +695,10 @@
 io.piod_addr = dst + bytes_read;
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_read = io.piod_len;
+bytes_read += io.piod_len;
 io.piod_len = size - bytes_read;
   } while (bytes_read < size);
 
@@ -723,10 +723,10 @@
 io.piod_offs = (void *)(addr + bytes_written);
 
 Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
-if (error.Fail())
+if (error.Fail() || io.piod_len == 0)
   return error;
 
-bytes_written = io.piod_len;
+bytes_written += io.piod_len;
 io.piod_len = size - bytes_written;
   } while (bytes_written < size);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r359573 - Un-xfail the TestMiniDump tests on Windows

2019-04-30 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Tue Apr 30 09:42:39 2019
New Revision: 359573

URL: http://llvm.org/viewvc/llvm-project?rev=359573&view=rev
Log:
Un-xfail the TestMiniDump tests on Windows

After Aaron's commit for ObjectFilePECOFF:: GetUUID, the tests are now passing

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py?rev=359573&r1=359572&r2=359573&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
 Tue Apr 30 09:42:39 2019
@@ -109,7 +109,6 @@ class MiniDumpTestCase(TestBase):
 self.assertTrue(frame.GetModule().IsValid())
 
 @skipUnlessWindows # Minidump saving works only on windows
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343")
 def test_deeper_stack_in_mini_dump(self):
 """Test that we can examine a more interesting stack in a mini dump."""
 self.build()
@@ -146,7 +145,6 @@ class MiniDumpTestCase(TestBase):
 os.unlink(core)
 
 @skipUnlessWindows # Minidump saving works only on windows
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343")
 def test_local_variables_in_mini_dump(self):
 """Test that we can examine local variables in a mini dump."""
 self.build()


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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM/r8-r15 registers

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 197355.
mgorny marked an inline comment as done.
mgorny retitled this revision from "[lldb] [lit] Add write tests for MM/XMM 
registers" to "[lldb] [lit] Add write tests for MM/XMM/r8-r15 registers".
mgorny edited the summary of this revision.
mgorny added a comment.

Inlined `mm_fill`, and added tests for r8-r15 & xmm8-xmm15.


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

https://reviews.llvm.org/D61303

Files:
  lldb/lit/Register/Inputs/x86-64-write.cpp
  lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
  lldb/lit/Register/x86-64-write.test
  lldb/lit/Register/x86-mm-xmm-write.test

Index: lldb/lit/Register/x86-mm-xmm-write.test
===
--- /dev/null
+++ lldb/lit/Register/x86-mm-xmm-write.test
@@ -0,0 +1,47 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
+# RUN: %clangxx %p/Inputs/x86-mm-xmm-write.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register write mm0 0x0102030405060708
+register write mm1 0x1112131415161718
+register write mm2 0x2122232425262728
+register write mm3 0x3132333435363738
+register write mm4 0x4142434445464748
+register write mm5 0x5152535455565758
+register write mm6 0x6162636465666768
+register write mm7 0x7172737475767778
+
+register write xmm0 "{0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}"
+register write xmm1 "{0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}"
+register write xmm2 "{0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}"
+register write xmm3 "{0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}"
+register write xmm4 "{0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}"
+register write xmm5 "{0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}"
+register write xmm6 "{0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}"
+register write xmm7 "{0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}"
+
+process continue
+# CHECK: process continue
+
+# CHECK-DAG: mm0 = 0x0102030405060708
+# CHECK-DAG: mm1 = 0x1112131415161718
+# CHECK-DAG: mm2 = 0x2122232425262728
+# CHECK-DAG: mm3 = 0x3132333435363738
+# CHECK-DAG: mm4 = 0x4142434445464748
+# CHECK-DAG: mm5 = 0x5152535455565758
+# CHECK-DAG: mm6 = 0x6162636465666768
+# CHECK-DAG: mm7 = 0x7172737475767778
+
+# CHECK-DAG: xmm0 = 0x030507090b0d0f00020406080a0c0e01
+# CHECK-DAG: xmm1 = 0x131517191b1d1f10121416181a1c1e11
+# CHECK-DAG: xmm2 = 0x232527292b2d2f20222426282a2c2e21
+# CHECK-DAG: xmm3 = 0x333537393b3d3f30323436383a3c3e31
+# CHECK-DAG: xmm4 = 0x434547494b4d4f40424446484a4c4e41
+# CHECK-DAG: xmm5 = 0x535557595b5d5f50525456585a5c5e51
+# CHECK-DAG: xmm6 = 0x636567696b6d6f60626466686a6c6e61
+# CHECK-DAG: xmm7 = 0x737577797b7d7f70727476787a7c7e71
+
+# CHECK: Process {{[0-9]+}} exited with status = 0
Index: lldb/lit/Register/x86-64-write.test
===
--- /dev/null
+++ lldb/lit/Register/x86-64-write.test
@@ -0,0 +1,46 @@
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
+# RUN: %clangxx %p/Inputs/x86-64-write.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register write r8 0x0102030405060708
+register write r9 0x1112131415161718
+register write r10 0x2122232425262728
+register write r11 0x3132333435363738
+register write r12 0x4142434445464748
+register write r13 0x5152535455565758
+register write r14 0x6162636465666768
+register write r15 0x7172737475767778
+
+register write xmm8 "{0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}"
+register write xmm9 "{0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}"
+register write xmm10 "{0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}"
+register write xmm11 "{0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}"
+register write xmm12 "{0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}"
+register write xmm13 "{0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}"
+register write xmm14 "{0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}"
+register write xmm15 "{0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}"
+
+process continue
+# CHECK: process continue
+
+# CHECK-DAG: r8 = 0x0102030405060708
+# CHECK-DAG: r9 = 0x1112131415161718
+# CHECK-DAG: r10 = 0x2122232425262728
+# CHECK-DAG: r11 = 0x3132333435363738
+# CHECK-DAG: r12 = 0x4142434445464748
+# CHECK-DAG: r13 = 0x5152535455565758
+# CHECK-DAG: r14 = 0x6162636465666768
+# CHECK-DAG: r15 = 0x7172737475767778
+
+# C

[Lldb-commits] [PATCH] D61266: Skip TestClassTemplateParameterPack.py on all platforms

2019-04-30 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 197360.
shafik added a comment.

Updated comment to be more precise.


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

https://reviews.llvm.org/D61266

Files:
  
packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
  packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp


Index: 
packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
===
--- 
packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
+++ 
packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
@@ -42,10 +42,12 @@
 (void)C().isSixteenThirtyTwo();
 (void)C().isSixteenThirtyTwo();
 (void)(myC.member != 64);   //% self.expect("expression -- myC", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"])
-//% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
["false"])
-//% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
 //% self.expect("expression -- 
myLesserC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
["false"])
 //% self.expect("expression -- 
myC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+
+// Disabling until we do template lookup 
correctly: 
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
+//#% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
["false"])
+//#% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])

 D myD;
 D myLesserD;
@@ -53,8 +55,10 @@
 (void)D().isIntBool();
 (void)D().isIntBool();
 return myD.member != 64;   //% self.expect("expression -- myD", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"])
-//% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
-//% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
 //% self.expect("expression -- 
myLesserD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
 //% self.expect("expression -- 
myD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+
+// See comment above.
+//#% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+//#% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
 }
Index: 
packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
===
--- 
packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
+++ 
packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
@@ -4,6 +4,4 @@
 lldbinline.MakeInlineTest(
 __file__, globals(), [
 decorators.expectedFailureAll(
-compiler="gcc"),
-# rdar://problem/48128064
-decorators.skipIfDarwin])
+compiler="gcc")])


Index: packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
===
--- packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
+++ packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
@@ -42,10 +42,12 @@
 (void)C().isSixteenThirtyTwo();
 (void)C().isSixteenThirtyTwo();
 (void)(myC.member != 64);   //% self.expect("expression -- myC", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"])
-//% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
-//% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
 //% self.expect("expression -- myLesserC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
 //% self.expect("expression -- myC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+
+// Disabling until we do template lookup correctly: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507

[Lldb-commits] [PATCH] D61266: Skip TestClassTemplateParameterPack.py on all platforms

2019-04-30 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

@friss makes sense, updated comment.


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

https://reviews.llvm.org/D61266



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


[Lldb-commits] [PATCH] D61266: Skip TestClassTemplateParameterPack.py on all platforms

2019-04-30 Thread Frederic Riss via Phabricator via lldb-commits
friss accepted this revision.
friss added a comment.
This revision is now accepted and ready to land.

LGTM if no one else objects.


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

https://reviews.llvm.org/D61266



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


[Lldb-commits] [PATCH] D61305: Add std::stack and std::queue support to CxxModuleHandler

2019-04-30 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.

LGTM


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61305



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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM/r8-r15 registers

2019-04-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/lit/Register/x86-64-write.test:1
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse

This fails on Darwin for me:
```
# CHECK-DAG: xmm8 = 0x030507090b0d0f00020406080a0c0e01
 ^
:38:1: note: scanning from here
r8 = 0x0102030405060708
^
:46:1: note: possible intended match here
xmm8 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f
```


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

https://reviews.llvm.org/D61303



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


[Lldb-commits] [lldb] r359575 - XFAIL x86-64-zmm-read on Darwin

2019-04-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Apr 30 10:21:05 2019
New Revision: 359575

URL: http://llvm.org/viewvc/llvm-project?rev=359575&view=rev
Log:
XFAIL x86-64-zmm-read on Darwin

Modified:
lldb/trunk/lit/Register/x86-64-zmm-read.test

Modified: lldb/trunk/lit/Register/x86-64-zmm-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-zmm-read.test?rev=359575&r1=359574&r2=359575&view=diff
==
--- lldb/trunk/lit/Register/x86-64-zmm-read.test (original)
+++ lldb/trunk/lit/Register/x86-64-zmm-read.test Tue Apr 30 10:21:05 2019
@@ -2,6 +2,7 @@
 # XFAIL: system-linux
 # XFAIL: system-netbsd
 # XFAIL: system-windows
+# XFAIL: system-darwin
 # REQUIRES: native && target-x86_64 && native-cpu-avx512f
 # RUN: %clangxx %p/Inputs/x86-zmm-read.cpp -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s


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


[Lldb-commits] [lldb] r359577 - Sort Symbol/CMakeLists.txt

2019-04-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Apr 30 10:22:29 2019
New Revision: 359577

URL: http://llvm.org/viewvc/llvm-project?rev=359577&view=rev
Log:
Sort Symbol/CMakeLists.txt

This makes resolving merge conflicts downstream a tad easier.

Modified:
lldb/trunk/source/Symbol/CMakeLists.txt

Modified: lldb/trunk/source/Symbol/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CMakeLists.txt?rev=359577&r1=359576&r2=359577&view=diff
==
--- lldb/trunk/source/Symbol/CMakeLists.txt (original)
+++ lldb/trunk/source/Symbol/CMakeLists.txt Tue Apr 30 10:22:29 2019
@@ -12,22 +12,22 @@ add_lldb_library(lldbSymbol
   ClangExternalASTSourceCallbacks.cpp
   ClangExternalASTSourceCommon.cpp
   ClangUtil.cpp
+  CompactUnwindInfo.cpp
+  CompileUnit.cpp
   CompilerDecl.cpp
   CompilerDeclContext.cpp
   CompilerType.cpp
-  CompileUnit.cpp
-  CompactUnwindInfo.cpp
+  CxxModuleHandler.cpp
+  DWARFCallFrameInfo.cpp
   DebugMacros.cpp
   Declaration.cpp
-  DWARFCallFrameInfo.cpp
-  Function.cpp
   FuncUnwinders.cpp
+  Function.cpp
   LineEntry.cpp
   LineTable.cpp
   LocateSymbolFile.cpp
   ObjectFile.cpp
   PostfixExpression.cpp
-  CxxModuleHandler.cpp
   Symbol.cpp
   SymbolContext.cpp
   SymbolFile.cpp


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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM/r8-r15 registers

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added inline comments.



Comment at: lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp:10
+int main() {
+  constexpr uint64_t mm_fill = 0x0F0F0F0F0F0F0F0F;
+  constexpr xmm_t xmm_fill = { mm_fill, mm_fill };

labath wrote:
> It looks like `mm_fill` is unused.
It's used to fill `xmm_fill` ;-). Should I inline it?



Comment at: lldb/lit/Register/x86-64-write.test:1
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse

JDevlieghere wrote:
> This fails on Darwin for me:
> ```
> # CHECK-DAG: xmm8 = 0x030507090b0d0f00020406080a0c0e01
>  ^
> :38:1: note: scanning from here
> r8 = 0x0102030405060708
> ^
> :46:1: note: possible intended match here
> xmm8 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f
> ```
Could you run it without FileCheck, and paste the full output? Manually would 
be something alike:

clang++ Inputs/x86-64-write.cpp
lldb -b -s x86-64-write.test a.out


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

https://reviews.llvm.org/D61303



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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM/r8-r15 registers

2019-04-30 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/lit/Register/x86-64-write.test:1
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse

mgorny wrote:
> JDevlieghere wrote:
> > This fails on Darwin for me:
> > ```
> > # CHECK-DAG: xmm8 = 0x030507090b0d0f00020406080a0c0e01
> >  ^
> > :38:1: note: scanning from here
> > r8 = 0x0102030405060708
> > ^
> > :46:1: note: possible intended match here
> > xmm8 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f
> > ```
> Could you run it without FileCheck, and paste the full output? Manually would 
> be something alike:
> 
> clang++ Inputs/x86-64-write.cpp
> lldb -b -s x86-64-write.test a.out
Sure, here's the output: https://reviews.llvm.org/P8141


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

https://reviews.llvm.org/D61303



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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM/r8-r15 registers

2019-04-30 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 197376.
mgorny added a comment.

Ok, I see that Darwin doesn't implement writing to xmm* registers at the 
moment. Added XFAIL for it.


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

https://reviews.llvm.org/D61303

Files:
  lldb/lit/Register/Inputs/x86-64-write.cpp
  lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp
  lldb/lit/Register/x86-64-write.test
  lldb/lit/Register/x86-mm-xmm-write.test

Index: lldb/lit/Register/x86-mm-xmm-write.test
===
--- /dev/null
+++ lldb/lit/Register/x86-mm-xmm-write.test
@@ -0,0 +1,47 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
+# RUN: %clangxx %p/Inputs/x86-mm-xmm-write.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register write mm0 0x0102030405060708
+register write mm1 0x1112131415161718
+register write mm2 0x2122232425262728
+register write mm3 0x3132333435363738
+register write mm4 0x4142434445464748
+register write mm5 0x5152535455565758
+register write mm6 0x6162636465666768
+register write mm7 0x7172737475767778
+
+register write xmm0 "{0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}"
+register write xmm1 "{0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}"
+register write xmm2 "{0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}"
+register write xmm3 "{0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}"
+register write xmm4 "{0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}"
+register write xmm5 "{0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}"
+register write xmm6 "{0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}"
+register write xmm7 "{0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}"
+
+process continue
+# CHECK: process continue
+
+# CHECK-DAG: mm0 = 0x0102030405060708
+# CHECK-DAG: mm1 = 0x1112131415161718
+# CHECK-DAG: mm2 = 0x2122232425262728
+# CHECK-DAG: mm3 = 0x3132333435363738
+# CHECK-DAG: mm4 = 0x4142434445464748
+# CHECK-DAG: mm5 = 0x5152535455565758
+# CHECK-DAG: mm6 = 0x6162636465666768
+# CHECK-DAG: mm7 = 0x7172737475767778
+
+# CHECK-DAG: xmm0 = 0x030507090b0d0f00020406080a0c0e01
+# CHECK-DAG: xmm1 = 0x131517191b1d1f10121416181a1c1e11
+# CHECK-DAG: xmm2 = 0x232527292b2d2f20222426282a2c2e21
+# CHECK-DAG: xmm3 = 0x333537393b3d3f30323436383a3c3e31
+# CHECK-DAG: xmm4 = 0x434547494b4d4f40424446484a4c4e41
+# CHECK-DAG: xmm5 = 0x535557595b5d5f50525456585a5c5e51
+# CHECK-DAG: xmm6 = 0x636567696b6d6f60626466686a6c6e61
+# CHECK-DAG: xmm7 = 0x737577797b7d7f70727476787a7c7e71
+
+# CHECK: Process {{[0-9]+}} exited with status = 0
Index: lldb/lit/Register/x86-64-write.test
===
--- /dev/null
+++ lldb/lit/Register/x86-64-write.test
@@ -0,0 +1,47 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
+# RUN: %clangxx %p/Inputs/x86-64-write.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register write r8 0x0102030405060708
+register write r9 0x1112131415161718
+register write r10 0x2122232425262728
+register write r11 0x3132333435363738
+register write r12 0x4142434445464748
+register write r13 0x5152535455565758
+register write r14 0x6162636465666768
+register write r15 0x7172737475767778
+
+register write xmm8 "{0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}"
+register write xmm9 "{0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}"
+register write xmm10 "{0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}"
+register write xmm11 "{0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}"
+register write xmm12 "{0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}"
+register write xmm13 "{0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}"
+register write xmm14 "{0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}"
+register write xmm15 "{0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}"
+
+process continue
+# CHECK: process continue
+
+# CHECK-DAG: r8 = 0x0102030405060708
+# CHECK-DAG: r9 = 0x1112131415161718
+# CHECK-DAG: r10 = 0x2122232425262728
+# CHECK-DAG: r11 = 0x3132333435363738
+# CHECK-DAG: r12 = 0x4142434445464748
+# CHECK-DAG: r13 = 0x5152535455565758
+# CHECK-DAG: r14 = 0x6162636465666768
+# CHECK-DAG: r15 = 0x7172737475767778
+
+# CHECK-DAG: xmm8 = 0x030507090b0d0f00020406080a0c0e01
+# CHECK-DAG: xmm9 = 0x131517191b1d1f10121416181a1c1e11
+# CHECK-DAG: xmm10 = 0x232527292b2d2f20222426282a2c2e21
+# CH

[Lldb-commits] [PATCH] D61299: Rename Minion to ASTImporterDelegate

2019-04-30 Thread Gabor Marton via Phabricator via lldb-commits
martong added inline comments.



Comment at: lldb/include/lldb/Symbol/ClangASTImporter.h:328
 clang::ASTContext *m_dst_ctx;
-MinionMap m_minions;
+DelegateMap m_minions;
 OriginMap m_origins;

Would it make sense to rename the variables too? E.g. `m_delegates`?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61299



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


[Lldb-commits] [PATCH] D61299: Rename Minion to ASTImporterDelegate

2019-04-30 Thread Gabor Marton via Phabricator via lldb-commits
martong added inline comments.



Comment at: lldb/include/lldb/Symbol/ClangASTImporter.h:259
 public:
-  CxxModuleScope(Minion &minion, clang::ASTContext *dst_ctx)
+  CxxModuleScope(ASTImporterDelegate &minion, clang::ASTContext *dst_ctx)
   : m_minion(minion) {

The name of the parameter is still `minion` ... if the goal is to completely 
wipe out the old name then perhaps these should be renamed. Also with the new 
type name it just feels odd.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61299



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


[Lldb-commits] [PATCH] D61303: [lldb] [lit] Add write tests for MM/XMM/r8-r15 registers

2019-04-30 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: lldb/lit/Register/Inputs/x86-mm-xmm-write.cpp:10
+int main() {
+  constexpr uint64_t mm_fill = 0x0F0F0F0F0F0F0F0F;
+  constexpr xmm_t xmm_fill = { mm_fill, mm_fill };

mgorny wrote:
> labath wrote:
> > It looks like `mm_fill` is unused.
> It's used to fill `xmm_fill` ;-). Should I inline it?
What I actually meant here was that I was expecting `mm_fill` to be used to 
initialize the `mm` registers, but you're initializing them with `xmm_fill` 
instead. However, that's not really important, as both are technically correct.


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

https://reviews.llvm.org/D61303



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


Re: [Lldb-commits] [lldb] r359575 - XFAIL x86-64-zmm-read on Darwin

2019-04-30 Thread Pavel Labath via lldb-commits

On 30/04/2019 19:21, Jonas Devlieghere via lldb-commits wrote:

Author: jdevlieghere
Date: Tue Apr 30 10:21:05 2019
New Revision: 359575

URL: http://llvm.org/viewvc/llvm-project?rev=359575&view=rev
Log:
XFAIL x86-64-zmm-read on Darwin

Modified:
 lldb/trunk/lit/Register/x86-64-zmm-read.test

Modified: lldb/trunk/lit/Register/x86-64-zmm-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-zmm-read.test?rev=359575&r1=359574&r2=359575&view=diff
==
--- lldb/trunk/lit/Register/x86-64-zmm-read.test (original)
+++ lldb/trunk/lit/Register/x86-64-zmm-read.test Tue Apr 30 10:21:05 2019
@@ -2,6 +2,7 @@
  # XFAIL: system-linux
  # XFAIL: system-netbsd
  # XFAIL: system-windows
+# XFAIL: system-darwin
  # REQUIRES: native && target-x86_64 && native-cpu-avx512f
  # RUN: %clangxx %p/Inputs/x86-zmm-read.cpp -o %t
  # RUN: %lldb -b -s %s %t | FileCheck %s


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



Jonas, could you double check why is this failing? This test is a 
replacement for a dotest test which I believe was passing on darwin 
before, so that fact that this is failing now probably means there is a 
typo or some other kind of a bug in this test.


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


[Lldb-commits] [lldb] r359593 - Add CxxModuleHandler to Xcode project

2019-04-30 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Apr 30 11:21:14 2019
New Revision: 359593

URL: http://llvm.org/viewvc/llvm-project?rev=359593&view=rev
Log:
Add CxxModuleHandler to Xcode project

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

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=359593&r1=359592&r2=359593&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Apr 30 11:21:14 2019
@@ -243,6 +243,7 @@
9A3D43D61F3151C400EB767C /* ConstStringTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A3D43C81F3150D200EB767C /* ConstStringTest.cpp 
*/; };
2668022F115FD19D008E1FE4 /* CoreFoundation.framework in 
Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* 
CoreFoundation.framework */; };
949EEDA01BA74B6D008C63CF /* CoreMedia.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 949EED9E1BA74B64008C63CF /* CoreMedia.cpp */; };
+   DDB5829C2278C8D700491B41 /* CxxModuleHandler.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = DDB5829B2278C8D600491B41 /* 
CxxModuleHandler.cpp */; };
945261BF1B9A11FC00BF138D /* CxxStringTypes.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 945261B31B9A11E800BF138D /* CxxStringTypes.cpp 
*/; };
6D95DC001B9DC057000E318A /* DIERef.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 6D95DBFD1B9DC057000E318A /* DIERef.cpp */; };
269DDD4A1B8FD1C300D0DBD8 /* DWARFASTParserClang.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 269DDD481B8FD1C300D0DBD8 /* 
DWARFASTParserClang.cpp */; };
@@ -1740,6 +1741,8 @@
949EED9F1BA74B64008C63CF /* CoreMedia.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CoreMedia.h; path 
= Language/ObjC/CoreMedia.h; sourceTree = ""; };
AF3F54AE1B3BA59C00186E73 /* CrashReason.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = CrashReason.cpp; sourceTree = ""; };
AF3F54AF1B3BA59C00186E73 /* CrashReason.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
CrashReason.h; sourceTree = ""; };
+   DDB5829B2278C8D600491B41 /* CxxModuleHandler.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = CxxModuleHandler.cpp; path = source/Symbol/CxxModuleHandler.cpp; 
sourceTree = ""; };
+   DDB5829D2278C8E900491B41 /* CxxModuleHandler.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
CxxModuleHandler.h; path = include/lldb/Symbol/CxxModuleHandler.h; sourceTree = 
""; };
945261B31B9A11E800BF138D /* CxxStringTypes.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
CxxStringTypes.cpp; path = Language/CPlusPlus/CxxStringTypes.cpp; sourceTree = 
""; };
945261B41B9A11E800BF138D /* CxxStringTypes.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CxxStringTypes.h; 
path = Language/CPlusPlus/CxxStringTypes.h; sourceTree = ""; };
6D95DBFD1B9DC057000E318A /* DIERef.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DIERef.cpp; sourceTree = ""; };
@@ -5306,8 +5309,10 @@
26BC7F1510F1B8EC00F91463 /* CompileUnit.cpp */,
23E77CDB1C20F2F2007192AD /* DebugMacros.cpp */,
26BC7C5810F1B6E900F91463 /* Declaration.h */,
+   DDB5829B2278C8D600491B41 /* 
CxxModuleHandler.cpp */,
26BC7F1610F1B8EC00F91463 /* Declaration.cpp */,
49B01A2D15F67B1700666829 /* DeclVendor.h */,
+   DDB5829D2278C8E900491B41 /* CxxModuleHandler.h 
*/,
26BC7C5910F1B6E900F91463 /* 
DWARFCallFrameInfo.h */,
26BC7F1710F1B8EC00F91463 /* 
DWARFCallFrameInfo.cpp */,
26BC7C5A10F1B6E900F91463 /* Function.h */,
@@ -7979,6 +7984,7 @@
AF0578C4217FA80700CF9D80 /* 
UdtRecordCompleter.cpp in Sources */,
268913353DB600698AC0 /* 
BreakpointResolver.cpp in Sources */,
25420ECD1A6490B8009ADBCB /* OptionValueChar.cpp 
in Sources */,
+   DDB5829C2278C8D700491B41 /* 
CxxModuleHandler.cpp in Sources */,
2689000113353DB600698AC0 /* 
BreakpointResolverAddress.cpp in Sources */,
255EFF741AFABA720069F277 /* LockFileBase.cpp in 
Sources */,
945261C2

Re: [Lldb-commits] [lldb] r359575 - XFAIL x86-64-zmm-read on Darwin

2019-04-30 Thread Jonas Devlieghere via lldb-commits
Hey Pavel,

Apologies if I was too hasty, given the number of XFAILs I assumed the test
was a WIP and the missing darwin was an oversight.

Here's the output on my machine: https://reviews.llvm.org/P8142

CHECK-DAG: expected string not found in input
# CHECK-DAG: xmm16 = {0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03 0x01 0x0e
0x0c 0x0a 0x08 0x06 0x04 0x02}

Looks like the problem is that there's no xmm16 in the output.

On Tue, Apr 30, 2019 at 11:08 AM Pavel Labath  wrote:

> On 30/04/2019 19:21, Jonas Devlieghere via lldb-commits wrote:
> > Author: jdevlieghere
> > Date: Tue Apr 30 10:21:05 2019
> > New Revision: 359575
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=359575&view=rev
> > Log:
> > XFAIL x86-64-zmm-read on Darwin
> >
> > Modified:
> >  lldb/trunk/lit/Register/x86-64-zmm-read.test
> >
> > Modified: lldb/trunk/lit/Register/x86-64-zmm-read.test
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-zmm-read.test?rev=359575&r1=359574&r2=359575&view=diff
> >
> ==
> > --- lldb/trunk/lit/Register/x86-64-zmm-read.test (original)
> > +++ lldb/trunk/lit/Register/x86-64-zmm-read.test Tue Apr 30 10:21:05 2019
> > @@ -2,6 +2,7 @@
> >   # XFAIL: system-linux
> >   # XFAIL: system-netbsd
> >   # XFAIL: system-windows
> > +# XFAIL: system-darwin
> >   # REQUIRES: native && target-x86_64 && native-cpu-avx512f
> >   # RUN: %clangxx %p/Inputs/x86-zmm-read.cpp -o %t
> >   # RUN: %lldb -b -s %s %t | FileCheck %s
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> >
>
> Jonas, could you double check why is this failing? This test is a
> replacement for a dotest test which I believe was passing on darwin
> before, so that fact that this is failing now probably means there is a
> typo or some other kind of a bug in this test.
>
> pl
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r359575 - XFAIL x86-64-zmm-read on Darwin

2019-04-30 Thread Pavel Labath via lldb-commits

On 30/04/2019 20:24, Jonas Devlieghere wrote:

Hey Pavel,

Apologies if I was too hasty, given the number of XFAILs I assumed the 
test was a WIP and the missing darwin was an oversight.


Here's the output on my machine: https://reviews.llvm.org/P8142

No worries. Darwin is actually the one place which has this implemented. 
However, judging by your output, that support isn't fully functional 
either (you have %zmm16-32, but not their %ymm and %xmm counterparts).


Michal, given this, I think we should remove the ymm and xmm 
expectations from this test (or leave them commented out with a note), 
so that we at least test the part of this feature that is actually 
working. Otherwise we'll end up with a test that is XFAILed everywhere..


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


[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

2019-04-30 Thread Gabor Marton via Phabricator via lldb-commits
martong created this revision.
martong added reviewers: shafik, teemperor, jingham, clayborg, a_sidorin.
Herald added subscribers: lldb-commits, cfe-commits, gamesh411, Szelethus, 
dkrupp, rnkovacs.
Herald added a reviewer: a.sidorin.
Herald added projects: clang, LLDB.

With LLDB we use localUncachedLookup(), however, that fails to find
Decls when a transparent context is involved and the given DC has
external lexical storage.  The solution is to use noload_lookup, which
works well with transparent contexts.  But, we cannot use only the
noload_lookup since the slow case of localUncachedLookup is still needed
in some other cases.

These other cases are handled in ASTImporterLookupTable, but we cannot
use that with LLDB since that traverses through the AST which initiates
the load of external decls again via DC::decls().

We must avoid loading external decls during the import becuase
ExternalASTSource is implemented with ASTImporter, so external loads
during import results in uncontrolled and faulty import.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61333

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp
  lldb/include/lldb/Utility/Logging.h
  lldb/packages/Python/lldbsuite/test/lang/c/ast/Makefile
  lldb/packages/Python/lldbsuite/test/lang/c/ast/TestAST.py
  lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
  lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Symbol/ClangASTImporter.cpp
  lldb/source/Utility/Logging.cpp

Index: lldb/source/Utility/Logging.cpp
===
--- lldb/source/Utility/Logging.cpp
+++ lldb/source/Utility/Logging.cpp
@@ -17,6 +17,7 @@
 
 static constexpr Log::Category g_categories[] = {
   {{"api"}, {"log API calls and return values"}, LIBLLDB_LOG_API},
+  {{"ast"}, {"log AST"}, LIBLLDB_LOG_AST},
   {{"break"}, {"log breakpoints"}, LIBLLDB_LOG_BREAKPOINTS},
   {{"commands"}, {"log command argument parsing"}, LIBLLDB_LOG_COMMANDS},
   {{"comm"}, {"log communication activities"}, LIBLLDB_LOG_COMMUNICATION},
Index: lldb/source/Symbol/ClangASTImporter.cpp
===
--- lldb/source/Symbol/ClangASTImporter.cpp
+++ lldb/source/Symbol/ClangASTImporter.cpp
@@ -918,6 +918,28 @@
   if (clang::TagDecl *to_tag = dyn_cast(to)) {
 if (clang::TagDecl *from_tag = dyn_cast(from)) {
   to_tag->setCompleteDefinition(from_tag->isCompleteDefinition());
+
+  Log *log_ast(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST));
+  if (log_ast) {
+std::string name_string;
+if (NamedDecl *from_named_decl = dyn_cast(from)) {
+  llvm::raw_string_ostream name_stream(name_string);
+  from_named_decl->printName(name_stream);
+  name_stream.flush();
+}
+log_ast->Printf(" [ClangASTImporter][TUDecl: %p] Imported "
+"(%sDecl*)%p, named %s (from "
+"(Decl*)%p)",
+static_cast(to->getTranslationUnitDecl()),
+from->getDeclKindName(), static_cast(to),
+name_string.c_str(), static_cast(from));
+
+// Log the AST of the TU.
+std::string ast_string;
+llvm::raw_string_ostream ast_stream(ast_string);
+to->getTranslationUnitDecl()->dump(ast_stream);
+log_ast->Printf("%s", ast_string.c_str());
+  }
 }
   }
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -637,18 +637,6 @@
 
 m_ast_importer_sp->RequireCompleteType(copied_field_type);
   }
-
-  DeclContext *decl_context_non_const =
-  const_cast(decl_context);
-
-  if (copied_decl->getDeclContext() != decl_context) {
-if (copied_decl->getDeclContext()->containsDecl(copied_decl))
-  copied_decl->getDeclContext()->removeDecl(copied_decl);
-copied_decl->setDeclContext(decl_context_non_const);
-  }
-
-  if (!decl_context_non_const->containsDecl(copied_decl))
-decl_context_non_const->addDeclInternal(copied_decl);
 }
   }
 
Index: lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
===
--- lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
+++ lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
@@ -5,11 +5,11 @@
 typedef struct {
 int a;
 int b;
-} FILE;
+} MYFILE;
 
 int main()
 {
-FILE *myFile = malloc(sizeof(FILE));
+MYFILE *myFile = malloc(sizeof(MYFILE));
 
 myFile->a = 5;
 myFile->b = 9;
Index: lldb/packages/Python/lldbsuite/test/lang/c/ast/main.c
===

[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

2019-04-30 Thread Gabor Marton via Phabricator via lldb-commits
martong marked 2 inline comments as done.
martong added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c:8
 int b;
-} FILE;
+} MYFILE;
 

In TestCmodules.py we have `import Darwin` and then `expr *fopen("/dev/zero", 
"w")`. This imports the name `FILE` from the Darwin module. Then when we want 
`expr *myFile`, the two different definition of the `FILE` structs collides.
This happens because now the lookup finds the existing definition for the 
`FILE` in the TU associated with the expression evaluator, and that comes from 
the Darwin module.



Comment at: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:640
   }
-
-  DeclContext *decl_context_non_const =

We must remove the below addDeclInternal call, because that may be called from 
another
addDeclInternal:
```
6  clang::CXXConstructorDecl::isDefaultConstructor() const + 87
7  clang::CXXRecordDecl::addedMember(clang::Decl*) + 803
8  clang::DeclContext::addHiddenDecl(clang::Decl*) + 341
9  clang::DeclContext::addDeclInternal(clang::Decl*) + 29
10 lldb_private::ClangASTSource::FindExternalLexicalDecls(clang::DeclContext 
const*, llvm::function_ref, 
llvm::SmallVectorImpl&) + 3917
11 
lldb_private::ClangASTSource::ClangASTSourceProxy::FindExternalLexicalDecls(clang::DeclContext
 const*, llvm::function_ref, 
llvm::SmallVectorImpl&) + 102
12 clang::ExternalASTSource::FindExternalLexicalDecls(clang::DeclContext 
const*, llvm::SmallVectorImpl&) + 101
13 clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const + 269
14 clang::DeclContext::buildLookup() + 336
15 clang::DeclContext::makeDeclVisibleInContextWithFlags(clang::NamedDecl*, 
bool, bool) + 403
16 clang::DeclContext::addDeclInternal(clang::Decl*) + 92
17 clang::ASTNodeImporter::VisitFieldDecl(clang::FieldDecl*) + 3851
```
... and at the second call of addDeclInternal we may add an incomplete Decl 
(CXXConstructorDecl above).
We must always avoid redundant work in lldb which is already handled in 
Clang::ASTImporter.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61333



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


[Lldb-commits] [PATCH] D59826: [expression] Explicitly build the lookup table of any TagDecl's context

2019-04-30 Thread Gabor Marton via Phabricator via lldb-commits
martong abandoned this revision.
martong added a comment.

During writing the tests, I realized that this is only a partial solution. So I 
abandon this patch in favor for https://reviews.llvm.org/D61333 , please take a 
look at that.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59826



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


[Lldb-commits] [PATCH] D61235: Add more information to the log timer dump

2019-04-30 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 197420.
aadsm added a comment.

Use EXPECT_NEAR for tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61235

Files:
  lldb/include/lldb/Utility/Timer.h
  lldb/source/Utility/Timer.cpp
  lldb/unittests/Utility/TimerTest.cpp

Index: lldb/unittests/Utility/TimerTest.cpp
===
--- lldb/unittests/Utility/TimerTest.cpp
+++ lldb/unittests/Utility/TimerTest.cpp
@@ -61,7 +61,9 @@
   StreamString ss;
   Timer::DumpCategoryTimes(&ss);
   double seconds1, seconds2;
-  ASSERT_EQ(2, sscanf(ss.GetData(), "%lf sec for CAT1%*[\n ]%lf sec for CAT2",
+  ASSERT_EQ(2, sscanf(ss.GetData(),
+  "%lf sec (total: %*lfs; child: %*lfs; count: %*d) for "
+  "CAT1%*[\n ]%lf sec for CAT2",
   &seconds1, &seconds2))
   << "String: " << ss.GetData();
   EXPECT_LT(0.01, seconds1);
@@ -69,3 +71,38 @@
   EXPECT_LT(0.001, seconds2);
   EXPECT_GT(0.1, seconds2);
 }
+
+TEST(TimerTest, CategoryTimesStats) {
+  Timer::ResetCategoryTimes();
+  {
+static Timer::Category tcat1("CAT1");
+Timer t1(tcat1, ".");
+std::this_thread::sleep_for(std::chrono::milliseconds(100));
+static Timer::Category tcat2("CAT2");
+{
+  Timer t2(tcat2, ".");
+  std::this_thread::sleep_for(std::chrono::milliseconds(10));
+}
+{
+  Timer t3(tcat2, ".");
+  std::this_thread::sleep_for(std::chrono::milliseconds(10));
+}
+  }
+  // Example output:
+  // 0.105202764 sec (total: 0.132s; child: 0.027s; count: 1) for CAT1
+  // 0.026772798 sec (total: 0.027s; child: 0.000s; count: 2) for CAT2
+  StreamString ss;
+  Timer::DumpCategoryTimes(&ss);
+  double seconds1, total1, child1, seconds2;
+  int count1, count2;
+  ASSERT_EQ(
+  6, sscanf(ss.GetData(),
+"%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n ]"
+"%lf sec (total: %*lfs; child: %*lfs; count: %d) for CAT2",
+&seconds1, &total1, &child1, &count1, &seconds2, &count2))
+  << "String: " << ss.GetData();
+  EXPECT_NEAR(total1 - child1, seconds1, 0.002)
+  EXPECT_EQ(1, count1);
+  EXPECT_NEAR(total1, seconds2, 0.002)
+  EXPECT_EQ(2, count2);
+}
Index: lldb/source/Utility/Timer.cpp
===
--- lldb/source/Utility/Timer.cpp
+++ lldb/source/Utility/Timer.cpp
@@ -41,6 +41,8 @@
 
 Timer::Category::Category(const char *cat) : m_name(cat) {
   m_nanos.store(0, std::memory_order_release);
+  m_nanos_total.store(0, std::memory_order_release);
+  m_count.store(0, std::memory_order_release);
   Category *expected = g_categories;
   do {
 m_next = expected;
@@ -93,6 +95,8 @@
 
   // Keep total results for each category so we can dump results.
   m_category.m_nanos += std::chrono::nanoseconds(timer_dur).count();
+  m_category.m_nanos_total += std::chrono::nanoseconds(total_dur).count();
+  m_category.m_count++;
 }
 
 void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; }
@@ -100,25 +104,38 @@
 /* binary function predicate:
  * - returns whether a person is less than another person
  */
-
-typedef std::pair TimerEntry;
-
-static bool CategoryMapIteratorSortCriterion(const TimerEntry &lhs,
- const TimerEntry &rhs) {
-  return lhs.second > rhs.second;
+namespace {
+struct Stats {
+  const char *name;
+  uint64_t nanos;
+  uint64_t nanos_total;
+  uint64_t count;
+};
+} // namespace
+
+static bool CategoryMapIteratorSortCriterion(const Stats &lhs,
+ const Stats &rhs) {
+  return lhs.nanos > rhs.nanos;
 }
 
 void Timer::ResetCategoryTimes() {
-  for (Category *i = g_categories; i; i = i->m_next)
+  for (Category *i = g_categories; i; i = i->m_next) {
 i->m_nanos.store(0, std::memory_order_release);
+i->m_nanos_total.store(0, std::memory_order_release);
+i->m_count.store(0, std::memory_order_release);
+  }
 }
 
 void Timer::DumpCategoryTimes(Stream *s) {
-  std::vector sorted;
+  std::vector sorted;
   for (Category *i = g_categories; i; i = i->m_next) {
 uint64_t nanos = i->m_nanos.load(std::memory_order_acquire);
-if (nanos)
-  sorted.push_back(std::make_pair(i->m_name, nanos));
+if (nanos) {
+  uint64_t nanos_total = i->m_nanos_total.load(std::memory_order_acquire);
+  uint64_t count = i->m_count.load(std::memory_order_acquire);
+  Stats stats{i->m_name, nanos, nanos_total, count};
+  sorted.push_back(stats);
+}
   }
   if (sorted.empty())
 return; // Later code will break without any elements.
@@ -126,6 +143,9 @@
   // Sort by time
   llvm::sort(sorted.begin(), sorted.end(), CategoryMapIteratorSortCriterion);
 
-  for (const auto &timer : sorted)
-s->Printf("%.9f sec for %s\n", timer.second / 10., timer.first);
+  for (const auto &stats : sorted)
+s->P

[Lldb-commits] [PATCH] D61146: Set a CXXRecordDecl to not be passed in registers if DW_CC_pass_by_reference when loading from DWARF

2019-04-30 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: 
packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp:22
+  bounds.y = 2;
+  return;
+}

aprantl wrote:
> what's the point of the return?
This is vestigial return left over from when the reproducer was more complex.



Comment at: 
packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp:40
+return Shape::empty_shape()->bounds().x; // break here
+}

teemperor wrote:
> Some small things:
> 1. I think the source here is not clang-formatted :)
> 2. It's not really clear to me if Shape or Bounds are supposed to have arg 
> passing restrictions (or both?). Maybe rename them or comment this in the 
> source. E.g. `// supposed to be passed by ref/value`.
> 3. Can this test be more minimized? Do we need both x and y as member 
> variables? Do we need all these methods and variables? Especially when debug 
> stepping through this test case at some point a minimized test case is always 
> nicer.
I am adding comments to the code to try to address what it is trying to catch.

I have tried to simplify as much as possible but the scenario is rather 
elaborate. 

I don't need both `x` and `y` though.


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

https://reviews.llvm.org/D61146



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


[Lldb-commits] [PATCH] D61146: Set a CXXRecordDecl to not be passed in registers if DW_CC_pass_by_reference when loading from DWARF

2019-04-30 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 197426.
shafik marked 9 inline comments as done.
shafik added a comment.

Changed to reflect comments.

- Added comments to test to explain what it is doing.
- Formatting and other minor fixes.


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

https://reviews.llvm.org/D61146

Files:
  
packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/Makefile
  
packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/TestArgumentPassingRestrictions.py
  
packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp
  packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -959,6 +959,14 @@
   }
 }
 
+if (calling_convention == llvm::dwarf::DW_CC_pass_by_reference) {
+  clang::CXXRecordDecl *record_decl =
+  m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
+  if (record_decl)
+record_decl->setArgPassingRestrictions(
+clang::RecordDecl::APK_CannotPassInRegs);
+}
+
   } break;
 
   case DW_TAG_enumeration_type: {
Index: packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
===
--- packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
+++ /dev/null
@@ -1,125 +0,0 @@
-"""Show global variables and check that they do indeed have global scopes."""
-
-from __future__ import print_function
-
-
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class GlobalVariablesTestCase(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
-# Find the line number to break inside main().
-self.source = 'main.c'
-self.line = line_number(
-self.source, '// Set break point at this line.')
-self.shlib_names = ["a"]
-
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
-@expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr37301")
-def test_without_process(self):
-"""Test that static initialized variables can be inspected without
-process."""
-self.build()
-
-# Create a target by the debugger.
-target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
-
-self.assertTrue(target, VALID_TARGET)
-self.expect("target variable g_ptr", VARIABLES_DISPLAYED_CORRECTLY,
-substrs=['(int *)'])
-self.expect("target variable *g_ptr", VARIABLES_DISPLAYED_CORRECTLY,
-substrs=['42'])
-
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
-@expectedFailureNetBSD
-def test_c_global_variables(self):
-"""Test 'frame variable --scope --no-args' which omits args and shows scopes."""
-self.build()
-
-# Create a target by the debugger.
-target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
-self.assertTrue(target, VALID_TARGET)
-
-# Break inside the main.
-lldbutil.run_break_set_by_file_and_line(
-self, self.source, self.line, num_expected_locations=1, loc_exact=True)
-
-# Register our shared libraries for remote targets so they get
-# automatically uploaded
-environment = self.registerSharedLibrariesWithTarget(
-target, self.shlib_names)
-
-# Now launch the process, and do not stop at entry point.
-process = target.LaunchSimple(
-None, environment, self.get_process_working_directory())
-self.assertTrue(process, PROCESS_IS_VALID)
-
-# The stop reason of the thread should be breakpoint.
-self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
-substrs=['stopped',
- 'stop reason = breakpoint'])
-
-# The breakpoint should have a hit count of 1.
-self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-substrs=[' resolved, hit count = 1'])
-
-# Test that the statically initialized variable can also be
-# inspected *with* a process.
-self.expect("target variable g_ptr", VARIABLES_DISPLAYED_CORRECTLY,
-substrs=['(int *)'])
-self.expect("target variable *g_ptr", VARIABLES_DISPLAYED_CORRECTLY,
-substrs=['42'])
-
-# Check that GLOBAL scopes are indicated for the variables.
-self.expect(
-  

[Lldb-commits] [PATCH] D61311: PostfixExpression: Use signed integers in IntegerNode

2019-04-30 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: include/lldb/Symbol/PostfixExpression.h:97
 private:
-  uint32_t m_value;
+  int64_t m_value;
 };

Do we want to try and use lldb_private::Scalar here? Then this could handle 
signed/unsigned ints, floats and anything else that comes along? Might need to 
be renamed "ScalarNode"? All of the type promotion stuff is already built into 
those classes.


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

https://reviews.llvm.org/D61311



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


[Lldb-commits] [PATCH] D61299: Rename Minion to ASTImporterDelegate

2019-04-30 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.

This is a good change!




Comment at: lldb/include/lldb/Symbol/ClangASTImporter.h:259
 public:
-  CxxModuleScope(Minion &minion, clang::ASTContext *dst_ctx)
+  CxxModuleScope(ASTImporterDelegate &minion, clang::ASTContext *dst_ctx)
   : m_minion(minion) {

martong wrote:
> The name of the parameter is still `minion` ... if the goal is to completely 
> wipe out the old name then perhaps these should be renamed. Also with the new 
> type name it just feels odd.
I fee like `importer_delegate` makes more sense now.



Comment at: lldb/include/lldb/Symbol/ClangASTImporter.h:328
 clang::ASTContext *m_dst_ctx;
-MinionMap m_minions;
+DelegateMap m_minions;
 OriginMap m_origins;

martong wrote:
> Would it make sense to rename the variables too? E.g. `m_delegates`?
or `m_importer_delegates`


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61299



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


[Lldb-commits] [PATCH] D61360: Initialization: remove ObjectContainer from Common

2019-04-30 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd created this revision.
compnerd added reviewers: davide, aprantl, clayborg.
Herald added subscribers: abidh, mgorny.
Herald added a project: LLDB.

This restructures the initialization path to move the ObjectContainer
initialization into the *full* initialization path.  This is not needed
for the lldb-server initialization path.  This helps strip off ~1MiB
from the binary.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61360

Files:
  source/API/CMakeLists.txt
  source/API/SystemInitializerFull.cpp
  source/Initialization/CMakeLists.txt
  source/Initialization/SystemInitializerCommon.cpp


Index: source/Initialization/SystemInitializerCommon.cpp
===
--- source/Initialization/SystemInitializerCommon.cpp
+++ source/Initialization/SystemInitializerCommon.cpp
@@ -102,15 +102,10 @@
   process_gdb_remote::ProcessGDBRemoteLog::Initialize();
 
   // Initialize plug-ins
-  ObjectContainerBSDArchive::Initialize();
-
   EmulateInstructionARM::Initialize();
   EmulateInstructionMIPS::Initialize();
   EmulateInstructionMIPS64::Initialize();
 
-  // Apple/Darwin hosted plugins
-  ObjectContainerUniversalMachO::Initialize();
-
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
   ProcessPOSIXLog::Initialize();
 #endif
@@ -124,14 +119,11 @@
 void SystemInitializerCommon::Terminate() {
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
-  ObjectContainerBSDArchive::Terminate();
 
   EmulateInstructionARM::Terminate();
   EmulateInstructionMIPS::Terminate();
   EmulateInstructionMIPS64::Terminate();
 
-  ObjectContainerUniversalMachO::Terminate();
-
 #if defined(_MSC_VER)
   ProcessWindowsLog::Terminate();
 #endif
Index: source/Initialization/CMakeLists.txt
===
--- source/Initialization/CMakeLists.txt
+++ source/Initialization/CMakeLists.txt
@@ -17,8 +17,6 @@
 lldbPluginInstructionARM
 lldbPluginInstructionMIPS
 lldbPluginInstructionMIPS64
-lldbPluginObjectContainerBSDArchive
-lldbPluginObjectContainerMachOArchive
 lldbPluginProcessGDBRemote
 ${EXTRA_PLUGINS}
 ${LLDB_SYSTEM_LIBS}
Index: source/API/SystemInitializerFull.cpp
===
--- source/API/SystemInitializerFull.cpp
+++ source/API/SystemInitializerFull.cpp
@@ -129,6 +129,9 @@
   ObjectFileMachO::Initialize();
   ObjectFilePECOFF::Initialize();
 
+  ObjectContainerBSDArchive::Initialize();
+  ObjectContainerUniversalMachO::Initialize();
+
   ScriptInterpreterNone::Initialize();
 
 #ifndef LLDB_DISABLE_PYTHON
@@ -355,6 +358,9 @@
   PlatformDarwinKernel::Terminate();
 #endif
 
+  ObjectContainerBSDArchive::Terminate();
+  ObjectContainerUniversalMachO::Terminate();
+
   breakpad::ObjectFileBreakpad::Terminate();
   ObjectFileELF::Terminate();
   ObjectFileMachO::Terminate();
Index: source/API/CMakeLists.txt
===
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -96,6 +96,8 @@
 lldbSymbol
 lldbTarget
 lldbUtility
+lldbPluginObjectContainerBSDArchive
+lldbPluginObjectContainerMachOArchive
 ${LLDB_ALL_PLUGINS}
   LINK_COMPONENTS
 Support


Index: source/Initialization/SystemInitializerCommon.cpp
===
--- source/Initialization/SystemInitializerCommon.cpp
+++ source/Initialization/SystemInitializerCommon.cpp
@@ -102,15 +102,10 @@
   process_gdb_remote::ProcessGDBRemoteLog::Initialize();
 
   // Initialize plug-ins
-  ObjectContainerBSDArchive::Initialize();
-
   EmulateInstructionARM::Initialize();
   EmulateInstructionMIPS::Initialize();
   EmulateInstructionMIPS64::Initialize();
 
-  // Apple/Darwin hosted plugins
-  ObjectContainerUniversalMachO::Initialize();
-
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
   ProcessPOSIXLog::Initialize();
 #endif
@@ -124,14 +119,11 @@
 void SystemInitializerCommon::Terminate() {
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
-  ObjectContainerBSDArchive::Terminate();
 
   EmulateInstructionARM::Terminate();
   EmulateInstructionMIPS::Terminate();
   EmulateInstructionMIPS64::Terminate();
 
-  ObjectContainerUniversalMachO::Terminate();
-
 #if defined(_MSC_VER)
   ProcessWindowsLog::Terminate();
 #endif
Index: source/Initialization/CMakeLists.txt
===
--- source/Initialization/CMakeLists.txt
+++ source/Initialization/CMakeLists.txt
@@ -17,8 +17,6 @@
 lldbPluginInstructionARM
 lldbPluginInstructionMIPS
 lldbPluginInstructionMIPS64
-lldbPluginObjectContainerBSDArchive
-lldbPluginObjectContainerMachOArchive
 lldbPluginProcessGDBRemote
 ${EXTRA_PLUGINS}
 ${LLDB_SYSTEM_LIBS}
Index: sour

[Lldb-commits] [PATCH] D61361: PluginInstructionARM: avoid unnecessary link

2019-04-30 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd created this revision.
compnerd added reviewers: davide, aprantl, clayborg.
Herald added subscribers: kristof.beyls, javed.absar, mgorny.
Herald added a project: LLDB.

lldbPluginInstructionARM does not depend on lldbProcessUtility at link
time.  The dependency is for defines and helper functions which are
header only dependencies.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61361

Files:
  source/Plugins/Instruction/ARM/CMakeLists.txt


Index: source/Plugins/Instruction/ARM/CMakeLists.txt
===
--- source/Plugins/Instruction/ARM/CMakeLists.txt
+++ source/Plugins/Instruction/ARM/CMakeLists.txt
@@ -8,7 +8,6 @@
 lldbInterpreter
 lldbSymbol
 lldbTarget
-lldbPluginProcessUtility
   LINK_COMPONENTS
 Support
   )


Index: source/Plugins/Instruction/ARM/CMakeLists.txt
===
--- source/Plugins/Instruction/ARM/CMakeLists.txt
+++ source/Plugins/Instruction/ARM/CMakeLists.txt
@@ -8,7 +8,6 @@
 lldbInterpreter
 lldbSymbol
 lldbTarget
-lldbPluginProcessUtility
   LINK_COMPONENTS
 Support
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61362: lldb-server: remove link against lldbInterpreter

2019-04-30 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd created this revision.
compnerd added reviewers: davide, aprantl, clayborg.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

This dependency is unused.  Remove the extraneous link.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61362

Files:
  tools/lldb-server/CMakeLists.txt


Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -67,7 +67,6 @@
   lldbCore
   lldbHost
   lldbInitialization
-  lldbInterpreter
   ${LLDB_PLUGINS}
   ${LLDB_SYSTEM_LIBS}
 


Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -67,7 +67,6 @@
   lldbCore
   lldbHost
   lldbInitialization
-  lldbInterpreter
   ${LLDB_PLUGINS}
   ${LLDB_SYSTEM_LIBS}
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r359645 - [CMake] Correct lldbPluginProcessPOSIX dependencies

2019-04-30 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Apr 30 20:23:09 2019
New Revision: 359645

URL: http://llvm.org/viewvc/llvm-project?rev=359645&view=rev
Log:
[CMake] Correct lldbPluginProcessPOSIX dependencies

This plugin does not depend on lldbInterpreter. It only depends on
lldbUtility.

Modified:
lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt?rev=359645&r1=359644&r2=359645&view=diff
==
--- lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt Tue Apr 30 20:23:09 
2019
@@ -4,7 +4,7 @@ add_lldb_library(lldbPluginProcessPOSIX
   ProcessPOSIXLog.cpp
 
   LINK_LIBS
-lldbInterpreter
+lldbUtility
   LINK_COMPONENTS
 Support
   )


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


[Lldb-commits] [PATCH] D61360: Initialization: remove ObjectContainer from Common

2019-04-30 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: source/API/CMakeLists.txt:99-100
 lldbUtility
+lldbPluginObjectContainerBSDArchive
+lldbPluginObjectContainerMachOArchive
 ${LLDB_ALL_PLUGINS}

These should get sucked into LLDB_ALL_PLUGINS right?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61360



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


Re: [Lldb-commits] [lldb] r359575 - XFAIL x86-64-zmm-read on Darwin

2019-04-30 Thread Michał Górny via lldb-commits
On Tue, 2019-04-30 at 21:00 +0200, Pavel Labath wrote:
> On 30/04/2019 20:24, Jonas Devlieghere wrote:
> > Hey Pavel,
> > 
> > Apologies if I was too hasty, given the number of XFAILs I assumed the 
> > test was a WIP and the missing darwin was an oversight.
> > 
> > Here's the output on my machine: https://reviews.llvm.org/P8142
> > 
> No worries. Darwin is actually the one place which has this implemented. 
> However, judging by your output, that support isn't fully functional 
> either (you have %zmm16-32, but not their %ymm and %xmm counterparts).
> 
> Michal, given this, I think we should remove the ymm and xmm 
> expectations from this test (or leave them commented out with a note), 
> so that we at least test the part of this feature that is actually 
> working. Otherwise we'll end up with a test that is XFAILed everywhere..
> 

Hmm, I think the main point of this was that AVX-512 increases
the register count from 16 to 32, so this test implicitly covers
{x,y}mm{16..32}.  Of course, I can split this into separate YMM and XMM
tests for AVX512.  I can see how this would also break NetBSD if ZMM
support is introduced given the ptrace() implementation.

-- 
Best regards,
Michał Górny


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