diff options
author | Sean Callanan <scallanan@apple.com> | 2015-10-21 00:28:44 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2015-10-21 00:28:44 +0000 |
commit | 3b682de6b1f7f7ba2b7ea337cb5107a643c34c8a (patch) | |
tree | 72da86300302c9ab460d50fb0ce260e0172b7bf0 | |
parent | ced9941cd423df578d94ba97c417d14105fda9fc (diff) | |
download | bcm5719-llvm-3b682de6b1f7f7ba2b7ea337cb5107a643c34c8a.tar.gz bcm5719-llvm-3b682de6b1f7f7ba2b7ea337cb5107a643c34c8a.zip |
When target is NULL, provide a debugger so that REPLs can use that to create
their own target.
llvm-svn: 250869
-rw-r--r-- | lldb/include/lldb/Expression/REPL.h | 7 | ||||
-rw-r--r-- | lldb/include/lldb/lldb-private-interfaces.h | 2 | ||||
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Expression/REPL.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 3 |
5 files changed, 11 insertions, 7 deletions
diff --git a/lldb/include/lldb/Expression/REPL.h b/lldb/include/lldb/Expression/REPL.h index 8e1ada82d70..90cbc64491b 100644 --- a/lldb/include/lldb/Expression/REPL.h +++ b/lldb/include/lldb/Expression/REPL.h @@ -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) diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h index d967e9d3ab1..22bdd18ac2a 100644 --- a/lldb/include/lldb/lldb-private-interfaces.h +++ b/lldb/include/lldb/lldb-private-interfaces.h @@ -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); diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index c5f46779fa5..8619b50b2a3 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1813,7 +1813,7 @@ Debugger::RunREPL (LanguageType language, const char *repl_options) 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()) { diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp index 472096ee044..1c6a6445fae 100644 --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -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; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 4cc6ee25d89..e08df55ac6c 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -233,7 +233,8 @@ Target::GetREPL (Error &err, lldb::LanguageType language, const char *repl_optio 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) { |