summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp75
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp9
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp22
3 files changed, 46 insertions, 60 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 5130a2f86be..942d7ff891c 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -91,45 +91,42 @@ CommandObjectBreakpointCommandAdd::CommandOptions::SetOptionValue
char short_option = (char) m_getopt_table[option_idx].val;
switch (short_option)
- {
- case 'o':
- m_use_one_liner = true;
- m_one_liner = option_arg;
- break;
- break;
- case 's':
- {
- bool found_one = false;
- m_script_language = (lldb::ScriptLanguage) Args::StringToOptionEnum (option_arg,
- g_option_table[option_idx].enum_values,
- eScriptLanguageNone,
- &found_one);
- if (!found_one)
- error.SetErrorStringWithFormat("Invalid enumeration value '%s' for option '%c'.\n",
- option_arg,
- short_option);
-
- if (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault)
- {
- m_use_commands = false;
- m_use_script_language = true;
- }
- else
- {
- m_use_commands = true;
- m_use_script_language = false;
- }
- }
- break;
- case 'e':
- bool success_ptr;
- m_stop_on_error = Args::StringToBoolean(option_arg, false, &success_ptr);
- if (!success_ptr)
- error.SetErrorStringWithFormat("Invalid value for stop-on-error: \"%s\".\n", option_arg);
- break;
- default:
- break;
- }
+ {
+ case 'o':
+ m_use_one_liner = true;
+ m_one_liner = option_arg;
+ break;
+
+ case 's':
+ m_script_language = (lldb::ScriptLanguage) Args::StringToOptionEnum (option_arg,
+ g_option_table[option_idx].enum_values,
+ eScriptLanguageNone,
+ error);
+
+ if (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault)
+ {
+ m_use_commands = false;
+ m_use_script_language = true;
+ }
+ else
+ {
+ m_use_commands = true;
+ m_use_script_language = false;
+ }
+ break;
+
+ case 'e':
+ {
+ bool success = false;
+ m_stop_on_error = Args::StringToBoolean(option_arg, false, &success);
+ if (!success)
+ error.SetErrorStringWithFormat("Invalid value for stop-on-error: \"%s\".\n", option_arg);
+ }
+ break;
+
+ default:
+ break;
+ }
return error;
}
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index f948d0f5963..2be8e8d951a 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1876,17 +1876,10 @@ public:
switch (short_option)
{
case 's':
- {
- bool found_one = false;
m_sort_order = (SortOrder) Args::StringToOptionEnum (option_arg,
g_option_table[option_idx].enum_values,
eSortOrderNone,
- &found_one);
- if (!found_one)
- error.SetErrorStringWithFormat("Invalid enumeration value '%s' for option '%c'.\n",
- option_arg,
- short_option);
- }
+ error);
break;
default:
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 8e4ae8d469e..c7bf27622f8 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -307,11 +307,8 @@ public:
case 'm':
{
- bool found_one = false;
OptionEnumValueElement *enum_values = g_option_table[option_idx].enum_values;
- m_run_mode = (lldb::RunMode) Args::StringToOptionEnum(option_arg, enum_values, eOnlyDuringStepping, &found_one);
- if (!found_one)
- error.SetErrorStringWithFormat("Invalid enumeration value for option '%c'.\n", short_option);
+ m_run_mode = (lldb::RunMode) Args::StringToOptionEnum(option_arg, enum_values, eOnlyDuringStepping, error);
}
break;
@@ -807,17 +804,16 @@ public:
break;
case 'm':
{
- bool found_one = false;
OptionEnumValueElement *enum_values = g_option_table[option_idx].enum_values;
- lldb::RunMode run_mode = (lldb::RunMode) Args::StringToOptionEnum(option_arg, enum_values, eOnlyDuringStepping, &found_one);
+ lldb::RunMode run_mode = (lldb::RunMode) Args::StringToOptionEnum(option_arg, enum_values, eOnlyDuringStepping, error);
- if (!found_one)
- error.SetErrorStringWithFormat("Invalid enumeration value for option '%c'.\n", short_option);
- else if (run_mode == eAllThreads)
- m_stop_others = false;
- else
- m_stop_others = true;
-
+ if (error.Success())
+ {
+ if (run_mode == eAllThreads)
+ m_stop_others = false;
+ else
+ m_stop_others = true;
+ }
}
break;
default:
OpenPOWER on IntegriCloud