bool LLDBConnector::LaunchLocalDebugServer()
{
#ifdef __WXMSW__
    // Not supported :(
    ::wxMessageBox(_("Locally debugging with LLDB on Windows is not supported by LLDB"), "CodeLite", wxICON_WARNING|wxOK|wxCENTER);
    return false;
#endif

    CL_DEBUG("Launching codelite-lldb");
    // Start the debugger
    if ( m_process ) {
        // another debugger process is already running
        return false;
    }
    
    // Apply the environment before we start
    wxStringMap_t om;
    
#ifdef __WXMAC__
    // set the LLDB_DEBUGSERVER_PATH env variable
    wxFileName debugserver(wxStandardPaths::Get().GetExecutablePath());
    debugserver.SetFullName( "debugserver" );
    debugserver.RemoveLastDir();
    debugserver.AppendDir("SharedSupport");
    om["LLDB_DEBUGSERVER_PATH"] = debugserver.GetFullPath();
#endif

    EnvSetter es(NULL, &om);
    
    wxFileName fnCodeLiteLLDB(wxStandardPaths::Get().GetExecutablePath());
    fnCodeLiteLLDB.SetFullName( "codelite-lldb" );
    
    wxString command;
    command << fnCodeLiteLLDB.GetFullPath() << " -s " << GetDebugServerPath();
    
    m_process = ::CreateAsyncProcess(this, command);
    if ( !m_process ) {
        CL_ERROR("LLDBConnector: failed to launch codelite-lldb: %s", fnCodeLiteLLDB.GetFullPath());
        return false;
        
    } else {
        CL_DEBUG("codelite-lldb launched successfully. PID=%d\n", m_process->GetPid());
        
    }
    return true;
}
Beispiel #2
0
void LLDBConnector::LaunchDebugServer()
{
    CL_DEBUG("Launching codelite-lldb");
    // Start the debugger
    if ( m_process ) {
        // another debugger process is already running
        return;
    }
    
    // Apply the environment before we start
    EnvSetter es;
    
    wxFileName fnCodeLiteLLDB(wxStandardPaths::Get().GetExecutablePath());
    fnCodeLiteLLDB.SetFullName( "codelite-lldb" );
    
#ifdef __WXMAC__
    wxFileName debugserver(wxStandardPaths::Get().GetExecutablePath());
    debugserver.SetFullName( "debugserver" );
    debugserver.RemoveLastDir();
    debugserver.AppendDir("SharedSupport");
    ::wxSetEnv("LLDB_DEBUGSERVER_PATH", debugserver.GetFullPath());
#endif

    wxString command;
    command << fnCodeLiteLLDB.GetFullPath() << " " << ::wxGetProcessId();
    
    // FIXME: 
    // On OSX, make sure we set the environment variable LLDB_DEBUGSERVER_PATH
    m_process = ::CreateAsyncProcess(this, command);
    if ( !m_process ) {
        CL_ERROR("LLDBConnector: failed to launch codelite-lldb: %s", fnCodeLiteLLDB.GetFullPath());
    }
#ifdef __WXMAC__
    ::wxUnsetEnv("LLDB_DEBUGSERVER_PATH");
#endif
    CL_DEBUG("codelite-lldb launcged successfully. PID=%d\n", m_process->GetPid());
}