[Lldb-commits] [lldb] r115572 - in /lldb/trunk: include/lldb/Core/Debugger.h source/Core/Debugger.cpp source/Interpreter/CommandInterpreter.cpp
Jim Ingham
jingham at apple.com
Mon Oct 4 15:44:14 PDT 2010
Author: jingham
Date: Mon Oct 4 17:44:14 2010
New Revision: 115572
URL: http://llvm.org/viewvc/llvm-project?rev=115572&view=rev
Log:
Add an "auto-confirm" setting to the debugger so you can turn off the confirmations if you want to.
Modified:
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=115572&r1=115571&r2=115572&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Mon Oct 4 17:44:14 2010
@@ -153,6 +153,19 @@
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 @@
static const ConstString &
UseExternalEditorVarName ();
+
+ static const ConstString &
+ AutoConfirmName ();
private:
@@ -195,6 +211,7 @@
std::string m_thread_format;
lldb::ScriptLanguage m_script_lang;
bool m_use_external_editor;
+ bool m_auto_confirm_on;
};
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=115572&r1=115571&r2=115572&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Mon Oct 4 17:44:14 2010
@@ -1298,7 +1298,8 @@
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 @@
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 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
{
// 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 }
};
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=115572&r1=115571&r2=115572&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Oct 4 17:44:14 2010
@@ -843,7 +843,10 @@
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)
More information about the lldb-commits
mailing list