his = self.getHistoryLen()
argv = string.join(string.split(self.clientCmd)[1:])
self.feed_dbg("run " + argv + "\n")
- return self.waitForPosition(his)
+ return self.waitForActivation(his)
def setContinue(self):
his = self.getHistoryLen()
self.feed_dbg("cont\n");
- return self.waitForPosition(his)
+ return self.waitForActivation(his)
def setStepover(self):
his = self.getHistoryLen()
self.feed_dbg("next\n");
- return self.waitForPosition(his)
+ return self.waitForActivation(his)
def setStepin(self):
his = self.getHistoryLen()
self.feed_dbg("step\n");
- return self.waitForPosition(his)
+ return self.waitForActivation(his)
def setQuit(self):
self.feed_dbg("quit\n")
his = self.getHistoryLen()
self.feed_dbg("print " + expr + "\n")
- rx = re.compile("^\$[1-9][0-9]* = .*$")
+ rx = re.compile("^\(gdb\) $")
his, response = self.waitForRx(rx, his)
- split = string.split(response, "=")
+ answer = self.history[his-1]
+
+ if len(string.split(answer, "=")) == 1:
+ return answer.strip()
+
+ split = string.split(answer, "=")
return string.join(split[1:], "=").strip()
- def waitForPosition(self, his):
+ def waitForActivation(self, his):
+
+ self.setActive(False)
rx = re.compile("^\(gdb\) $")
his, reponse = self.waitForRx(rx,his)
+ self.setActive(True)
if self.history[his-1][0:2]=="\x1a\x1a":
tuples = string.split(self.history[his-1][2:], ":")
--- /dev/null
+#!/usr/bin/python
+#shuber, 2008-06-04
+
+__author__ = "shuber"
+
+
+import gtk
+import vte
+
+import WatchesFrame
+
+
+class StatusWindow (gtk.Window):
+
+ def __init__(self, parent, debugger):
+
+ gtk.Window.__init__(self)
+ self.set_screen(parent.get_screen())
+
+ self.set_border_width(5)
+ self.set_title("Status")
+ self.set_default_size(400,400)
+
+
+ vbox = gtk.VBox(False, 5)
+ self.add(vbox)
+
+ self.status = gtk.Label("Not Running")
+ vbox.pack_start(self.status, False, False)
+ vpaned = gtk.VPaned()
+ vbox.add(vpaned)
+
+ self.watchesFrame = WatchesFrame.WatchesFrame(debugger)
+ vpaned.add1(self.watchesFrame)
+
+ self.show_all()
+
+
+ def updateValues(self, pos):
+
+ if pos == None:
+ self.status.set_text("Exited")
+ else:
+ file, lineno = pos
+ self.status.set_text("%s:%s" % (file, lineno))
+
+ self.watchesFrame.updateValues()
+
+
--- /dev/null
+#!/usr/bin/python
+#shuber, 2008-06-04
+
+__author__ = "shuber"
+
+
+import gobject
+import gtk
+import vte
+
+import DbgTerminal
+
+
+class WatchesFrame (gtk.Frame):
+
+
+ def __init__(self, debugger):
+
+ gtk.Frame.__init__(self, "Watches")
+ self.debugger = debugger
+
+ vbox = gtk.VBox(False, 5)
+ self.add(vbox)
+
+ hbox = gtk.HButtonBox()
+ vbox.pack_start(hbox, False, False)
+
+ self.addBtn = gtk.Button(stock=gtk.STOCK_ADD)
+ self.delBtn = gtk.Button(stock=gtk.STOCK_REMOVE)
+ hbox.add(self.addBtn)
+ hbox.add(self.delBtn)
+ hbox.set_layout(gtk.BUTTONBOX_SPREAD)
+
+ sw = gtk.ScrolledWindow()
+ sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
+ sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ vbox.add(sw)
+
+ self.model = self.__createModel()
+ self.tv = gtk.TreeView(self.model)
+ self.tv.set_rules_hint(True)
+ self.tv.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
+
+ self.__addColumns(self.tv)
+ sw.add(self.tv)
+
+ self.addBtn.connect("clicked", self.addBtnClicked)
+ self.delBtn.connect("clicked", self.delBtnClicked)
+
+
+
+ def __createModel(self):
+
+ model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, \
+ gobject.TYPE_BOOLEAN)
+
+ return model
+
+
+ def __addColumns(self, tv):
+
+ model = tv.get_model()
+
+ renderer = gtk.CellRendererText()
+ renderer.connect("edited", self.onExprEdited, model)
+ renderer.set_data("column", 0)
+ col = gtk.TreeViewColumn("Expr", renderer, text=0, editable=2)
+ col.set_resizable(True)
+ tv.append_column(col)
+
+
+ renderer = gtk.CellRendererText()
+ renderer.set_data("column", 1)
+ col = gtk.TreeViewColumn("Result", renderer, text=1)
+ col.set_resizable(True)
+ tv.append_column(col)
+
+
+ def onExprEdited(self, cell, pathStr, expr, model):
+ iter = model.get_iter_from_string(pathStr)
+ path = model.get_path(iter)[0]
+ col = cell.get_data("column")
+
+ model.set(iter, 0, expr)
+
+ if self.debugger.isActive():
+ res = self.debugger.getExpression(expr)
+ model.set(iter, 1, res)
+
+
+
+
+ def addBtnClicked(self, btn):
+ iter = self.model.append()
+ self.model.set(iter, 0, "0", 1, "0", 2, True)
+
+
+ def delBtnClicked(self, btn):
+ selection = self.tv.get_selection()
+ model, paths = selection.get_selected_rows()
+
+ for path in paths:
+ iter = model.get_iter(path)
+ model.remove(iter)
+
+
+ def updateValues(self):
+
+ iter = self.model.get_iter_first()
+
+ while iter != None:
+
+ expr, = self.model.get(iter, 0)
+ res = self.debugger.getExpression(expr)
+ self.model.set(iter, 1, res)
+
+ iter = self.model.iter_next(iter)
+