diff options
author | Jim Ingham <jingham@apple.com> | 2010-10-04 22:44:14 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2010-10-04 22:44:14 +0000 |
commit | 3bcdb29cab367ce88a8fa337bf313bb8d2d1bbcd (patch) | |
tree | af6bd33cbc30d1ba0dee6349b3f71a4cf5aee912 | |
parent | c8d6cfd7308a43caf1b4102a2d321bdeb334b911 (diff) | |
download | bcm5719-llvm-3bcdb29cab367ce88a8fa337bf313bb8d2d1bbcd.tar.gz bcm5719-llvm-3bcdb29cab367ce88a8fa337bf313bb8d2d1bbcd.zip |
Add an "auto-confirm" setting to the debugger so you can turn off the confirmations if you want to.
llvm-svn: 115572
-rw-r--r-- | lldb/include/lldb/Core/Debugger.h | 17 | ||||
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 34 | ||||
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 5 |
3 files changed, 50 insertions, 6 deletions
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index bcfd47c61c8..cafb89c7780 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -153,6 +153,19 @@ public: m_use_external_editor = use_external_editor_p; return old_value; } + + bool + GetAutoConfirm () const + { + return m_auto_confirm_on; + } + + void + SetAutoConfirm (bool auto_confirm_on) + { + m_auto_confirm_on = auto_confirm_on; + } + protected: @@ -186,6 +199,9 @@ protected: static const ConstString & UseExternalEditorVarName (); + + static const ConstString & + AutoConfirmName (); private: @@ -195,6 +211,7 @@ private: std::string m_thread_format; lldb::ScriptLanguage m_script_lang; bool m_use_external_editor; + bool m_auto_confirm_on; }; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index d2768e72568..3e0b617c631 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1298,7 +1298,8 @@ DebuggerInstanceSettings::DebuggerInstanceSettings m_frame_format (), m_thread_format (), m_script_lang (), - m_use_external_editor (false) + m_use_external_editor (false), + m_auto_confirm_on (false) { // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called // until the vtables for DebuggerInstanceSettings are properly set up, i.e. AFTER all the initializers. @@ -1324,7 +1325,8 @@ DebuggerInstanceSettings::DebuggerInstanceSettings (const DebuggerInstanceSettin m_frame_format (rhs.m_frame_format), m_thread_format (rhs.m_thread_format), m_script_lang (rhs.m_script_lang), - m_use_external_editor (rhs.m_use_external_editor) + m_use_external_editor (rhs.m_use_external_editor), + m_auto_confirm_on(rhs.m_auto_confirm_on) { const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name); CopyInstanceSettings (pending_settings, false); @@ -1346,6 +1348,7 @@ DebuggerInstanceSettings::operator= (const DebuggerInstanceSettings &rhs) m_thread_format = rhs.m_thread_format; m_script_lang = rhs.m_script_lang; m_use_external_editor = rhs.m_use_external_editor; + m_auto_confirm_on = rhs.m_auto_confirm_on; } return *this; @@ -1434,6 +1437,10 @@ DebuggerInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var { UserSettingsController::UpdateBooleanVariable (op, m_use_external_editor, value, err); } + else if (var_name == AutoConfirmName ()) + { + UserSettingsController::UpdateBooleanVariable (op, m_auto_confirm_on, value, err); + } } bool @@ -1472,6 +1479,13 @@ DebuggerInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry, else value.AppendString ("false"); } + else if (var_name == AutoConfirmName()) + { + if (m_auto_confirm_on) + value.AppendString ("true"); + else + value.AppendString ("false"); + } else { if (err) @@ -1509,6 +1523,7 @@ DebuggerInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP & m_term_width = new_debugger_settings->m_term_width; m_script_lang = new_debugger_settings->m_script_lang; m_use_external_editor = new_debugger_settings->m_use_external_editor; + m_auto_confirm_on = new_debugger_settings->m_auto_confirm_on; } @@ -1610,6 +1625,14 @@ DebuggerInstanceSettings::UseExternalEditorVarName () return use_external_editor_var_name; } +const ConstString & +DebuggerInstanceSettings::AutoConfirmName () +{ + static ConstString use_external_editor_var_name ("auto-confirm"); + + return use_external_editor_var_name; +} + //-------------------------------------------------- // SettingsController Variable Tables //-------------------------------------------------- @@ -1646,11 +1669,12 @@ Debugger::SettingsController::instance_settings_table[] = { // NAME Setting variable type Default Enum Init'd Hidden Help // ======================= ======================= ====================== ==== ====== ====== ====================== -{ "term-width", eSetVarTypeInt, "80" , NULL, false, false, "The maximum number of columns to use for displaying text." }, -{ "script-lang", eSetVarTypeString, "python", NULL, false, false, "The script language to be used for evaluating user-written scripts." }, -{ "prompt", eSetVarTypeString, "(lldb)", NULL, false, false, "The debugger command line prompt displayed for the user." }, { "frame-format", eSetVarTypeString, DEFAULT_FRAME_FORMAT, NULL, false, false, "The default frame format string to use when displaying thread information." }, +{ "prompt", eSetVarTypeString, "(lldb)", NULL, false, false, "The debugger command line prompt displayed for the user." }, +{ "script-lang", eSetVarTypeString, "python", NULL, false, false, "The script language to be used for evaluating user-written scripts." }, +{ "term-width", eSetVarTypeInt, "80" , NULL, false, false, "The maximum number of columns to use for displaying text." }, { "thread-format", eSetVarTypeString, DEFAULT_THREAD_FORMAT, NULL, false, false, "The default thread format string to use when displaying thread information." }, { "use-external-editor", eSetVarTypeBool, "false", NULL, false, false, "Whether to use an external editor or not." }, +{ "auto-confirm", eSetVarTypeBool, "false", NULL, false, false, "If true all confirmation prompts will receive their default reply." }, { NULL, eSetVarTypeNone, NULL, NULL, false, false, NULL } }; diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index cfa30ea1856..f0704f767c4 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -843,7 +843,10 @@ CommandInterpreter::GetConfirmationInputReaderCallback (void *baton, bool CommandInterpreter::Confirm (const char *message, bool default_answer) { - // The default interpretation just pushes a new input reader and lets it get the answer: + // Check AutoConfirm first: + if (m_debugger.GetAutoConfirm()) + return default_answer; + InputReaderSP reader_sp (new InputReader(GetDebugger())); bool response = default_answer; if (reader_sp) |