From cf0e4f0dafe445ae2ca9228e41767944329f30c4 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Fri, 7 Oct 2011 18:58:12 +0000 Subject: Re-organized the contents of RangeMap.h to be more concise and also allow for a Range, RangeArray, RangeData (range + data), or a RangeDataArray. We have many range implementations in LLDB and I will be converting over to using the classes in RangeMap.h so we can have one set of code that does ranges and searching of ranges. Fixed up DWARFDebugAranges to use the new range classes. Fixed the enumeration parsing to take a lldb_private::Error to avoid a lot of duplicated code. Now when an invalid enumeration is supplied, an error will be returned and that error will contain a list of the valid enumeration values. llvm-svn: 141382 --- lldb/source/Commands/CommandObjectThread.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'lldb/source/Commands/CommandObjectThread.cpp') diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 8e4ae8d469ec..c7bf27622f83 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: -- cgit v1.2.3