about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2011-11-15 23:00:19 +0100
committerserpilliere <devnull@localhost>2011-11-15 23:00:19 +0100
commit36aa60d3fed6c834b0f3bab945d2ffb5741a133f (patch)
treee6ba7f0e35ffd62a4a2468e223a4ba700b41e16d
parent4ff4f432d35d3916dee1e68fdf35da3484ce0595 (diff)
downloadmiasm-36aa60d3fed6c834b0f3bab945d2ffb5741a133f.tar.gz
miasm-36aa60d3fed6c834b0f3bab945d2ffb5741a133f.zip
add goto address/symbol ctrl+G
-rwxr-xr-xmiasm/graph/graph_qt.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/miasm/graph/graph_qt.py b/miasm/graph/graph_qt.py
index 054c2336..1f806076 100755
--- a/miasm/graph/graph_qt.py
+++ b/miasm/graph/graph_qt.py
@@ -49,14 +49,14 @@ class HighlightingRule():
         self.format = format
 
 symbols_known = set()
-
+syntax_rules = None
 def gen_syntax_rules(symbols = []):
     global syntax_rules, symbols_known
 
     new_symbols = set()
     for s in symbols.s:
         new_symbols.add(re.escape(str(s)))
-    if new_symbols == symbols_known:
+    if new_symbols == symbols_known and syntax_rules:
         return syntax_rules
 
     highlightingRules = []
@@ -645,6 +645,7 @@ class MainWindow(QtGui.QWidget):
 
         QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Q"), self, self.close)
         QtGui.QShortcut(QtGui.QKeySequence("Ctrl+S"), self, self.save)
+        QtGui.QShortcut(QtGui.QKeySequence("Ctrl+G"), self, self.goto)
         self.label = None
         #self.ad = ad
         #self.all_bloc = all_bloc
@@ -694,6 +695,19 @@ class MainWindow(QtGui.QWidget):
         f.close()
         self.history_mngr.restaure(h)
 
+    def goto(self):
+        text, ok = QtGui.QInputDialog.getText(None, "goto",
+                                              'enter symbol/address:')
+        if not ok:
+            return
+
+        text = str(text)
+        ad = parse_address(text, self.symbol_pool)
+        if ad == None:
+            print 'bad addr', text
+            return
+        app.postEvent(self,e_refresh(self.history_mngr.hist_next, ad))
+
     def pos2graphpos(self, x, y):
         o_x = self.zoom*x + self.add_x
         o_y = self.zoom*y + self.add_y