aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/embedded_interpreter.py
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2011-01-14 00:29:16 +0000
committerCaroline Tice <ctice@apple.com>2011-01-14 00:29:16 +0000
commit2f88aadff1276ea99569657b8424776167ec5a34 (patch)
tree698f290fb0c66494fd953537ff1aa2e3ddd54602 /lldb/source/Interpreter/embedded_interpreter.py
parent0c34cb429ed90af168b1c2a8384401feb2e0085f (diff)
downloadllvm-2f88aadff1276ea99569657b8424776167ec5a34.zip
llvm-2f88aadff1276ea99569657b8424776167ec5a34.tar.gz
llvm-2f88aadff1276ea99569657b8424776167ec5a34.tar.bz2
Split up the Python script interpreter code to allow multiple script interpreter objects to
exist within the same process (one script interpreter object per debugger object). The python script interpreter objects are all using the same global Python script interpreter; they use separate dictionaries to keep their data separate, and mutex's to prevent any object attempting to use the global Python interpreter when another object is already using it. llvm-svn: 123415
Diffstat (limited to 'lldb/source/Interpreter/embedded_interpreter.py')
-rw-r--r--lldb/source/Interpreter/embedded_interpreter.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/embedded_interpreter.py b/lldb/source/Interpreter/embedded_interpreter.py
index 5492833..0e57c1e 100644
--- a/lldb/source/Interpreter/embedded_interpreter.py
+++ b/lldb/source/Interpreter/embedded_interpreter.py
@@ -84,7 +84,20 @@ class SimpleREPL(code.InteractiveConsole):
if not more:
break
+ def one_line (self, input):
+ line = self.process_input (input)
+ more = self.push(line)
+ if more:
+ self.write ("Input not a complete line.")
+ self.resetbuffer()
+ more = 0
+
def run_python_interpreter (dict):
# Pass in the dictionary, for continuity from one session to the next.
repl = SimpleREPL('>>> ', dict)
repl.interact()
+
+def run_one_line (dict, input_string):
+ repl = SimpleREPL ('', dict)
+ repl.one_line (input_string)
+