[Lldb-commits] [lldb] r365295 - Change LaunchThread interface to return an Expected for non-Apple-non-Windows

Carlo Kok via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 8 04:51:42 PDT 2019


This looks to be broken on Windows: 

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2555	'lldb_private::HostProcessWindows::StartMonitoring': overriding virtual function return type differs and is not covariant from 'lldb_private::HostNativeProcessBase::StartMonitoring'	lldbPluginProcessWindowsCommon	C:\p\llvm\llvm\tools\lldb\include\lldb\Host\windows\HostProcessWindows.h	33	
Error	C2664	'llvm::Expected<lldb_private::HostThread> lldb_private::ThreadLauncher::LaunchThread(llvm::StringRef,lldb::thread_func_t,lldb::thread_arg_t,size_t)': cannot convert argument 4 from 'lldb_private::Status *' to 'size_t'	lldbPluginProcessWindowsCommon	C:\p\llvm\llvm\tools\lldb\source\Plugins\Process\Windows\Common\DebuggerThread.cpp	68	
Error	C2664	'llvm::Expected<lldb_private::HostThread> lldb_private::ThreadLauncher::LaunchThread(llvm::StringRef,lldb::thread_func_t,lldb::thread_arg_t,size_t)': cannot convert argument 4 from 'lldb_private::Status *' to 'size_t'	lldbPluginProcessWindowsCommon	C:\p\llvm\llvm\tools\lldb\source\Plugins\Process\Windows\Common\DebuggerThread.cpp	85	

On Mon, Jul 8, 2019, at 09:06, Fangrui Song via lldb-commits wrote:
> Author: maskray
> Date: Mon Jul  8 00:07:05 2019
> New Revision: 365295
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=365295&view=rev
> Log:
> Change LaunchThread interface to return an Expected for non-Apple-non-Windows
> 
> Fixes Linux build errors after D64163/r365226
> 
> Modified:
>     lldb/trunk/include/lldb/Host/Host.h
>     lldb/trunk/include/lldb/Host/HostNativeProcessBase.h
>     lldb/trunk/include/lldb/Host/HostProcess.h
>     lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h
>     lldb/trunk/source/Host/common/Host.cpp
>     lldb/trunk/source/Host/common/HostProcess.cpp
>     lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
>     lldb/trunk/source/Host/common/ProcessLaunchInfo.cpp
>     lldb/trunk/source/Host/posix/HostProcessPosix.cpp
> 
> Modified: lldb/trunk/include/lldb/Host/Host.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Host/Host.h (original)
> +++ lldb/trunk/include/lldb/Host/Host.h Mon Jul  8 00:07:05 2019
> @@ -99,7 +99,7 @@ public:
>    ///     was spawned to monitor \a pid.
>    ///
>    /// \see static void Host::StopMonitoringChildProcess (uint32_t)
> -  static HostThread
> +  static llvm::Expected<HostThread>
>    StartMonitoringChildProcess(const MonitorChildProcessCallback 
> &callback,
>                                lldb::pid_t pid, bool monitor_signals);
>  
> 
> Modified: lldb/trunk/include/lldb/Host/HostNativeProcessBase.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostNativeProcessBase.h?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Host/HostNativeProcessBase.h (original)
> +++ lldb/trunk/include/lldb/Host/HostNativeProcessBase.h Mon Jul  8 
> 00:07:05 2019
> @@ -35,7 +35,7 @@ public:
>  
>    lldb::process_t GetSystemHandle() const { return m_process; }
>  
> -  virtual HostThread
> +  virtual llvm::Expected<HostThread>
>    StartMonitoring(const Host::MonitorChildProcessCallback &callback,
>                    bool monitor_signals) = 0;
>  
> 
> Modified: lldb/trunk/include/lldb/Host/HostProcess.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostProcess.h?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Host/HostProcess.h (original)
> +++ lldb/trunk/include/lldb/Host/HostProcess.h Mon Jul  8 00:07:05 2019
> @@ -43,8 +43,9 @@ public:
>    lldb::pid_t GetProcessId() const;
>    bool IsRunning() const;
>  
> -  HostThread StartMonitoring(const Host::MonitorChildProcessCallback &callback,
> -                             bool monitor_signals);
> +  llvm::Expected<HostThread>
> +  StartMonitoring(const Host::MonitorChildProcessCallback &callback,
> +                  bool monitor_signals);
>  
>    HostNativeProcessBase &GetNativeProcess();
>    const HostNativeProcessBase &GetNativeProcess() const;
> 
> Modified: lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h (original)
> +++ lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h Mon Jul  8 
> 00:07:05 2019
> @@ -32,8 +32,9 @@ public:
>    lldb::pid_t GetProcessId() const override;
>    bool IsRunning() const override;
>  
> -  HostThread StartMonitoring(const Host::MonitorChildProcessCallback &callback,
> -                             bool monitor_signals) override;
> +  llvm::Expected<HostThread>
> +  StartMonitoring(const Host::MonitorChildProcessCallback &callback,
> +                  bool monitor_signals) override;
>  };
>  
>  } // namespace lldb_private
> 
> Modified: lldb/trunk/source/Host/common/Host.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/source/Host/common/Host.cpp (original)
> +++ lldb/trunk/source/Host/common/Host.cpp Mon Jul  8 00:07:05 2019
> @@ -99,7 +99,7 @@ struct MonitorInfo {
>  
>  static thread_result_t MonitorChildProcessThreadFunction(void *arg);
>  
> -HostThread Host::StartMonitoringChildProcess(
> +llvm::Expected<HostThread> Host::StartMonitoringChildProcess(
>      const Host::MonitorChildProcessCallback &callback, lldb::pid_t pid,
>      bool monitor_signals) {
>    MonitorInfo *info_ptr = new MonitorInfo();
> @@ -112,7 +112,7 @@ HostThread Host::StartMonitoringChildPro
>    ::snprintf(thread_name, sizeof(thread_name),
>               "<lldb.host.wait4(pid=%" PRIu64 ")>", pid);
>    return ThreadLauncher::LaunchThread(
> -      thread_name, MonitorChildProcessThreadFunction, info_ptr, nullptr);
> +      thread_name, MonitorChildProcessThreadFunction, info_ptr, 0);
>  }
>  
>  #ifndef __linux__
> 
> Modified: lldb/trunk/source/Host/common/HostProcess.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostProcess.cpp?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/source/Host/common/HostProcess.cpp (original)
> +++ lldb/trunk/source/Host/common/HostProcess.cpp Mon Jul  8 00:07:05 
> 2019
> @@ -32,7 +32,7 @@ lldb::pid_t HostProcess::GetProcessId()
>  
>  bool HostProcess::IsRunning() const { return m_native_process->IsRunning(); }
>  
> -HostThread
> +llvm::Expected<HostThread>
>  HostProcess::StartMonitoring(const Host::MonitorChildProcessCallback &callback,
>                               bool monitor_signals) {
>    return m_native_process->StartMonitoring(callback, monitor_signals);
> 
> Modified: lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp 
> (original)
> +++ lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp Mon Jul 
>  8 00:07:05 2019
> @@ -53,8 +53,12 @@ MonitoringProcessLauncher::LaunchProcess
>      Log 
> *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
>  
>      assert(launch_info.GetMonitorProcessCallback());
> -    process.StartMonitoring(launch_info.GetMonitorProcessCallback(),
> -                            launch_info.GetMonitorSignals());
> +    llvm::Expected<HostThread> maybe_thread =
> +        
> process.StartMonitoring(launch_info.GetMonitorProcessCallback(),
> +                                launch_info.GetMonitorSignals());
> +    if (!maybe_thread)
> +      error.SetErrorStringWithFormatv("failed to launch host thread: 
> {}",
> +                                      
> llvm::toString(maybe_thread.takeError()));
>      if (log)
>        log->PutCString("started monitoring child process.");
>    } else {
> 
> Modified: lldb/trunk/source/Host/common/ProcessLaunchInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/ProcessLaunchInfo.cpp?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/source/Host/common/ProcessLaunchInfo.cpp (original)
> +++ lldb/trunk/source/Host/common/ProcessLaunchInfo.cpp Mon Jul  8 
> 00:07:05 2019
> @@ -188,8 +188,13 @@ bool ProcessLaunchInfo::NoOpMonitorCallb
>  
>  bool ProcessLaunchInfo::MonitorProcess() const {
>    if (m_monitor_callback && ProcessIDIsValid()) {
> +    llvm::Expected<HostThread> maybe_thread =
>      Host::StartMonitoringChildProcess(m_monitor_callback, GetProcessID(),
>                                        m_monitor_signals);
> +    if (!maybe_thread)
> +      LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST),
> +               "failed to launch host thread: {}",
> +               llvm::toString(maybe_thread.takeError()));
>      return true;
>    }
>    return false;
> 
> Modified: lldb/trunk/source/Host/posix/HostProcessPosix.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostProcessPosix.cpp?rev=365295&r1=365294&r2=365295&view=diff
> ==============================================================================
> --- lldb/trunk/source/Host/posix/HostProcessPosix.cpp (original)
> +++ lldb/trunk/source/Host/posix/HostProcessPosix.cpp Mon Jul  8 
> 00:07:05 2019
> @@ -87,7 +87,7 @@ bool HostProcessPosix::IsRunning() const
>    return error.Success();
>  }
>  
> -HostThread HostProcessPosix::StartMonitoring(
> +llvm::Expected<HostThread> HostProcessPosix::StartMonitoring(
>      const Host::MonitorChildProcessCallback &callback, bool monitor_signals) {
>    return Host::StartMonitoringChildProcess(callback, m_process,
>                                             monitor_signals);
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>


More information about the lldb-commits mailing list