How to interrupt debugger.RunCommandInterpreter()?

Hi,
I am trying to figure out how can terminate command interpreter started via debugger.RunCommandInterpreter(false, false). I’ve tried calling debugger.DispatchInputEndOfFile() from another thread, but that doesn’t seem to work.

@clayborg Hi Greg, do you have any tips on this?

I’m embedding LLDB in an app and drive it via the SB API, but would like to also have a command interpreter on a tty, so that the user can enter commands directly. This part works well, but unfortunately I cannot find any docs or examples on how to programmatically terminate the interpreter thread when I shut down.

SBDebugger::Clear() should do the trick. The other thing you can do is to call the static SBDebugger::Terminate(). This will shut everything down globally. So use the instance methods SBDebugger::Clear() if you have only one debugger object (some IDEs have one SBDebugger object per debug window (Xcode)), or call SBDebugger::Terminate() if you are shutting down the entire process.

Thanks Greg! Unfortunately SBDebugger::Clear( ) seem to doesn’t work… Looking at the source, it clears added IO handlers, but not Debugger’s own one at the bottom of the stack.
I’ve also tried SBDebugger::Destroy(). This one looked more promising, at least execution got into Debugger::Clear(), which calls StopIOHandlerThread(). However, even after that, the handler thread still remained running. :man_shrugging: