diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Breakpoint/WatchpointLocation.cpp | 7 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 28 | ||||
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupWatchpoint.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 9 |
5 files changed, 47 insertions, 7 deletions
diff --git a/lldb/source/Breakpoint/WatchpointLocation.cpp b/lldb/source/Breakpoint/WatchpointLocation.cpp index 3387e483605..937fc8fca00 100644 --- a/lldb/source/Breakpoint/WatchpointLocation.cpp +++ b/lldb/source/Breakpoint/WatchpointLocation.cpp @@ -72,6 +72,13 @@ WatchpointLocation::BreakpointWasHit (StoppointCallbackContext *context) } void +WatchpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level) +{ + // FIXME: Add implmentation of GetDescription(). + return; +} + +void WatchpointLocation::Dump(Stream *s) const { if (s == NULL) diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 235ecfd958f..a86156cb084 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -493,7 +493,7 @@ public: result.GetErrorStream().Printf ("error: unkown regex error when compiling '%s'\n", name_cstr); } } - else + else // No regex, either exact variable names or variable expressions. { Error error; uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember; @@ -514,10 +514,34 @@ public: } if (summary_format_sp) valobj_sp->SetCustomSummaryFormat(summary_format_sp); - ValueObject::DumpValueObject (result.GetOutputStream(), + + Stream &output_stream = result.GetOutputStream(); + ValueObject::DumpValueObject (output_stream, valobj_sp.get(), valobj_sp->GetParent() ? name_cstr : NULL, options); + // Process watchpoint if necessary. + if (m_option_watchpoint.watch_variable) + { + lldb::addr_t addr = LLDB_INVALID_ADDRESS; + size_t size = 0; + uint32_t watch_type = m_option_watchpoint.watch_type; + WatchpointLocation *wp_loc = + exe_ctx.target->CreateWatchpointLocation(addr, size, watch_type).get(); + if (wp_loc) + { + output_stream.Printf("Watchpoint created: "); + wp_loc->GetDescription(&output_stream, lldb::eDescriptionLevelBrief); + output_stream.EOL(); + result.SetStatus(eReturnStatusSuccessFinishResult); + } + else + { + result.AppendErrorWithFormat("Watchpoint creation failed.\n"); + result.SetStatus(eReturnStatusFailed); + } + return (wp_loc != NULL); + } } else { diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index c3547e23995..afd00c520b7 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -830,7 +830,7 @@ CommandObject::g_arguments_data[] = { eArgTypeWidth, "width", CommandCompletions::eNoCompletion, { NULL, false }, "Help text goes here." }, { eArgTypeNone, "none", CommandCompletions::eNoCompletion, { NULL, false }, "No help available for this." }, { eArgTypePlatform, "platform-name", CommandCompletions::ePlatformPluginCompletion, { NULL, false }, "The name of an installed platform plug-in . Type 'platform list' to see a complete list of installed platforms." }, - { eArgTypeWatchMode, "watch-mode", CommandCompletions::eNoCompletion, { NULL, false }, "Specify the mode for a watchpoint." } + { eArgTypeWatchType, "watch-type", CommandCompletions::eNoCompletion, { NULL, false }, "Specify the type for a watchpoint." } }; const CommandObject::ArgumentTableEntry* diff --git a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp index 4f9f2c19a6a..b0f381ef4b3 100644 --- a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -20,7 +20,7 @@ using namespace lldb; using namespace lldb_private; -static OptionEnumValueElement g_watch_mode[] = +static OptionEnumValueElement g_watch_type[] = { { OptionGroupWatchpoint::eWatchRead, "read", "Watch for read"}, { OptionGroupWatchpoint::eWatchWrite, "write", "Watch for write"}, @@ -32,7 +32,7 @@ static OptionEnumValueElement g_watch_mode[] = static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1, false, "watch", 'w', required_argument, g_watch_mode, 0, eArgTypeWatchMode, "Determine how to watch a memory location (read, write, or read/write)."} + { LLDB_OPT_SET_1, false, "watch", 'w', required_argument, g_watch_type, 0, eArgTypeWatchType, "Determine how to watch a memory location (read, write, or read/write)."} }; @@ -56,7 +56,7 @@ OptionGroupWatchpoint::SetOptionValue (CommandInterpreter &interpreter, { case 'w': { OptionEnumValueElement *enum_values = g_option_table[option_idx].enum_values; - watch_mode = (WatchMode) Args::StringToOptionEnum(option_arg, enum_values, 0, &watch_variable); + watch_type = (WatchType) Args::StringToOptionEnum(option_arg, enum_values, 0, &watch_variable); if (!watch_variable) error.SetErrorStringWithFormat("Invalid option arg for '-w': '%s'.\n", option_arg); break; @@ -73,7 +73,7 @@ void OptionGroupWatchpoint::OptionParsingStarting (CommandInterpreter &interpreter) { watch_variable = false; - watch_mode = eWatchInvalid; + watch_type = eWatchInvalid; } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index a236d71bdc4..7dfe4558c8f 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -328,6 +328,15 @@ Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resol return bp_sp; } +// See also WatchpointLocation::SetWatchpointType() and OptionGroupWatchpoint::WatchType. +WatchpointLocationSP +Target::CreateWatchpointLocation(lldb::addr_t addr, size_t size, uint32_t type) +{ + WatchpointLocationSP wp_loc_sp; + if (addr == LLDB_INVALID_ADDRESS || size == 0 || GetProcessSP()) + return wp_loc_sp; +} + void Target::RemoveAllBreakpoints (bool internal_also) { |