diff options
author | Johnny Chen <johnny.chen@apple.com> | 2012-06-04 23:19:54 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2012-06-04 23:19:54 +0000 |
commit | b90827e66c6576a229b9018ba8400a2e3e300d02 (patch) | |
tree | 982b29230add06d804c9c61b0299fd05fd992d3e /lldb/source/API | |
parent | 188d830405a47a6c1b5c87f85cd46bce587c2ec7 (diff) | |
download | bcm5719-llvm-b90827e66c6576a229b9018ba8400a2e3e300d02.tar.gz bcm5719-llvm-b90827e66c6576a229b9018ba8400a2e3e300d02.zip |
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.
llvm-svn: 157964
Diffstat (limited to 'lldb/source/API')
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 6 | ||||
-rw-r--r-- | lldb/source/API/SBValue.cpp | 10 | ||||
-rw-r--r-- | lldb/source/API/SBWatchpoint.cpp | 17 |
3 files changed, 11 insertions, 22 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index d26788642ae..1b2b94847a2 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -1674,7 +1674,7 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id) } 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 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write) 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); } diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index bb656e57956..bd6a5fcdcb0 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -1655,7 +1655,7 @@ SBValue::GetData () } 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 @@ SBValue::Watch (bool resolve_location, bool read, bool write) 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 @@ SBValue::Watch (bool resolve_location, bool read, bool write) } 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; } diff --git a/lldb/source/API/SBWatchpoint.cpp b/lldb/source/API/SBWatchpoint.cpp index fd505aead54..76ce57cccf7 100644 --- a/lldb/source/API/SBWatchpoint.cpp +++ b/lldb/source/API/SBWatchpoint.cpp @@ -87,22 +87,7 @@ SBWatchpoint::GetID () bool SBWatchpoint::IsValid() const { - lldb::WatchpointSP watchpoint_sp(GetSP()); - if (watchpoint_sp && watchpoint_sp->GetError().Success()) - return true; - return false; -} - -SBError -SBWatchpoint::GetError () -{ - SBError sb_error; - lldb::WatchpointSP watchpoint_sp(GetSP()); - if (watchpoint_sp) - { - sb_error.SetError(watchpoint_sp->GetError()); - } - return sb_error; + return m_opaque_sp; } int32_t |