Get the address and the size of the variable for passing to the Target::CreateWatchpointLocation() method.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139614 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index d214439..8bf9b14 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -522,8 +522,14 @@
// Process watchpoint if necessary.
if (m_option_watchpoint.watch_variable)
{
- lldb::addr_t addr = LLDB_INVALID_ADDRESS;
+ AddressType addr_type;
+ lldb::addr_t addr = valobj_sp->GetAddressOf(false, &addr_type);
size_t size = 0;
+ if (addr_type == eAddressTypeLoad) {
+ // We're in business.
+ // Find out the size of this variable.
+ size = valobj_sp->GetByteSize();
+ }
uint32_t watch_type = m_option_watchpoint.watch_type;
WatchpointLocation *wp_loc =
exe_ctx.target->CreateWatchpointLocation(addr, size, watch_type).get();
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 78f16bf..7b6dcf7 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -333,7 +333,12 @@
Target::CreateWatchpointLocation(lldb::addr_t addr, size_t size, uint32_t type)
{
WatchpointLocationSP wp_loc_sp;
- if (addr == LLDB_INVALID_ADDRESS || size == 0 || GetProcessSP())
+ bool process_is_valid = m_process_sp && m_process_sp->IsAlive();
+ if (!process_is_valid)
+ return wp_loc_sp;
+ if (addr == LLDB_INVALID_ADDRESS)
+ return wp_loc_sp;
+ if (size == 0)
return wp_loc_sp;
// FIXME: Add implmenetation.