summaryrefslogtreecommitdiff
path: root/python/scriptingprovider.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2018-11-08 09:58:36 -0500
committerPeter LaFosse <peter@vector35.com>2018-11-13 11:07:27 -0500
commitd8ff0a6324fe92ccafe296298409c50cc4b526fa (patch)
treec5bf8cdf43902d3122a6747d5c42d9197afc0808 /python/scriptingprovider.py
parent9df7c7c621c82e6caa7a09c4273e4feba86277f2 (diff)
Add expression parsing APIs
Add text-based and constant-based searching
Diffstat (limited to 'python/scriptingprovider.py')
-rw-r--r--python/scriptingprovider.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py
index 5b5d830e..52584ec7 100644
--- a/python/scriptingprovider.py
+++ b/python/scriptingprovider.py
@@ -557,12 +557,20 @@ class PythonScriptingInstance(ScriptingInstance):
for line in code.split(b'\n'):
self.interpreter.push(line.decode('charmap'))
- if self.locals["here"] != self.active_addr:
- if not self.active_view.file.navigate(self.active_view.file.view, self.locals["here"]):
- sys.stderr.write("Address 0x%x is not valid for the current view\n" % self.locals["here"])
- elif self.locals["current_address"] != self.active_addr:
- if not self.active_view.file.navigate(self.active_view.file.view, self.locals["current_address"]):
- sys.stderr.write("Address 0x%x is not valid for the current view\n" % self.locals["current_address"])
+ tryNavigate = True
+ if isinstance(self.locals["here"], str) or isinstance(self.locals["current_address"], str):
+ try:
+ self.locals["here"] = self.active_view.parse_expression(self.locals["here"], self.active_addr)
+ except ValueError as e:
+ sys.stderr.write(e)
+ tryNavigate = False
+ if tryNavigate:
+ if self.locals["here"] != self.active_addr:
+ if not self.active_view.file.navigate(self.active_view.file.view, self.locals["here"]):
+ sys.stderr.write("Address 0x%x is not valid for the current view\n" % self.locals["here"])
+ elif self.locals["current_address"] != self.active_addr:
+ if not self.active_view.file.navigate(self.active_view.file.view, self.locals["current_address"]):
+ sys.stderr.write("Address 0x%x is not valid for the current view\n" % self.locals["current_address"])
if self.active_view is not None:
self.active_view.update_analysis()
except: