summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2011-05-03 21:21:50 +0000
committerCaroline Tice <ctice@apple.com>2011-05-03 21:21:50 +0000
commite67afe15b43e2e788dfef60c2d5ff7cda822922a (patch)
tree629803bedcc3f4fb5f7518a0e408b697cc0fbe46 /lldb/source/Interpreter
parentdb0996c8221fe0d26cbbc8648a0fa6f29c1843ce (diff)
downloadbcm5719-llvm-e67afe15b43e2e788dfef60c2d5ff7cda822922a.tar.gz
bcm5719-llvm-e67afe15b43e2e788dfef60c2d5ff7cda822922a.zip
Pre-load the Python script interpreter with the following
convenience variables (from the ExecutionContext) each time it is entered: lldb.debugger, lldb.target, lldb.process, lldb.thread, lldb.frame. If a frame (or thread, process, etc) does not currently exist, the variable contains the Python value 'None'. llvm-svn: 130792
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index 47302be0ee4..373699127d7 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -377,8 +377,49 @@ ScriptInterpreterPython::EnterSession ()
run_string.Printf ("run_one_line (%s, 'lldb.debugger_unique_id = %d')", m_dictionary_name.c_str(),
GetCommandInterpreter().GetDebugger().GetID());
PyRun_SimpleString (run_string.GetData());
+ run_string.Clear();
+
+
+ run_string.Printf ("run_one_line (%s, 'lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%d)')",
+ m_dictionary_name.c_str(),
+ GetCommandInterpreter().GetDebugger().GetID());
+ PyRun_SimpleString (run_string.GetData());
+ run_string.Clear();
+ ExecutionContext exe_ctx = m_interpreter.GetDebugger().GetSelectedExecutionContext();
+
+ if (exe_ctx.target)
+ run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.debugger.GetSelectedTarget()')",
+ m_dictionary_name.c_str());
+ else
+ run_string.Printf ("run_one_line (%s, 'lldb.target = None')", m_dictionary_name.c_str());
+ PyRun_SimpleString (run_string.GetData());
+ run_string.Clear();
+
+ if (exe_ctx.process)
+ run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.target.GetProcess()')", m_dictionary_name.c_str());
+ else
+ run_string.Printf ("run_one_line (%s, 'lldb.process = None')", m_dictionary_name.c_str());
+ PyRun_SimpleString (run_string.GetData());
+ run_string.Clear();
+
+ if (exe_ctx.thread)
+ run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.process.GetSelectedThread ()')",
+ m_dictionary_name.c_str());
+ else
+ run_string.Printf ("run_one_line (%s, 'lldb.thread = None')", m_dictionary_name.c_str());
+ PyRun_SimpleString (run_string.GetData());
+ run_string.Clear();
+
+ if (exe_ctx.frame)
+ run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.thread.GetSelectedFrame ()')",
+ m_dictionary_name.c_str());
+ else
+ run_string.Printf ("run_one_line (%s, 'lldb.frame = None')", m_dictionary_name.c_str());
+ PyRun_SimpleString (run_string.GetData());
+ run_string.Clear();
+
PyObject *sysmod = PyImport_AddModule ("sys");
PyObject *sysdict = PyModule_GetDict (sysmod);
OpenPOWER on IntegriCloud