From 49e2737eb482affe4ef15f9972950d4e266037ee Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Tue, 7 Sep 2010 18:35:40 +0000 Subject: [PATCH] Fix various minor bugs in the Settings stuff. llvm-svn: 113245 --- .../source/Commands/CommandObjectSettings.cpp | 2 +- lldb/source/Core/Debugger.cpp | 24 +++++++++++++++++-- lldb/source/Core/UserSettingsController.cpp | 5 ++-- lldb/source/Target/Process.cpp | 4 ++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index a4a3643d7bf3..ff06172c5eb8 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -82,7 +82,7 @@ CommandObjectSettingsSet::Execute (CommandInterpreter &interpreter, const int argc = command.GetArgumentCount (); - if (argc < 2) + if ((argc < 2) && (!m_options.m_reset)) { result.AppendError ("'settings set' takes more arguments"); result.SetStatus (eReturnStatusFailed); diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 9ccd2c166127..aa7d08a88276 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -689,7 +689,16 @@ DebuggerInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var UserSettingsController::UpdateStringVariable (op, m_prompt, value, err); if (!pending) { - BroadcastPromptChange (instance_name, m_prompt.c_str()); + // 'instance_name' is actually (probably) in the form '[]'; if so, we need to + // strip off the brackets before passing it to BroadcastPromptChange. + + std::string tmp_instance_name (instance_name.AsCString()); + if ((tmp_instance_name[0] == '[') + && (tmp_instance_name[instance_name.GetLength() - 1] == ']')) + tmp_instance_name = tmp_instance_name.substr (1, instance_name.GetLength() - 2); + ConstString new_name (tmp_instance_name.c_str()); + + BroadcastPromptChange (new_name, m_prompt.c_str()); } } else if (var_name == ScriptLangVarName()) @@ -746,7 +755,18 @@ DebuggerInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP & m_prompt = new_debugger_settings->m_prompt; if (!pending) - BroadcastPromptChange (m_instance_name, m_prompt.c_str()); + { + // 'instance_name' is actually (probably) in the form '[]'; if so, we need to + // strip off the brackets before passing it to BroadcastPromptChange. + + std::string tmp_instance_name (m_instance_name.AsCString()); + if ((tmp_instance_name[0] == '[') + && (tmp_instance_name[m_instance_name.GetLength() - 1] == ']')) + tmp_instance_name = tmp_instance_name.substr (1, m_instance_name.GetLength() - 2); + ConstString new_name (tmp_instance_name.c_str()); + + BroadcastPromptChange (new_name, m_prompt.c_str()); + } m_script_lang = new_debugger_settings->m_script_lang; } diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index 554ea76beddb..9fd0c5c211cc 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -1042,13 +1042,14 @@ UserSettingsController::GetAllVariableValues (CommandInterpreter &interpreter, StringList value = root->GetVariable (full_var_name.GetData(), var_type); description.Clear(); if (value.GetSize() == 1) - description.Printf ("%s (%s) = %s", full_var_name.GetData(), GetTypeString (entry.var_type), + description.Printf ("%s (%s) = '%s'", full_var_name.GetData(), GetTypeString (entry.var_type), value.GetStringAtIndex (0)); else { - description.Printf ("%s (%s) = ", full_var_name.GetData(), GetTypeString (entry.var_type)); + description.Printf ("%s (%s) = '", full_var_name.GetData(), GetTypeString (entry.var_type)); for (int j = 0; j < value.GetSize(); ++j) description.Printf ("%s ", value.GetStringAtIndex (j)); + description.Printf ("'"); } result_stream.Printf ("%s\n", description.GetData()); diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 4a6e26953e7b..19b0d4f81e6a 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2196,7 +2196,7 @@ ProcessInstanceSettings::InputPathVarName () const ConstString & ProcessInstanceSettings::OutputPathVarName () { - static ConstString output_path_var_name ("output_path"); + static ConstString output_path_var_name ("output-path"); return output_path_var_name; } @@ -2204,7 +2204,7 @@ ProcessInstanceSettings::OutputPathVarName () const ConstString & ProcessInstanceSettings::ErrorPathVarName () { - static ConstString error_path_var_name ("error_path"); + static ConstString error_path_var_name ("error-path"); return error_path_var_name; }