diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.cpp | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index 7217c440cbc..14d1083ca31 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -1035,46 +1035,18 @@ protected: Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); StackFrame *frame = m_exe_ctx.GetFramePtr(); - Args command(raw_command); - const char *expr = nullptr; - if (raw_command[0] == '-') { - // We have some options and these options MUST end with --. - const char *end_options = nullptr; - const char *s = raw_command; - while (s && s[0]) { - end_options = ::strstr(s, "--"); - if (end_options) { - end_options += 2; // Get past the "--" - if (::isspace(end_options[0])) { - expr = end_options; - while (::isspace(*expr)) - ++expr; - break; - } - } - s = end_options; - } + OptionsWithRaw args(raw_command); - if (end_options) { - Args args(llvm::StringRef(raw_command, end_options - raw_command)); - if (!ParseOptions(args, result)) - return false; - - Status error(m_option_group.NotifyOptionParsingFinished(&exe_ctx)); - if (error.Fail()) { - result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); - return false; - } - } - } + llvm::StringRef expr = args.GetRawPart(); - if (expr == nullptr) - expr = raw_command; + if (args.HasArgs()) + if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group, + exe_ctx)) + return false; // If no argument is present, issue an error message. There's no way to // set a watchpoint. - if (command.GetArgumentCount() == 0) { + if (llvm::StringRef(raw_command).trim().empty()) { result.GetErrorStream().Printf("error: required argument missing; " "specify an expression to evaulate into " "the address to watch for\n"); @@ -1107,7 +1079,7 @@ protected: if (expr_result != eExpressionCompleted) { result.GetErrorStream().Printf( "error: expression evaluation of address to watch failed\n"); - result.GetErrorStream().Printf("expression evaluated: %s\n", expr); + result.GetErrorStream() << "expression evaluated: \n" << expr << "\n"; result.SetStatus(eReturnStatusFailed); return false; } |