This patch can only be successfully applied to a repo that already has [1/2] applied. This is the core meat of the change.
See D7946 for more context and information about this patch.
Paths
| Differential D7957
Python Split [2/2] - Content change AbandonedPublic Authored by zturner on Feb 27 2015, 1:17 PM.
Details
Summary This patch can only be successfully applied to a repo that already has [1/2] applied. This is the core meat of the change. See D7946 for more context and information about this patch.
Diff Detail Event Timelinezturner updated this object. Comment ActionsBah. It looks like I need to fix the formatting. I didn't notice it when it was all one gigantic changelist, but now that it's not, I noticed that "git clang-format" reformatted the entire patch. Hold off on this until I get that straightened out. Comment Actions I almost fixed the argdumper linker errors, but there's a problem. OperatingSystemPython is linked into lldb-core, so when argdumper links against lldb-core.a, it tries to link OperatingSystemPython, which then requires we bring in everything else. But we can't link API into lldb-core, so it doesn't work. Is it possible to have OperatingSystemPython not be part of lldb-core, but instead be part of lldb-core-python or something? This way argdumper could just link against lldb-core.a but not lldb-core-python.a, and lldb could link against both. I don't know how to set this up in Xcode though. Comment Actions Rebase against ToT. See part 1 for more information. This patch and part 1 are coupled, please make sure to apply them at the same time. Comment Actions So seems like part of the work required for this patch to work is to change any references in code from PythonList, PythonString, PythonInteger, and PythonDictionary to use classes from lldb/Core/StructuredData.h. The means we probably need to have OperatingSystemPython rely only upon virtual functions in ScriptInterpreter and have those functions return stuff from StructuredData instead of python variants: PythonDictionary dictionary(m_interpreter->OSPlugin_RegisterInfo(m_python_object_sp)); Will need to become: StructuredData::Dictionary dictionary(m_interpreter->OSPlugin_RegisterInfo(m_python_object_sp)); We then need to modify the Python callbacks that return PythonList, PythonString, PythonInteger, and PythonDictionary objects, to convert them into StructuredData::Array, StructuredData::String, StructuredData::Integer and StructuredData::Dictionary respectively. clayborg edited edge metadata. Comment ActionsProcessGDBRemote::ParsePythonTargetDefinition() will also need to be updated to use StructuredData objects and the conversion from Python to StructuredData objects will need to be done in ScriptInterpreterPython. So: lldb::ScriptInterpreterObjectSP target_definition_sp (interpreter->GetDynamicSettings(module_object_sp, &GetTarget(), "gdb-server-target-definition", error)); PythonDictionary target_dict(target_definition_sp); Will need to become: lldb::StructuredDataObjectSP target_definition_sp (interpreter->GetDynamicSettings(module_object_sp, &GetTarget(), "gdb-server-target-definition", error)); StructuredData::Dictionary *dict = target_definition_sp->GetAsDictionary(); if (dict) { } So Python* data types should _only_ exist in ScriptInterpreterPython code and should always be converted to StructuredData types before being given out to any code within LLDB. This revision now requires changes to proceed.Mar 5 2015, 2:45 PM Comment Actions There is one more issue which I was unable to solve, which is that Comment Actions SBCommandInterpreter::InitializeSWIG () seems like a good place to do this. This could be renamed to be InitializeScriptInterpreters() and then you can do this if and only if python is enabled. Comment Actions SBDebugger::Initialize () is the main function that must be called prior to using anything in the lldb::SB* layer, and it currently looks like: void SBDebugger::Initialize () { Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBDebugger::Initialize ()"); SBCommandInterpreter::InitializeSWIG (); Debugger::Initialize(LoadPlugin); } You might need to call Debugger::Initialize() first so all plug-ins registers themselves, and then call SBCommandInterpreter::InitializeScriptInterpreters() after to ensure everything is setup as the ScriptInterpreterPython will need to register itself with the ScriptInterpreter if it already isn't doing so. Comment Actions ScriptInterpreter will need to keep a map of language to static create functions (ScriptInterpreterPython::CreateInstance()) so it can create the interpreter when needed. So the SBCommandInterpreter::InitializeScriptInterpreter() would: (lldb) settings show script-lang The default language is gettable using Debugger::GetScriptLanguage(). Comment Actions I think this part needs to be done as a separate patch. Makes it easier to
Revision Contents
Diff 21209 cmake/LLDBDependencies.cmake
cmake/modules/LLDBConfig.cmake
include/lldb/API/SBBreakpointLocation.h
include/lldb/API/SBCommandInterpreter.h
include/lldb/API/SBFrame.h
include/lldb/API/bindings/Python/ScriptInterpreterPython.h
include/lldb/DataFormatters/TypeSummary.h
include/lldb/Interpreter/CommandInterpreter.h
include/lldb/ScriptInterpreter/ScriptInterpreter.h
include/lldb/ScriptInterpreter/ScriptInterpreterNone.h
include/lldb/lldb-forward.h
source/API/Bindings/CMakeLists.txt
source/API/Bindings/Python/CMakeLists.txt
source/API/Bindings/Python/PythonDataObjects.cpp
source/API/Bindings/Python/ScriptInterpreterPython.cpp
source/API/CMakeLists.txt
source/API/SBBreakpoint.cpp
source/API/SBBreakpointLocation.cpp
source/API/SBCommandInterpreter.cpp
source/API/SBDebugger.cpp
source/API/SBTypeCategory.cpp
source/CMakeLists.txt
source/Commands/CommandObjectCommands.cpp
source/Core/Module.cpp
source/Core/ValueObject.cpp
source/DataFormatters/FormatManager.cpp
source/DataFormatters/TypeSynthetic.cpp
source/Interpreter/CMakeLists.txt
source/Interpreter/CommandInterpreter.cpp
source/Interpreter/CommandObject.cpp
source/Interpreter/CommandObjectScript.cpp
source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
source/ScriptInterpreter/CMakeLists.txt
source/ScriptInterpreter/ScriptInterpreter.cpp
source/ScriptInterpreter/ScriptInterpreterNone.cpp
source/Target/ThreadPlanPython.cpp
source/lldb.cpp
tools/driver/CMakeLists.txt
tools/lldb-server/CMakeLists.txt
|