[Lldb-commits] [PATCH] D74917: [lldb/cmake] Enable more verbose find_package output.

2020-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGMT. Thank you!


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

https://reviews.llvm.org/D74917



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


[Lldb-commits] [PATCH] D74917: [lldb/cmake] Enable more verbose find_package output.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd updated this revision to Diff 245771.
mattd retitled this revision from "[lldb/cmake] Fail configuration if a 
required swig dependency is not met." to "[lldb/cmake] Enable more verbose 
find_package output.".
mattd edited the summary of this revision.

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

https://reviews.llvm.org/D74917

Files:
  lldb/cmake/modules/FindLuaAndSwig.cmake
  lldb/cmake/modules/FindPythonInterpAndLibs.cmake


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -7,10 +7,10 @@
 if(PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS AND PYTHON_EXECUTABLE AND 
SWIG_EXECUTABLE)
   set(PYTHONINTERPANDLIBS_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
-  find_package(Python3 COMPONENTS Interpreter Development QUIET)
+  find_package(Python3 COMPONENTS Interpreter Development)
   if (Python3_FOUND AND Python3_Interpreter_FOUND)
 set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
 set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
@@ -22,8 +22,8 @@
   SWIG_EXECUTABLE)
   endif()
 else()
-  find_package(PythonInterp QUIET)
-  find_package(PythonLibs QUIET)
+  find_package(PythonInterp)
+  find_package(PythonLibs)
   if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 if (NOT CMAKE_CROSSCOMPILING)
   string(REPLACE "." ";" pythonlibs_version_list 
${PYTHONLIBS_VERSION_STRING})
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,9 +7,9 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
-find_package(Lua QUIET)
+find_package(Lua)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -7,10 +7,10 @@
 if(PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS AND PYTHON_EXECUTABLE AND SWIG_EXECUTABLE)
   set(PYTHONINTERPANDLIBS_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
-  find_package(Python3 COMPONENTS Interpreter Development QUIET)
+  find_package(Python3 COMPONENTS Interpreter Development)
   if (Python3_FOUND AND Python3_Interpreter_FOUND)
 set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
 set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
@@ -22,8 +22,8 @@
   SWIG_EXECUTABLE)
   endif()
 else()
-  find_package(PythonInterp QUIET)
-  find_package(PythonLibs QUIET)
+  find_package(PythonInterp)
+  find_package(PythonLibs)
   if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 if (NOT CMAKE_CROSSCOMPILING)
   string(REPLACE "." ";" pythonlibs_version_list ${PYTHONLIBS_VERSION_STRING})
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,9 +7,9 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
-find_package(Lua QUIET)
+find_package(Lua)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74917: [lldb/cmake] Fail configuration if a required swig dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd added a comment.

In D74917#1885621 , @JDevlieghere 
wrote:

> In D74917#1885615 , @mattd wrote:
>
> > In D74917#1885590 , @JDevlieghere 
> > wrote:
> >
> > > It should never be possible for `LLDB_ENABLE_PYTHON` to be true but 
> > > `SWIG_FOUND` to be false. The modules `FindPythonInterpAndLibs.cmake` and 
> > > `FindLuaAndSwig.cmake` should fail early when SWIG isn't found.
> >
> >
> > Thanks for taking a look.  Would you be okay with making the status 
> > `message()` in `FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake` 
> > fatal, that way the dependency error is clearer?
>
>
> That would defeat the purpose of auto-detecting these dependencies. Please 
> take a look at D71306  for all the details. 
> The summary is that all optional dependencies default to `Auto`: where we 
> enable them if we can find them. You can override this behavior by passing 
> `LLDB_ENABLE_PYTHON=ON` to CMake, in which case not finding Python (or SWIG) 
> will be a fatal error.


Thanks for the clarification there.

> I agree that it can be confusing to figure out that Python got disabled 
> because SWIG wasn't found. Currently we call `find_package` with `QUIET` from 
> `FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake`. I think we should 
> remove that so that the user gets more information in CMake's configuration 
> output. Would that address your concerns?

Ah, yes, dropping the `QUIET` produces meaningful insight as to what might be 
missing. I think others, who might not have all the dependencies, might find 
this level of verbosity clearer, so that they can more quickly understand what 
is missing in their build environment.


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

https://reviews.llvm.org/D74917



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


[Lldb-commits] [PATCH] D74727: Allow customized relative PYTHONHOME

2020-02-20 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 245770.
hhb added a comment.

The code should check on LLDB_EMBED_PYTHON_HOME


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74727

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/include/lldb/Host/Config.h.cmake
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -277,14 +277,36 @@
 
 private:
   void InitializePythonHome() {
-#if defined(LLDB_PYTHON_HOME)
+#if LLDB_EMBED_PYTHON_HOME
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, );
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type g_python_home = []() -> str_type {
+  const char *lldb_python_home = LLDB_PYTHON_HOME;
+  const char *absolute_python_home = nullptr;
+  llvm::SmallString<64> path;
+  if (llvm::sys::path::is_absolute(lldb_python_home)) {
+absolute_python_home = lldb_python_home;
+  } else {
+FileSpec spec = HostInfo::GetShlibDir();
+if (!spec)
+  return nullptr;
+spec.GetPath(path);
+llvm::sys::path::append(path, lldb_python_home);
+absolute_python_home = path.c_str();
+  }
+#if PY_MAJOR_VERSION >= 3
+  size_t size = 0;
+  return Py_DecodeLocale(absolute_python_home, );
+#else
+  return strdup(absolute_python_home);
+#endif
+}();
+if (g_python_home != nullptr) {
+  Py_SetPythonHome(g_python_home);
+}
 #else
 #if defined(__APPLE__) && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7
 // For Darwin, the only Python version supported is the one shipped in the
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Config.h.cmake
+++ lldb/include/lldb/Host/Config.h.cmake
@@ -46,6 +46,8 @@
 
 #cmakedefine01 LLDB_ENABLE_PYTHON
 
+#cmakedefine01 LLDB_EMBED_PYTHON_HOME
+
 #cmakedefine LLDB_PYTHON_HOME "${LLDB_PYTHON_HOME}"
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -59,7 +59,6 @@
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
 add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
 
-option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to 
locate Python." OFF)
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install 
a copy of it" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
@@ -140,10 +139,20 @@
 endif()
 
 if (LLDB_ENABLE_PYTHON)
+  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
+set(default_embed_python_home ON)
+  else()
+set(default_embed_python_home OFF)
+  endif()
+  option(LLDB_EMBED_PYTHON_HOME
+"Embed PYTHONHOME in the binary. If set to OFF, PYTHONHOME environment 
variable will be used to to locate Python."
+${default_embed_python_home})
+
   include_directories(${PYTHON_INCLUDE_DIRS})
-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND NOT 
LLDB_RELOCATABLE_PYTHON)
+  if (LLDB_EMBED_PYTHON_HOME)
 get_filename_component(PYTHON_HOME "${PYTHON_EXECUTABLE}" DIRECTORY)
-file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME)
+set(LLDB_PYTHON_HOME "${PYTHON_HOME}" CACHE STRING
+  "Path to use as PYTHONHOME in lldb. If a relative path is specified, it 
will be resolved at runtime relative to liblldb directory.")
   endif()
 endif()
 


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -277,14 +277,36 @@
 
 private:
   void InitializePythonHome() {
-#if defined(LLDB_PYTHON_HOME)
+#if LLDB_EMBED_PYTHON_HOME
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, );
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type 

[Lldb-commits] [PATCH] D74917: [lldb/cmake] Fail configuration if a required swig dependency is not met.

2020-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D74917#1885615 , @mattd wrote:

> In D74917#1885590 , @JDevlieghere 
> wrote:
>
> > It should never be possible for `LLDB_ENABLE_PYTHON` to be true but 
> > `SWIG_FOUND` to be false. The modules `FindPythonInterpAndLibs.cmake` and 
> > `FindLuaAndSwig.cmake` should fail early when SWIG isn't found.
>
>
> Thanks for taking a look.  Would you be okay with making the status 
> `message()` in `FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake` 
> fatal, that way the dependency error is clearer?


That would defeat the purpose of auto-detecting these dependencies. Please take 
a look at D71306  for all the details. The 
summary is that all optional dependencies default to `Auto`: where we enable 
them if we can find them. You can override this behavior by passing 
`LLDB_ENABLE_PYTHON=ON` to CMake, in which case not finding Python (or SWIG) 
will be a fatal error.

I agree that it can be confusing to figure out that Python got disabled because 
SWIG wasn't found. Currently we call `find_package` with `QUIET` from 
`FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake`. I think we should 
remove that so that the user gets more information in CMake's configuration 
output. Would that address your concerns?


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

https://reviews.llvm.org/D74917



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


[Lldb-commits] [PATCH] D74917: [lldb/cmake] Fail configuration if a required swig dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd updated this revision to Diff 245763.
mattd retitled this revision from "[lldb/bindings] Fail configuration when a 
required dependency is not met." to "[lldb/cmake] Fail configuration if a 
required swig dependency is not met.".

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

https://reviews.llvm.org/D74917

Files:
  lldb/cmake/modules/FindLuaAndSwig.cmake
  lldb/cmake/modules/FindPythonInterpAndLibs.cmake


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -44,7 +44,7 @@
   endif()
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but 
could not be found")
+message(FATAL_ERROR "SWIG 2 or later is required for Python support in 
LLDB but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -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(FATAL_ERROR "SWIG 2 or later is required for Lua support in LLDB 
but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -44,7 +44,7 @@
   endif()
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but could not be found")
+message(FATAL_ERROR "SWIG 2 or later is required for Python support in LLDB but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -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(FATAL_ERROR "SWIG 2 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] D74917: [lldb/bindings] Fail configuration when a required dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd added a comment.

In D74917#1885590 , @JDevlieghere 
wrote:

> It should never be possible for `LLDB_ENABLE_PYTHON` to be true but 
> `SWIG_FOUND` to be false. The modules `FindPythonInterpAndLibs.cmake` and 
> `FindLuaAndSwig.cmake` should fail early when SWIG isn't found.


Thanks for taking a look.  Would you be okay with making the status `message()` 
in `FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake` fatal, that way 
the dependency error is clearer?


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

https://reviews.llvm.org/D74917



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


[Lldb-commits] [PATCH] D74917: [lldb/bindings] Fail configuration when a required dependency is not met.

2020-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

It should never be possible for `LLDB_ENABLE_PYTHON` to be true but 
`SWIG_FOUND` to be false. The modules `FindPythonInterpAndLibs.cmake` and 
`FindLuaAndSwig.cmake` should fail early when SWIG isn't found.


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

https://reviews.llvm.org/D74917



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


[Lldb-commits] [lldb] 0d19b01 - [lldb/Test] Remove stale README in test/API

2020-02-20 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-20T14:52:39-08:00
New Revision: 0d19b016226dc2c442a34abfe9b9c06ab4d7ea1e

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

LOG: [lldb/Test] Remove stale README in test/API

Now that the test live in the same directory the README is no longer
relevant.

Added: 


Modified: 


Removed: 
lldb/test/API/README.md



diff  --git a/lldb/test/API/README.md b/lldb/test/API/README.md
deleted file mode 100644
index fbb37136e26d..
--- a/lldb/test/API/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# LLDB API Tests
-
-This directory only exists for the lit test driver. The actual tests live in
-the `tests` directory in top level LLDB directory.



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


[Lldb-commits] [PATCH] D74727: Allow customized relative PYTHONHOME

2020-02-20 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 245750.
hhb added a comment.

Move option() into if


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74727

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -279,12 +279,34 @@
   void InitializePythonHome() {
 #if defined(LLDB_PYTHON_HOME)
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, );
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type g_python_home = []() -> str_type {
+  const char *lldb_python_home = LLDB_PYTHON_HOME;
+  const char *absolute_python_home = nullptr;
+  llvm::SmallString<64> path;
+  if (llvm::sys::path::is_absolute(lldb_python_home)) {
+absolute_python_home = lldb_python_home;
+  } else {
+FileSpec spec = HostInfo::GetShlibDir();
+if (!spec)
+  return nullptr;
+spec.GetPath(path);
+llvm::sys::path::append(path, lldb_python_home);
+absolute_python_home = path.c_str();
+  }
+#if PY_MAJOR_VERSION >= 3
+  size_t size = 0;
+  return Py_DecodeLocale(absolute_python_home, );
+#else
+  return strdup(absolute_python_home);
+#endif
+}();
+if (g_python_home != nullptr) {
+  Py_SetPythonHome(g_python_home);
+}
 #else
 #if defined(__APPLE__) && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7
 // For Darwin, the only Python version supported is the one shipped in the
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -59,7 +59,6 @@
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
 add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
 
-option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to 
locate Python." OFF)
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install 
a copy of it" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
@@ -140,10 +139,21 @@
 endif()
 
 if (LLDB_ENABLE_PYTHON)
+  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
+set(default_embed_python_home ON)
+  else()
+set(default_embed_python_home OFF)
+  endif()
+  option(LLDB_EMBED_PYTHON_HOME
+ "Embed PYTHONHOME in the binary. If set to OFF, PYTHONHOME 
environment variable will \
+ be used to to locate Python." ${default_embed_python_home})
+
   include_directories(${PYTHON_INCLUDE_DIRS})
-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND NOT 
LLDB_RELOCATABLE_PYTHON)
+  if (LLDB_EMBED_PYTHON_HOME)
 get_filename_component(PYTHON_HOME "${PYTHON_EXECUTABLE}" DIRECTORY)
-file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME)
+set(LLDB_PYTHON_HOME "${PYTHON_HOME}" CACHE STRING
+  "Path to use as PYTHONHOME in lldb. If a relative path is specified, \
+  it will be resolved at runtime relative to liblldb directory.")
   endif()
 endif()
 


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -279,12 +279,34 @@
   void InitializePythonHome() {
 #if defined(LLDB_PYTHON_HOME)
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, );
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type g_python_home = []() -> str_type {
+  const char *lldb_python_home = LLDB_PYTHON_HOME;
+  const char *absolute_python_home = nullptr;
+  llvm::SmallString<64> path;
+  if (llvm::sys::path::is_absolute(lldb_python_home)) {
+absolute_python_home = lldb_python_home;
+  } else {
+FileSpec spec = HostInfo::GetShlibDir();
+if (!spec)
+  return nullptr;
+spec.GetPath(path);
+llvm::sys::path::append(path, lldb_python_home);
+absolute_python_home = path.c_str();
+   

[Lldb-commits] [lldb] 3ee2810 - [lldb/Plugin] Don't mark ProcessNetBSD as a plugin

2020-02-20 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-20T14:35:49-08:00
New Revision: 3ee281082737d18585abff3b482a7ab86af73b5a

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

LOG: [lldb/Plugin] Don't mark ProcessNetBSD as a plugin

ProcessNetBSD has no initializers so it's just a regular library and
shouldn't have the PLUGIN argument in add_lldb_library.

Added: 


Modified: 
lldb/source/Plugins/Process/NetBSD/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt 
b/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt
index 586725bb7a56..13f3790497b9 100644
--- a/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/NetBSD/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginProcessNetBSD PLUGIN
+add_lldb_library(lldbPluginProcessNetBSD
   NativeProcessNetBSD.cpp
   NativeRegisterContextNetBSD.cpp
   NativeRegisterContextNetBSD_x86_64.cpp



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add ability to fetch crash information on crashed processes

2020-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

A few small nits inline, but this LGTM if Pavel is on board.




Comment at: lldb/source/Commands/CommandObjectProcess.cpp:1260
+if (command.GetArgumentCount()) {
+  result.AppendError("`process status` takes no arguments");
+  result.SetStatus(eReturnStatusFailed);

Please use single quotes like we do for other command objects. 



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp:1541
+
+ConstString section_name("__crash_info");
+SectionSP crash_info = sections->FindSectionByName(section_name);

You can move this out of the loop


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add ability to fetch crash information on crashed processes

2020-02-20 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 245721.
mib retitled this revision from "[lldb/Plugins] Add `platform process 
crash-info` command" to "[lldb/Plugins] Add ability to fetch crash information 
on crashed processes".
mib edited the summary of this revision.
mib added a comment.

Moved invocation to `process status --verbose`.
Removed macOS' `CrashReporterClient` header.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657

Files:
  lldb/bindings/interface/SBPlatform.i
  lldb/include/lldb/API/SBPlatform.h
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/API/SBTarget.h
  lldb/include/lldb/Target/Platform.h
  lldb/include/lldb/Target/Process.h
  lldb/source/API/SBPlatform.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/Options.td
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/test/API/functionalities/process_crash_info/Makefile
  lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
  lldb/test/API/functionalities/process_crash_info/main.c

Index: lldb/test/API/functionalities/process_crash_info/main.c
===
--- /dev/null
+++ lldb/test/API/functionalities/process_crash_info/main.c
@@ -0,0 +1,7 @@
+#include 
+int main() {
+  int *var = malloc(sizeof(int));
+  free(var);
+  free(var);
+  return 0;
+}
Index: lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
===
--- /dev/null
+++ lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
@@ -0,0 +1,63 @@
+"""
+Test lldb process crash info.
+"""
+
+import os
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class PlatformProcessCrashInfoTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+self.runCmd("settings set auto-confirm true")
+
+def tearDown(self):
+self.runCmd("settings clear auto-confirm")
+TestBase.tearDown(self)
+
+@skipUnlessDarwin
+def test_cli(self):
+"""Test that `process status --verbose` fetches the extended crash
+information dictionnary from the command-line properly."""
+self.build()
+exe = self.getBuildArtifact("a.out")
+self.expect("file " + exe,
+patterns=["Current executable set to .*a.out"])
+
+self.expect('process launch',
+patterns=["Process .* launched: .*a.out"])
+
+self.expect('process status --verbose',
+patterns=["\"message\".*pointer being freed was not allocated"])
+
+
+@skipUnlessDarwin
+def test_api(self):
+"""Test that lldb can fetch a crashed process' extended crash information
+dictionnary from the api properly."""
+self.build()
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.assertTrue(target, VALID_TARGET)
+
+target.LaunchSimple(None, None, os.getcwd())
+
+platform = target.GetPlatform()
+
+stream = lldb.SBStream()
+self.assertTrue(stream)
+
+crash_info = platform.GetExtendedCrashInformation(target)
+
+error = crash_info.GetAsJSON(stream)
+
+self.assertTrue(error.Success())
+
+self.assertTrue(crash_info.IsValid())
+
+self.assertIn("pointer being freed was not allocated", stream.GetData())
Index: lldb/test/API/functionalities/process_crash_info/Makefile
===
--- /dev/null
+++ lldb/test/API/functionalities/process_crash_info/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+
+include Makefile.rules
+
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -12,6 +12,7 @@
 #include "Plugins/Platform/POSIX/PlatformPOSIX.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/StructuredData.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/FileSystem.h"
 
@@ -84,7 +85,38 @@
 iPhoneOS,
   };
 
+  lldb_private::StructuredData::DictionarySP
+  FetchExtendedCrashInformation(lldb_private::Target ) override;
+
 protected:
+  struct CrashInfoAnnotations {
+uint64_t version;  // unsigned long
+uint64_t message;  // char *
+uint64_t signature_string; // char *
+uint64_t backtrace;// char *
+uint64_t message2; // char *
+uint64_t thread;   // uint64_t
+uint64_t dialog_mode;  // unsigned int
+uint64_t abort_cause;  // unsigned int
+  };
+
+  /// 

[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-20 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 2 inline comments as done.
mib added inline comments.



Comment at: lldb/source/Commands/CommandObjectPlatform.cpp:1574-1577
+interpreter, "platform process",
+"Commands to query, launch and attach to "
+"processes on the current platform.",
+"platform process [attach|launch|list|crash-info] ...") {

labath wrote:
> I am not sure if this command really belongs here. If definitely doesn't fit 
> the description "Commands to query, launch and attach to processes on the 
> current platform.", and if you look at the subcommands, you see that these 
> are all things that you do *before* you get an actual running process. 
> "crash-info" is the exact opposite -- it only makes sense *after* you have a 
> process.
> 
> The "process" (where you had it originally) command tree contains commands 
> for interaction with a running process (although it also overlaps these 
> commands somewhat :/). This command is pretty similar to "process status" so 
> I think it makes sense for it to be next to it (in fact, it is so similar, 
> that I'd consider putting this under some "verbose" switch of process status).
I misunderstood your request. I'm moving it under "process status --verbose".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

Reverted again with rG2f215cf36adc 
. The 
investigation is needed.


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Oliver Stannard (Linaro) via Phabricator via lldb-commits
ostannard added a comment.

Reproducer for that crash: P8198  P8199 



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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73067: [lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin

2020-02-20 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

Autogeneration of the code puts extra burden on us for tracking what is defined 
where and for repackaging LLDB with custom build rules (we need plain Makefile 
in the distribution). I presume the same problem is for gn users, for FreeBSD 
etc.

The NetBSD buildbot is now broken:

  FAILED: lib/liblldb.so.11.0.0git 
  : && /home/motus/netbsd8/netbsd8/wrappers/clang++ -fPIC -fPIC 
-fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default 
-Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor 
-Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections 
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing 
-Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG  -Wl,-z,defs 
-Wl,--color-diagnostics   -Wl,-O3 -Wl,--gc-sections  
-Wl,--version-script,"/home/motus/netbsd8/netbsd8/build-stage2/tools/lldb/source/API/liblldb.exports"
 -shared -Wl,-soname,liblldb.so.11git -o lib/liblldb.so.11.0.0git 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBAddress.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBAttachInfo.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBlock.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpoint.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpointLocation.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpointName.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpointOptionCommon.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBroadcaster.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCommandInterpreter.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCommandReturnObject.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCommunication.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCompileUnit.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBData.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBDebugger.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBDeclaration.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBError.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBEvent.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBExecutionContext.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBExpressionOptions.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFileSpec.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFile.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFileSpecList.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFrame.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFunction.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBHostOS.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBInstruction.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBInstructionList.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLanguageRuntime.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLaunchInfo.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLineEntry.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBListener.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBMemoryRegionInfo.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBMemoryRegionInfoList.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBModule.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBModuleSpec.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBPlatform.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBProcess.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBProcessInfo.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBQueue.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBQueueItem.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBReproducer.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSection.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSourceManager.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBStream.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBStringList.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBStructuredData.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSymbol.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSymbolContext.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSymbolContextList.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTarget.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBThread.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBThreadCollection.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBThreadPlan.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTrace.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTraceOptions.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBType.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeCategory.cpp.o 
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeEnumMember.cpp.o 

[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

Nice! Thanks!


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D74917: [lldb/bindings] Fail configuration when a required dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd created this revision.
mattd added reviewers: aadsm, hhb.
mattd added a project: LLDB.
Herald added a subscriber: mgorny.

If the SWIG dependency is required {LLDB_ENABLE_PYTHON, LLDB_ENABLE_LUA}
and SWIG is not available, fail the configuration step.  Terminate the
configure early rather than later with a clear error message.

We could possibly modify:
`llvm-project/lldb/cmake/modules/FindPythonInterpAndLibs.cmake`
However, the patch here seems clear in my opinion.


https://reviews.llvm.org/D74917

Files:
  lldb/bindings/CMakeLists.txt


Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -33,6 +33,10 @@
 )
 
 if (LLDB_ENABLE_PYTHON)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for Python support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
@@ -57,6 +61,10 @@
 endif()
 
 if (LLDB_ENABLE_LUA)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for LUA support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
 DEPENDS ${SWIG_SOURCES}


Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -33,6 +33,10 @@
 )
 
 if (LLDB_ENABLE_PYTHON)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for Python support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
@@ -57,6 +61,10 @@
 endif()
 
 if (LLDB_ENABLE_LUA)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for LUA support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
 DEPENDS ${SWIG_SOURCES}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74903: [lldb][test] Add two wrapper functions to manage settings in test-suite

2020-02-20 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

I'm kinda curious how much we actually support this? I know we do a lot of 
random fiddling with settings and what not, but I feel if we anyway say that 
each test needs to have a clean setup, can't we just create like a new 
SBDebugger instance or something like that at test start? That would solve all 
the cleanup issues and cover all the hidden settings that LLDB supports (e.g. 
the amazing `platform settings` command and all that).


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74903



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-20 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaf64b31959f6: Add target.xml support for qXfer request. 
(authored by omjavaid).

Changed prior to commit:
  https://reviews.llvm.org/D74217?vs=245167=245686#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -199,6 +199,8 @@
   static std::string XMLEncodeAttributeValue(llvm::StringRef value);
 
 private:
+  llvm::Expected> BuildTargetXml();
+
   void HandleInferiorState_Exited(NativeProcessProtocol *process);
 
   void HandleInferiorState_Stopped(NativeProcessProtocol *process);
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -377,6 +377,99 @@
   }
 }
 
+static llvm::StringRef GetEncodingNameOrEmpty(const RegisterInfo _info) {
+  switch (reg_info.encoding) {
+  case eEncodingUint:
+return "uint";
+  case eEncodingSint:
+return "sint";
+  case eEncodingIEEE754:
+return "ieee754";
+  case eEncodingVector:
+return "vector";
+  default:
+return "";
+  }
+}
+
+static llvm::StringRef GetFormatNameOrEmpty(const RegisterInfo _info) {
+  switch (reg_info.format) {
+  case eFormatBinary:
+return "binary";
+  case eFormatDecimal:
+return "decimal";
+  case eFormatHex:
+return "hex";
+  case eFormatFloat:
+return "float";
+  case eFormatVectorOfSInt8:
+return "vector-sint8";
+  case eFormatVectorOfUInt8:
+return "vector-uint8";
+  case eFormatVectorOfSInt16:
+return "vector-sint16";
+  case eFormatVectorOfUInt16:
+return "vector-uint16";
+  case eFormatVectorOfSInt32:
+return "vector-sint32";
+  case eFormatVectorOfUInt32:
+return "vector-uint32";
+  case eFormatVectorOfFloat32:
+return "vector-float32";
+  case eFormatVectorOfUInt64:
+return "vector-uint64";
+  case eFormatVectorOfUInt128:
+return "vector-uint128";
+  default:
+return "";
+  };
+}
+
+static llvm::StringRef GetKindGenericOrEmpty(const RegisterInfo _info) {
+  switch (reg_info.kinds[RegisterKind::eRegisterKindGeneric]) {
+  case LLDB_REGNUM_GENERIC_PC:
+return "pc";
+  case LLDB_REGNUM_GENERIC_SP:
+return "sp";
+  case LLDB_REGNUM_GENERIC_FP:
+return "fp";
+  case LLDB_REGNUM_GENERIC_RA:
+return "ra";
+  case LLDB_REGNUM_GENERIC_FLAGS:
+return "flags";
+  case LLDB_REGNUM_GENERIC_ARG1:
+return "arg1";
+  case LLDB_REGNUM_GENERIC_ARG2:
+return "arg2";
+  case LLDB_REGNUM_GENERIC_ARG3:
+return "arg3";
+  case LLDB_REGNUM_GENERIC_ARG4:
+return "arg4";
+  case LLDB_REGNUM_GENERIC_ARG5:
+return "arg5";
+  case LLDB_REGNUM_GENERIC_ARG6:
+return "arg6";
+  case LLDB_REGNUM_GENERIC_ARG7:
+return "arg7";
+  case LLDB_REGNUM_GENERIC_ARG8:
+return "arg8";
+  default:
+return "";
+  }
+}
+
+static void CollectRegNums(const uint32_t *reg_num, StreamString ,
+   bool usehex) {
+  for (int i = 0; *reg_num != LLDB_INVALID_REGNUM; ++reg_num, ++i) {
+if (i > 0)
+  response.PutChar(',');
+if (usehex)
+  response.Printf("%" PRIx32, *reg_num);
+else
+  response.Printf("%" PRIu32, *reg_num);
+  }
+}
+
 static void WriteRegisterValueInHexFixedWidth(
 StreamString , NativeRegisterContext _ctx,
 const RegisterInfo _info, const RegisterValue *reg_value_p,
@@ -1699,74 +1792,18 @@
   response.Printf("bitsize:%" PRIu32 ";offset:%" PRIu32 ";",
   reg_info->byte_size * 8, reg_info->byte_offset);
 
-  switch (reg_info->encoding) {
-  case eEncodingUint:
-response.PutCString("encoding:uint;");
-break;
-  case eEncodingSint:
-response.PutCString("encoding:sint;");
-break;
-  case eEncodingIEEE754:
-response.PutCString("encoding:ieee754;");
-break;
-  case eEncodingVector:
-response.PutCString("encoding:vector;");
-break;
-  default:
-break;
-  }
+  llvm::StringRef 

[Lldb-commits] [PATCH] D74859: [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY

2020-02-20 Thread Jordan Rupprecht via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0ffa6e1a7e1c: [lldb] Fix version string when using 
LLDB_REVISION but not LLDB_REPOSITORY (authored by rupprecht).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74859

Files:
  lldb/source/lldb.cpp


Index: lldb/source/lldb.cpp
===
--- lldb/source/lldb.cpp
+++ lldb/source/lldb.cpp
@@ -50,8 +50,10 @@
   g_version_str += " (";
   if (lldb_repo)
 g_version_str += lldb_repo;
+  if (lldb_repo && lldb_rev)
+g_version_str += " ";
   if (lldb_rev) {
-g_version_str += " revision ";
+g_version_str += "revision ";
 g_version_str += lldb_rev;
   }
   g_version_str += ")";


Index: lldb/source/lldb.cpp
===
--- lldb/source/lldb.cpp
+++ lldb/source/lldb.cpp
@@ -50,8 +50,10 @@
   g_version_str += " (";
   if (lldb_repo)
 g_version_str += lldb_repo;
+  if (lldb_repo && lldb_rev)
+g_version_str += " ";
   if (lldb_rev) {
-g_version_str += " revision ";
+g_version_str += "revision ";
 g_version_str += lldb_rev;
   }
   g_version_str += ")";
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 0ffa6e1 - [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY

2020-02-20 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2020-02-20T10:07:50-08:00
New Revision: 0ffa6e1a7e1c5de36276375486f49277c6f95d0e

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

LOG: [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY

Summary:
lldb's format string (line one) is:
`lldb version $clang_version ($lldb_repo revision $lldb_revision)`

When only using $lldb_revision and not $lldb_repo, this might look like:
`lldb version 11 ( revision 12345)`
which looks pretty ugly.

Aside: I'm not sure we really need all the different versions since we've moved 
to the monorepo layout -- I don't think anyone is using different 
llvm/clang/lldb revisions, are they? We could likely tidy this up further if we 
knew how people consumed the output of lldb --version.

Reviewers: labath, JDevlieghere, friss

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/source/lldb.cpp

Removed: 




diff  --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp
index 885c62021286..6d4ed66074dc 100644
--- a/lldb/source/lldb.cpp
+++ b/lldb/source/lldb.cpp
@@ -50,8 +50,10 @@ const char *lldb_private::GetVersion() {
   g_version_str += " (";
   if (lldb_repo)
 g_version_str += lldb_repo;
+  if (lldb_repo && lldb_rev)
+g_version_str += " ";
   if (lldb_rev) {
-g_version_str += " revision ";
+g_version_str += "revision ";
 g_version_str += lldb_rev;
   }
   g_version_str += ")";



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


[Lldb-commits] [lldb] af64b31 - Add target.xml support for qXfer request.

2020-02-20 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2020-02-20T23:03:54+05:00
New Revision: af64b31959f634031e5ddbcf8df1fab69689bfee

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

LOG: Add target.xml support for qXfer request.

Summary:
Requesting registers one by one takes a while in our project.
We want to get rid of it by using target.xml.

Reviewers: jarin, labath, omjavaid

Reviewed By: labath, omjavaid

Subscribers: omjavaid, lldb-commits

Tags: #lldb

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

Added: 

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp

Modified: 

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
new file mode 100644
index ..8b20bcb0
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
new file mode 100644
index ..530e2ce80023
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
@@ -0,0 +1,69 @@
+
+
+import gdbremote_testcase
+import textwrap
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+import re
+import xml.etree.ElementTree as ET
+
+class TestGdbRemoteTargetXmlPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@expectedFailureNetBSD
+@llgs_test
+def test_g_target_xml_returns_correct_data(self):
+self.init_llgs_test()
+self.build()
+self.set_inferior_startup_launch()
+
+procs = self.prep_debug_monitor_and_inferior()
+
+OFFSET = 0
+LENGTH = 0x10
+self.test_sequence.add_log_lines([
+"read packet: $qXfer:features:read:target.xml:{:x},{:x}#00".format(
+OFFSET,
+LENGTH),
+{   
+"direction": "send", 
+"regex": re.compile("^\$l(.+)#[0-9a-fA-F]{2}$"), 
+"capture": {1: "target_xml"}
+}],
+True)
+context = self.expect_gdbremote_sequence()
+
+target_xml = context.get("target_xml")
+
+root = ET.fromstring(target_xml)
+self.assertIsNotNone(root)
+self.assertEqual(root.tag, "target")
+
+architecture = root.find("architecture")
+self.assertIsNotNone(architecture)
+self.assertEqual(architecture.text, self.getArchitecture())
+
+feature = root.find("feature")
+self.assertIsNotNone(feature)
+
+target_xml_registers = feature.findall("reg")
+self.assertTrue(len(target_xml_registers) > 0)
+
+# registers info collected by qRegisterInfo
+self.add_register_info_collection_packets()
+context = self.expect_gdbremote_sequence()
+self.assertIsNotNone(context)
+q_info_registers = self.parse_register_info_packets(context)
+
+self.assertTrue(len(target_xml_registers) == len(q_info_registers))
+for register in zip(target_xml_registers, q_info_registers):
+xml_info_reg = register[0]
+q_info_reg = register[1]
+self.assertEqual(q_info_reg["name"], xml_info_reg.get("name"))
+self.assertEqual(q_info_reg["set"], xml_info_reg.get("group"))
+self.assertEqual(q_info_reg["format"], xml_info_reg.get("format"))
+self.assertEqual(q_info_reg["bitsize"], 
xml_info_reg.get("bitsize"))
+self.assertEqual(q_info_reg["offset"], xml_info_reg.get("offset"))
+self.assertEqual(q_info_reg["encoding"], 
xml_info_reg.get("encoding"))
\ No newline at end of file

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp
 

[Lldb-commits] [PATCH] D74859: [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY

2020-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

In D74859#1884159 , @labath wrote:

> > Aside: I'm not sure we really need all the different versions since we've 
> > moved to the monorepo layout -- I don't think anyone is using different 
> > llvm/clang/lldb revisions, are they?
>
> The standalone build of lldb (and clang) still works, and there are people 
> that use it (some distros build their packages this way, and it's the 
> "official" build method in the swift fork afaik). So, in theory one could 
> build lldb+clang+llvm from three different revisions (but I hope noone 
> actually does that).


Yup, Swift uses the standalone build.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74859



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


[Lldb-commits] [PATCH] D74903: [lldb][test] Add two wrapper-functions to manage settings in test-suite

2020-02-20 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: JDevlieghere, labath.
tatyana-krasnukha added a project: LLDB.
Herald added subscribers: lldb-commits, teemperor.

Some tests set settings and don't clean them up, this leads to side effects in 
other tests.

The patch adds wrappers that will set/append a setting and add a tear-down hook 
to clean/remove/restore its old value during the cleanup.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74903

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py
  lldb/test/API/benchmarks/continue/TestBenchmarkContinue.py
  lldb/test/API/benchmarks/libcxxlist/TestBenchmarkLibcxxList.py
  lldb/test/API/benchmarks/libcxxmap/TestBenchmarkLibcxxMap.py
  
lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
  
lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
  
lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
  
lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/no-std-module/TestMissingStdModule.py
  
lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/stack/TestStackFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/sysroot/TestStdModuleSysroot.py
  
lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
  
lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
  
lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
  lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
  lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py
  lldb/test/API/commands/expression/test/TestExprs.py
  lldb/test/API/commands/expression/top-level/TestTopLevelExprs.py
  lldb/test/API/commands/expression/weak_symbols/TestWeakSymbols.py
  lldb/test/API/commands/help/TestHelp.py
  lldb/test/API/commands/process/launch/TestProcessLaunch.py
  lldb/test/API/commands/watchpoints/watchpoint_size/TestWatchpointSizes.py
  
lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
  
lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
  
lldb/test/API/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
  lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
  
lldb/test/API/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
  
lldb/test/API/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  

[Lldb-commits] [lldb] 2f215cf - Revert "Reland "[DebugInfo] Enable the debug entry values feature by default""

2020-02-20 Thread Djordje Todorovic via lldb-commits

Author: Djordje Todorovic
Date: 2020-02-20T14:41:39+01:00
New Revision: 2f215cf36adced6bf1abda4bdbbc6422c1369353

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

LOG: Revert "Reland "[DebugInfo] Enable the debug entry values feature by 
default""

This reverts commit rGfaff707db82d.
A failure found on an ARM 2-stage buildbot.
The investigation is needed.

Added: 


Modified: 
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/CC1Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/debug-info-extern-call.c
clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
lldb/packages/Python/lldbsuite/test/decorators.py

lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
llvm/include/llvm/CodeGen/CommandFlags.inc
llvm/include/llvm/Target/TargetMachine.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
llvm/lib/CodeGen/TargetOptionsImpl.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMTargetMachine.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/AArch64/arm64-anyregcc.ll
llvm/test/CodeGen/AArch64/arm64-patchpoint.ll
llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll
llvm/test/CodeGen/ARM/smml.ll
llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
llvm/test/CodeGen/X86/call-site-info-output.ll
llvm/test/CodeGen/X86/hoist-invariant-load.ll
llvm/test/CodeGen/X86/speculative-load-hardening-indirect.ll
llvm/test/CodeGen/X86/statepoint-allocas.ll
llvm/test/CodeGen/X86/tail-dup-repeat.ll
llvm/test/CodeGen/X86/xray-custom-log.ll
llvm/test/CodeGen/X86/xray-typed-event-log.ll
llvm/test/DebugInfo/AArch64/call-site-info-output.ll
llvm/test/DebugInfo/ARM/call-site-info-output.ll
llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir
llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
llvm/test/DebugInfo/X86/dbg-value-range.ll
llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
llvm/test/DebugInfo/X86/loclists-dwp.ll

[Lldb-commits] [PATCH] D74895: [lldb]: fix typo in lldb-gdb-remote.txt

2020-02-20 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc7b7f76ae6ae: [lldb]: fix typo in lldb-gdb-remote.txt 
(authored by kwk).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74895

Files:
  lldb/docs/lldb-gdb-remote.txt


Index: lldb/docs/lldb-gdb-remote.txt
===
--- lldb/docs/lldb-gdb-remote.txt
+++ lldb/docs/lldb-gdb-remote.txt
@@ -3,7 +3,7 @@
 correct GDB server when debugging. If you have mismatch, then things go wrong
 very quickly. LLDB makes extensive use of the GDB remote protocol and we
 wanted to make sure that the experience was a bit more dynamic where we can
-discover information about a remote target with having to know anything up
+discover information about a remote target without having to know anything up
 front. We also ran into performance issues with the existing GDB remote
 protocol that can be overcome when using a reliable communications layer.
 Some packets improve performance, others allow for remote process launching


Index: lldb/docs/lldb-gdb-remote.txt
===
--- lldb/docs/lldb-gdb-remote.txt
+++ lldb/docs/lldb-gdb-remote.txt
@@ -3,7 +3,7 @@
 correct GDB server when debugging. If you have mismatch, then things go wrong
 very quickly. LLDB makes extensive use of the GDB remote protocol and we
 wanted to make sure that the experience was a bit more dynamic where we can
-discover information about a remote target with having to know anything up
+discover information about a remote target without having to know anything up
 front. We also ran into performance issues with the existing GDB remote
 protocol that can be overcome when using a reliable communications layer.
 Some packets improve performance, others allow for remote process launching
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] c7b7f76 - [lldb]: fix typo in lldb-gdb-remote.txt

2020-02-20 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-02-20T14:30:12+01:00
New Revision: c7b7f76ae6ae2a5f3d9753b37ef811da15386cd4

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

LOG: [lldb]: fix typo in lldb-gdb-remote.txt

Summary: The logic of the sentence made more sense when "with" is replaced with 
"without".

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/docs/lldb-gdb-remote.txt

Removed: 




diff  --git a/lldb/docs/lldb-gdb-remote.txt b/lldb/docs/lldb-gdb-remote.txt
index 06cd09d77c41..276beedd047c 100644
--- a/lldb/docs/lldb-gdb-remote.txt
+++ b/lldb/docs/lldb-gdb-remote.txt
@@ -3,7 +3,7 @@ remote debugging. Why? Normally you need to start the correct 
GDB and the
 correct GDB server when debugging. If you have mismatch, then things go wrong
 very quickly. LLDB makes extensive use of the GDB remote protocol and we
 wanted to make sure that the experience was a bit more dynamic where we can
-discover information about a remote target with having to know anything up
+discover information about a remote target without having to know anything up
 front. We also ran into performance issues with the existing GDB remote
 protocol that can be overcome when using a reliable communications layer.
 Some packets improve performance, others allow for remote process launching



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


[Lldb-commits] [PATCH] D74895: [lldb]: fix typo in lldb-gdb-remote.txt

2020-02-20 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

yep


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74895



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


[Lldb-commits] [PATCH] D74895: [lldb]: fix typo in lldb-gdb-remote.txt

2020-02-20 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk created this revision.
kwk added a reviewer: labath.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The logic of the sentence made more sense when "with" is replaced with 
"without".


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74895

Files:
  lldb/docs/lldb-gdb-remote.txt


Index: lldb/docs/lldb-gdb-remote.txt
===
--- lldb/docs/lldb-gdb-remote.txt
+++ lldb/docs/lldb-gdb-remote.txt
@@ -3,7 +3,7 @@
 correct GDB server when debugging. If you have mismatch, then things go wrong
 very quickly. LLDB makes extensive use of the GDB remote protocol and we
 wanted to make sure that the experience was a bit more dynamic where we can
-discover information about a remote target with having to know anything up
+discover information about a remote target without having to know anything up
 front. We also ran into performance issues with the existing GDB remote
 protocol that can be overcome when using a reliable communications layer.
 Some packets improve performance, others allow for remote process launching


Index: lldb/docs/lldb-gdb-remote.txt
===
--- lldb/docs/lldb-gdb-remote.txt
+++ lldb/docs/lldb-gdb-remote.txt
@@ -3,7 +3,7 @@
 correct GDB server when debugging. If you have mismatch, then things go wrong
 very quickly. LLDB makes extensive use of the GDB remote protocol and we
 wanted to make sure that the experience was a bit more dynamic where we can
-discover information about a remote target with having to know anything up
+discover information about a remote target without having to know anything up
 front. We also ran into performance issues with the existing GDB remote
 protocol that can be overcome when using a reliable communications layer.
 Some packets improve performance, others allow for remote process launching
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 7b59ff2 - [lldb] Add boilerplate to recognize the .debug_tu_index section

2020-02-20 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-20T13:44:21+01:00
New Revision: 7b59ff2fa0a56a0158f3f21aaed217118da669a3

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

LOG: [lldb] Add boilerplate to recognize the .debug_tu_index section

It's just like debug_cu_index, only for type units.

Added: 


Modified: 
lldb/include/lldb/lldb-enumerations.h
lldb/source/Core/Section.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Symbol/ObjectFile.cpp
lldb/test/Shell/ObjectFile/ELF/section-types.yaml

Removed: 




diff  --git a/lldb/include/lldb/lldb-enumerations.h 
b/lldb/include/lldb/lldb-enumerations.h
index 1347f91a9b3e..543e454c27c8 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -695,6 +695,7 @@ enum SectionType {
   eSectionTypeDWARFDebugRngListsDwo,
   eSectionTypeDWARFDebugLocDwo,
   eSectionTypeDWARFDebugLocListsDwo,
+  eSectionTypeDWARFDebugTuIndex,
 };
 
 FLAGS_ENUM(EmulateInstructionOptions){

diff  --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 1d5fd603e57c..94adab29b880 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -68,6 +68,8 @@ const char *Section::GetTypeAsCString() const {
 return "dwarf-aranges";
   case eSectionTypeDWARFDebugCuIndex:
 return "dwarf-cu-index";
+  case eSectionTypeDWARFDebugTuIndex:
+return "dwarf-tu-index";
   case eSectionTypeDWARFDebugFrame:
 return "dwarf-frame";
   case eSectionTypeDWARFDebugInfo:

diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index a328e16e4bde..403aa5909bd6 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1592,6 +1592,7 @@ static SectionType GetSectionTypeFromName(llvm::StringRef 
Name) {
 .Case("str.dwo", eSectionTypeDWARFDebugStrDwo)
 .Case("str_offsets", eSectionTypeDWARFDebugStrOffsets)
 .Case("str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)
+.Case("tu_index", eSectionTypeDWARFDebugTuIndex)
 .Case("types", eSectionTypeDWARFDebugTypes)
 .Case("types.dwo", eSectionTypeDWARFDebugTypesDwo)
 .Default(eSectionTypeOther);

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index afa9b645cbec..5b75e1f2a2ec 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1150,6 +1150,7 @@ AddressClass 
ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) {
 case eSectionTypeDWARFDebugStrDwo:
 case eSectionTypeDWARFDebugStrOffsets:
 case eSectionTypeDWARFDebugStrOffsetsDwo:
+case eSectionTypeDWARFDebugTuIndex:
 case eSectionTypeDWARFDebugTypes:
 case eSectionTypeDWARFDebugTypesDwo:
 case eSectionTypeDWARFAppleNames:

diff  --git a/lldb/source/Symbol/ObjectFile.cpp 
b/lldb/source/Symbol/ObjectFile.cpp
index 0367703db1ae..5a4680b01103 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -367,6 +367,7 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) {
   case eSectionTypeDWARFDebugStrDwo:
   case eSectionTypeDWARFDebugStrOffsets:
   case eSectionTypeDWARFDebugStrOffsetsDwo:
+  case eSectionTypeDWARFDebugTuIndex:
   case eSectionTypeDWARFDebugTypes:
   case eSectionTypeDWARFDebugTypesDwo:
   case eSectionTypeDWARFAppleNames:

diff  --git a/lldb/test/Shell/ObjectFile/ELF/section-types.yaml 
b/lldb/test/Shell/ObjectFile/ELF/section-types.yaml
index 7d59b3b4870d..7c12a52038c2 100644
--- a/lldb/test/Shell/ObjectFile/ELF/section-types.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/section-types.yaml
@@ -34,6 +34,12 @@
 # CHECK-LABEL: Name: .debug_names
 # CHECK-NEXT: Type: dwarf-names
 
+# CHECK-LABEL: Name: .debug_cu_index
+# CHECK-NEXT: Type: dwarf-cu-index
+
+# CHECK-LABEL: Name: .debug_tu_index
+# CHECK-NEXT: Type: dwarf-tu-index
+
 # CHECK-LABEL: Name: .gnu_debugaltlink
 # CHECK-NEXT: Type: dwarf-gnu-debugaltlink
 
@@ -104,6 +110,14 @@ Sections:
 Type:SHT_PROGBITS
 AddressAlign:0x0001
 Content: DEADBEEFBAADF00D
+  - Name:.debug_cu_index
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: DEADBEEFBAADF00D
+  - Name:.debug_tu_index
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: DEADBEEFBAADF00D
   - Name:.gnu_debugaltlink
  

[Lldb-commits] [PATCH] D74891: [lldb] Never compile the debugserver with Clang module flags

2020-02-20 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
Herald added subscribers: lldb-commits, JDevlieghere, mgorny.
Herald added a project: LLDB.

Compiling ObjC++ with Clang modules is usually not working well and compiling
the small debugserver with modules is not worth the trouble.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74891

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


Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -62,6 +62,14 @@
 
 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")
 
+# Remove any module flags as the debugserver contains ObjC++ code which 
probably won't work
+# with Clang modules.
+string(REGEX REPLACE "-fmodules-cache-path=[^ ]+" "" CMAKE_CXX_FLAGS 
"${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-fmodules-local-submodule-visibility" "" CMAKE_CXX_FLAGS 
"${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-fmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-gmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-fcxx-modules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+
 check_cxx_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments"
 CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
 if (CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)


Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -62,6 +62,14 @@
 
 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")
 
+# Remove any module flags as the debugserver contains ObjC++ code which probably won't work
+# with Clang modules.
+string(REGEX REPLACE "-fmodules-cache-path=[^ ]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-fmodules-local-submodule-visibility" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-fmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-gmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REGEX REPLACE "-fcxx-modules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+
 check_cxx_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments"
 CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
 if (CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

@ostannard Thanks for reporting that! Please share the case.


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added a comment.

In D73534#1883048 , @djtodoro wrote:

> I’ve already pushed this. Please rebase on the latest commits.


Ah faff707db82d7db12fcd9f7826b8741261230e63 
. Cool, I 
can no longer reproduce the previous issue. Thanks for the quick fix.


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Oliver Stannard (Linaro) via Phabricator via lldb-commits
ostannard added a comment.

There's a failure on an ARM 2-stage buildbot which looks related to this: 
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-full-sh/builds/3920/steps/build%20stage%202/logs/stdio

I can reproduce the crash on the buildbot machine, so hopefully I'll have a 
standalone reproducer for you soon.


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

In D73534#1883022 , @nickdesaulniers 
wrote:

> In D73534#1882136 , @djtodoro wrote:
>
> > - Address the issue with ARM `describeLoadedValue()` (thanks to @vsk, I've 
> > reduced the test 
> > `llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir`)
>
>
> I'd like to help test this, but `arc patch D73534` is now failing with merge 
> conflicts. Can you please rebase this on master?


I’ve already pushed this. Please rebase on the latest commits.


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added a comment.

In D73534#1882136 , @djtodoro wrote:

> - Address the issue with ARM `describeLoadedValue()` (thanks to @vsk, I've 
> reduced the test 
> `llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir`)


I'd like to help test this, but `arc patch D73534` is now failing with merge 
conflicts. Can you please rebase this on master?


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [lldb] ddf60ba - [lldb/DWARF] Always construct a DWARFDebugInfo object

2020-02-20 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-20T10:51:40+01:00
New Revision: ddf60ba09f2cf31851ea165c7c5fcfc4c2ad546e

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

LOG: [lldb/DWARF] Always construct a DWARFDebugInfo object

Change the return value of SymbolFileDWARF::DebugInfo from a pointer to
a reference, and remove all null checks.

Previously, we were not constructing the DebugInfo object when the
debug_info section was empty. Now we always construct the object but
it will return an empty list of dwarf units (a thing which it already
supported).

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 0ea3adceaecc..8d0ac23ef9e3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2001,12 +2001,12 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE ,
 dwarf->GetObjCMethodDIEOffsets(class_name, method_die_offsets);
 
 if (!method_die_offsets.empty()) {
-  DWARFDebugInfo *debug_info = dwarf->DebugInfo();
+  DWARFDebugInfo _info = dwarf->DebugInfo();
 
   const size_t num_matches = method_die_offsets.size();
   for (size_t i = 0; i < num_matches; ++i) {
 const DIERef _ref = method_die_offsets[i];
-DWARFDIE method_die = debug_info->GetDIE(die_ref);
+DWARFDIE method_die = debug_info.GetDIE(die_ref);
 
 if (method_die)
   method_die.ResolveType();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index 83cda24a27d2..305f1cbd2826 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -517,7 +517,7 @@ DWARFDIE DWARFFormValue::Reference() const {
 
   case DW_FORM_ref_addr: {
 DWARFUnit *ref_cu =
-m_unit->GetSymbolFileDWARF().DebugInfo()->GetUnitContainingDIEOffset(
+m_unit->GetSymbolFileDWARF().DebugInfo().GetUnitContainingDIEOffset(
 DIERef::Section::DebugInfo, value);
 if (!ref_cu) {
   m_unit->GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
@@ -530,7 +530,7 @@ DWARFDIE DWARFFormValue::Reference() const {
 
   case DW_FORM_ref_sig8: {
 DWARFTypeUnit *tu =
-m_unit->GetSymbolFileDWARF().DebugInfo()->GetTypeUnitForHash(value);
+m_unit->GetSymbolFileDWARF().DebugInfo().GetTypeUnitForHash(value);
 if (!tu)
   return {};
 return tu->GetDIE(tu->GetTypeOffset());

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 705578c2e4eb..c11df30696f0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -19,18 +19,14 @@ using namespace lldb;
 llvm::Expected>
 DebugNamesDWARFIndex::Create(Module , DWARFDataExtractor debug_names,
  DWARFDataExtractor debug_str,
- DWARFDebugInfo *debug_info) {
-  if (!debug_info) {
-return llvm::make_error("debug info null",
-   llvm::inconvertibleErrorCode());
-  }
+ DWARFDebugInfo _info) {
   auto index_up = std::make_unique(debug_names.GetAsLLVM(),
 debug_str.GetAsLLVM());
   if (llvm::Error E = index_up->extract())
 return std::move(E);
 
   return std::unique_ptr(new DebugNamesDWARFIndex(
-  module, std::move(index_up), debug_names, debug_str, *debug_info));
+  module, std::move(index_up), debug_names, debug_str, debug_info));
 }
 
 llvm::DenseSet

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index f2f5c0bc34de..5ba8577d59f4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -20,7 +20,7 @@ class 

[Lldb-commits] [PATCH] D74727: Allow customized relative PYTHONHOME

2020-02-20 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.

This looks good to me.




Comment at: lldb/cmake/modules/LLDBConfig.cmake:68-70
+option(LLDB_EMBED_PYTHON_HOME
+   "Embed PYTHONHOME in the binary. If set to OFF, PYTHONHOME environment 
variable will \
+   be used to to locate Python." ${default_embed_python_home})

Maybe this could also be in the `if(LLDB_ENABLE_PYTHON)` block below?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74727



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks a bit better, but my the purpose of my previous command was not to 
move the location of the cli command itself -- I think it was ok just where it 
was. The fact that the part of the functionality is implemented in the Platform 
class does not mean the cli command has to be there.




Comment at: lldb/source/Commands/CommandObjectPlatform.cpp:1574-1577
+interpreter, "platform process",
+"Commands to query, launch and attach to "
+"processes on the current platform.",
+"platform process [attach|launch|list|crash-info] ...") {

I am not sure if this command really belongs here. If definitely doesn't fit 
the description "Commands to query, launch and attach to processes on the 
current platform.", and if you look at the subcommands, you see that these are 
all things that you do *before* you get an actual running process. "crash-info" 
is the exact opposite -- it only makes sense *after* you have a process.

The "process" (where you had it originally) command tree contains commands for 
interaction with a running process (although it also overlaps these commands 
somewhat :/). This command is pretty similar to "process status" so I think it 
makes sense for it to be next to it (in fact, it is so similar, that I'd 
consider putting this under some "verbose" switch of process status).



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h:93
+  // This struct should only be available in macOS but could be used on other
+  // platforms. #ifdef HAVE_CRASHREPORTERCLIENT_H #include
+  //  #endif

JDevlieghere wrote:
> mib wrote:
> > JDevlieghere wrote:
> > > Assuming the header defines this struct, why not do 
> > > 
> > > ```
> > > #ifdef HAVE_CRASHREPORTERCLIENT_H 
> > > #include  
> > > #else 
> > > struct CrashInfoAnnotations {
> > >   ...
> > > }
> > > #endif 
> > > ```
> > The struct have a different name in the header (which is not a big deal), 
> > but I don't see the point of including the header if I give the structure 
> > definition below it.
> > 
> > I put the header comment following @teemperor's feedback 
> > (https://reviews.llvm.org/D74657#inline-679127) but maybe I could get rid 
> > of it ?
> > 
> > 
> I'll leave it up to your discretion, but I'd either specify the struct myself 
> and say it's defined in `CrashReporterClient.h`, or alternatively put the 
> ifdefs in the code and include the header and typedef it if the header is 
> available, and use the custom struct otherwise, which means we still have the 
> layout and type info Raphael asked about. 
I don't think it makes sense to include the system definition if you're going 
to provide the alternative -- either you support both cross and native 
scenarios (in which case you can use the hand-rolled version everywhere), or 
you just support the native one (and you just use the system version). That 
said, if the struct contains pointer members, I am not sure if you can actually 
use the native struct like that. What if the process you're debugging is 32-bit 
?

And whatever you do, please don't include a system header in the middle of a 
class.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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