summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index a4d78151c75..500913ad41b 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -680,6 +680,15 @@ void Debugger::Destroy(DebuggerSP &debugger_sp) {
if (!debugger_sp)
return;
+ /*
+ * FILE* get flushed on process exit. If those FILEs need to call into python
+ * to flush, we can't have them flushing after python is already torn down.
+ * That would result in a segfault. We are still relying on the python script
+ * to tear down the debugger before it exits.
+ */
+ debugger_sp->m_output_file_sp->Flush();
+ debugger_sp->m_error_file_sp->Flush();
+
debugger_sp->Clear();
if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
@@ -896,6 +905,11 @@ void Debugger::SetErrorFileHandle(FILE *fh, bool tranfer_ownership) {
err_file.SetStream(stderr, false);
}
+void Debugger::FlushDebuggerOutputHandles() {
+ m_output_file_sp->Flush();
+ m_error_file_sp->Flush();
+}
+
void Debugger::SaveInputTerminalState() {
if (m_input_file_sp) {
File &in_file = m_input_file_sp->GetFile();
OpenPOWER on IntegriCloud