Ejemplo n.º 1
0
void DebugView::runDebugger(    QString const&  newWorkingDirectory,
                                QString const&  newTarget,
                                QString const&  newArguments )
{
    m_workingDirectory = newWorkingDirectory;
    m_target = newTarget;
    m_arguments = newArguments;

    if( m_state == none )
    {
        m_outBuffer.clear();
        m_errBuffer.clear();
        m_errorList.clear();

        //create a process to control GDB
        m_debugProcess = new QProcess( this );
        m_debugProcess->setWorkingDirectory( m_workingDirectory );

        //use the shell to find gdb for us, rather than launching gdb directly
        const char* shell = getenv( "SHELL" );
        if( shell == NULL )
        {
            shell = "/bin/sh";
        }

        //prepare the m_arguments to pass to shell
        QStringList args;
        args.append( "-c" );
        args.append( "gdb" );

        connect( m_debugProcess, SIGNAL( error(QProcess::ProcessError) ),
                            this, SLOT( slotError() ) );

        connect( m_debugProcess, SIGNAL( readyReadStandardError() ),
                            this, SLOT( slotReadDebugStdErr() ) );

        connect( m_debugProcess, SIGNAL( readyReadStandardOutput() ),
                            this, SLOT( slotReadDebugStdOut() ) );

        connect( m_debugProcess, SIGNAL( finished(int,QProcess::ExitStatus) ),
                            this, SLOT( slotDebugFinished(int,QProcess::ExitStatus) ) );

        m_debugProcess->start( shell, args );

        m_nextCommands << "set pagination off";
        m_state = ready;
    }
Ejemplo n.º 2
0
void DebugView::runDebugger(    QString const&  newWorkingDirectory,
                                QString const&  newTarget,
                                QString const&  newArguments )
{
    m_workingDirectory = newWorkingDirectory;
    m_target = newTarget;
    m_arguments = newArguments;

    if( m_state == none )
    {
        m_outBuffer.clear();
        m_errBuffer.clear();
        m_errorList.clear();

        //create a process to control GDB
        m_debugProcess.setWorkingDirectory( m_workingDirectory );

        connect( &m_debugProcess, SIGNAL(error(QProcess::ProcessError)),
                            this, SLOT(slotError()) );

        connect( &m_debugProcess, SIGNAL(readyReadStandardError()),
                            this, SLOT(slotReadDebugStdErr()) );

        connect( &m_debugProcess, SIGNAL(readyReadStandardOutput()),
                            this, SLOT(slotReadDebugStdOut()) );

        connect( &m_debugProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
                            this, SLOT(slotDebugFinished(int,QProcess::ExitStatus)) );

        m_debugProcess.setShellCommand("gdb");
        m_debugProcess.setOutputChannelMode(KProcess::SeparateChannels);
        m_debugProcess.start();

        m_nextCommands << "set pagination off";
        m_state = ready;
    }