[LLDB][REPL] Destroy the repl instances correctly
authorwalter erquinigo <walter@modular.com>
Tue, 25 Apr 2023 19:46:34 +0000 (14:46 -0500)
committerwalter erquinigo <walter@modular.com>
Tue, 25 Apr 2023 20:09:08 +0000 (15:09 -0500)
This change ensures that the REPL map inside Target is destroyed correctly when `Target::Destroy()` is invoked. Not doing so results in the REPL not finishing its job when the debugger is initialized in REPL mode reading from a file. In my particular case, my REPL doesn't print the stdout of the last expression in the input file unless I include this change.

Differential Revision: https://reviews.llvm.org/D149180

lldb/source/Target/Target.cpp

index c5946d1..4f3c644 100644 (file)
@@ -293,6 +293,7 @@ void Target::Destroy() {
   m_stop_hooks.clear();
   m_stop_hook_next_id = 0;
   m_suppress_stop_hooks = false;
+  m_repl_map.clear();
   Args signal_args;
   ClearDummySignals(signal_args);
 }