[Lldb-commits] [lldb] r139614 - in /lldb/trunk/source: Commands/CommandObjectFrame.cpp Target/Target.cpp

Johnny Chen johnny.chen at apple.com
Tue Sep 13 11:30:59 PDT 2011


Author: johnny
Date: Tue Sep 13 13:30:59 2011
New Revision: 139614

URL: http://llvm.org/viewvc/llvm-project?rev=139614&view=rev
Log:
Get the address and the size of the variable for passing to the Target::CreateWatchpointLocation() method.

Modified:
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=139614&r1=139613&r2=139614&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Sep 13 13:30:59 2011
@@ -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();

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=139614&r1=139613&r2=139614&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Sep 13 13:30:59 2011
@@ -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.





More information about the lldb-commits mailing list