diff options
Diffstat (limited to 'contrib/llvm-project/lldb/source/Interpreter/OptionGroupWatchpoint.cpp')
| -rw-r--r-- | contrib/llvm-project/lldb/source/Interpreter/OptionGroupWatchpoint.cpp | 48 |
1 files changed, 11 insertions, 37 deletions
diff --git a/contrib/llvm-project/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/contrib/llvm-project/lldb/source/Interpreter/OptionGroupWatchpoint.cpp index c2f78d8c2dd1..d1ae916cd74b 100644 --- a/contrib/llvm-project/lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ b/contrib/llvm-project/lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -28,41 +28,23 @@ static constexpr OptionEnumValueElement g_watch_type[] = { "Watch for write", }, { + OptionGroupWatchpoint::eWatchModify, + "modify", + "Watch for modifications", + }, + { OptionGroupWatchpoint::eWatchReadWrite, "read_write", "Watch for read/write", }, }; -static constexpr OptionEnumValueElement g_watch_size[] = { - { - 1, - "1", - "Watch for byte size of 1", - }, - { - 2, - "2", - "Watch for byte size of 2", - }, - { - 4, - "4", - "Watch for byte size of 4", - }, - { - 8, - "8", - "Watch for byte size of 8", - }, -}; - static constexpr OptionDefinition g_option_table[] = { {LLDB_OPT_SET_1, false, "watch", 'w', OptionParser::eRequiredArgument, nullptr, OptionEnumValues(g_watch_type), 0, eArgTypeWatchType, "Specify the type of watching to perform."}, {LLDB_OPT_SET_1, false, "size", 's', OptionParser::eRequiredArgument, - nullptr, OptionEnumValues(g_watch_size), 0, eArgTypeByteSize, + nullptr, {}, 0, eArgTypeByteSize, "Number of bytes to use to watch a region."}, {LLDB_OPT_SET_2, false, @@ -75,16 +57,6 @@ static constexpr OptionDefinition g_option_table[] = { eArgTypeLanguage, "Language of expression to run"}}; -bool OptionGroupWatchpoint::IsWatchSizeSupported(uint32_t watch_size) { - for (const auto& size : g_watch_size) { - if (0 == size.value) - break; - if (watch_size == size.value) - return true; - } - return false; -} - Status OptionGroupWatchpoint::SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, @@ -115,8 +87,10 @@ OptionGroupWatchpoint::SetOptionValue(uint32_t option_idx, break; } case 's': - watch_size = (uint32_t)OptionArgParser::ToOptionEnum( - option_arg, g_option_table[option_idx].enum_values, 0, error); + error = watch_size.SetValueFromString(option_arg); + if (watch_size.GetCurrentValue() == 0) + error.SetErrorStringWithFormat("invalid --size option value '%s'", + option_arg.str().c_str()); break; default: @@ -130,7 +104,7 @@ void OptionGroupWatchpoint::OptionParsingStarting( ExecutionContext *execution_context) { watch_type_specified = false; watch_type = eWatchInvalid; - watch_size = 0; + watch_size.Clear(); language_type = eLanguageTypeUnknown; } |
