Пример #1
0
DebugPanel::DebugPanel(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::DebugPanel)
{
    ui->setupUi(this);

    ui->breakpointTableWidget->setShowGrid(false);

    connect(ui->runButton, SIGNAL(toggled(bool)),
            this, SLOT(runToggle(bool)));
    connect(ui->pauseButton, SIGNAL(released()),
            this, SLOT(pause()));
    connect(ui->continueButton, SIGNAL(released()),
            this, SLOT(continueDebug()));
    connect(ui->nextButton, SIGNAL(released()),
            this, SLOT(next()));
    connect(ui->newBreakpointToolButton, SIGNAL(released()),
            this, SLOT(newBreakpoint()));
    connect(ui->deleteBreakpointToolButton, SIGNAL(released()),
            this, SLOT(deleteBreakpoint()));

    connect(ui->breakpointTableWidget, SIGNAL(cellChanged(int,int)),
            this, SLOT(cellChanged(int,int)));
    connect(ui->breakpointTableWidget, SIGNAL(currentCellChanged(int,int,int,int)),
            this, SLOT(currentCellChanged(int,int,int,int)));
}
Пример #2
0
bool BreakptMgr::AddBreakpoint(const BreakpointInfo &bp)
{
    if (bp.bp_type != BP_type_watchpt &&
        bp.file.IsEmpty() && bp.function_name.IsEmpty() && bp.memory_address.IsEmpty() && bp.lineno == wxNOT_FOUND) {
        // no function nor file? no memory address?
        // do nothing then
        return true;
    }

    IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger();
    if (dbgr && dbgr->IsRunning()) {
        // If the debugger is already running, tell it we want a new bp
        // If not, they'll all be added together when the debugger does start
        bool contIsNeeded = PauseDebuggerIfNeeded();

        dbgr->Break(bp);

        if (contIsNeeded) {
            dbgr->Continue();
        }
    }

    BreakpointInfo newBreakpoint(bp);
    SetBestBPType(newBreakpoint);
    
    BreakpointInfoVec_t::const_iterator iter = std::find(m_bps.begin(), m_bps.end(), newBreakpoint);
    if ( iter == m_bps.end() ) {
        // new breakpoint
        m_bps.push_back( newBreakpoint );
    }
    
    DeleteAllBreakpointMarkers();
    RefreshBreakpointMarkers();
    return true;
}
Пример #3
0
void OCamlSource::contextMenuEvent( QContextMenuEvent *event )
{
    QTextCursor current_cur = textCursor();
    QTextCursor mouse_position = cursorForPosition( event->pos() );
    QTextCursor cur = mouse_position;
    if ( current_cur.hasSelection() )
        cur = current_cur;

    _breakpoint_line   = mouse_position.blockNumber() + 1;
    _breakpoint_column = mouse_position.position() - mouse_position.block().position() + 1;
    if ( ! cur.hasSelection() )
    {
        cur.select(QTextCursor::WordUnderCursor);
        setTextCursor(cur);
    }
    _selected_text = cur.selectedText();

    QAction *breakAct = new QAction( tr( "&Set Breakpoint at line %1 column %2" )
            .arg( QString::number(mouse_position.blockNumber()+1))
            .arg( QString::number(mouse_position.columnNumber()+1))
            , this );
    breakAct->setStatusTip( tr( "Set a breakpoint to the current location" ) );
    connect( breakAct, SIGNAL( triggered() ), this, SLOT( newBreakpoint() ) );

    QAction *displayAct = NULL;
    if ( cur.hasSelection() )
    {
        displayAct = new QAction( tr( "&Display '%1'" )
                .arg( _selected_text )
                , this );
        connect( displayAct, SIGNAL( triggered() ), this, SLOT( displayVar() ) );
    }

    QAction *printAct = NULL;
    if ( cur.hasSelection() )
    {
        printAct = new QAction( tr( "&Print '%1'" )
                .arg( _selected_text )
                , this );
        connect( printAct, SIGNAL( triggered() ), this, SLOT( printVar() ) );
    }
    QAction *watchAct = NULL;
    if ( cur.hasSelection() )
    {
        watchAct = new QAction( tr( "&Watch '%1'" )
                .arg( _selected_text )
                , this );
        connect( watchAct, SIGNAL( triggered() ), this, SLOT( watchVar() ) );
    }

    QMenu *menu = createStandardContextMenu();

    menu->addAction( breakAct );
    if (displayAct)
        menu->addAction( displayAct );
    if (printAct)
        menu->addAction( printAct );
    if (watchAct)
        menu->addAction( watchAct );
    menu->exec( event->globalPos() );

    delete breakAct;
    if (displayAct)
        delete displayAct;
    if (printAct)
        delete printAct;
    if (watchAct)
        delete watchAct;
    delete menu;
}