[Lldb-commits] [lldb] r250870 - When a REPL creates a new target for itself, it is that target's REPL.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 20 20:28:32 PDT 2015


This is a good example of where a "null repl" would be great for testing.
You don't need a language to verify, for example, that when a repl creates
a new target for itself, it is correcly set as the repl for that target.
And even if you had a language specific repl, that wouldn't really be the
right place to test that, because it makes the person reading the test
think that this is some property of a language instead of some property of
all repls.  So having a null repl is a great place to test all these
behaviors of the system that have nothing to do with what language you're
dealing with.

On Tue, Oct 20, 2015 at 5:38 PM Sean Callanan via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

> Author: spyffe
> Date: Tue Oct 20 19:36:34 2015
> New Revision: 250870
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250870&view=rev
> Log:
> When a REPL creates a new target for itself, it is that target's REPL.
> To allow that, I've added a SetREPL call to the Target, which allows a REPL
> that just created a target to install itself as the go-to REPL for the
> corresponding language.
>
> Modified:
>     lldb/trunk/include/lldb/Target/Target.h
>     lldb/trunk/source/Target/Target.cpp
>
> Modified: lldb/trunk/include/lldb/Target/Target.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=250870&r1=250869&r2=250870&view=diff
>
> ==============================================================================
> --- lldb/trunk/include/lldb/Target/Target.h (original)
> +++ lldb/trunk/include/lldb/Target/Target.h Tue Oct 20 19:36:34 2015
> @@ -1569,6 +1569,9 @@ public:
>
>      lldb::REPLSP
>      GetREPL (Error &err, lldb::LanguageType language, const char
> *repl_options, bool can_create);
> +
> +    void
> +    SetREPL (lldb::LanguageType language, lldb::REPLSP repl_sp);
>
>  protected:
>      //------------------------------------------------------------------
>
> Modified: lldb/trunk/source/Target/Target.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=250870&r1=250869&r2=250870&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Target/Target.cpp (original)
> +++ lldb/trunk/source/Target/Target.cpp Tue Oct 20 19:36:34 2015
> @@ -56,6 +56,7 @@
>  #include "lldb/Target/SystemRuntime.h"
>  #include "lldb/Target/Thread.h"
>  #include "lldb/Target/ThreadSpec.h"
> +#include "lldb/Utility/LLDBAssert.h"
>
>  using namespace lldb;
>  using namespace lldb_private;
> @@ -251,6 +252,14 @@ Target::GetREPL (Error &err, lldb::Langu
>  }
>
>  void
> +Target::SetREPL (lldb::LanguageType language, lldb::REPLSP repl_sp)
> +{
> +    lldbassert(!m_repl_map.count(language));
> +
> +    m_repl_map[language] = repl_sp;
> +}
> +
> +void
>  Target::Destroy()
>  {
>      Mutex::Locker locker (m_mutex);
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151021/31791254/attachment.html>


More information about the lldb-commits mailing list