Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void TextDocument::setDebugger ( GpsimDebugger debugger,
bool  ownDebugger 
)

Attach ourselves to the given debugger.

Parameters:
ownDebugger whether we have permission to delete it.

Definition at line 950 of file textdocument.cpp.

References breakpointList(), SymbolViewer::setContext(), slotInitDebugActions(), and Document::url().

Referenced by DebugManager::urlOpened().

{
      if ( debugger == m_pDebugger )
            return;
      
      // If we create a gpsim, then we may get called by DebugManager, which will
      // try to claim we don't own it. So if we have a symbol file waiting, thne
      // wait until we are called from its successful creation
      if ( !m_symbolFile.isEmpty() && !ownDebugger )
            return;
      
      // Reset it for use next time
      m_symbolFile = QString::null;
      
      if (m_bOwnDebugger)
            delete m_pDebugger;
      
      m_pDebugger = debugger;
      m_bOwnDebugger = ownDebugger;
      
      if (!m_pDebugger)
            return;
      
      if ( m_debugFile.isEmpty() )
            m_debugFile = url().path();
      
      connect( m_pDebugger,               SIGNAL(destroyed()),                                  this, SLOT(slotDebuggerDestroyed()) );
      connect( m_pDebugger->gpsim(),      SIGNAL(runningStatusChanged(bool )),            this, SLOT(slotInitDebugActions()) );
      connect( m_pDebugger,               SIGNAL(lineReached(const SourceLine &)),  this, SLOT(slotDebugSetCurrentLine(const SourceLine &)) );
      m_pDebugger->setBreakpoints( m_debugFile, breakpointList() );
      
      slotInitDebugActions();
      if ( !m_pDebugger->gpsim()->isRunning() )
            slotDebugSetCurrentLine( m_pDebugger->currentLine() );
      
      if ( this == dynamic_cast<TextDocument*>(DocManager::self()->getFocusedDocument()) )
            SymbolViewer::self()->setContext( m_pDebugger->gpsim() );
}


Generated by  Doxygen 1.6.0   Back to index