Maked LLDB into a package so we can import things without poluting the global namespace.

Enrico will follow this up with fixing the data formatter test cases that are failing.

llvm-svn: 155514
This commit is contained in:
Greg Clayton
2012-04-25 00:58:03 +00:00
parent 62079b43cc
commit 6d98f56c58
4 changed files with 113 additions and 560 deletions

View File

@@ -296,13 +296,14 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
int old_count = Debugger::TestDebuggerRefCount();
run_string.Printf ("run_one_line (%s, 'import copy, os, re, sys, uuid, lldb, gnu_libstdcpp, libcxx, objc, Logger')", m_dictionary_name.c_str());
run_string.Printf ("run_one_line (%s, 'import copy, os, re, sys, uuid, lldb')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
// WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set
// and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task
run_string.Clear();
run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate, NSIndexSet, Selector, Class, CFBitVector')", m_dictionary_name.c_str());
//run_string.Printf ("run_one_line (%s, 'from lldb.formatters import *; from lldb.formatters.objc import *; from lldb.formatters.cpp import *')", m_dictionary_name.c_str());
run_string.Printf ("run_one_line (%s, 'from lldb.formatters import *')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
int new_count = Debugger::TestDebuggerRefCount();
@@ -1961,13 +1962,7 @@ ScriptInterpreterPython::InitializePrivate ()
}
}
PyRun_SimpleString ("sys.dont_write_bytecode = 1");
PyRun_SimpleString ("import embedded_interpreter");
PyRun_SimpleString ("from embedded_interpreter import run_python_interpreter");
PyRun_SimpleString ("from embedded_interpreter import run_one_line");
PyRun_SimpleString ("from termios import *");
PyRun_SimpleString ("sys.dont_write_bytecode = 1; import lldb.embedded_interpreter; from lldb.embedded_interpreter import run_python_interpreter; from lldb.embedded_interpreter import run_one_line; from termios import *");
stdin_tty_state.Restore();
}