Index: include/lldb/Core/Debugger.h =================================================================== --- include/lldb/Core/Debugger.h +++ include/lldb/Core/Debugger.h @@ -352,6 +352,12 @@ SetTabSize (uint32_t tab_size); bool + GetEnforceInteractivity () const; + + bool + SetEnforceInteractivity (bool b); + + bool GetEscapeNonPrintables () const; bool Index: source/Core/Debugger.cpp =================================================================== --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -151,6 +151,7 @@ { "print-decls", OptionValue::eTypeBoolean , true, true , nullptr, nullptr, "If true, LLDB will print the values of variables declared in an expression. Currently only supported in the REPL (default: true)." }, { "tab-size", OptionValue::eTypeUInt64 , true, 4 , nullptr, nullptr, "The tab size to use when indenting code in multi-line input mode (default: 4)." }, { "escape-non-printables", OptionValue::eTypeBoolean , true, true, nullptr, nullptr, "If true, LLDB will automatically escape non-printable and escape characters when formatting strings." }, +{ "enforce-interactivity", OptionValue::eTypeBoolean , true, true, nullptr, nullptr, "If true, LLDB will enforce interactivity checks before executing potentially interactive actions."}, { nullptr, OptionValue::eTypeInvalid , true, 0 , nullptr, nullptr, nullptr } }; @@ -174,7 +175,8 @@ ePropertyAutoIndent, ePropertyPrintDecls, ePropertyTabSize, - ePropertyEscapeNonPrintables + ePropertyEscapeNonPrintables, + ePropertyEnforceInteractivity }; LoadPluginCallbackType Debugger::g_load_plugin_callback = nullptr; @@ -431,6 +433,20 @@ return m_collection_sp->SetPropertyAtIndexAsUInt64(nullptr, idx, tab_size); } +bool +Debugger::GetEnforceInteractivity () const +{ + const uint32_t idx = ePropertyEnforceInteractivity; + return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, g_properties[idx].default_uint_value != 0); +} + +bool +Debugger::SetEnforceInteractivity (bool b) +{ + const uint32_t idx = ePropertyEnforceInteractivity; + return m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); +} + #pragma mark Debugger //const DebuggerPropertiesSP & Index: source/Core/IOHandler.cpp =================================================================== --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -455,7 +455,7 @@ FILE *in = GetInputFILE(); if (in) { - if (GetIsInteractive()) + if (GetIsInteractive() || !m_debugger.GetEnforceInteractivity()) { const char *prompt = nullptr;