[Lldb-commits] [PATCH] D67890: [lldb] [cmake] Fix installing Python modules on systems using /usr/lib

2019-09-22 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: hhb, JDevlieghere, sgraenitz, zturner, beanz, labath.

Fix installing Python modules on systems that use /usr/lib for Python
while installing other libraries in /usr/lib64.  Rewrite CMake logic
to query correct directories from Python, similarly to how
prepare_binding_Python.py does it.  Furthermore, change the regex used
in get_relative_lib_dir.py to allow 'lib' without suffix.

I think that the code can be further improved but I'd like to take
this enterprise in smaller steps in case one of them breaks something.


https://reviews.llvm.org/D67890

Files:
  lldb/scripts/CMakeLists.txt
  lldb/scripts/get_relative_lib_dir.py


Index: lldb/scripts/get_relative_lib_dir.py
===
--- lldb/scripts/get_relative_lib_dir.py
+++ lldb/scripts/get_relative_lib_dir.py
@@ -23,7 +23,7 @@
 # right answer always.
 arch_specific_libdir = distutils.sysconfig.get_python_lib(True, False)
 split_libdir = arch_specific_libdir.split(os.sep)
-lib_re = re.compile(r"^lib.+$")
+lib_re = re.compile(r"^lib.*$")
 
 for i in range(len(split_libdir)):
 match = lib_re.match(split_libdir[i])
Index: lldb/scripts/CMakeLists.txt
===
--- lldb/scripts/CMakeLists.txt
+++ lldb/scripts/CMakeLists.txt
@@ -42,15 +42,18 @@
 )
 
 if(NOT LLDB_BUILD_FRAMEWORK)
-  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
-set(swig_python_subdir site-packages)
-  else()
-set(swig_python_subdir 
python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-  endif()
-
-  set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
-  set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig, sys; 
print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+${CMAKE_BINARY_DIR}
+OUTPUT_VARIABLE SWIG_PYTHON_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(True, False, ''))"
+OUTPUT_VARIABLE SWIG_INSTALL_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
 
   # Install the LLDB python module
-  install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
+  install(DIRECTORY ${SWIG_PYTHON_DIR}/ DESTINATION ${SWIG_INSTALL_DIR})
 endif()


Index: lldb/scripts/get_relative_lib_dir.py
===
--- lldb/scripts/get_relative_lib_dir.py
+++ lldb/scripts/get_relative_lib_dir.py
@@ -23,7 +23,7 @@
 # right answer always.
 arch_specific_libdir = distutils.sysconfig.get_python_lib(True, False)
 split_libdir = arch_specific_libdir.split(os.sep)
-lib_re = re.compile(r"^lib.+$")
+lib_re = re.compile(r"^lib.*$")
 
 for i in range(len(split_libdir)):
 match = lib_re.match(split_libdir[i])
Index: lldb/scripts/CMakeLists.txt
===
--- lldb/scripts/CMakeLists.txt
+++ lldb/scripts/CMakeLists.txt
@@ -42,15 +42,18 @@
 )
 
 if(NOT LLDB_BUILD_FRAMEWORK)
-  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
-set(swig_python_subdir site-packages)
-  else()
-set(swig_python_subdir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-  endif()
-
-  set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
-  set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig, sys; print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+${CMAKE_BINARY_DIR}
+OUTPUT_VARIABLE SWIG_PYTHON_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
+OUTPUT_VARIABLE SWIG_INSTALL_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
 
   # Install the LLDB python module
-  install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
+  install(DIRECTORY ${SWIG_PYTHON_DIR}/ DESTINATION ${SWIG_INSTALL_DIR})
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-22 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda, zturner, jingham, 
labath.
Herald added a project: LLDB.

This patch removes File::SetStream() and File::SetDescriptor(),
and replaces most direct uses of File with std::shared_ptr.
Instead of calling SetStream() on a file, we make a new file and
replace it.

My ultimate goal here is to introduce a new API class SBFile, which
has full support for python io.IOStream file objects.   These can
redirect read() and write() to python code, so lldb::Files will
a way to dispatch those methods.   Additionally it will need some form
of sharing and assigning files, as a SBFile will be passed in and
assigned to the main IO streams of the debugger.

In my prototype patch queue, I make File itself copyable and add a
secondary class FileOps to manage the sharing and dispatch.  In that
case SBFile was a unique_ptr.
(here: https://github.com/smoofra/llvm-project/tree/files)

However in review, Pavel Labath suggested that it be shared_ptr instead.
(here: https://reviews.llvm.org/D67793)

In order for SBFile to use shared_ptr, everything else should
as well.

If this patch is accepted, I will make SBFile use a shared_ptr
I will remove FileOps from future patches and use subclasses of File
instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67891

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Core/StreamFile.h
  lldb/include/lldb/Host/File.h
  lldb/include/lldb/Host/FileSystem.h
  lldb/scripts/Python/python-typemaps.swig
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBStream.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Core/StreamFile.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Host/common/FileCache.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Host/windows/Host.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/ModuleCache.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanTracer.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -581,11 +581,14 @@
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonFile) {
-  File file;
+  lldb::FileSP file;
   FileSystem::Instance().Open(file, FileSpec(FileSystem::DEV_NULL),
   File::eOpenOptionRead);
-  PythonFile py_file(file, "r");
-  EXPECT_TRUE(PythonFile::Check(py_file.get()));
+  EXPECT_TRUE(file);
+  if (file) {
+PythonFile py_file(*file, "r");
+EXPECT_TRUE(PythonFile::Check(py_file.get()));
+  }
 }
 
 TEST_F(PythonDataObjectsTest, TestObjectAttributes) {
Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -46,7 +46,7 @@
   else {
 TargetSP target_sp(m_thread.CalculateTarget());
 if (target_sp)
-  return target_sp->GetDebugger().GetOutputFile().get();
+  return &(target_sp->GetDebugger().GetOutputStream());
   }
   return nul

[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

2019-09-22 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna updated this revision to Diff 221222.
lawrence_danna edited the summary of this revision.
lawrence_danna added a comment.

updated description


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67891

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Core/StreamFile.h
  lldb/include/lldb/Host/File.h
  lldb/include/lldb/Host/FileSystem.h
  lldb/scripts/Python/python-typemaps.swig
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBStream.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Core/StreamFile.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Host/common/FileCache.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Host/windows/Host.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/ModuleCache.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanTracer.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -581,11 +581,14 @@
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonFile) {
-  File file;
+  lldb::FileSP file;
   FileSystem::Instance().Open(file, FileSpec(FileSystem::DEV_NULL),
   File::eOpenOptionRead);
-  PythonFile py_file(file, "r");
-  EXPECT_TRUE(PythonFile::Check(py_file.get()));
+  EXPECT_TRUE(file);
+  if (file) {
+PythonFile py_file(*file, "r");
+EXPECT_TRUE(PythonFile::Check(py_file.get()));
+  }
 }
 
 TEST_F(PythonDataObjectsTest, TestObjectAttributes) {
Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -46,7 +46,7 @@
   else {
 TargetSP target_sp(m_thread.CalculateTarget());
 if (target_sp)
-  return target_sp->GetDebugger().GetOutputFile().get();
+  return &(target_sp->GetDebugger().GetOutputStream());
   }
   return nullptr;
 }
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1358,15 +1358,15 @@
   if (module_sp && !module_sp->LoadScriptingResourceInTarget(
target, error, &feedback_stream)) {
 if (error.AsCString())
-  target->GetDebugger().GetErrorFile()->Printf(
+  target->GetDebugger().GetErrorStream().Printf(
   "unable to load scripting data for module %s - error reported was "
   "%s\n",
   module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
   error.AsCString());
   }
   if (feedback_stream.GetSize())
-target->GetDebugger().GetErrorFile()->Printf("%s\n",
- feedback_stream.GetData());
+target->GetDebugger().GetErrorStream().Printf("%s\n",
+  feedback_stream.GetData());
 }
 
 void Target::ClearModules(bool delete_locations) {
Index: lldb/source/Target/P

[Lldb-commits] [PATCH] D67887: Use _WIN32 instead of _MSC_VER

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

Just FTR, this was identical to D67857  that I 
posted a few days ago.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67887



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


[Lldb-commits] [PATCH] D67857: [LLDB] Include lldb/Host/windows/windows.h on any windows target

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo abandoned this revision.
mstorsjo added a comment.

D67887  was committed with the same change.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67857



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


[Lldb-commits] [PATCH] D67885: [LLDB] Add a missing specification of linking against dbghelp

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

@hhb - This is the only change left for builds of lldb on mingw to succeed for 
me (for x86), but I have a whole bunch of more changes lined up that fix 
warnings and other issues I've found.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67885



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


[Lldb-commits] [PATCH] D67793: new api class: SBFile

2019-09-22 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna added a comment.

@labath

I wrote a patch for the shared_ptr approach.   It's simple, but it touches a 
lot of lines.

https://reviews.llvm.org/D67891

Now that I've gone and done it, I kind of like it better that way.   If you 
approve the other patch, I'll update this one accordingly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67793



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


[Lldb-commits] [PATCH] D67892: [LLDB] Fix typo in RegisterContextDarwin_arm64

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: jasonmolenda, jingham.
Herald added subscribers: JDevlieghere, kristof.beyls.
Herald added a project: LLDB.

In these cases, the register number should be calculated from `fpu_d0`, not 
`fpu_s0`.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67892

Files:
  lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp


Index: lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
===
--- lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -503,7 +503,7 @@
   case fpu_d31: {
 ProcessSP process_sp(m_thread.GetProcess());
 if (process_sp.get()) {
-  DataExtractor regdata(&fpu.v[reg - fpu_s0], 8, 
process_sp->GetByteOrder(),
+  DataExtractor regdata(&fpu.v[reg - fpu_d0], 8, 
process_sp->GetByteOrder(),
 process_sp->GetAddressByteSize());
   offset_t offset = 0;
   value.SetDouble(regdata.GetDouble(&offset));


Index: lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
===
--- lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -503,7 +503,7 @@
   case fpu_d31: {
 ProcessSP process_sp(m_thread.GetProcess());
 if (process_sp.get()) {
-  DataExtractor regdata(&fpu.v[reg - fpu_s0], 8, process_sp->GetByteOrder(),
+  DataExtractor regdata(&fpu.v[reg - fpu_d0], 8, process_sp->GetByteOrder(),
 process_sp->GetAddressByteSize());
   offset_t offset = 0;
   value.SetDouble(regdata.GetDouble(&offset));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67893: [LLDB] Check for _WIN32 instead of _MSC_VER for code specific to windows in general

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: hhb, compnerd, amccarth.
Herald added subscribers: JDevlieghere, abidh.
Herald added a project: LLDB.

These ifdefs contain code that isn't specific to MSVC but useful for any 
windows target, like MinGW.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67893

Files:
  lldb/source/Core/IOHandler.cpp
  lldb/source/Host/common/UDPSocket.cpp
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/source/Utility/SelectHelper.cpp
  lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp

Index: lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
===
--- lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -31,7 +31,7 @@
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/FileSpec.h"
 
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 #include "lldb/Host/windows/windows.h"
 #include 
 #endif
@@ -46,7 +46,7 @@
 // Initialize and TearDown the plugin every time, so we get a brand new
 // AST every time so that modifications to the AST from each test don't
 // leak into the next test.
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
 #endif
 
@@ -69,7 +69,7 @@
 HostInfo::Terminate();
 FileSystem::Terminate();
 
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 ::CoUninitialize();
 #endif
   }
Index: lldb/source/Utility/SelectHelper.cpp
===
--- lldb/source/Utility/SelectHelper.cpp
+++ lldb/source/Utility/SelectHelper.cpp
@@ -92,7 +92,7 @@
 
 lldb_private::Status SelectHelper::Select() {
   lldb_private::Status error;
-#ifdef _MSC_VER
+#ifdef _WIN32
   // On windows FD_SETSIZE limits the number of file descriptors, not their
   // numeric value.
   lldbassert(m_fd_map.size() <= FD_SETSIZE);
@@ -107,7 +107,7 @@
   for (auto &pair : m_fd_map) {
 pair.second.PrepareForSelect();
 const lldb::socket_t fd = pair.first;
-#if !defined(__APPLE__) && !defined(_MSC_VER)
+#if !defined(__APPLE__) && !defined(_WIN32)
 lldbassert(fd < static_cast(FD_SETSIZE));
 if (fd >= static_cast(FD_SETSIZE)) {
   error.SetErrorStringWithFormat("%i is too large for select()", fd);
Index: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
===
--- lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -564,7 +564,7 @@
   select_helper.SetTimeout(*timeout);
 
 select_helper.FDSetRead(handle);
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 // select() won't accept pipes on Windows.  The entire Windows codepath
 // needs to be converted over to using WaitForMultipleObjects and event
 // HANDLEs, but for now at least this will allow ::select() to not return
Index: lldb/source/Host/common/UDPSocket.cpp
===
--- lldb/source/Host/common/UDPSocket.cpp
+++ lldb/source/Host/common/UDPSocket.cpp
@@ -80,7 +80,7 @@
   &service_info_list);
   if (err != 0) {
 error.SetErrorStringWithFormat(
-#if defined(_MSC_VER) && defined(UNICODE)
+#if defined(_WIN32) && defined(UNICODE)
 "getaddrinfo(%s, %s, &hints, &info) returned error %i (%S)",
 #else
 "getaddrinfo(%s, %s, &hints, &info) returned error %i (%s)",
Index: lldb/source/Core/IOHandler.cpp
===
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -579,7 +579,7 @@
   else
 #endif
   {
-#ifdef _MSC_VER
+#ifdef _WIN32
 const char *prompt = GetPrompt();
 if (prompt) {
   // Back up over previous prompt using Windows API
@@ -594,7 +594,7 @@
 }
 #endif
 IOHandler::PrintAsync(stream, s, len);
-#ifdef _MSC_VER
+#ifdef _WIN32
 if (prompt)
   IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt,
 strlen(prompt));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67894: [LLDB] Rework a MinGW build fix from D65691

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added a reviewer: hhb.
Herald added subscribers: JDevlieghere, abidh.
Herald added a project: LLDB.

That change didn't contain any explanation for this bit. There shouldn't be any 
need for a check for MinGW ifdefs here, as long as the include uses lowercase 
windows.h (as is used consistently elsewhere in the llvm projects).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67894

Files:
  lldb/tools/lldb-vscode/VSCode.cpp


Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -15,10 +15,8 @@
 #include "llvm/Support/FormatVariadic.h"
 
 #if defined(_WIN32)
-#ifndef __MINGW32__
 #define NOMINMAX
-#include 
-#endif // __MINGW32__
+#include 
 #include 
 #include 
 #endif


Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -15,10 +15,8 @@
 #include "llvm/Support/FormatVariadic.h"
 
 #if defined(_WIN32)
-#ifndef __MINGW32__
 #define NOMINMAX
-#include 
-#endif // __MINGW32__
+#include 
 #include 
 #include 
 #endif
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67895: [LLDB] Avoid a warning about an unused static variable

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: hhb, compnerd, amccarth.
Herald added a subscriber: JDevlieghere.
Herald added a project: LLDB.

The variable is unused on windows.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67895

Files:
  lldb/tools/lldb-server/lldb-gdbserver.cpp


Index: lldb/tools/lldb-server/lldb-gdbserver.cpp
===
--- lldb/tools/lldb-server/lldb-gdbserver.cpp
+++ lldb/tools/lldb-server/lldb-gdbserver.cpp
@@ -108,10 +108,10 @@
 {"fd", required_argument, nullptr, 'F'},
 {nullptr, 0, nullptr, 0}};
 
+#ifndef _WIN32
 // Watch for signals
 static int g_sighup_received_count = 0;
 
-#ifndef _WIN32
 static void sighup_handler(MainLoopBase &mainloop) {
   ++g_sighup_received_count;
 


Index: lldb/tools/lldb-server/lldb-gdbserver.cpp
===
--- lldb/tools/lldb-server/lldb-gdbserver.cpp
+++ lldb/tools/lldb-server/lldb-gdbserver.cpp
@@ -108,10 +108,10 @@
 {"fd", required_argument, nullptr, 'F'},
 {nullptr, 0, nullptr, 0}};
 
+#ifndef _WIN32
 // Watch for signals
 static int g_sighup_received_count = 0;
 
-#ifndef _WIN32
 static void sighup_handler(MainLoopBase &mainloop) {
   ++g_sighup_received_count;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67896: [LLDB] Add a void* cast when passing object pointers to printf %p

2019-09-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: hhb, compnerd, amccarth.
Herald added subscribers: JDevlieghere, abidh.
Herald added a project: LLDB.

This fixes build warnings in MinGW mode.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67896

Files:
  lldb/source/Host/windows/ConnectionGenericFileWindows.cpp


Index: lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
===
--- lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
+++ lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
@@ -249,8 +249,8 @@
 LLDB_LOGF(log,
   "%p ConnectionGenericFile::Read()  handle = %p, dst = %p, "
   "dst_len = %zu) => %zu, error = %s",
-  this, m_file, dst, dst_len, return_info.GetBytes(),
-  return_info.GetError().AsCString());
+  static_cast(this), m_file, dst, dst_len,
+  return_info.GetBytes(), return_info.GetError().AsCString());
   }
 
   return return_info.GetBytes();
@@ -300,8 +300,8 @@
 LLDB_LOGF(log,
   "%p ConnectionGenericFile::Write()  handle = %p, src = %p, "
   "src_len = %zu) => %zu, error = %s",
-  this, m_file, src, src_len, return_info.GetBytes(),
-  return_info.GetError().AsCString());
+  static_cast(this), m_file, src, src_len,
+  return_info.GetBytes(), return_info.GetError().AsCString());
   }
   return return_info.GetBytes();
 }


Index: lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
===
--- lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
+++ lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
@@ -249,8 +249,8 @@
 LLDB_LOGF(log,
   "%p ConnectionGenericFile::Read()  handle = %p, dst = %p, "
   "dst_len = %zu) => %zu, error = %s",
-  this, m_file, dst, dst_len, return_info.GetBytes(),
-  return_info.GetError().AsCString());
+  static_cast(this), m_file, dst, dst_len,
+  return_info.GetBytes(), return_info.GetError().AsCString());
   }
 
   return return_info.GetBytes();
@@ -300,8 +300,8 @@
 LLDB_LOGF(log,
   "%p ConnectionGenericFile::Write()  handle = %p, src = %p, "
   "src_len = %zu) => %zu, error = %s",
-  this, m_file, src, src_len, return_info.GetBytes(),
-  return_info.GetError().AsCString());
+  static_cast(this), m_file, src, src_len,
+  return_info.GetBytes(), return_info.GetError().AsCString());
   }
   return return_info.GetBytes();
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67866: [lldb] Unify python site-packages path

2019-09-22 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 221251.
hhb added a comment.

Fix symbol linker


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67866

Files:
  lldb/CMakeLists.txt
  lldb/scripts/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py
  lldb/scripts/finishSwigWrapperClasses.py
  lldb/scripts/get_relative_lib_dir.py
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -48,8 +48,7 @@
 
 protected:
   static void ComputePythonDirForApple(llvm::SmallVectorImpl &path);
-  static void ComputePythonDirForPosix(llvm::SmallVectorImpl &path);
-  static void ComputePythonDirForWindows(llvm::SmallVectorImpl &path);
+  static void ComputePythonDir(llvm::SmallVectorImpl &path);
 };
 } // namespace lldb_private
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -28,6 +28,7 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
@@ -302,35 +303,22 @@
   auto rend = llvm::sys::path::rend(path_ref);
   auto framework = std::find(rbegin, rend, "LLDB.framework");
   if (framework == rend) {
-ComputePythonDirForPosix(path);
+ComputePythonDir(path);
 return;
   }
   path.resize(framework - rend);
   llvm::sys::path::append(path, style, "LLDB.framework", "Resources", "Python");
 }
 
-void ScriptInterpreterPython::ComputePythonDirForPosix(
+void ScriptInterpreterPython::ComputePythonDir(
 llvm::SmallVectorImpl &path) {
-  auto style = llvm::sys::path::Style::posix;
-#if defined(LLDB_PYTHON_RELATIVE_LIBDIR)
-  // Build the path by backing out of the lib dir, then building with whatever
-  // the real python interpreter uses.  (e.g. lib for most, lib64 on RHEL
-  // x86_64).
-  llvm::sys::path::remove_filename(path, style);
-  llvm::sys::path::append(path, style, LLDB_PYTHON_RELATIVE_LIBDIR);
+#if defined(_WIN32)
+auto style = llvm::sys::path::Style::windows;
 #else
-  llvm::sys::path::append(path, style,
-  "python" + llvm::Twine(PY_MAJOR_VERSION) + "." +
-  llvm::Twine(PY_MINOR_VERSION),
-  "site-packages");
+auto style = llvm::sys::path::Style::posix;
 #endif
-}
-
-void ScriptInterpreterPython::ComputePythonDirForWindows(
-llvm::SmallVectorImpl &path) {
-  auto style = llvm::sys::path::Style::windows;
   llvm::sys::path::remove_filename(path, style);
-  llvm::sys::path::append(path, style, "lib", "site-packages");
+  llvm::sys::path::append(path, style, "lib" LLDB_LIBDIR_SUFFIX, "site-packages");
 
   // This will be injected directly through FileSpec.GetDirectory().SetString(),
   // so we need to normalize manually.
@@ -347,10 +335,8 @@
 
 #if defined(__APPLE__)
 ComputePythonDirForApple(path);
-#elif defined(_WIN32)
-ComputePythonDirForWindows(path);
 #else
-ComputePythonDirForPosix(path);
+ComputePythonDir(path);
 #endif
 spec.GetDirectory().SetString(path);
 return spec;
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -1,16 +1,3 @@
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  # Call a python script to gather the arch-specific libdir for
-  # modules like the lldb module.
-  execute_process(
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../../../../scripts/get_relative_lib_dir.py
-RESULT_VARIABLE get_libdir_status
-OUTPUT_VARIABLE relative_libdir
-)
-  if (get_libdir_status EQUAL 0)
-add_definitions(-DLLDB_PYTHON_RELATIVE_LIBDIR="${relative_libdir}")
-  endif()
-endif()
-
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
   PythonDataObjects.cpp
   PythonExceptionState.cpp
Index: lldb/scripts/get_relative_lib_dir.py
===
--- lldb/scripts/get_relative_lib_dir.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import distutils.sysconfig
-import os
-import platform
-import re
-import sys
-
-
-def g

[Lldb-commits] [PATCH] D67866: [lldb] Unify python site-packages path

2019-09-22 Thread Michał Górny via Phabricator via lldb-commits
mgorny requested changes to this revision.
mgorny added a comment.
This revision now requires changes to proceed.

I do not believe this to be the right approach. Unconditionally installing 
Python modules to the wrong directory is a bug, not a feature. It should be 
fixed (as I proposed in D67890 ), not made 
more prominent by making everything hinge on it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67866



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


[Lldb-commits] [lldb] r372548 - [lldb] Fix LLDB build after r372538

2019-09-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sun Sep 22 23:59:35 2019
New Revision: 372548

URL: http://llvm.org/viewvc/llvm-project?rev=372548&view=rev
Log:
[lldb] Fix LLDB build after r372538

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

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=372548&r1=372547&r2=372548&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Sun Sep 22 23:59:35 2019
@@ -8229,7 +8229,8 @@ clang::CXXMethodDecl *ClangASTContext::A
 getASTContext()->DeclarationNames.getCXXDestructorName(
 getASTContext()->getCanonicalType(record_qual_type)),
 clang::SourceLocation()),
-method_qual_type, nullptr, is_inline, is_artificial);
+method_qual_type, nullptr, is_inline, is_artificial,
+  ConstexprSpecKind::CSK_unspecified);
 cxx_method_decl = cxx_dtor_decl;
   } else if (decl_name == cxx_record_decl->getDeclName()) {
 cxx_ctor_decl = clang::CXXConstructorDecl::Create(


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