rdar://problem/11584012
Refactorings of watchpoint creation APIs so that SBTarget::WatchAddress(), SBValue::Watch(), and SBValue::WatchPointee()
now take an additional 'SBError &error' parameter (at the end) to contain the reason if there is some failure in the
operation. Update 'watchpoint set variable/expression' commands to take advantage of that.
Update existing test cases to reflect the API change and add test cases to verify that the SBError mechanism works for
SBTarget::WatchAddress() by passing an invalid watch_size.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157964 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index d267886..1b2b948 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -1674,7 +1674,7 @@
}
lldb::SBWatchpoint
-SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write)
+SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError &error)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -1690,7 +1690,9 @@
if (write)
watch_type |= LLDB_WATCH_TYPE_WRITE;
// Target::CreateWatchpoint() is thread safe.
- watchpoint_sp = target_sp->CreateWatchpoint(addr, size, watch_type);
+ Error cw_error;
+ watchpoint_sp = target_sp->CreateWatchpoint(addr, size, watch_type, cw_error);
+ error.SetError(cw_error);
sb_watchpoint.SetSP (watchpoint_sp);
}