Author: spyffe Date: Tue Oct 20 19:28:44 2015 New Revision: 250869 URL: http://llvm.org/viewvc/llvm-project?rev=250869&view=rev Log: When target is NULL, provide a debugger so that REPLs can use that to create their own target.
Modified: lldb/trunk/include/lldb/Expression/REPL.h lldb/trunk/include/lldb/lldb-private-interfaces.h lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Expression/REPL.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/Expression/REPL.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/REPL.h?rev=250869&r1=250868&r2=250869&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/REPL.h (original) +++ lldb/trunk/include/lldb/Expression/REPL.h Tue Oct 20 19:28:44 2015 @@ -38,7 +38,7 @@ public: virtual ~REPL(); //------------------------------------------------------------------ - /// Get a REPL with an (optional) existing target, and (optional) extra arguments for the compiler. + /// Get a REPL with an existing target (or, failing that, a debugger to use), and (optional) extra arguments for the compiler. /// /// @param[out] error /// If this language is supported but the REPL couldn't be created, this error is populated with the reason. @@ -46,6 +46,9 @@ public: /// @param[in] language /// The language to create a REPL for. /// + /// @param[in] debugger + /// If provided, and target is NULL, the debugger to use when setting up a top-level REPL. + /// /// @param[in] target /// If provided, the target to put the REPL inside. /// @@ -56,7 +59,7 @@ public: /// The range of the containing object in the target process. //------------------------------------------------------------------ static lldb::REPLSP - Create (Error &Error, lldb::LanguageType language, Target *target, const char *repl_options); + Create (Error &Error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options); void SetFormatOptions (const OptionGroupFormat &options) Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=250869&r1=250868&r2=250869&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-interfaces.h (original) +++ lldb/trunk/include/lldb/lldb-private-interfaces.h Tue Oct 20 19:28:44 2015 @@ -49,7 +49,7 @@ namespace lldb_private typedef lldb::InstrumentationRuntimeType (*InstrumentationRuntimeGetType) (); typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance) (const lldb::ProcessSP &process_sp); typedef lldb::TypeSystemSP (*TypeSystemCreateInstance) (lldb::LanguageType language, Module *module, Target *target); - typedef lldb::REPLSP (*REPLCreateInstance) (Error &error, lldb::LanguageType language, Target *target, const char *repl_options); + typedef lldb::REPLSP (*REPLCreateInstance) (Error &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options); typedef void (*TypeSystemEnumerateSupportedLanguages) (std::set<lldb::LanguageType> &languages_for_types, std::set<lldb::LanguageType> &languages_for_expressions); typedef int (*ComparisonFunction)(const void *, const void *); typedef void (*DebuggerInitializeCallback)(Debugger &debugger); Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=250869&r1=250868&r2=250869&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Tue Oct 20 19:28:44 2015 @@ -1813,7 +1813,7 @@ Debugger::RunREPL (LanguageType language Target *const target = nullptr; // passing in an empty target means the REPL must create one - REPLSP repl_sp(REPL::Create(err, language, target, repl_options)); + REPLSP repl_sp(REPL::Create(err, language, this, target, repl_options)); if (!err.Success()) { Modified: lldb/trunk/source/Expression/REPL.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/REPL.cpp?rev=250869&r1=250868&r2=250869&view=diff ============================================================================== --- lldb/trunk/source/Expression/REPL.cpp (original) +++ lldb/trunk/source/Expression/REPL.cpp Tue Oct 20 19:28:44 2015 @@ -23,14 +23,14 @@ using namespace lldb_private; lldb::REPLSP -REPL::Create(Error &err, lldb::LanguageType language, Target *target, const char *repl_options) +REPL::Create(Error &err, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options) { uint32_t idx = 0; lldb::REPLSP ret; while (REPLCreateInstance create_instance = PluginManager::GetREPLCreateCallbackAtIndex(idx++)) { - ret = (*create_instance)(err, language, target, repl_options); + ret = (*create_instance)(err, language, debugger, target, repl_options); if (ret) { break; Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=250869&r1=250868&r2=250869&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Tue Oct 20 19:28:44 2015 @@ -233,7 +233,8 @@ Target::GetREPL (Error &err, lldb::Langu return lldb::REPLSP(); } - lldb::REPLSP ret = REPL::Create(err, language, this, repl_options); + Debugger *const debugger = nullptr; + lldb::REPLSP ret = REPL::Create(err, language, debugger, this, repl_options); if (ret) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits