void CompilerLocatorGCC::AddTools(CompilerPtr compiler,
                                  const wxString& binFolder,
                                  const wxString& suffix)
{
    wxFileName masterPath(binFolder, "");
    wxString defaultBinFolder = "/usr/bin";
    compiler->SetCompilerFamily(COMPILER_FAMILY_GCC);
    compiler->SetInstallationPath( binFolder );

    CL_DEBUG("Found GNU GCC compiler under: %s. \"%s\"", masterPath.GetPath(), compiler->GetName());
    wxFileName toolFile(binFolder, "");

    // ++++-----------------------------------------------------------------
    // With XCode installation, only
    // g++, gcc, and make are installed under the Xcode installation folder
    // the rest (mainly ar and as) are taken from /usr/bin
    // ++++-----------------------------------------------------------------

    toolFile.SetFullName("g++");
    AddTool(compiler, "CXX", toolFile.GetFullPath(), suffix);
    AddTool(compiler, "LinkerName", toolFile.GetFullPath(), suffix);
#ifndef __WXMAC__
    AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), suffix, "-shared -fPIC");
#else
    AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), suffix, "-dynamiclib -fPIC");
#endif
    toolFile.SetFullName("gcc");
    AddTool(compiler, "CC", toolFile.GetFullPath(), suffix);
    toolFile.SetFullName("make");
    wxString makeExtraArgs;
    if ( wxThread::GetCPUCount() > 1 ) {
        makeExtraArgs << "-j" << wxThread::GetCPUCount();
    }
    AddTool(compiler, "MAKE", toolFile.GetFullPath(), "", makeExtraArgs);

    // ++++-----------------------------------------------------------------
    // From this point on, we use /usr/bin only
    // ++++-----------------------------------------------------------------

    toolFile.AssignDir( defaultBinFolder );
    toolFile.SetFullName("ar");
    AddTool(compiler, "AR", toolFile.GetFullPath(), "", "rcu");

    toolFile.SetFullName("windres");
    AddTool(compiler, "ResourceCompiler", "", "");

    toolFile.SetFullName("as");
    AddTool(compiler, "AS", toolFile.GetFullPath(), "");
}
void ConnectionSmEncryptionKeyRefresh(const typed_bdaddr* taddr)
{
#ifdef CONNECTION_DEBUG_LIB
    if(taddr == NULL)
    {
       CL_DEBUG(("Out of range Bluetooth Address 0x%p\n", (void*)taddr)); 
    }
#endif
    
    {
        MAKE_CL_MESSAGE(CL_INTERNAL_SM_ENCRYPTION_KEY_REFRESH_REQ);
        message->taddr = *taddr;
        MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_ENCRYPTION_KEY_REFRESH_REQ, message); 
    }
}
Beispiel #3
0
void CppCheckPlugin::DoProcess(ProjectPtr proj)
{
    wxString command = DoGetCommand(proj);
    m_view->AppendLine(wxString::Format(_("Starting cppcheck: %s\n"), command.c_str()));

#if defined(__WXMSW__)
    // Under Windows, we set the working directory to the binary folder
    // so the configurtion files can be found
    CL_DEBUG("CppCheck: Working directory: %s", clStandardPaths::Get().GetBinFolder());
    CL_DEBUG("CppCheck: Command: %s", command);
    m_cppcheckProcess = CreateAsyncProcess(this, command, IProcessCreateDefault, clStandardPaths::Get().GetBinFolder());
#elif defined(__WXOSX__)
    CL_DEBUG("CppCheck: Working directory: %s", clStandardPaths::Get().GetDataDir());
    CL_DEBUG("CppCheck: Command: %s", command);
    m_cppcheckProcess = CreateAsyncProcess(this, command, IProcessCreateDefault, clStandardPaths::Get().GetDataDir());

#else
    m_cppcheckProcess = CreateAsyncProcess(this, command);
#endif
    if(!m_cppcheckProcess) {
        wxMessageBox(_("Failed to launch codelite_cppcheck process!"), _("Warning"), wxOK | wxCENTER | wxICON_WARNING);
        return;
    }
}
Beispiel #4
0
void LLDBPlugin::TerminateTerminal()
{
    if(m_terminalPID != wxNOT_FOUND) {
        CL_DEBUG("Killing Terminal Process PID: %d", (int)m_terminalPID);
        ::wxKill(m_terminalPID, wxSIGKILL);
        m_terminalPID = wxNOT_FOUND;
    }
#ifdef __WXGTK__
    if(m_terminalTTY.StartsWith("/tmp/pts")) {
        // this is a fake symlink - remove it
        ::unlink(m_terminalTTY.mb_str(wxConvUTF8).data());
    }
#endif
    m_terminalTTY.Clear();
}
Beispiel #5
0
void ConnectionL2capUnmapConnectionlessRequest(Sink sink)
{
    if (sink)
    {
        MAKE_CL_MESSAGE(CL_INTERNAL_L2CAP_UNMAP_CONNECTIONLESS_REQ);
        message->sink = sink;
        MessageSend(connectionGetCmTask(), CL_INTERNAL_L2CAP_UNMAP_CONNECTIONLESS_REQ, message);
    }
#ifdef CONNECTION_DEBUG_LIB
    else
    {
        CL_DEBUG(("Sink is NULL!\n"));
    }
#endif
}
FileNameVector_t CompilationDatabase::GetCompileCommandsFiles() const
{
    wxFileName databaseFile(GetFileName());
    wxFileName fn(databaseFile);

    // Usually it will be under the top folder
    fn.RemoveLastDir();

    // Since we can have multiple "compile_commands.json" files, we take the most updated file
    // Prepare a list of files to check
    FileNameVector_t files;
    std::queue<std::pair<wxString, int> > dirs;

    // we start with the current path
    dirs.push(std::make_pair(fn.GetPath(), 0));

    const int MAX_DEPTH = 2; // If no files were found, scan 2 levels only

    while(!dirs.empty()) {
        std::pair<wxString, int> curdir = dirs.front();
        dirs.pop();
        if(files.empty() && (curdir.second > MAX_DEPTH)) {
            CL_DEBUG("Could not find compile_commands.json files while reaching depth 2, aborting");
            break;
        }

        wxFileName fn(curdir.first, "compile_commands.json");
        if(fn.Exists()) {
            CL_DEBUGS("CompilationDatabase: found file: " + fn.GetFullPath());
            files.push_back(fn);
        }

        // Check to see if there are more directories to recurse
        wxDir dir;
        if(dir.Open(curdir.first)) {
            wxString dirname;
            bool cont = dir.GetFirst(&dirname, "", wxDIR_DIRS);
            while(cont) {
                wxString new_dir;
                new_dir << curdir.first << wxFileName::GetPathSeparator() << dirname;
                dirs.push(std::make_pair(new_dir, curdir.second + 1));
                dirname.Clear();
                cont = dir.GetNext(&dirname);
            }
        }
    }
    return files;
}
void LLDBConnector::DeleteBreakpoints()
{
    if ( IsCanInteract() ) {
        CL_DEBUGS(wxString () << "codelite: deleting breakpoints (total of " << m_pendingDeletionBreakpoints.size() << " breakpoints)");
        LLDBCommand command;
        command.SetCommandType( kCommandDeleteBreakpoint );
        command.SetBreakpoints( m_pendingDeletionBreakpoints );
        SendCommand( command );
        CL_DEBUGS(wxString () << "codelite: DeleteBreakpoints celar pending deletionbreakpoints queue");
        m_pendingDeletionBreakpoints.clear();
    
    } else {
        CL_DEBUG("codelite: interrupting codelite-lldb for kInterruptReasonDeleteBreakpoint");
        Interrupt( kInterruptReasonDeleteBreakpoint );
    }
}
Beispiel #8
0
void ClangUtils::printDiagnosticsToLog(CXTranslationUnit& TU)
{
	//// Report diagnostics to the log file
	const unsigned diagCount = clang_getNumDiagnostics(TU);
	for(unsigned i=0; i<diagCount; i++) {
		CXDiagnostic diag     = clang_getDiagnostic(TU, i);
		CXString diagStr      = clang_formatDiagnostic(diag, clang_defaultDiagnosticDisplayOptions());
		wxString wxDiagString = wxString(clang_getCString(diagStr), wxConvUTF8);
		if(!wxDiagString.Contains(wxT("'dllimport' attribute"))) {
			CL_DEBUG(wxT("Diagnostic: %s"), wxDiagString.c_str());

		}
		clang_disposeString(diagStr);
		clang_disposeDiagnostic(diag);
	}
}
Beispiel #9
0
static void t_mine_init ( MbsTask *task )
{
  GList *l;
  gint64 total = 0;
  task->data = g_new0(MineData, 1);
  for (l = MB_SECTOR(MB_COLONY_SECTOR(MB_TASK_COLONY(task)))->veins; l; l = l->next)
    {
      if (MB_VEIN_RESOURCE(l->data) == MB_TASK_RESOURCE(task))
        MINE_DATA(task)->veins = g_list_append(MINE_DATA(task)->veins,
                                               l_object_ref(l->data));
      total += MB_VEIN_QTTY(l->data);
    }
  CL_DEBUG("mine task '%s' : %" G_GINT64_FORMAT,
           MB_RESOURCE_NAME(MB_TASK_RESOURCE(task)),
           total);
}
void CompilerLocatorMinGW::AddTools(CompilerPtr compiler, const wxString& binFolder, const wxString& name)
{
    wxFileName masterPath(binFolder, "");
    masterPath.RemoveLastDir();
    if ( m_locatedFolders.count(masterPath.GetPath()) ) {
        return;
    }
    m_locatedFolders.insert( masterPath.GetPath() );
    
    if ( name.IsEmpty() ) {
        compiler->SetName("MinGW ( " + masterPath.GetDirs().Last() + " )");

    } else {
        compiler->SetName("MinGW ( " + name + " )");
    }
    
    CL_DEBUG("Found MinGW compiler under: %s. \"%s\"", masterPath.GetPath(), compiler->GetName());
    wxFileName toolFile(binFolder, "");
    
    toolFile.SetFullName("g++.exe");
    AddTool(compiler, "CXX", toolFile.GetFullPath());
    AddTool(compiler, "LinkerName", toolFile.GetFullPath());
    AddTool(compiler, "SharedObjectLinkerName", toolFile.GetFullPath(), "-shared -fPIC");
    
    toolFile.SetFullName("gcc.exe");
    AddTool(compiler, "CC", toolFile.GetFullPath());

    toolFile.SetFullName("ar.exe");
    AddTool(compiler, "AR", toolFile.GetFullPath(), "rcu");

    toolFile.SetFullName("windres.exe");
    AddTool(compiler, "ResourceCompiler", toolFile.GetFullPath());
    
    toolFile.SetFullName("as.exe");
    AddTool(compiler, "AS", toolFile.GetFullPath());
    
    toolFile.SetFullName("make.exe");
    if ( toolFile.FileExists() ) {
        AddTool(compiler, "MAKE", toolFile.GetFullPath());
        
    } else {
        toolFile.SetFullName("mingw32-make.exe");
        if ( toolFile.FileExists() ) {
            AddTool(compiler, "MAKE", toolFile.GetFullPath());
        }
    }
}
CXTranslationUnit ClangWorkerThread::DoCreateTU(CXIndex index, ClangThreadRequest* task, bool reparse)
{
    wxFileName fn(task->GetFileName());
    DoSetStatusMsg(wxString::Format(wxT("clang: parsing file %s..."), fn.GetFullName().c_str()));

    FileExtManager::FileType type = FileExtManager::GetType(task->GetFileName());
    int argc(0);
    char** argv = MakeCommandLine(task, argc, type);

    for(int i = 0; i < argc; i++) {
        CL_DEBUG(wxT("Command Line Argument: %s"), wxString(argv[i], wxConvUTF8).c_str());
    }

    std::string c_filename = task->GetFileName().mb_str(wxConvUTF8).data();
    CL_DEBUG(wxT("Calling clang_parseTranslationUnit..."));

    // First time, need to create it
    unsigned flags;
    if(reparse) {
        flags = CXTranslationUnit_CacheCompletionResults | CXTranslationUnit_PrecompiledPreamble |
                CXTranslationUnit_Incomplete | CXTranslationUnit_DetailedPreprocessingRecord |
                CXTranslationUnit_CXXChainedPCH;
    } else {
        flags = CXTranslationUnit_Incomplete | 
#if HAS_LIBCLANG_BRIEFCOMMENTS
		CXTranslationUnit_SkipFunctionBodies |
#endif
                CXTranslationUnit_DetailedPreprocessingRecord;
    }

    CXTranslationUnit TU = clang_parseTranslationUnit(index, c_filename.c_str(), argv, argc, NULL, 0, flags);

    CL_DEBUG(wxT("Calling clang_parseTranslationUnit... done"));
    ClangUtils::FreeArgv(argv, argc);
    DoSetStatusMsg(wxString::Format(wxT("clang: parsing file %s...done"), fn.GetFullName().c_str()));
    if(TU && reparse) {
        CL_DEBUG(wxT("Calling clang_reparseTranslationUnit..."));
        if(clang_reparseTranslationUnit(TU, 0, NULL, clang_defaultReparseOptions(TU)) == 0) {
            CL_DEBUG(wxT("Calling clang_reparseTranslationUnit... done"));
            return TU;

        } else {
            CL_DEBUG(wxT("An error occured during reparsing of the TU for file %s. TU: %p"),
                     task->GetFileName().c_str(),
                     (void*)TU);

            // The only thing that left to be done here, is to dispose the TU
            clang_disposeTranslationUnit(TU);
            PostEvent(wxEVT_CLANG_TU_CREATE_ERROR, task->GetFileName());
            return NULL;
        }
    }
    return TU;
}
Beispiel #12
0
void clTernServer::OnTernTerminated(clProcessEvent& event)
{
    wxDELETE(m_tern);
    if(m_goingDown || !m_jsCCManager->IsEnabled()) {
        return;
    }
#if defined(__WXMSW__) && !defined(NDEBUG)
    HANDLE hProcess = ::GetCurrentProcess();
    DWORD handleCount;
    ::GetProcessHandleCount(hProcess, &handleCount);
    CL_DEBUG("Tern process termianted. Number of handles %d", (int)handleCount);
    ::CloseHandle(hProcess);
#endif

    PrintMessage("Tern server terminated, will restart it\n");
    Start(m_workingDirectory);
}
void NotebookNavigationDlg::OnKeyUp(wxKeyEvent& event)
{
    CL_DEBUG("NotebookNavigationDlg::OnKeyUp");
#ifdef __WXOSX__
    if(event.GetKeyCode() == WXK_ALT) {
        CloseDialog();
    } else {
        event.Skip();
    }
#else
    if(event.GetKeyCode() == WXK_CONTROL) {
        CloseDialog();
    } else {
        event.Skip();
    }
#endif
}
void ConnectionWriteScanEnable(hci_scan_enable mode)
{
    /* Check params are within allowed values - debug build only */
#ifdef CONNECTION_DEBUG_LIB    
    if (mode > hci_scan_enable_inq_and_page)
    {
        CL_DEBUG(("Out of range scan enable 0x%x\n", mode));
    }
#endif
    
    {
        /* All requests are sent through the internal state handler */
        MAKE_CL_MESSAGE(CL_INTERNAL_DM_WRITE_SCAN_ENABLE_REQ);
        message->mode = mode;
        MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_WRITE_SCAN_ENABLE_REQ, message);
    }
}
void ClangCleanerThread::DeleteStalePCHFiles()
{
    wxString tmpdir;
    if ( ::wxGetEnv("TMP", &tmpdir) ) {
        wxArrayString files;
        if ( wxDir::GetAllFiles(tmpdir, &files, "*.pch", wxDIR_FILES) ) {
            for(size_t i=0; i<files.GetCount(); ++i) {
                wxFileName fn( files.Item(i) );
                if ( fn.GetFullName().StartsWith("preamble") ) {
                    if( ::wxRemoveFile( files.Item(i) ) ) {
                        CL_DEBUG("Deleting stale file: %s", files.Item(i) );
                    }
                }
            }
        }
    }
}
void ClangCodeCompletion::OnFileSaved(wxCommandEvent& e)
{
    e.Skip();
    CHECK_CLANG_ENABLED_RET();

    if( TagsManagerST::Get()->GetCtagsOptions().GetFlags() & ::CC_DISABLE_AUTO_PARSING) {
        CL_DEBUG(wxT("ClangCodeCompletion::OnFileSaved: Auto-parsing of saved files is disabled"));
        return;
    }

    // Incase a file has been saved, we need to reparse its translation unit
    wxFileName fn( e.GetString() );
    if(!TagsManagerST::Get()->IsValidCtagsFile(fn))
        return;

    m_clang.ReparseFile( fn.GetFullPath() );
}
void ConnectionSdpOpenSearchRequest(Task appTask, const bdaddr* bd_addr)
{
#ifdef CONNECTION_DEBUG_LIB
    if(bd_addr == NULL)
    {
       CL_DEBUG(("Out of range Bluetooth Address 0x%p\n", (void*)bd_addr)); 
    }
#endif

    {
	    /* Send an internal message */
	    MAKE_CL_MESSAGE(CL_INTERNAL_SDP_OPEN_SEARCH_REQ);
	    message->theAppTask = appTask;
	    message->bd_addr = *bd_addr;
	    MessageSend(connectionGetCmTask(), CL_INTERNAL_SDP_OPEN_SEARCH_REQ, message);
    }
}
Beispiel #18
0
void ConnectionL2capMapConnectionlessResponse(Task theAppTask, Source source, l2cap_connectionless_data_type type)
{
    if (source)
    {
        MAKE_CL_MESSAGE(CL_INTERNAL_L2CAP_MAP_CONNECTIONLESS_RES);
        message->theAppTask = theAppTask;
        message->source = source;
        message->type = type;
        MessageSend(connectionGetCmTask(), CL_INTERNAL_L2CAP_MAP_CONNECTIONLESS_RES, message);
    }
#ifdef CONNECTION_DEBUG_LIB
    else
    {
        CL_DEBUG(("Source is NULL!\n"));
    }
#endif
}
void ConnectionSmSecModeConfig(Task theAppTask, cl_sm_wae write_auth_enable, bool debug_keys, bool legacy_auto_pair_key_missing)
{
#ifdef CONNECTION_DEBUG_LIB
	if (write_auth_enable > cl_sm_wae_always)
	{
		CL_DEBUG(("Out of range wae 0x%x\n", write_auth_enable));
	}
#endif
	{
    MAKE_CL_MESSAGE(CL_INTERNAL_SM_SEC_MODE_CONFIG_REQ);
	message->theAppTask = theAppTask;
	message->write_auth_enable = write_auth_enable;
	message->debug_keys = debug_keys;
        message->legacy_auto_pair_key_missing = legacy_auto_pair_key_missing;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_SEC_MODE_CONFIG_REQ, message);
	}
}
Beispiel #20
0
bool LLDBPlugin::DoInitializeDebugger(clDebugEvent& event, bool redirectOutput, const wxString& terminalTitle)
{
    if(event.GetDebuggerName() != LLDB_DEBUGGER_NAME) {
        event.Skip();
        return false;
    }

    if(m_connector.IsRunning()) {
        // Another debug session is already in progress
        ::wxMessageBox(_("Another debug session is already in progress. Please stop it first"),
                       "CodeLite",
                       wxOK | wxCENTER | wxICON_WARNING);
        return false;
    }

    TerminateTerminal();

    // If terminal is required, launch it now
    bool isWindows = wxPlatformInfo::Get().GetOperatingSystemId() & wxOS_WINDOWS;
    if(redirectOutput && !isWindows) {
        wxString realPts;
        ::LaunchTerminalForDebugger(
            terminalTitle.IsEmpty() ? event.GetExecutableName() : terminalTitle, m_terminalTTY, realPts, m_terminalPID);

        if(m_terminalPID != wxNOT_FOUND) {
            CL_DEBUG("Successfully launched terminal");

        } else {
            // Failed to launch it...
            DoCleanup();
            ::wxMessageBox(_("Failed to start terminal for debugger"), "CodeLite", wxICON_ERROR | wxOK | wxCENTER);
            return false;
        }
    }

    // Launch local server if needed
    LLDBSettings settings;
    settings.Load();
    if(!settings.IsUsingRemoteProxy() && !m_connector.LaunchLocalDebugServer()) {
        DoCleanup();
        return false;
    }

    return true;
}
Beispiel #21
0
void LLDBConnector::InvalidateBreakpoints()
{
    // mark all the breakpoints as "not-applied" (id=-1)
    LLDBBreakpoint::Vec_t updatedList;

    for(size_t i = 0; i < m_breakpoints.size(); ++i) {
        m_breakpoints.at(i)->Invalidate();
        if(wxFileName::Exists(m_breakpoints.at(i)->GetFilename())) {
            updatedList.push_back(m_breakpoints.at(i));
        }
    }
    // we keep only breakpoints with valid filename
    m_breakpoints.swap(updatedList);
    ClearBreakpointDeletionQueue();

    CL_DEBUG("codelite: InvalidateBreakpoints called");
    m_pendingDeletionBreakpoints.clear();
}
Beispiel #22
0
void XDebugManager::DoStopDebugger()
{
    ClearDebuggerMarker();
    m_connected = false;
    
    // Clear all handlers from the queue
    m_handlers.clear();
    
    // Save the breakpoints
    
    // Reset the connection
    CL_DEBUG("CodeLite >>> closing debug session");
    wxDELETE(m_readerThread);
    
    // Notify about debug session ended
    XDebugEvent eventEnd(wxEVT_XDEBUG_SESSION_ENDED);
    EventNotifier::Get()->AddPendingEvent( eventEnd );
}
void ConnectionSmPinCodeResponse(const bdaddr* bd_addr, uint16 length, const uint8* pin_code)
{   
#ifdef CONNECTION_DEBUG_LIB
    if(bd_addr == NULL)
    {
       CL_DEBUG(("Out of range Bluetooth Address 0x%p\n", (void*)bd_addr)); 
    }
#endif

    {
        MAKE_CL_MESSAGE(CL_INTERNAL_SM_PIN_REQUEST_RES);
        message->bd_addr = *bd_addr;
        message->pin_length = length;
        if (length > 0)
            memcpy(message->pin, pin_code, length);
        MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_PIN_REQUEST_RES, message);
    }
}
void ConnectionWriteInquiryAccessCode(Task theAppTask, const uint32 *iac, uint16 num_iac)
{
	/* Check params are within allowed values - debug build only */
#ifdef CONNECTION_DEBUG_LIB
	if ((num_iac < MIN_WRITE_IAC_LAP) || (num_iac > MAX_WRITE_IAC_LAP))
	{
		CL_DEBUG(("Out of range num_iac 0x%x\n", num_iac));
	}
#endif

	{
		MAKE_CL_MESSAGE_WITH_LEN(CL_INTERNAL_DM_WRITE_IAC_LAP_REQ, sizeof(uint32) * num_iac);
		message->theAppTask = theAppTask;
		message->num_iac = num_iac;
		memmove(&message->iac, iac, sizeof(uint32) * num_iac);
		MessageSendConditionally(connectionGetCmTask(), CL_INTERNAL_DM_WRITE_IAC_LAP_REQ, message, (const uint16 *)&theCm.inqState.inquiryLock);
	}
}
Beispiel #25
0
void ConnectionSetSniffSubRatePolicy(Sink sink, uint16 max_remote_latency, uint16 min_remote_timeout, uint16 min_local_timeout)
{
#ifdef CONNECTION_DEBUG_LIB
    if (connectionGetBtVersion() < bluetooth2_1)
    {
        CL_DEBUG(("Sniff subrating is not supported on (pre BT 2.1)\n"));
    }
    else
#endif
    {
        MAKE_CL_MESSAGE(CL_INTERNAL_DM_SET_SNIFF_SUB_RATE_POLICY_REQ);
        message->sink = sink;
        message->max_remote_latency = max_remote_latency;
        message->min_remote_timeout = min_remote_timeout;
        message->min_local_timeout = min_local_timeout;
        MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_SET_SNIFF_SUB_RATE_POLICY_REQ, message);
    }
}
FileNameVector_t CompilationDatabase::GetCompileCommandsFiles() const
{
    wxFileName databaseFile ( GetFileName() );
    wxFileName fn( databaseFile );
    
    // Usually it will be under the top folder
    fn.RemoveLastDir();

    // Since we can have multiple "compile_commands.json" files, we take the most updated file
    // Prepare a list of files to check
    FileNameVector_t files;
    std::queue<wxString> dirs;
    
    // we start with the current path
    dirs.push( fn.GetPath() );
    
    while ( !dirs.empty() ) {
        wxString curdir = dirs.front();
        dirs.pop();
        
        wxFileName fn(curdir, "compile_commands.json" );
        if ( fn.Exists() &&                                                                          // file exists
            (fn.GetModificationTime().GetTicks() > databaseFile.GetModificationTime().GetTicks() ) ) // and its newer than the database file
        {
            CL_DEBUG("CompilationDatabase: found file: " + fn.GetFullPath());
            files.push_back( fn );
        }

        // Check to see if there are more directories to recurse
        wxDir dir;
        if ( dir.Open( curdir ) ) {
            wxString dirname;
            bool cont = dir.GetFirst( &dirname, "", wxDIR_DIRS );
            while ( cont ) {
                wxString new_dir;
                new_dir << curdir << wxFileName::GetPathSeparator() << dirname;
                dirs.push( new_dir );
                dirname.Clear();
                cont = dir.GetNext( &dirname );
            }
        }
    }
    return files;
}
Beispiel #27
0
void NodeJSSocket::WriteRequest(JSONElement& request, NodeJSHandlerBase::Ptr_t handler)
{
    if(!IsConnected()) return;
    size_t seq = NextSequence();
    request.addProperty("seq", seq);

    wxString content, str;
    str = request.format();
    content << "Content-Length:" << str.length() << "\r\n\r\n";
    content << str;

    CL_DEBUG("CodeLite >>>> %s", content);
    m_socket.Send(content);

    // Keep the handler
    if(handler) {
        m_handlers.insert(std::make_pair(seq, handler));
    }
}
Beispiel #28
0
void DbgGdb::OnDataRead( wxCommandEvent& e )
{
    // Data arrived from the debugger
    ProcessEventData *ped = ( ProcessEventData * )e.GetClientData();

    wxString bufferRead;
    bufferRead << ped->GetData();
    delete ped;

    if( !m_gdbProcess || !m_gdbProcess->IsAlive() )
        return;

    CL_DEBUG("GDB>> %s", bufferRead);
    wxArrayString lines = wxStringTokenize( bufferRead, wxT( "\n" ), wxTOKEN_STRTOK );
    if(lines.IsEmpty())
        return;

    // Prepend the partially saved line from previous iteration to the first line
    // of this iteration
    lines.Item(0).Prepend(m_gdbOutputIncompleteLine);
    m_gdbOutputIncompleteLine.Clear();

    // If the last line is in-complete, remove it from the array and keep it for next iteration
    if(!bufferRead.EndsWith(wxT("\n"))) {
        m_gdbOutputIncompleteLine = lines.Last();
        lines.RemoveAt(lines.GetCount()-1);
    }

    for( size_t i=0; i<lines.GetCount(); i++ ) {
        wxString line = lines.Item( i );

        line.Replace( wxT( "(gdb)" ), wxT( "" ) );
        line.Trim().Trim( false );
        if ( line.IsEmpty() == false ) {
            m_gdbOutputArr.Add( line );
        }
    }

    if ( m_gdbOutputArr.IsEmpty() == false ) {
        // Trigger GDB processing
        Poke();
    }
}
void ConnectionSmEncryptionKeyRefreshSink(Sink sink)
{
#ifdef CONNECTION_DEBUG_LIB
    if(!sink)
    {
		CL_DEBUG(("Null sink passed in\n")); 
    }
#endif
	
	{
		bdaddr addr;
		if(SinkGetBdAddr(sink, &addr))
		{
			MAKE_CL_MESSAGE(CL_INTERNAL_SM_ENCRYPTION_KEY_REFRESH_REQ);
			message->bd_addr = addr;
			MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_ENCRYPTION_KEY_REFRESH_REQ, message); 
		}
	}
}
void NodeJSGetScriptHandler::Process(NodeJSDebugger* debugger, const wxString& output)
{
    JSONRoot root(output);
    wxString sourceFile = root.toElement().namedObject("body").namedObject("source").toString();
    if(!sourceFile.IsEmpty()) {
        wxFileName fn(clStandardPaths::Get().GetUserDataDir(), m_filename);
        fn.AppendDir("webtools");
        fn.AppendDir("tmp");
        fn.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
        if(FileUtils::WriteFileContent(fn, sourceFile)) {
            CL_DEBUG("Calling marking line for %s:%d", fn.GetFullPath(), m_line);
            debugger->AddTempFile(fn.GetFullPath());
            clDebugEvent eventHighlight(wxEVT_NODEJS_DEBUGGER_MARK_LINE);
            eventHighlight.SetLineNumber(m_line);
            eventHighlight.SetFileName(fn.GetFullPath());
            EventNotifier::Get()->AddPendingEvent(eventHighlight);
        }
    }
}