Esempio n. 1
0
void XDebugManager::DoHandleResponse(wxXmlNode* xml)
{
    CHECK_PTR_RET(xml);
    
    wxString txId = xml->GetAttribute("transaction_id");
    long nTxId (0);
    txId.ToCLong(&nTxId);
    XDebugCommandHandler::Ptr_t handler = PopHandler(nTxId);
    if ( handler ) {
        handler->Process(xml);
        
    } else {
        
        // Just log the reply
        wxXmlDocument doc;
        doc.SetRoot( xml );
        
        wxStringOutputStream sos;
        if ( doc.Save( sos ) ) {
            CL_DEBUG( sos.GetString() );
        }
        doc.DetachRoot();
    }
}
Esempio n. 2
0
void DbgGdb::DoProcessAsyncCommand( wxString &line, wxString &id )
{
    if ( line.StartsWith( wxT( "^error" ) ) ) {

        // the command was error, for example:
        // finish in the outer most frame
        // print the error message and remove the command from the queue
        DbgCmdHandler *handler = PopHandler( id );
        bool errorProcessed (false);

        if ( handler && handler->WantsErrors() ) {
            errorProcessed = handler->ProcessOutput( line );
        }

        if ( handler ) {
            delete handler;
        }

        StripString( line );

        //We also need to pass the control back to the program
        if (!errorProcessed) {
            m_observer->UpdateGotControl( DBG_CMD_ERROR );
        }

        if ( !FilterMessage( line ) && m_info.enableDebugLog ) {
            m_observer->UpdateAddLine( line );
        }

    } else if ( line.StartsWith( wxT( "^done" ) ) || line.StartsWith( wxT( "^connected" ) ) ) {
        //The synchronous operation was successful, results are the return values.
        DbgCmdHandler *handler = PopHandler( id );
        if ( handler ) {
            handler->ProcessOutput( line );
            delete handler;
        }

    } else if ( line.StartsWith( wxT( "^running" ) ) ) {
        //asynchronous command was executed
        //send event that we dont have the control anymore
        m_observer->UpdateLostControl();

    } else if ( line.StartsWith( wxT( "*stopped" ) ) ) {
        //get the stop reason,
        if ( line == wxT( "*stopped" ) ) {
            if ( m_bpList.empty() ) {

                ExecuteCmd( wxT( "set auto-solib-add off" ) );
                ExecuteCmd( wxT( "set stop-on-solib-events 0" ) );

            } else {

                //no reason for the failure, this means that we stopped due to
                //hitting a loading of shared library
                //try to place all breakpoints which previously failed
                SetBreakpoints();
            }

            Continue();

        } else {
            //GDB/MI Out-of-band Records
            //caused by async command, this line indicates that we have the control back
            DbgCmdHandler *handler = PopHandler( id );
            if ( handler ) {
                handler->ProcessOutput( line );
                delete handler;
            }
        }
    }
}