Make all debugger-level user settable variables into instance variables.
Make get/set variable at the debugger level always set the particular debugger's instance variables rather than
the default variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113474 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index e7b3a1e..0da474b 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -64,7 +64,9 @@
std::string lang_name = ScriptInterpreter::LanguageToString (script_language);
StreamString var_name;
var_name.Printf ("[%s].script-lang", dbg_name);
- debugger.GetSettingsController()->SetVariable (var_name.GetData(), lang_name.c_str(), lldb::eVarSetOperationAssign, false);
+ debugger.GetSettingsController()->SetVariable (var_name.GetData(), lang_name.c_str(),
+ lldb::eVarSetOperationAssign, false,
+ m_debugger.GetInstanceName().AsCString());
}
void
@@ -140,7 +142,8 @@
const char *dbg_name = GetDebugger().GetInstanceName().AsCString();
StreamString var_name;
var_name.Printf ("[%s].script-lang", dbg_name);
- value = Debugger::GetSettingsController()->GetVariable (var_name.GetData(), var_type);
+ value = Debugger::GetSettingsController()->GetVariable (var_name.GetData(), var_type,
+ m_debugger.GetInstanceName().AsCString());
bool success;
script_language = Args::StringToScriptLanguage (value.GetStringAtIndex(0), lldb::eScriptLanguageDefault, &success);
@@ -777,7 +780,7 @@
const char *instance_name = GetDebugger().GetInstanceName().AsCString();
StreamString var_name;
var_name.Printf ("[%s].prompt", instance_name);
- return Debugger::GetSettingsController()->GetVariable (var_name.GetData(), var_type).GetStringAtIndex(0);
+ return Debugger::GetSettingsController()->GetVariable (var_name.GetData(), var_type, instance_name).GetStringAtIndex(0);
}
void
@@ -786,7 +789,8 @@
const char *instance_name = GetDebugger().GetInstanceName().AsCString();
StreamString name_str;
name_str.Printf ("[%s].prompt", instance_name);
- Debugger::GetSettingsController()->SetVariable (name_str.GetData(), new_prompt, lldb::eVarSetOperationAssign, false);
+ Debugger::GetSettingsController()->SetVariable (name_str.GetData(), new_prompt, lldb::eVarSetOperationAssign,
+ false, m_debugger.GetInstanceName().AsCString());
}
void
@@ -1037,7 +1041,8 @@
{
lldb::SettableVariableType var_type;
const char *width_value =
- Debugger::GetSettingsController()->GetVariable ("term-width", var_type).GetStringAtIndex(0);
+ Debugger::GetSettingsController()->GetVariable ("term-width", var_type,
+ m_debugger.GetInstanceName().AsCString()).GetStringAtIndex(0);
int max_columns = atoi (width_value);
// Sanity check max_columns, to cope with emacs shell mode with TERM=dumb
// (0 rows; 0 columns;).
@@ -1128,7 +1133,7 @@
complete_command_name.Printf ("%s %s", prefix, command_name);
- if (sub_cmd_obj->HelpTextContainsWord (search_word))
+ if (sub_cmd_obj->HelpTextContainsWord (search_word, *this))
{
commands_found.AppendString (complete_command_name.GetData());
commands_help.AppendString (sub_cmd_obj->GetHelp());
@@ -1152,7 +1157,7 @@
const char *command_name = pos->first.c_str();
CommandObject *cmd_obj = pos->second.get();
- if (cmd_obj->HelpTextContainsWord (search_word))
+ if (cmd_obj->HelpTextContainsWord (search_word, *this))
{
commands_found.AppendString (command_name);
commands_help.AppendString (cmd_obj->GetHelp());
diff --git a/source/Interpreter/CommandObject.cpp b/source/Interpreter/CommandObject.cpp
index 88841c4..571c3d4 100644
--- a/source/Interpreter/CommandObject.cpp
+++ b/source/Interpreter/CommandObject.cpp
@@ -177,7 +177,8 @@
else
{
// No error string, output the usage information into result
- options->GenerateOptionUsage (result.GetErrorStream(), this);
+ options->GenerateOptionUsage (result.GetErrorStream(), this,
+ interpreter.GetDebugger().GetInstanceName().AsCString());
}
// Set the return status to failed (this was an error).
result.SetStatus (eReturnStatusFailed);
@@ -396,7 +397,7 @@
}
bool
-CommandObject::HelpTextContainsWord (const char *search_word)
+CommandObject::HelpTextContainsWord (const char *search_word, CommandInterpreter &interpreter)
{
const char *short_help;
const char *long_help;
@@ -421,7 +422,7 @@
&& GetOptions() != NULL)
{
StreamString usage_help;
- GetOptions()->GenerateOptionUsage (usage_help, this);
+ GetOptions()->GenerateOptionUsage (usage_help, this, interpreter.GetDebugger().GetInstanceName().AsCString());
if (usage_help.GetSize() > 0)
{
const char *usage_text = usage_help.GetData();
diff --git a/source/Interpreter/Options.cpp b/source/Interpreter/Options.cpp
index 60ab120..a589664 100644
--- a/source/Interpreter/Options.cpp
+++ b/source/Interpreter/Options.cpp
@@ -362,11 +362,13 @@
(
Stream &strm,
CommandObject *cmd,
+ const char *debugger_instance_name,
const char *program_name)
{
lldb::SettableVariableType var_type;
const char *screen_width_str =
- Debugger::GetSettingsController()->GetVariable ("term-width", var_type).GetStringAtIndex(0);
+ Debugger::GetSettingsController()->GetVariable ("term-width", var_type,
+ debugger_instance_name).GetStringAtIndex(0);
uint32_t screen_width = atoi (screen_width_str);
if (screen_width == 0)
screen_width = 80;