[Lldb-commits] [lldb] r365526 - [lldb, windows] Update two more locations that use LaunchThread to the new function signature

Stella Stamenova via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 9 11:10:36 PDT 2019


Author: stella.stamenova
Date: Tue Jul  9 11:10:36 2019
New Revision: 365526

URL: http://llvm.org/viewvc/llvm-project?rev=365526&view=rev
Log:
[lldb, windows] Update two more locations that use LaunchThread to the new function signature

Modified:
    lldb/trunk/source/Host/windows/HostProcessWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=365526&r1=365525&r2=365526&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Tue Jul  9 11:10:36 2019
@@ -14,6 +14,7 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/WindowsError.h"
 
 #include <psapi.h>
 
@@ -94,8 +95,7 @@ llvm::Expected<HostThread> HostProcessWi
                                         HostProcessWindows::MonitorThread,
                                         info);
   } else {
-    DWORD err = GetLastError();
-    return llvm::errorCodeToError(std::error_code(err, std::system_category()));
+    return llvm::errorCodeToError(llvm::mapWindowsError(GetLastError()));
   }
 }
 

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp?rev=365526&r1=365525&r2=365526&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Tue Jul  9 11:10:36 2019
@@ -63,16 +63,18 @@ Status DebuggerThread::DebugLaunch(const
   Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
   LLDB_LOG(log, "launching '{0}'", launch_info.GetExecutableFile().GetPath());
 
-  Status error;
+  Status result;
   DebugLaunchContext *context = new DebugLaunchContext(this, launch_info);
-  HostThread slave_thread(ThreadLauncher::LaunchThread(
-      "lldb.plugin.process-windows.slave[?]", DebuggerThreadLaunchRoutine,
-      context, &error));
 
-  if (!error.Success())
-    LLDB_LOG(log, "couldn't launch debugger thread. {0}", error);
+  llvm::Expected<HostThread> slave_thread = ThreadLauncher::LaunchThread(
+      "lldb.plugin.process-windows.slave[?]", DebuggerThreadLaunchRoutine,
+      context);
+  if (!slave_thread) {
+    result = Status(slave_thread.takeError());
+    LLDB_LOG(log, "couldn't launch debugger thread. {0}", result);
+  }
 
-  return error;
+  return result;
 }
 
 Status DebuggerThread::DebugAttach(lldb::pid_t pid,
@@ -80,16 +82,18 @@ Status DebuggerThread::DebugAttach(lldb:
   Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
   LLDB_LOG(log, "attaching to '{0}'", pid);
 
-  Status error;
+  Status result;
   DebugAttachContext *context = new DebugAttachContext(this, pid, attach_info);
-  HostThread slave_thread(ThreadLauncher::LaunchThread(
-      "lldb.plugin.process-windows.slave[?]", DebuggerThreadAttachRoutine,
-      context, &error));
 
-  if (!error.Success())
-    LLDB_LOG(log, "couldn't attach to process '{0}'. {1}", pid, error);
+  llvm::Expected<HostThread> slave_thread = ThreadLauncher::LaunchThread(
+      "lldb.plugin.process-windows.slave[?]", DebuggerThreadAttachRoutine,
+      context);
+  if (!slave_thread) {
+    result = Status(slave_thread.takeError());
+    LLDB_LOG(log, "couldn't attach to process '{0}'. {1}", pid, result);
+  }
 
-  return error;
+  return result;
 }
 
 lldb::thread_result_t DebuggerThread::DebuggerThreadLaunchRoutine(void *data) {




More information about the lldb-commits mailing list