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/SBValue.cpp b/source/API/SBValue.cpp
index bb656e5..bd6a5fc 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -1655,7 +1655,7 @@
}
lldb::SBWatchpoint
-SBValue::Watch (bool resolve_location, bool read, bool write)
+SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{
SBWatchpoint sb_watchpoint;
@@ -1696,7 +1696,9 @@
if (write)
watch_type |= LLDB_WATCH_TYPE_WRITE;
- WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, watch_type);
+ Error rc;
+ WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, watch_type, rc);
+ error.SetError(rc);
if (watchpoint_sp)
{
@@ -1718,11 +1720,11 @@
}
lldb::SBWatchpoint
-SBValue::WatchPointee (bool resolve_location, bool read, bool write)
+SBValue::WatchPointee (bool resolve_location, bool read, bool write, SBError &error)
{
SBWatchpoint sb_watchpoint;
if (IsInScope() && GetType().IsPointerType())
- sb_watchpoint = Dereference().Watch (resolve_location, read, write);
+ sb_watchpoint = Dereference().Watch (resolve_location, read, write, error);
return sb_watchpoint;
}