bool LLDBDebugger::Run( const wxString &in, const wxString& out, const wxString &err, const wxArrayString& argvArr, const wxArrayString& envArr, const wxString &workingDirectory) { if ( m_debugger.IsValid() ) { // Construct char** arrays const char** argv = (const char**)_wxArrayStringToCharPtrPtr(argvArr); const char** envp = (const char**)_wxArrayStringToCharPtrPtr(envArr); const char* pin = in.mb_str(wxConvUTF8).data(); const char* pout = out.mb_str(wxConvUTF8).data(); const char* perr = err.mb_str(wxConvUTF8).data(); const char* wd = workingDirectory.mb_str(wxConvUTF8).data(); lldb::SBError error; lldb::SBListener listener = m_debugger.GetListener(); bool isOk = m_target.Launch(listener, argv, envp, pin, pout, perr, wd, 0, false, error).IsValid(); _deleteCharPtrPtr( const_cast<char**>(argv) ); _deleteCharPtrPtr( const_cast<char**>(envp) ); if ( !isOk ) { Cleanup(); NotifyExited(); } return isOk; } return false; }
bool LLDBDebugger::Run( const wxString &in, const wxString& out, const wxString &err, const wxArrayString& argvArr, const wxArrayString& envArr, const wxString &workingDirectory) { if ( m_thread ) { return false; } if ( m_debugger.IsValid() ) { // Construct char** arrays const char** argv = (const char**)_wxArrayStringToCharPtrPtr(argvArr); const char** envp = (const char**)_wxArrayStringToCharPtrPtr(envArr); const char* pin = in.mb_str(wxConvUTF8).data(); const char* pout = out.mb_str(wxConvUTF8).data(); const char* perr = err.mb_str(wxConvUTF8).data(); const char* wd = workingDirectory.mb_str(wxConvUTF8).data(); wxUnusedVar(pin); wxUnusedVar(pout); wxUnusedVar(perr); lldb::SBLaunchInfo launchInfo(argv); lldb::SBError error; // Set the launch flags launchInfo.SetLaunchFlags(lldb::eLaunchFlagStopAtEntry | lldb::eLaunchFlagLaunchInSeparateProcessGroup); launchInfo.SetEnvironmentEntries(envp, false); launchInfo.SetWorkingDirectory(wd); launchInfo.AddOpenFileAction(STDIN_FILENO, pin, true, false); launchInfo.AddOpenFileAction(STDERR_FILENO, perr, false, true); launchInfo.AddOpenFileAction(STDOUT_FILENO, pout, false, true); bool isOk = m_target.Launch(launchInfo, error).IsValid(); //bool isOk = m_target.LaunchSimple(argv, envp, wd).IsValid(); _deleteCharPtrPtr( const_cast<char**>(argv) ); _deleteCharPtrPtr( const_cast<char**>(envp) ); if ( !isOk ) { Cleanup(); NotifyExited(); } m_debugeePid = m_target.GetProcess().GetProcessID(); m_thread = new LLDBDebuggerThread(this, m_debugger.GetListener(), m_target.GetProcess()); m_thread->Start(); return isOk; } return false; }