Skip to content
Browse files

Merge branch 'master' of github.com:rainerf/ricodebug

  • Loading branch information...
2 parents 817a1e4 + 9b2b5b2 commit 68dc7b0ac368e66c332d8957717817b52dcd74e5 @rainerf rainerf committed Mar 28, 2012
View
10 src/helpers/actions.py
@@ -76,12 +76,14 @@ def add(self, enum, action):
def createAction(self, icon, text, shortcut, statustip, enum, parameter=None):
"""dont use this function outside of class!!!"""
- if parameter == None:
+ if parameter is None:
newAction = QtGui.QAction(QtGui.QIcon(icon), text, self)
else:
newAction = ActionEx(parameter)
- if shortcut != None:
+
+ if shortcut is not None:
newAction.setShortcut(shortcut)
+
newAction.setStatusTip(statustip)
self.add(enum, newAction)
@@ -161,6 +163,4 @@ def initGlobalActions(self):
"Del var from Watch", "+", \
"Remove selected variable from watchview-window", self.DelWatch)
- ###############################################
- ## <your description>
- ###############################################
+
View
1 src/helpers/distributedobjects.py
@@ -64,3 +64,4 @@ def __init__(self):
self.datagraphController = DataGraphController(self)
self.stlvectorParser = StlVectorParser(self)
self.tracepointwaveController = TracepointWaveController(self)
+
View
3 src/helpers/gdbconnector.py
@@ -186,7 +186,7 @@ def record(self):
# FIXME: find the real mi command!
return self.executeAndRaiseIfFailed("-interpreter-exec console rec", \
"Could not record the process.")
-
+
def next_(self):
return self.executeAndRaiseIfFailed("-exec-next")
@@ -256,3 +256,4 @@ def getStackDepth(self):
def selectStackFrame(self, exp):
return self.executeAndRaiseIfFailed("-stack-select-frame " + str(exp))
+
View
4 src/helpers/gdboutput.py
@@ -22,6 +22,9 @@
#
# For further information see <http://syscdbg.hagenberg.servus.at/>.
+"""
+Predefined constants for the gdb output
+"""
class GdbOutput:
RESULT_RECORD, \
@@ -53,3 +56,4 @@ def __init__(self):
self.class_ = None # done, running,...
self.string = None # the string of a stream output
self.type_ = None # the type of a async response
+
View
18 src/helpers/gdbreader.py
@@ -22,6 +22,9 @@
#
# For further information see <http://syscdbg.hagenberg.servus.at/>.
+"""GdbReader that listens to the gnu debugger output
+"""
+
from PyQt4.QtCore import QThread, QMutex, QSemaphore, SIGNAL
from gdbresultparser import GdbResultParser
from gdboutput import GdbOutput
@@ -44,13 +47,21 @@ def __init__(self, connector, parent=None):
self.streamSem = QSemaphore(0)
def startReading(self, stdout):
+ """Intialise and start the gdbreader thread
+ """
self.stdout = stdout
+
+ # self.start is predefined method by QThread and starts the thread.
self.start()
def run(self):
+ """Pre defined method by QThread to start the thread
+ """
self.listener()
def listener(self):
+ """Main method for listening to the gdb output
+ """
lines = []
while True:
line = self.stdout.readline()
@@ -70,9 +81,13 @@ def listener(self):
lines.append(line)
def forwardMultipleBreakPointInfo(self, lines):
+ """Documentation Incomplete for this method!"""
+ # Can't reproduce the step to call this function
self.emit(SIGNAL("forwardMultipleBreakpointInfo(PyQt_PyObject)"), lines)
def forwardResult(self, res):
+ """Forwards the result from the gdb output according to its type
+ """
type_ = res.type_
if type_ == GdbOutput.RESULT_RECORD:
self.enqueueResult(res)
@@ -100,6 +115,8 @@ def enqueueResult(self, gdbresult):
s.release()
def getResult(self, type_):
+ """Get the first result in the queue
+ """
# getResult will be deprecated for other types
assert(type_ == GdbOutput.RESULT_RECORD)
q = self.resultRecordQueue
@@ -111,3 +128,4 @@ def getResult(self, type_):
res = q.popleft()
m.unlock()
return res
+
View
10 src/helpers/gdbresultparser.py
@@ -22,6 +22,11 @@
#
# For further information see <http://syscdbg.hagenberg.servus.at/>.
+"""Lexical parser for the gdb output
+
+For futher information see the ply python module documentation.
+"""
+
import ply.lex as lex
import ply.yacc as yacc
from gdboutput import GdbOutput
@@ -102,8 +107,6 @@ def t_error(t):
class Result:
- pass
-
def __str__(self):
return "RESULT(" + self.__dict__.__str__() + ")"
@@ -313,7 +316,8 @@ def p_top(p):
class GdbResultParser:
@classmethod
def parse(cls, lines):
- """ this function-call is required to get the yacc running! """
+ """Parse the lines with the above defined lexical rules
+ """
lex.lex(reflags=re.DOTALL)
parser = yacc.yacc(start='top', debug=0, outputdir=str(QDir.homePath()) + "/.ricodebug")
View
17 src/helpers/ptyhandler.py
@@ -22,6 +22,12 @@
#
# For further information see <http://syscdbg.hagenberg.servus.at/>.
+"""Linux pseudo terminal handler
+
+Not portable!
+"""
+
+
import pty
import os
import select
@@ -30,19 +36,28 @@
class PtyHandler(QThread):
def __init__(self, parent=None):
- super(PtyHandler, self).__init__(parent)
+ """Initialise Linux pseudo terminal
+ """
+ QThread.__init__(self, parent)
self.master, self.slave = pty.openpty()
self.ptyname = os.ttyname(self.slave)
self.stop = False
def run(self):
+ """Predifined method by QThread after that is called after start()
+ """
self.listener()
def listener(self):
+ """Listens to the pseudo terminal for new output
+ """
while not self.stop:
if select.select([self.master], [], [], 0.2) != ([], [], []):
ret = os.read(self.master, 100)
self.emit(SIGNAL('dataAvailable(QString)'), ret)
def write(self, s):
+ """Writes to the pseudo terminal
+ """
self.master.write(s)
+
View
103 src/views/mainwindow.py
@@ -33,6 +33,58 @@
class MainWindow(QMainWindow):
+
+ def __init__(self, parent=None):
+ """ init UI """
+ QMainWindow.__init__(self, parent)
+ self.ui = Ui_MainWindow()
+ self.ui.setupUi(self)
+
+ self.ui.actionSaveSession.setEnabled(False)
+
+ self.distributedObjects = DistributedObjects()
+
+ self.debugController = self.distributedObjects.debugController
+ self.settings = self.debugController.settings
+ self.signalproxy = self.distributedObjects.signalProxy
+ self.pluginloader = PluginLoader(self.distributedObjects)
+
+ #init RecentFileHandler
+ nrRecentFiles = 5
+ self.initRecentFileHandler(nrRecentFiles)
+
+ QObject.connect(self.debugController, SIGNAL('executableOpened'), self.showExecutableName)
+
+ # signal proxy
+ QObject.connect(self.signalproxy, SIGNAL('inferiorIsRunning(PyQt_PyObject)'), self.targetStartedRunning, Qt.QueuedConnection)
+ QObject.connect(self.signalproxy, SIGNAL('inferiorStoppedNormally(PyQt_PyObject)'), self.targetStopped, Qt.QueuedConnection)
+ QObject.connect(self.signalproxy, SIGNAL('inferiorReceivedSignal(PyQt_PyObject)'), self.targetStopped, Qt.QueuedConnection)
+ QObject.connect(self.signalproxy, SIGNAL('inferiorHasExited(PyQt_PyObject)'), self.targetExited, Qt.QueuedConnection)
+
+ QObject.connect(self.signalproxy, SIGNAL('addDockWidget(PyQt_PyObject, QDockWidget, PyQt_PyObject)'), self.addPluginDockWidget)
+ QObject.connect(self.signalproxy, SIGNAL('removeDockWidget(QDockWidget)'), self.removeDockWidget)
+ QObject.connect(self.pluginloader, SIGNAL('insertPluginAction(PyQt_PyObject)'), self.addPluginAction)
+ QObject.connect(self.ui.actionSavePlugins, SIGNAL('activated()'), self.showSavePluginsDialog)
+ QObject.connect(self.ui.actionLoadPlugins, SIGNAL('activated()'), self.showLoadPluginsDialog)
+
+ # Add editor to main window.
+ self.ui.gridLayout.addWidget(self.distributedObjects.editorController.editor_view, 0, 0, 1, 1)
+
+ self.pluginloader.addAvailablePlugins()
+
+ # Tell everyone to insert their dock widgets into the main window
+ self.distributedObjects.signalProxy.insertDockWidgets()
+
+ # get filelist dockwidget
+ self.filelist_dockwidget = self.findChild(QDockWidget, "FileListView")
+
+ self.setWindowFilePath("<none>")
+ self.setupUi()
+ self.createInitialWindowPlacement()
+ self.readSettings()
+
+ self.quickwatch = QuickWatch(self, self.distributedObjects)
+
def setupUi(self):
self.__initActions()
self.ui.statusLabel = QLabel()
@@ -128,57 +180,6 @@ def __connectActions(self):
QObject.connect(self.ui.actionSaveSession, SIGNAL('activated()'), \
self.distributedObjects.sessionManager.showSaveSessionDialog)
- def __init__(self, parent=None):
- """ init UI """
- QMainWindow.__init__(self, parent)
- self.ui = Ui_MainWindow()
- self.ui.setupUi(self)
-
- self.ui.actionSaveSession.setEnabled(False)
-
- self.distributedObjects = DistributedObjects()
-
- self.debugController = self.distributedObjects.debugController
- self.settings = self.debugController.settings
- self.signalproxy = self.distributedObjects.signalProxy
- self.pluginloader = PluginLoader(self.distributedObjects)
-
- #init RecentFileHandler
- nrRecentFiles = 5
- self.initRecentFileHandler(nrRecentFiles)
-
- QObject.connect(self.debugController, SIGNAL('executableOpened'), self.showExecutableName)
-
- # signal proxy
- QObject.connect(self.signalproxy, SIGNAL('inferiorIsRunning(PyQt_PyObject)'), self.targetStartedRunning, Qt.QueuedConnection)
- QObject.connect(self.signalproxy, SIGNAL('inferiorStoppedNormally(PyQt_PyObject)'), self.targetStopped, Qt.QueuedConnection)
- QObject.connect(self.signalproxy, SIGNAL('inferiorReceivedSignal(PyQt_PyObject)'), self.targetStopped, Qt.QueuedConnection)
- QObject.connect(self.signalproxy, SIGNAL('inferiorHasExited(PyQt_PyObject)'), self.targetExited, Qt.QueuedConnection)
-
- QObject.connect(self.signalproxy, SIGNAL('addDockWidget(PyQt_PyObject, QDockWidget, PyQt_PyObject)'), self.addPluginDockWidget)
- QObject.connect(self.signalproxy, SIGNAL('removeDockWidget(QDockWidget)'), self.removeDockWidget)
- QObject.connect(self.pluginloader, SIGNAL('insertPluginAction(PyQt_PyObject)'), self.addPluginAction)
- QObject.connect(self.ui.actionSavePlugins, SIGNAL('activated()'), self.showSavePluginsDialog)
- QObject.connect(self.ui.actionLoadPlugins, SIGNAL('activated()'), self.showLoadPluginsDialog)
-
- # Add editor to main window.
- self.ui.gridLayout.addWidget(self.distributedObjects.editorController.editor_view, 0, 0, 1, 1)
-
- self.pluginloader.addAvailablePlugins()
-
- # Tell everyone to insert their dock widgets into the main window
- self.distributedObjects.signalProxy.insertDockWidgets()
-
- # get filelist dockwidget
- self.filelist_dockwidget = self.findChild(QDockWidget, "FileListView")
-
- self.setWindowFilePath("<none>")
- self.setupUi()
- self.createInitialWindowPlacement()
- self.readSettings()
-
- self.quickwatch = QuickWatch(self, self.distributedObjects)
-
def addPluginDockWidget(self, area, widget, addToggleViewAction):
self.addDockWidget(area, widget)
if addToggleViewAction:

0 comments on commit 68dc7b0

Please sign in to comment.
Something went wrong with that request. Please try again.