[Lldb-commits] [PATCH] D63667: Support __kernel_rt_sigreturn in frame initialization

2019-07-21 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D63667#1586427 , @JosephTremoulet 
wrote:

> without the bogus frame in between.  Do I have the wrong repro steps or 
> something?


You did not have DWARF for glibc installed: `dnf debuginfo-install glibc`

Then in fact your test was better as only real frames matter for this patch. 
There is some LLDB bug/incompatibility decoding inline function from 
(GCC-produced) DWARF but that is unrelated to this patch.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63667



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


[Lldb-commits] [lldb] r366653 - [lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor

2019-07-21 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sun Jul 21 03:31:13 2019
New Revision: 366653

URL: http://llvm.org/viewvc/llvm-project?rev=366653&view=rev
Log:
[lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor

Summary:
We assume in LLDB that every type comes from an ASTContext with an associated 
ClangASTContext.
However the types inside the ClangModuleDeclVendor don't have a ClangASTContext 
so we end up
crashing whenever we create a CompilerType for one of these types.

Simplest way to trigger this bug is to just look up NSObject from a module:
   (lldb) expr @import Foundation
   (lldb) type lookup NSObject
   Assertion failed: (m_type_system != nullptr), function CompilerType, file 
/Users/teemperor/llvm1/llvm-project/lldb/source/Symbol/CompilerType.cpp, line 
39.

This patch just creates a ClangASTContext for the ASTContext used by 
ClangModuleDeclVendor.

Reviewers: davide, shafik

Reviewed By: davide

Subscribers: lldb-commits

Tags: #lldb

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py?rev=366653&r1=366652&r2=366653&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py 
Sun Jul 21 03:31:13 2019
@@ -60,6 +60,10 @@ class ObjCModulesTestCase(TestBase):
 "int",
 "4"])
 
+# Type lookup should still work and print something reasonable
+# for types from the module.
+self.expect("type lookup NSObject", substrs=["instanceMethod"])
+
 self.expect("expr string.length", VARIABLES_DISPLAYED_CORRECTLY,
 substrs=["NSUInteger", "5"])
 

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=366653&r1=366652&r2=366653&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
Sun Jul 21 03:31:13 2019
@@ -27,6 +27,7 @@
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SourceModule.h"
 #include "lldb/Target/Target.h"
@@ -110,6 +111,9 @@ private:
   ImportedModuleMap m_imported_modules;
   ImportedModuleSet m_user_imported_modules;
   const clang::ExternalASTMerger::OriginMap m_origin_map;
+  // We assume that every ASTContext has an ClangASTContext, so we also store
+  // a custom ClangASTContext for our internal ASTContext.
+  std::unique_ptr m_ast_context;
 };
 } // anonymous namespace
 
@@ -155,7 +159,13 @@ ClangModulesDeclVendorImpl::ClangModules
 : m_diagnostics_engine(std::move(diagnostics_engine)),
   m_compiler_invocation(std::move(compiler_invocation)),
   m_compiler_instance(std::move(compiler_instance)),
-  m_parser(std::move(parser)), m_origin_map() {}
+  m_parser(std::move(parser)), m_origin_map() {
+
+  // Initialize our ClangASTContext.
+  auto target_opts = m_compiler_invocation->getTargetOpts();
+  m_ast_context.reset(new ClangASTContext(target_opts.Triple.c_str()));
+  m_ast_context->setASTContext(&m_compiler_instance->getASTContext());
+}
 
 void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
 std::set &exports,


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


[Lldb-commits] [PATCH] D64989: [lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor

2019-07-21 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366653: [lldb] Fix crash when looking up type coming from 
the ClangModuleDeclVendor (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64989?vs=210817&id=210986#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64989

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp


Index: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
@@ -60,6 +60,10 @@
 "int",
 "4"])
 
+# Type lookup should still work and print something reasonable
+# for types from the module.
+self.expect("type lookup NSObject", substrs=["instanceMethod"])
+
 self.expect("expr string.length", VARIABLES_DISPLAYED_CORRECTLY,
 substrs=["NSUInteger", "5"])
 
Index: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -27,6 +27,7 @@
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SourceModule.h"
 #include "lldb/Target/Target.h"
@@ -110,6 +111,9 @@
   ImportedModuleMap m_imported_modules;
   ImportedModuleSet m_user_imported_modules;
   const clang::ExternalASTMerger::OriginMap m_origin_map;
+  // We assume that every ASTContext has an ClangASTContext, so we also store
+  // a custom ClangASTContext for our internal ASTContext.
+  std::unique_ptr m_ast_context;
 };
 } // anonymous namespace
 
@@ -155,7 +159,13 @@
 : m_diagnostics_engine(std::move(diagnostics_engine)),
   m_compiler_invocation(std::move(compiler_invocation)),
   m_compiler_instance(std::move(compiler_instance)),
-  m_parser(std::move(parser)), m_origin_map() {}
+  m_parser(std::move(parser)), m_origin_map() {
+
+  // Initialize our ClangASTContext.
+  auto target_opts = m_compiler_invocation->getTargetOpts();
+  m_ast_context.reset(new ClangASTContext(target_opts.Triple.c_str()));
+  m_ast_context->setASTContext(&m_compiler_instance->getASTContext());
+}
 
 void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
 std::set &exports,


Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
@@ -60,6 +60,10 @@
 "int",
 "4"])
 
+# Type lookup should still work and print something reasonable
+# for types from the module.
+self.expect("type lookup NSObject", substrs=["instanceMethod"])
+
 self.expect("expr string.length", VARIABLES_DISPLAYED_CORRECTLY,
 substrs=["NSUInteger", "5"])
 
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -27,6 +27,7 @@
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SourceModule.h"
 #include "lldb/Target/Target.h"
@@ -110,6 +111,9 @@
   ImportedModuleMap m_imported_modules;
   ImportedModuleSet m_user_imported_modules;
   const clang::ExternalASTMerger::OriginMap m_origin_map;
+  // We assume that every ASTContext has an ClangASTContext, so we also store
+  // a custom ClangASTContext for our internal ASTContext.
+  std::unique_ptr m_ast_context;
 };
 } // anonymous namespace
 
@@ -155,7 +159,13 @@
 : m_diagnostics_engine(std::move(diagnostics_engine)),
   m_compiler_invocation(std::move(compiler_invocation)),
   m_compiler_instance(std::move(compiler_instance)),
-  m_parser(std::move(parser)), m_origin_map() {}
+  m_parser(std::move(parser)), m_origin_map() {
+
+  // Initialize our ClangASTContext.
+  auto target_opts = m_compiler_invocat

[Lldb-commits] [PATCH] D63667: Support __kernel_rt_sigreturn in frame initialization

2019-07-21 Thread Joseph Tremoulet via Phabricator via lldb-commits
JosephTremoulet added a comment.

In D63667#1594718 , @jankratochvil 
wrote:

> You did not have DWARF for glibc installed: `dnf debuginfo-install glibc`
>
> Then in fact your test was better as only real frames matter for this patch. 
> There is some LLDB bug/incompatibility decoding inline function from 
> (GCC-produced) DWARF but that is unrelated to this patch.


Ah, that makes sense.  Thanks for following up.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63667



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


[Lldb-commits] [PATCH] D62183: [Windows] Fix race condition between state changes

2019-07-21 Thread Martin Andersson via Phabricator via lldb-commits
martin added a comment.

What is the next step to get this commited? Can you commit it?


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

https://reviews.llvm.org/D62183



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