[Lldb-commits] [PATCH] D94077: Support unscoped enumeration members in the expression evaluator.

2021-01-08 Thread Andy Yankovsky via Phabricator via lldb-commits
werat updated this revision to Diff 315319.
werat added a comment.
Herald added a reviewer: shafik.

Handle enum constants similar to global variables, support scoped lookup in the 
expression evaluator.
Add more test cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94077

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
  lldb/test/API/lang/cpp/enum_types/main.cpp
  lldb/test/API/python_api/target/globals/Makefile
  lldb/test/API/python_api/target/globals/TestTargetGlobals.py
  lldb/test/API/python_api/target/globals/main.cpp

Index: lldb/test/API/python_api/target/globals/main.cpp
===
--- /dev/null
+++ lldb/test/API/python_api/target/globals/main.cpp
@@ -0,0 +1,22 @@
+namespace A {
+enum AEnum { eMany = 0 } ae;
+};
+
+struct B {
+  enum BEnum { eMany = 1 } be;
+} b;
+
+enum CEnum { eMany = 2 } ce;
+
+enum MyEnum {
+  eFirst,
+} my_enum;
+
+enum class MyScopedEnum {
+  eFoo = 1,
+  eBar,
+} my_scoped_enum;
+
+int eFoo = 2;
+
+int main() {}
Index: lldb/test/API/python_api/target/globals/TestTargetGlobals.py
===
--- /dev/null
+++ lldb/test/API/python_api/target/globals/TestTargetGlobals.py
@@ -0,0 +1,45 @@
+"""
+Test SBTarget::FindGlobalVariables API.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class TargetAPITestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@add_test_categories(['pyapi'])
+def test_find_global_variables(self):
+"""Exercise SBTarget.FindGlobalVariables() API."""
+self.build()
+
+# Don't need to launch a process, since we're only interested in
+# looking up global variables.
+target = self.dbg.CreateTarget(self.getBuildArtifact())
+
+def test_global_var(query, name, type_name, value):
+value_list = target.FindGlobalVariables(query, 1)
+self.assertEqual(value_list.GetSize(), 1)
+var = value_list.GetValueAtIndex(0)
+self.DebugSBValue(var)
+self.assertTrue(var)
+self.assertEqual(var.GetName(), name)
+self.assertEqual(var.GetTypeName(), type_name)
+self.assertEqual(var.GetValue(), value)
+
+test_global_var("eFirst", "eFirst", "MyEnum", "eFirst")
+
+# Global variable eFoo is looked up fine, since scoped enumeration
+# members are not available as constants in the surrounding scope.
+test_global_var("eFoo", "::eFoo", "int", "2")
+
+# eBar is not available since it's a member of a scoped enumeration.
+value_list = target.FindGlobalVariables("eBar", 1)
+self.assertEqual(value_list.GetSize(), 0)
+
+# Get enumerator values from all scopes.
+value_list = target.FindGlobalVariables("eMany", 100500)
+self.assertEqual(value_list.GetSize(), 3)
+value_types = {value.GetTypeName() for value in value_list}
+self.assertEqual(value_types, {"A::AEnum", "B::BEnum", "CEnum"})
Index: lldb/test/API/python_api/target/globals/Makefile
===
--- /dev/null
+++ lldb/test/API/python_api/target/globals/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
Index: lldb/test/API/lang/cpp/enum_types/main.cpp
===
--- lldb/test/API/lang/cpp/enum_types/main.cpp
+++ lldb/test/API/lang/cpp/enum_types/main.cpp
@@ -25,4 +25,44 @@
 DEFINE_UNSIGNED_ENUM(ull, unsigned long long)
 DEFINE_SIGNED_ENUM(ll, signed long long)
 
-int main(int argc, char const *argv[]) { return 0; }
+enum MyEnum {
+  eFoo = 1,
+};
+MyEnum my_enum = eFoo;
+
+enum class MyScopedEnum {
+  eBar = 1,
+};
+MyScopedEnum my_scoped_enum = MyScopedEnum::eBar;
+
+int x = 2;
+
+enum CEnum { eValue = 2 } ce;
+
+namespace A {
+
+enum AEnum { eValue = 0 } ae;
+
+void g() {
+  // break here
+}
+
+}; // namespace A
+
+struct B {
+  enum BEnum { eValue = 1 } be;
+
+  void f() {
+// break here
+  }
+};
+
+int main() {
+  A::g();
+
+  B b;
+  b.f();
+
+  // break here
+  return 0;
+}
Index: lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
===
--- lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
+++ lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
@@ -1,9 +1,7 @@
 """Look up enum type information and check for correct display."""
 
-import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.te

[Lldb-commits] [PATCH] D94077: Support unscoped enumeration members in the expression evaluator.

2021-01-08 Thread Andy Yankovsky via Phabricator via lldb-commits
werat added a comment.

In D94077#2479984 , @shafik wrote:

> We can have unscoped enums in namespace and class scope and the enumerators 
> won't leak out from those scopes. Thus we can have shadowing going on e.g.:
>
> ...
>
> How does this change deal with those cases?

Thanks for pointing this out! My first patch didn't really take this into 
account, so it didn't work properly. I've made some changes to make it work, 
although I'm not very familiar with these parts of LLDB yet, so I'm not sure 
whether this approach is how it should be implemented.

Also I've noticed that LLDB's expression evaluator is not perfect with these 
lookups, e.g. it can find global variables from other scopes if there's no 
better candidate (not sure if this is a bug of a feature):

  Process 3768045 stopped
  * thread #1, name = 'a.out', stop reason = breakpoint 1.1
  frame #0: 0x00401116 a.out`main at global.cpp:2:13
 1namespace Foo { int x = 1; }
  -> 2int main() {};
  (lldb) p x
  (int) $0 = 1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94077

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


[Lldb-commits] [PATCH] D94077: Support unscoped enumeration members in the expression evaluator.

2021-01-08 Thread Andy Yankovsky via Phabricator via lldb-commits
werat added a comment.

In D94077#2481942 , @labath wrote:

> This suffers from the same problem as the other patch, where the other index 
> classes (apple_names and debug_names) will essentially never be able to 
> implement this feature. (Unless they re-index the dwarf themselves, that is, 
> but this would defeat the purpose of having the index in the first place.)

I'm not sure I completely understand.  Why does changing the 
`manual_dwarf_index` mean that the other index classes can't ever implement 
this feature? If, let's say, `debug_names` decides to support enum constants, 
then its data layout should be changed to either include enumerators as 
globals, or add a new section, or something else. Then it can be properly 
handled in LLDB too (maybe changing the way `manual_dwarf_index` works too to 
keep things consistent). As I understand, `manual_dwarf_index` can be changed 
anytime, since we're building it ourselves.

Do I misunderstand how these indexes work and interact with each other?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94077

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


[Lldb-commits] [PATCH] D94077: Support unscoped enumeration members in the expression evaluator.

2021-01-08 Thread Andy Yankovsky via Phabricator via lldb-commits
werat updated this revision to Diff 315343.
werat added a comment.

Generate fully qualified names for enum constants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94077

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
  lldb/test/API/lang/cpp/enum_types/main.cpp
  lldb/test/API/python_api/target/globals/Makefile
  lldb/test/API/python_api/target/globals/TestTargetGlobals.py
  lldb/test/API/python_api/target/globals/main.cpp

Index: lldb/test/API/python_api/target/globals/main.cpp
===
--- /dev/null
+++ lldb/test/API/python_api/target/globals/main.cpp
@@ -0,0 +1,22 @@
+namespace A {
+enum AEnum { eMany = 0 } ae;
+};
+
+struct B {
+  enum BEnum { eMany = 1 } be;
+} b;
+
+enum CEnum { eMany = 2 } ce;
+
+enum MyEnum {
+  eFirst,
+} my_enum;
+
+enum class MyScopedEnum {
+  eFoo = 1,
+  eBar,
+} my_scoped_enum;
+
+int eFoo = 2;
+
+int main() {}
Index: lldb/test/API/python_api/target/globals/TestTargetGlobals.py
===
--- /dev/null
+++ lldb/test/API/python_api/target/globals/TestTargetGlobals.py
@@ -0,0 +1,46 @@
+"""
+Test SBTarget::FindGlobalVariables API.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class TargetAPITestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@add_test_categories(['pyapi'])
+def test_find_global_variables(self):
+"""Exercise SBTarget.FindGlobalVariables() API."""
+self.build()
+
+# Don't need to launch a process, since we're only interested in
+# looking up global variables.
+target = self.dbg.CreateTarget(self.getBuildArtifact())
+
+def test_global_var(query, name, type_name, value):
+value_list = target.FindGlobalVariables(query, 1)
+self.assertEqual(value_list.GetSize(), 1)
+var = value_list.GetValueAtIndex(0)
+self.DebugSBValue(var)
+self.assertTrue(var)
+self.assertEqual(var.GetName(), name)
+self.assertEqual(var.GetTypeName(), type_name)
+self.assertEqual(var.GetValue(), value)
+
+test_global_var("eFirst", "::eFirst", "MyEnum", "eFirst")
+test_global_var("A::eMany", "A::eMany", "A::AEnum", "eMany")
+
+# Global variable eFoo is looked up fine, since scoped enumeration
+# members are not available as constants in the surrounding scope.
+test_global_var("eFoo", "::eFoo", "int", "2")
+
+# eBar is not available since it's a member of a scoped enumeration.
+value_list = target.FindGlobalVariables("eBar", 1)
+self.assertEqual(value_list.GetSize(), 0)
+
+# Get enumerator values from all scopes.
+value_list = target.FindGlobalVariables("eMany", 100500)
+self.assertEqual(value_list.GetSize(), 3)
+value_types = {value.GetTypeName() for value in value_list}
+self.assertEqual(value_types, {"A::AEnum", "B::BEnum", "CEnum"})
Index: lldb/test/API/python_api/target/globals/Makefile
===
--- /dev/null
+++ lldb/test/API/python_api/target/globals/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
Index: lldb/test/API/lang/cpp/enum_types/main.cpp
===
--- lldb/test/API/lang/cpp/enum_types/main.cpp
+++ lldb/test/API/lang/cpp/enum_types/main.cpp
@@ -25,4 +25,44 @@
 DEFINE_UNSIGNED_ENUM(ull, unsigned long long)
 DEFINE_SIGNED_ENUM(ll, signed long long)
 
-int main(int argc, char const *argv[]) { return 0; }
+enum MyEnum {
+  eFoo = 1,
+};
+MyEnum my_enum = eFoo;
+
+enum class MyScopedEnum {
+  eBar = 1,
+};
+MyScopedEnum my_scoped_enum = MyScopedEnum::eBar;
+
+int x = 2;
+
+enum CEnum { eValue = 2 } ce;
+
+namespace A {
+
+enum AEnum { eValue = 0 } ae;
+
+void g() {
+  // break here
+}
+
+}; // namespace A
+
+struct B {
+  enum BEnum { eValue = 1 } be;
+
+  void f() {
+// break here
+  }
+};
+
+int main() {
+  A::g();
+
+  B b;
+  b.f();
+
+  // break here
+  return 0;
+}
Index: lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
===
--- lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
+++ lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
@@ -1,9 +1,7 @@
 """Look up enum type information and check for correct display."""
 
-import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
-import lldbs

[Lldb-commits] [PATCH] D93421: Fix how ValueObject deals with getting unsigned values

2021-01-08 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


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

https://reviews.llvm.org/D93421

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


[Lldb-commits] [PATCH] D94244: [lldb] Bump the required SWIG version to 3

2021-01-08 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM modulo the warning messages still referencing 2 instead of 3.




Comment at: lldb/cmake/modules/FindLuaAndSwig.cmake:20
   else()
 message(STATUS "SWIG 2 or later is required for Lua support in LLDB but 
could not be found")
   endif()

SWIG 3



Comment at: lldb/cmake/modules/FindPythonAndSwig.cmake:45
   else()
 message(STATUS "SWIG 2 or later is required for Python support in LLDB but 
could not be found")
   endif()

"SWIG 3 or later ..." as pointed out in the bug report.


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

https://reviews.llvm.org/D94244

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


[Lldb-commits] [lldb] b0dc54e - [lldb][NFC] Refactor setup code for Clang diagnostics

2021-01-08 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-01-08T14:26:04+01:00
New Revision: b0dc54e08a9b5bee8ba1e874e9c12f4c4859f4a3

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

LOG: [lldb][NFC] Refactor setup code for Clang diagnostics

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 9b6e6e0f01f0..c61c0105661f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -337,6 +337,20 @@ static void RemoveAllCppKeywords(IdentifierTable &idents) {
 #include "clang/Basic/TokenKinds.def"
 }
 
+/// Configures Clang diagnostics for the expression parser.
+static void SetupDefaultClangDiagnostics(CompilerInstance &compiler) {
+  // List of Clang warning groups that are not useful when parsing expressions.
+  const std::vector groupsToIgnore = {
+  "unused-value",
+  "odr",
+  };
+  for (const char *group : groupsToIgnore) {
+compiler.getDiagnostics().setSeverityForGroup(
+clang::diag::Flavor::WarningOrError, group,
+clang::diag::Severity::Ignored, SourceLocation());
+  }
+}
+
 
//===--===//
 // Implementation of ClangExpressionParser
 
//===--===//
@@ -637,12 +651,7 @@ ClangExpressionParser::ClangExpressionParser(
 m_compiler->getCodeGenOpts().setDebugInfo(codegenoptions::NoDebugInfo);
 
   // Disable some warnings.
-  m_compiler->getDiagnostics().setSeverityForGroup(
-  clang::diag::Flavor::WarningOrError, "unused-value",
-  clang::diag::Severity::Ignored, SourceLocation());
-  m_compiler->getDiagnostics().setSeverityForGroup(
-  clang::diag::Flavor::WarningOrError, "odr",
-  clang::diag::Severity::Ignored, SourceLocation());
+  SetupDefaultClangDiagnostics(*m_compiler);
 
   // Inform the target of the language options
   //



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


[Lldb-commits] [lldb] cb6d53c - [lldb] Bump the required SWIG version to 3

2021-01-08 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-01-08T08:47:21-08:00
New Revision: cb6d53ccdc7288f1bb62b0d50055545acfb59f77

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

LOG: [lldb] Bump the required SWIG version to 3

Bump the required SWIG version to 3. If my memory serves me well we last
bumped the required SWIG version to 2 for Python 3. At that time SWIG 3
had already been around for a while so everyone I know was already using
that.

It appears that SWIG 3 is the only version that officially supports
C++11 which we're using in the typemap. SWIG 3 was released in 2014 so I
think it's reasonable to make that the minimum required version.

https://bugs.llvm.org/show_bug.cgi?id=48685

Differential revision: https://reviews.llvm.org/D94244

Added: 


Modified: 
lldb/cmake/modules/FindLuaAndSwig.cmake
lldb/cmake/modules/FindPythonAndSwig.cmake
lldb/docs/resources/build.rst

Removed: 




diff  --git a/lldb/cmake/modules/FindLuaAndSwig.cmake 
b/lldb/cmake/modules/FindLuaAndSwig.cmake
index 968f905ef2d3..f6251bbd1042 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,7 +7,7 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
 find_package(Lua 5.3)
 if(LUA_FOUND AND SWIG_FOUND)
@@ -17,7 +17,7 @@ else()
 SWIG_EXECUTABLE)
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Lua support in LLDB but 
could not be found")
+message(STATUS "SWIG 3 or later is required for Lua support in LLDB but 
could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)

diff  --git a/lldb/cmake/modules/FindPythonAndSwig.cmake 
b/lldb/cmake/modules/FindPythonAndSwig.cmake
index dcbc386b70dd..3535b548c45f 100644
--- a/lldb/cmake/modules/FindPythonAndSwig.cmake
+++ b/lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -38,11 +38,11 @@ endmacro()
 if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND 
SWIG_EXECUTABLE)
   set(PYTHONANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
   FindPython3()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but 
could not be found")
+message(STATUS "SWIG 3 or later is required for Python support in LLDB but 
could not be found")
   endif()
 
   get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index 8aadd126ed0b..825f86459d7f 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -34,7 +34,7 @@ If you want to run the test suite, you'll need to build LLDB 
with Python
 scripting support.
 
 * `Python `_
-* `SWIG `_ 2 or later.
+* `SWIG `_ 3 or later.
 
 Optional Dependencies
 *



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


[Lldb-commits] [PATCH] D94244: [lldb] Bump the required SWIG version to 3

2021-01-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcb6d53ccdc72: [lldb] Bump the required SWIG version to 3 
(authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D94244?vs=315175&id=315418#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94244

Files:
  lldb/cmake/modules/FindLuaAndSwig.cmake
  lldb/cmake/modules/FindPythonAndSwig.cmake
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -34,7 +34,7 @@
 scripting support.
 
 * `Python `_
-* `SWIG `_ 2 or later.
+* `SWIG `_ 3 or later.
 
 Optional Dependencies
 *
Index: lldb/cmake/modules/FindPythonAndSwig.cmake
===
--- lldb/cmake/modules/FindPythonAndSwig.cmake
+++ lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -38,11 +38,11 @@
 if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND 
SWIG_EXECUTABLE)
   set(PYTHONANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
   FindPython3()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but 
could not be found")
+message(STATUS "SWIG 3 or later is required for Python support in LLDB but 
could not be found")
   endif()
 
   get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,7 +7,7 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
 find_package(Lua 5.3)
 if(LUA_FOUND AND SWIG_FOUND)
@@ -17,7 +17,7 @@
 SWIG_EXECUTABLE)
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Lua support in LLDB but 
could not be found")
+message(STATUS "SWIG 3 or later is required for Lua support in LLDB but 
could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -34,7 +34,7 @@
 scripting support.
 
 * `Python `_
-* `SWIG `_ 2 or later.
+* `SWIG `_ 3 or later.
 
 Optional Dependencies
 *
Index: lldb/cmake/modules/FindPythonAndSwig.cmake
===
--- lldb/cmake/modules/FindPythonAndSwig.cmake
+++ lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -38,11 +38,11 @@
 if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND SWIG_EXECUTABLE)
   set(PYTHONANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
   FindPython3()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but could not be found")
+message(STATUS "SWIG 3 or later is required for Python support in LLDB but could not be found")
   endif()
 
   get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,7 +7,7 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
 find_package(Lua 5.3)
 if(LUA_FOUND AND SWIG_FOUND)
@@ -17,7 +17,7 @@
 SWIG_EXECUTABLE)
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Lua support in LLDB but could not be found")
+message(STATUS "SWIG 3 or later is required for Lua support in LLDB but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D94320: [debugserver] Various plist changes

2021-01-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: jasonmolenda.
Herald added a subscriber: mgorny.
JDevlieghere requested review of this revision.

- Remove unused plists that were referenced (but unused) by Xcode.
- Move all debugserver plists unders `tools/debugserver/resources`.
- Add the ability to distinguish between `com.apple.security.cs.debugger` and 
`com.apple.private.cs.debugger`.

rdar://66082043


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D94320

Files:
  lldb/tools/debugserver/debugnub-exports
  lldb/tools/debugserver/resources/debugserver-entitlements.plist
  lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist
  lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist
  lldb/tools/debugserver/source/CMakeLists.txt
  lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
  lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
  lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
  lldb/tools/debugserver/source/com.apple.debugserver.plist
  lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
  lldb/tools/debugserver/source/com.apple.debugserver.posix.plist
  lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
  lldb/tools/debugserver/source/debugserver-entitlements.plist
  lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist

Index: lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
===
--- lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
+++ /dev/null
@@ -1,35 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.internal.xpc.remote.debugserver
-	RemoteServices
-	
-		com.apple.internal.debugserver
-		
-			RequireEntitlement
-			AppleInternal
-			ExposedToUntrustedDevices
-			
-		
-	
-	ProgramArguments
-	
-		/usr/libexec/remotectl
-		trampoline
-		-2
-		42
-		com.apple.internal.debugserver
-		/usr/local/bin/debugserver-nonui
-		--fd
-		42
-	
-	POSIXSpawnType
-	Interactive
-	EnableTransactions
-	
-	EnablePressuredExit
-	
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.posix.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.posix.plist
+++ /dev/null
@@ -1,18 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.posix
-	UserName
-	mobile
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
-		--launch=posix
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
+++ /dev/null
@@ -1,16 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.posix.internal
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
-		--launch=posix
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.plist
+++ /dev/null
@@ -1,18 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver
-	UserName
-	mobile
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
---launch=frontboard
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
+++ /dev/null
@@ -1,15 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.internal
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
+++ /dev/null
@@ -1,19 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.applist
-	UserName
-	mobile
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
---applist
---launch=frontboard
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
+++ /dev/null
@@ -1,16 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.applist.internal
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown

[Lldb-commits] [lldb] 311b247 - [lldb] Remove stale LLDB-Info.plist

2021-01-08 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-01-08T10:12:16-08:00
New Revision: 311b247c9fb58ee476184a7eb8044b8f54f95035

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

LOG: [lldb] Remove stale LLDB-Info.plist

Remove the stale LLDB-Info.plist which was only used by TestHelp.py. The
latter would try to parse the version number from the plist and use that
to verify the version in the help output. Of course this never matched
so it would fall back to matching any arbitrary version.

This patch does *not* change the real LLDB-Info.plist.in file which is
used for the LLDB Framework.

Added: 


Modified: 
lldb/test/API/commands/help/TestHelp.py

Removed: 
lldb/resources/LLDB-Info.plist



diff  --git a/lldb/resources/LLDB-Info.plist b/lldb/resources/LLDB-Info.plist
deleted file mode 100644
index 77330e2929cb..
--- a/lldb/resources/LLDB-Info.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-   CFBundleDevelopmentRegion
-   English
-   CFBundleExecutable
-   ${EXECUTABLE_NAME}
-   CFBundleIdentifier
-   com.apple.${PRODUCT_NAME}.framework
-   CFBundleInfoDictionaryVersion
-   6.0
-   CFBundlePackageType
-   FMWK
-   CFBundleShortVersionString
-   1.${CURRENT_PROJECT_VERSION}
-   CFBundleSignature
-   
-   CFBundleVersion
-   360.99.0
-   CFBundleName
-   ${EXECUTABLE_NAME}
-
-

diff  --git a/lldb/test/API/commands/help/TestHelp.py 
b/lldb/test/API/commands/help/TestHelp.py
index f671fc7ad5f4..2e849fb768a7 100644
--- a/lldb/test/API/commands/help/TestHelp.py
+++ b/lldb/test/API/commands/help/TestHelp.py
@@ -36,44 +36,6 @@ def test_help_on_help(self):
 substrs=['--hide-aliases',
  '--hide-user-commands'])
 
-@no_debug_info_test
-def version_number_string(self):
-"""Helper function to find the version number string of lldb."""
-plist = os.path.join(
-os.environ["LLDB_SRC"],
-"resources",
-"LLDB-Info.plist")
-try:
-CFBundleVersionSegFound = False
-with open(plist, 'r') as f:
-for line in f:
-if CFBundleVersionSegFound:
-version_line = line.strip()
-import re
-m = re.match("(.*)", version_line)
-if m:
-version = m.group(1)
-return version
-else:
-# Unsuccessful, let's juts break out of the for
-# loop.
-break
-
-if line.find("CFBundleVersion") != -1:
-# Found our match.  The next line contains our version
-# string, for example:
-#
-# 38
-CFBundleVersionSegFound = True
-
-except:
-# Just fallthrough...
-import traceback
-traceback.print_exc()
-
-# Use None to signify that we are not able to grok the version number.
-return None
-
 @no_debug_info_test
 def test_help_arch(self):
 """Test 'help arch' which should list of supported architectures."""
@@ -85,13 +47,8 @@ def test_help_version(self):
 """Test 'help version' and 'version' commands."""
 self.expect("help version",
 substrs=['Show the LLDB debugger version.'])
-import re
-version_str = self.version_number_string()
-match = re.match('[0-9]+', version_str)
-search_regexp = ['lldb( version|-' + (version_str if match else 
'[0-9]+') + ').*\n']
-
 self.expect("version",
-patterns=search_regexp)
+patterns=['lldb( version|-[0-9]+).*\n'])
 
 @no_debug_info_test
 def test_help_should_not_crash_lldb(self):



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


[Lldb-commits] [PATCH] D70277: [Signal] Allow llvm clients to opt into one-shot SIGPIPE handling

2021-01-08 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

The issue is that InitLLVM initializes its private PrettyStackPrinter before 
installing the one-shot default SIGPIPE handler: the PrettyStackPrinter itself 
eventually calls RegisterHandlers(), which runs before the SIGPIPE handler is 
installed and therefore doesn't register a SIGPIPE handler.

Why doesn't RegisterHandlers simply unconditionally install llvm's 
"SignalHandler" as a handler for SIGPIPE? We found that it broke lldb's ability 
to ignore SIGPIPE, as RegisterHandlers is called by a ton of library code 
(including library code called by lldb!). I'll be the first to admit that this 
one-shot sigpipe handler business is incredibly fragile, but unfortunately I 
don't have a better solution :/.

The fix is up here: https://reviews.llvm.org/D94324


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70277

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


[Lldb-commits] [PATCH] D94077: Support unscoped enumeration members in the expression evaluator.

2021-01-08 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D94077#2486225 , @werat wrote:

> In D94077#2479984 , @shafik wrote:
>
>> We can have unscoped enums in namespace and class scope and the enumerators 
>> won't leak out from those scopes. Thus we can have shadowing going on e.g.:
>>
>> ...
>>
>> How does this change deal with those cases?
>
> Thanks for pointing this out! My first patch didn't really take this into 
> account, so it didn't work properly. I've made some changes to make it work, 
> although I'm not very familiar with these parts of LLDB yet, so I'm not sure 
> whether this approach is how it should be implemented.
>
> Also I've noticed that LLDB's expression evaluator is not perfect with these 
> lookups, e.g. it can find global variables from other scopes if there's no 
> better candidate (not sure if this is a bug of a feature):
>
>   Process 3768045 stopped
>   * thread #1, name = 'a.out', stop reason = breakpoint 1.1
>   frame #0: 0x00401116 a.out`main at global.cpp:2:13
>  1namespace Foo { int x = 1; }
>   -> 2int main() {};
>   (lldb) p x
>   (int) $0 = 1

That's a feature, not a bug.  lldb tries to find the "closest" definition to 
the frame in which the expression is evaluated, it isn't bound by what the 
current frame can see.  If it can find a unique closest definition for an 
identifier working out from the current frame, it will that.

This seems the most useful behavior.  If your program has a shared library that 
has a static singleton which stores some interesting information about the 
library's state, debugger users want to be able to access that variable in the 
expression evaluator even if they aren't currently stopped in a frame of that 
library.  That's also important for type lookups.  If I'm in a frame of library 
A, which only sees a forward declaration of some type, but library B has the 
full debug information for that type, it's super useful to be able to keep 
looking past library A for a full type definition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94077

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


[Lldb-commits] [PATCH] D94077: Support unscoped enumeration members in the expression evaluator.

2021-01-08 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D94077#2486232 , @werat wrote:

> In D94077#2481942 , @labath wrote:
>
>> This suffers from the same problem as the other patch, where the other index 
>> classes (apple_names and debug_names) will essentially never be able to 
>> implement this feature. (Unless they re-index the dwarf themselves, that is, 
>> but this would defeat the purpose of having the index in the first place.)
>
> I'm not sure I completely understand.  Why does changing the 
> `manual_dwarf_index` mean that the other index classes can't ever implement 
> this feature? If, let's say, `debug_names` decides to support enum constants, 
> then its data layout should be changed to either include enumerators as 
> globals, or add a new section, or something else. Then it can be properly 
> handled in LLDB too (maybe changing the way `manual_dwarf_index` works too to 
> keep things consistent). As I understand, `manual_dwarf_index` can be changed 
> anytime, since we're building it ourselves.
>
> Do I misunderstand how these indexes work and interact with each other?

Maybe "(n)ever" was too strong a word. Still, there is a fundamental difference 
between the "manual" index and the other two indexes:

- the manual index is entirely an lldb concept. We can change it whenever we 
want. We don't need to ask anyone for permission to do that, coordinate with 
anyone, or care about what anyone else is doing.
- the contents of the other two indexes is given by a specification (it case of 
apple_names, it's a local llvm spec, but it still suffers from similar 
problems, albeit less pronounced). We cannot unilaterally change anything about 
them. We first need to change the relevant specification, which requires 
gathering consensus and convincing people that this use case is really worth 
the extra amount of space that the new entries will introduce. Then we need to 
wait until a new version of the standard is published and producers (compilers) 
to start using it. And even them our job is not finished, because we still need 
to figure out what do we want to do with debug info produced by older producers 
which still adhere to the old version of the spec.

This is why I am pushing back against the "simple" solution of having the 
manual index index more things -- it fragments the feature set for users who 
have the index vs. those who not.

This doesn't mean we cannot change the manual index at all -- it's possible 
some feature cannot be implemented differently. But it's also possible the 
feature can be implemented differently, in a way that makes works with all 
indexes. Or it's possible the feature is not worth the divergence, or the 
increase in the manual index memory footprint that it produces (i think it 
would be interesting to get some measurements on that, particularly as one can 
also expect a similar increase in the on-disk indexes, if they are to support 
this). So, I think this deserves a wider discussion and exploration of other 
alternatives.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94077

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


[Lldb-commits] [PATCH] D94320: [debugserver] Various plist changes

2021-01-08 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

Thanks Jonas, LGTM.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D94320

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


[Lldb-commits] [lldb] aa1943a - Don't take the address of a temporary

2021-01-08 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-01-08T13:24:07-08:00
New Revision: aa1943a2d167823e6d506895292477f79874dd20

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

LOG: Don't take the address of a temporary

Added: 


Modified: 
lldb/source/Core/ValueObject.cpp

Removed: 




diff  --git a/lldb/source/Core/ValueObject.cpp 
b/lldb/source/Core/ValueObject.cpp
index bcd76f5a74be4..da90092336d69 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -3205,7 +3205,7 @@ bool ValueObject::CanProvideValue() {
   // we need to support invalid types as providers of values because some bare-
   // board debugging scenarios have no notion of types, but still manage to
   // have raw numeric values for things like registers. sigh.
-  const CompilerType &type(GetCompilerType());
+  CompilerType type = GetCompilerType();
   return (!type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue));
 }
 



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


[Lldb-commits] [PATCH] D93951: [vscode] Improve runInTerminal and support linux

2021-01-08 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 315527.
wallace added a comment.

Followed all the suggestions:

- This is POSIX-only, but making it work for windows should only require 
deleting a few #ifdef blocks and using the CreateNamedPipe API instead of 
mkfifo. I'll do it later in another diff.
- Added more tests covering different possible failures and making sure that 
environment variables are passed correctly.
- Now using JSON for the messages. That will make more robust if in the future 
we need to send more information back to the debugger.
- I tried to keep it as simple as possible, but still created a few 
abstractions to keep each piece very readable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93951

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py
  lldb/tools/lldb-vscode/CMakeLists.txt
  lldb/tools/lldb-vscode/FifoFiles.cpp
  lldb/tools/lldb-vscode/FifoFiles.h
  lldb/tools/lldb-vscode/JSONUtils.cpp
  lldb/tools/lldb-vscode/JSONUtils.h
  lldb/tools/lldb-vscode/Options.td
  lldb/tools/lldb-vscode/RunInTerminal.cpp
  lldb/tools/lldb-vscode/RunInTerminal.h
  lldb/tools/lldb-vscode/VSCode.h
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -384,12 +384,7 @@
 break;
   case lldb::eStateSuspended:
 break;
-  case lldb::eStateStopped: {
-if (g_vsc.waiting_for_run_in_terminal) {
-  g_vsc.waiting_for_run_in_terminal = false;
-  g_vsc.request_in_terminal_cv.notify_one();
-}
-  }
+  case lldb::eStateStopped:
 // Only report a stopped event if the process was not restarted.
 if (!lldb::SBProcess::GetRestartedFromEvent(event)) {
   SendStdOutStdErr(process);
@@ -461,7 +456,7 @@
 }
 body.try_emplace("module", module_value);
 module_event.try_emplace("body", std::move(body));
-g_vsc.SendJSON(llvm::json::Value(std::move(module_event)));
+// g_vsc.SendJSON(llvm::json::Value(std::move(module_event)));
   }
 }
   } else if (event.BroadcasterMatchesRef(g_vsc.broadcaster)) {
@@ -1441,47 +1436,52 @@
   g_vsc.SendJSON(llvm::json::Value(std::move(response)));
 }
 
-void request_runInTerminal(const llvm::json::Object &launch_request,
-   llvm::json::Object &launch_response) {
-  // We have already created a target that has a valid "program" path to the
-  // executable. We will attach to the next process whose name matches that
-  // of the target's.
+llvm::Error request_runInTerminal(const llvm::json::Object &launch_request) {
   g_vsc.is_attach = true;
   lldb::SBAttachInfo attach_info;
-  lldb::SBError error;
-  attach_info.SetWaitForLaunch(true, /*async*/ true);
-  g_vsc.target.Attach(attach_info, error);
 
-  llvm::json::Object reverse_request =
-  CreateRunInTerminalReverseRequest(launch_request);
+  llvm::Expected comm_dir = CreateRunInTerminalCommDir();
+  if (!comm_dir)
+return comm_dir.takeError();
+
+  RunInTerminalDebugAdapterCommChannel comm_channel(comm_dir->path);
+
+  llvm::json::Object reverse_request = CreateRunInTerminalReverseRequest(
+  launch_request, g_vsc.debug_adaptor_path, comm_dir->path);
   llvm::json::Object reverse_response;
   lldb_vscode::PacketStatus status =
   g_vsc.SendReverseRequest(reverse_request, reverse_response);
   if (status != lldb_vscode::PacketStatus::Success)
-error.SetErrorString("Process cannot be launched by IDE.");
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "Process cannot be launched by the IDE. %s",
+   comm_channel.GetLauncherError().c_str());
 
-  if (error.Success()) {
-// Wait for the attach stop event to happen or for a timeout.
-g_vsc.waiting_for_run_in_terminal = true;
-static std::mutex mutex;
-std::unique_lock locker(mutex);
-g_vsc.request_in_terminal_cv.wait_for(locker, std::chrono::seconds(10));
+  if (llvm::Expected pid = comm_channel.GetLauncherPid())
+attach_info.SetProcessID(*pid);
+  else
+return pid.takeError();
 
-auto attached_pid = g_vsc.target.GetProcess().GetProcessID();
-if (attached_pid == LLDB_INVALID_PROCESS_ID)
-  error.SetErrorString("Failed to attach to a process");
-else
-  SendProcessEvent(Attach);
-  }
+  g_vsc.debugger.SetAsync(false);
+  lldb::SBError error;
+  g_vsc.target.Attach(attach_info, error);
 
-  if (error.Fail()) {
-launch_response["success"] = llvm::json::Value(false);

[Lldb-commits] [PATCH] D78978: [LLDB] Add support for WebAssembly debugging

2021-01-08 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

What's the testing story for WASM going to be?




Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h:300
 
+  // WebAssembly-specific commands
+  bool GetWasmGlobal(int frame_index, int index, void *buf, size_t buffer_size,

Nit:

/// WebAssembly-specific commands
/// \{
...
/// \}

Even better would be doxygen comments for all functions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78978

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


[Lldb-commits] [PATCH] D93895: Implement vAttachWait in lldb-server

2021-01-08 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

looks good to me too.  When you get around to the wait times & intervals I'd 
argue for not doing that as a GDBRemote specific addition, as Greg was 
suggesting above.  There's nothing gdb-remote specific about how long you want 
the debug agent to wait around for some process to show up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93895

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


[Lldb-commits] [lldb] 2723551 - [debugserver] Various plist changes

2021-01-08 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-01-08T18:53:08-08:00
New Revision: 272355128f48089a959215472b645628a48659f2

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

LOG: [debugserver] Various plist changes

 - Remove unused plists that were referenced (but unused) by Xcode.
 - Move all debugserver plists unders tools/debugserver/resources.
 - Add the ability to distinguish between com.apple.security.cs.debugger
   and com.apple.private.cs.debugger.

rdar://66082043

Differential revision: https://reviews.llvm.org/D94320

Added: 
lldb/tools/debugserver/resources/debugserver-entitlements.plist
lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist

lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist

Modified: 
lldb/tools/debugserver/source/CMakeLists.txt

Removed: 
lldb/tools/debugserver/debugnub-exports
lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
lldb/tools/debugserver/source/com.apple.debugserver.plist
lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
lldb/tools/debugserver/source/com.apple.debugserver.posix.plist

lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
lldb/tools/debugserver/source/debugserver-entitlements.plist
lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist



diff  --git a/lldb/tools/debugserver/debugnub-exports 
b/lldb/tools/debugserver/debugnub-exports
deleted file mode 100644
index 662bf9308a6f..
--- a/lldb/tools/debugserver/debugnub-exports
+++ /dev/null
@@ -1,2 +0,0 @@
-_DNB*
-__DNB*

diff  --git a/lldb/tools/debugserver/source/debugserver-entitlements.plist 
b/lldb/tools/debugserver/resources/debugserver-entitlements.plist
similarity index 100%
rename from lldb/tools/debugserver/source/debugserver-entitlements.plist
rename to lldb/tools/debugserver/resources/debugserver-entitlements.plist

diff  --git 
a/lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist 
b/lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist
new file mode 100644
index ..3d60e8bd0b94
--- /dev/null
+++ b/lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist
@@ -0,0 +1,8 @@
+
+http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+
+
+com.apple.security.cs.debugger
+
+
+

diff  --git 
a/lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist 
b/lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist
similarity index 100%
rename from lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist
rename to 
lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist

diff  --git a/lldb/tools/debugserver/source/CMakeLists.txt 
b/lldb/tools/debugserver/source/CMakeLists.txt
index 6977fe734381..0318d5051c1f 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -60,7 +60,10 @@ endfunction()
 # llvm dependencies in the current scope to the empty set.
 set(LLVM_COMMON_DEPENDS)
 
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_SOURCE_DIR}/../resources/lldb-debugserver-Info.plist")
+set(DEBUGSERVER_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../resources")
+set(DEBUGSERVER_INFO_PLIST 
"${DEBUGSERVER_RESOURCE_DIR}/lldb-debugserver-Info.plist")
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ 
-Wl,-sectcreate,__TEXT,__info_plist,${DEBUGSERVER_INFO_PLIST}")
 
 check_cxx_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments"
 CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
@@ -128,8 +131,11 @@ if(LLDB_USE_ENTITLEMENTS)
   if(APPLE_EMBEDDED)
 set(entitlements 
${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
   else()
-# Same entitlements file as used for lldb-server
-set(entitlements 
${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist)
+if (LLDB_USE_PRIVATE_ENTITLEMENTS)
+  set(entitlements 
${DEBUGSERVER_RESOURCE_DIR}/debugserver-macosx-entitlements.plist)
+else()
+  set(entitlements 
${DEBUGSERVER_RESOURCE_DIR}/debugserver-macosx-private-entitlements.plist)
+endif()
   endif()
 endif()
 

diff  --git 
a/lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist 
b/lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
deleted file mode 100644
index e9a74bd0bf79..
--- a/lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
+++ /dev/null
@@ -1,16 +0

[Lldb-commits] [PATCH] D94320: [debugserver] Various plist changes

2021-01-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG272355128f48: [debugserver] Various plist changes (authored 
by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D94320?vs=315435&id=315565#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94320

Files:
  lldb/tools/debugserver/debugnub-exports
  lldb/tools/debugserver/resources/debugserver-entitlements.plist
  lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist
  lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist
  lldb/tools/debugserver/source/CMakeLists.txt
  lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
  lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
  lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
  lldb/tools/debugserver/source/com.apple.debugserver.plist
  lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
  lldb/tools/debugserver/source/com.apple.debugserver.posix.plist
  lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
  lldb/tools/debugserver/source/debugserver-entitlements.plist
  lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist

Index: lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
===
--- lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
+++ /dev/null
@@ -1,35 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.internal.xpc.remote.debugserver
-	RemoteServices
-	
-		com.apple.internal.debugserver
-		
-			RequireEntitlement
-			AppleInternal
-			ExposedToUntrustedDevices
-			
-		
-	
-	ProgramArguments
-	
-		/usr/libexec/remotectl
-		trampoline
-		-2
-		42
-		com.apple.internal.debugserver
-		/usr/local/bin/debugserver-nonui
-		--fd
-		42
-	
-	POSIXSpawnType
-	Interactive
-	EnableTransactions
-	
-	EnablePressuredExit
-	
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.posix.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.posix.plist
+++ /dev/null
@@ -1,18 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.posix
-	UserName
-	mobile
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
-		--launch=posix
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
+++ /dev/null
@@ -1,16 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.posix.internal
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
-		--launch=posix
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.plist
+++ /dev/null
@@ -1,18 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver
-	UserName
-	mobile
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
---launch=frontboard
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
+++ /dev/null
@@ -1,15 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.internal
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
+++ /dev/null
@@ -1,19 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.applist
-	UserName
-	mobile
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
---applist
---launch=frontboard
-	
-AllowByProxy
-
-
-
Index: lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
===
--- lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
+++ /dev/null
@@ -1,16 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-
-
-	Label
-	com.apple.debugserver.applist.internal
-	ProgramArguments
-	
-		/Developer/usr/bin/debugserver
-		--lockdown
-		--applist
-	
-AllowByProxy
-
-
-
Index: lldb/tools/deb

[Lldb-commits] [PATCH] D93895: Implement vAttachWait in lldb-server

2021-01-08 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D93895#2488249 , @jingham wrote:

> looks good to me too.  When you get around to the wait times & intervals I'd 
> argue for not doing that as a GDBRemote specific addition, as Greg was 
> suggesting above.  There's nothing gdb-remote specific about how long you 
> want the debug agent to wait around for some process to show up.

As long as we are find passing these arguments to _any_ process subclass I am 
find doing these as options.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93895

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


[Lldb-commits] [PATCH] D93951: [vscode] Improve runInTerminal and support linux

2021-01-08 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Can we still try to use just one file? Isn't this file both read and write? The 
flow would be:

- create 1 file using mkfifo(...) and pass it down as argument
- launcher lldb-vscode will write pid or error JSON back into the stream, and 
will start to wait for some data from the same fifo file
- normal lldb-vscode will write some JSON to fifo file to indicate it has 
attached after it has attached
- launcher lldb-vscode reads that it attached and then does the exec

It would really simplify everything if we can use just one file




Comment at: lldb/tools/lldb-vscode/RunInTerminal.cpp:93
+static std::string CreateToAdaptorFilePath(StringRef comm_dir) {
+  return comm_dir.str() + "/to_adaptor";
+}

Need to use the llvm file system appending stuff so this will work on windows.

```
  llvm::SmallString<64> current_path = comm_dir.str(); // this might not 
compile, but you get the idea...
  style = ...; // Set this correctly with #ifdef for windows
  llvm::sys::path::append(comm_dir, style, "to_adaptor");
```



Comment at: lldb/tools/lldb-vscode/RunInTerminal.cpp:97
+static std::string CreateDidAttachFilePath(StringRef comm_dir) {
+  return comm_dir.str() + "/did_attach";
+}

ditto



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:459
 module_event.try_emplace("body", std::move(body));
-g_vsc.SendJSON(llvm::json::Value(std::move(module_event)));
+// g_vsc.SendJSON(llvm::json::Value(std::move(module_event)));
   }

Is this intentional??



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1482
+
+  g_vsc.debugger.SetAsync(true);
+

Do we want to set async to true prior to doing the continue?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93951

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


[Lldb-commits] [PATCH] D93895: Implement vAttachWait in lldb-server

2021-01-08 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D93895#2488372 , @clayborg wrote:

> In D93895#2488249 , @jingham wrote:
>
>> looks good to me too.  When you get around to the wait times & intervals I'd 
>> argue for not doing that as a GDBRemote specific addition, as Greg was 
>> suggesting above.  There's nothing gdb-remote specific about how long you 
>> want the debug agent to wait around for some process to show up.
>
> As long as we are find passing these arguments to _any_ process subclass I am 
> find doing these as options.

I can't see why we wouldn't be, but I'm also not sure why we would need to 
change any Process API's.  Wouldn't we just add them interval and timeout to 
the ProcessAttachInfo?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93895

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