[Lldb-commits] [lldb] r140575 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Breakpoint/ lldb.xcodeproj/ source/API/ source/Breakpoint/ source/Commands/ source/Plugins/Process/Utility/ source/Target/

Johnny Chen johnny.chen at apple.com
Mon Sep 26 15:40:50 PDT 2011


Author: johnny
Date: Mon Sep 26 17:40:50 2011
New Revision: 140575

URL: http://llvm.org/viewvc/llvm-project?rev=140575&view=rev
Log:
Add SB API class SBWatchpointLocation and some extra methods to the SBTarget class to
iterate on the available watchpoint locations and to perform watchpoint manipulations.

I still need to export the SBWatchpointLocation class as well as the added watchpoint
manipulation methods to the Python interface.  And write test cases for them.

Added:
    lldb/trunk/include/lldb/API/SBWatchpointLocation.h
    lldb/trunk/source/API/SBWatchpointLocation.cpp
Modified:
    lldb/trunk/include/lldb/API/SBDefines.h
    lldb/trunk/include/lldb/API/SBStream.h
    lldb/trunk/include/lldb/API/SBTarget.h
    lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h
    lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h
    lldb/trunk/include/lldb/lldb-forward.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/Breakpoint/WatchpointLocation.cpp
    lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
    lldb/trunk/source/Target/StopInfo.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/API/SBDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDefines.h (original)
+++ lldb/trunk/include/lldb/API/SBDefines.h Mon Sep 26 17:40:50 2011
@@ -63,6 +63,7 @@
 class SBTypeList;
 class SBValue;
 class SBValueList;
+class SBWatchpointLocation;
 
 }
 

Modified: lldb/trunk/include/lldb/API/SBStream.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStream.h?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBStream.h (original)
+++ lldb/trunk/include/lldb/API/SBStream.h Mon Sep 26 17:40:50 2011
@@ -76,6 +76,7 @@
     friend class SBTarget;
     friend class SBThread;
     friend class SBValue;
+    friend class SBWatchpointLocation;
     friend class SBCommandReturnObject;
 
 #ifndef SWIG

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Mon Sep 26 17:40:50 2011
@@ -16,6 +16,7 @@
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBFileSpecList.h"
 #include "lldb/API/SBType.h"
+#include "lldb/API/SBWatchpointLocation.h"
 
 namespace lldb {
 
@@ -443,6 +444,27 @@
     bool
     DeleteAllBreakpoints ();
 
+    uint32_t
+    GetNumWatchpointLocations () const;
+
+    lldb::SBWatchpointLocation
+    GetWatchpointLocationAtIndex (uint32_t idx) const;
+
+    bool
+    WatchpointLocationDelete (watch_id_t watch_id);
+
+    lldb::SBWatchpointLocation
+    FindWatchpointLocationByID (watch_id_t watch_id);
+
+    bool
+    EnableAllWatchpointLocations ();
+
+    bool
+    DisableAllWatchpointLocations ();
+
+    bool
+    DeleteAllWatchpointLocations ();
+
     lldb::SBBroadcaster
     GetBroadcaster () const;
     

Added: lldb/trunk/include/lldb/API/SBWatchpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpointLocation.h?rev=140575&view=auto
==============================================================================
--- lldb/trunk/include/lldb/API/SBWatchpointLocation.h (added)
+++ lldb/trunk/include/lldb/API/SBWatchpointLocation.h Mon Sep 26 17:40:50 2011
@@ -0,0 +1,85 @@
+//===-- SBWatchpointLocation.h ----------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBWatchpointLocation_h_
+#define LLDB_SBWatchpointLocation_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBWatchpointLocation
+{
+public:
+
+    SBWatchpointLocation ();
+
+    SBWatchpointLocation (const lldb::SBWatchpointLocation &rhs);
+
+    ~SBWatchpointLocation ();
+
+#ifndef SWIG
+    const lldb::SBWatchpointLocation &
+    operator = (const lldb::SBWatchpointLocation &rhs);
+#endif
+
+    bool
+    IsValid() const;
+
+    lldb::addr_t
+    GetWatchAddress () const;
+
+    size_t
+    GetWatchSize() const;
+
+    void
+    SetEnabled(bool enabled);
+
+    bool
+    IsEnabled ();
+
+    uint32_t
+    GetIgnoreCount ();
+
+    void
+    SetIgnoreCount (uint32_t n);
+
+    bool
+    GetDescription (lldb::SBStream &description, DescriptionLevel level);
+
+#ifndef SWIG
+    SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp);
+#endif
+
+private:
+    friend class SBTarget;
+
+#ifndef SWIG
+
+    lldb_private::WatchpointLocation *
+    operator->() const;
+
+    lldb_private::WatchpointLocation *
+    get() const;
+
+    lldb::WatchpointLocationSP &
+    operator *();
+
+    const lldb::WatchpointLocationSP &
+    operator *() const;
+
+#endif
+
+    lldb::WatchpointLocationSP m_opaque_sp;
+
+};
+
+} // namespace lldb
+
+#endif  // LLDB_SBWatchpointLocation_h_

Modified: lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h Mon Sep 26 17:40:50 2011
@@ -20,6 +20,7 @@
 
 // Project includes
 #include "lldb/lldb-private.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Core/UserID.h"
 #include "lldb/Breakpoint/StoppointLocation.h"
 
@@ -56,8 +57,14 @@
     void        GetDescription (Stream *s, lldb::DescriptionLevel level);
     void        Dump (Stream *s) const;
     void        DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
+    Target      &GetTarget() { return *m_target; }
 
 private:
+    friend class Target;
+
+    void        SetTarget(Target *target_ptr) { m_target = target_ptr; }
+
+    Target      *m_target;
     bool        m_enabled;          // Is this watchpoint enabled
     bool        m_is_hardware;      // Is this a hardware watchpoint
     uint32_t    m_watch_read:1,     // 1 if we stop when the watched data is read from

Modified: lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h Mon Sep 26 17:40:50 2011
@@ -19,7 +19,6 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Core/Address.h"
 #include "lldb/Host/Mutex.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
 
 namespace lldb_private {
 

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Mon Sep 26 17:40:50 2011
@@ -196,6 +196,7 @@
 class   Variable;
 class   VariableList;
 class   WatchpointLocation;
+class   WatchpointLocationList;
 struct  LineEntry;
 
 } // namespace lldb_private

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Sep 26 17:40:50 2011
@@ -450,6 +450,8 @@
 		B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; };
 		B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointLocationList.cpp */; };
 		B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; };
+		B2A58722143119810092BFBA /* SBWatchpointLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpointLocation.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		B2A58724143119D50092BFBA /* SBWatchpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -1362,6 +1364,8 @@
 		B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMDefines.h; path = Utility/ARMDefines.h; sourceTree = "<group>"; };
 		B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVersion.cpp; path = source/Commands/CommandObjectVersion.cpp; sourceTree = "<group>"; };
 		B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVersion.h; path = source/Commands/CommandObjectVersion.h; sourceTree = "<group>"; };
+		B2A58721143119810092BFBA /* SBWatchpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBWatchpointLocation.h; path = include/lldb/API/SBWatchpointLocation.h; sourceTree = "<group>"; };
+		B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBWatchpointLocation.cpp; path = source/API/SBWatchpointLocation.cpp; sourceTree = "<group>"; };
 		B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstructionUtils.h; path = Utility/InstructionUtils.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -1832,6 +1836,8 @@
 				9A19A6AD1163BB9800E0D453 /* SBValue.cpp */,
 				9A357582116CFDEE00E8ED2F /* SBValueList.h */,
 				9A35758D116CFE0F00E8ED2F /* SBValueList.cpp */,
+				B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */,
+				B2A58721143119810092BFBA /* SBWatchpointLocation.h */,
 			);
 			name = API;
 			sourceTree = "<group>";
@@ -2865,9 +2871,10 @@
 				9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */,
 				26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */,
 				26D265BC136B4269002EEE45 /* lldb-public.h in Headers */,
-				4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */,
 				4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */,
+				4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */,
 				26B8283D142D01E9002DBC64 /* SBSection.h in Headers */,
+				B2A58722143119810092BFBA /* SBWatchpointLocation.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3154,6 +3161,7 @@
 				4CAA56151422D986001FFA01 /* BreakpointResolverFileRegex.cpp in Sources */,
 				4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */,
 				26B82840142D020F002DBC64 /* SBSection.cpp in Sources */,
+				B2A58724143119D50092BFBA /* SBWatchpointLocation.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Mon Sep 26 17:40:50 2011
@@ -766,6 +766,49 @@
     return sb_bp;
 }
 
+uint32_t
+SBTarget::GetNumBreakpoints () const
+{
+    if (m_opaque_sp)
+    {
+        // The breakpoint list is thread safe, no need to lock
+        return m_opaque_sp->GetBreakpointList().GetSize();
+    }
+    return 0;
+}
+
+SBBreakpoint
+SBTarget::GetBreakpointAtIndex (uint32_t idx) const
+{
+    SBBreakpoint sb_breakpoint;
+    if (m_opaque_sp)
+    {
+        // The breakpoint list is thread safe, no need to lock
+        *sb_breakpoint = m_opaque_sp->GetBreakpointList().GetBreakpointAtIndex(idx);
+    }
+    return sb_breakpoint;
+}
+
+bool
+SBTarget::BreakpointDelete (break_id_t bp_id)
+{
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+    bool result = false;
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
+        result = m_opaque_sp->RemoveBreakpointByID (bp_id);
+    }
+
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) bp_id, result);
+    }
+
+    return result;
+}
+
 SBBreakpoint
 SBTarget::FindBreakpointByID (break_id_t bp_id)
 {
@@ -787,31 +830,67 @@
     return sb_breakpoint;
 }
 
+bool
+SBTarget::EnableAllBreakpoints ()
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
+        m_opaque_sp->EnableAllBreakpoints ();
+        return true;
+    }
+    return false;
+}
+
+bool
+SBTarget::DisableAllBreakpoints ()
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
+        m_opaque_sp->DisableAllBreakpoints ();
+        return true;
+    }
+    return false;
+}
+
+bool
+SBTarget::DeleteAllBreakpoints ()
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
+        m_opaque_sp->RemoveAllBreakpoints ();
+        return true;
+    }
+    return false;
+}
+
 uint32_t
-SBTarget::GetNumBreakpoints () const
+SBTarget::GetNumWatchpointLocations () const
 {
     if (m_opaque_sp)
     {
         // The breakpoint list is thread safe, no need to lock
-        return m_opaque_sp->GetBreakpointList().GetSize();
+        return m_opaque_sp->GetWatchpointLocationList().GetSize();
     }
     return 0;
 }
 
-SBBreakpoint
-SBTarget::GetBreakpointAtIndex (uint32_t idx) const
+SBWatchpointLocation
+SBTarget::GetWatchpointLocationAtIndex (uint32_t idx) const
 {
-    SBBreakpoint sb_breakpoint;
+    SBWatchpointLocation sb_watchpoint_location;
     if (m_opaque_sp)
     {
         // The breakpoint list is thread safe, no need to lock
-        *sb_breakpoint = m_opaque_sp->GetBreakpointList().GetBreakpointAtIndex(idx);
+        *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().GetByIndex(idx);
     }
-    return sb_breakpoint;
+    return sb_watchpoint_location;
 }
 
 bool
-SBTarget::BreakpointDelete (break_id_t bp_id)
+SBTarget::WatchpointLocationDelete (watch_id_t wp_id)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
@@ -819,48 +898,69 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        result = m_opaque_sp->RemoveBreakpointByID (bp_id);
+        result = m_opaque_sp->RemoveWatchpointLocationByID (wp_id);
     }
 
     if (log)
     {
-        log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) bp_id, result);
+        log->Printf ("SBTarget(%p)::WatchpointLocationDelete (wp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) wp_id, result);
     }
 
     return result;
 }
 
+SBWatchpointLocation
+SBTarget::FindWatchpointLocationByID (watch_id_t wp_id)
+{
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+    SBWatchpointLocation sb_watchpoint_location;
+    if (m_opaque_sp && wp_id != LLDB_INVALID_WATCH_ID)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
+        *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id);
+    }
+
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpointLocation(%p)", 
+                     m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint_location.get());
+    }
+
+    return sb_watchpoint_location;
+}
+
 bool
-SBTarget::EnableAllBreakpoints ()
+SBTarget::EnableAllWatchpointLocations ()
 {
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        m_opaque_sp->EnableAllBreakpoints ();
+        m_opaque_sp->EnableAllWatchpointLocations ();
         return true;
     }
     return false;
 }
 
 bool
-SBTarget::DisableAllBreakpoints ()
+SBTarget::DisableAllWatchpointLocations ()
 {
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        m_opaque_sp->DisableAllBreakpoints ();
+        m_opaque_sp->DisableAllWatchpointLocations ();
         return true;
     }
     return false;
 }
 
 bool
-SBTarget::DeleteAllBreakpoints ()
+SBTarget::DeleteAllWatchpointLocations ()
 {
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        m_opaque_sp->RemoveAllBreakpoints ();
+        m_opaque_sp->RemoveAllWatchpointLocations ();
         return true;
     }
     return false;

Added: lldb/trunk/source/API/SBWatchpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpointLocation.cpp?rev=140575&view=auto
==============================================================================
--- lldb/trunk/source/API/SBWatchpointLocation.cpp (added)
+++ lldb/trunk/source/API/SBWatchpointLocation.cpp Mon Sep 26 17:40:50 2011
@@ -0,0 +1,183 @@
+//===-- SBWatchpointLocation.cpp --------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBWatchpointLocation.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBStream.h"
+
+#include "lldb/lldb-types.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/WatchpointLocationList.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Core/Stream.h"
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+
+SBWatchpointLocation::SBWatchpointLocation () :
+    m_opaque_sp ()
+{
+}
+
+SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp) :
+    m_opaque_sp (watch_loc_sp)
+{
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+    if (log)
+    {
+        SBStream sstr;
+        GetDescription (sstr, lldb::eDescriptionLevelBrief);
+        log->Printf ("SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationsSP &watch_loc_sp"
+                     "=%p)  => this.sp = %p (%s)", watch_loc_sp.get(), m_opaque_sp.get(), sstr.GetData());
+    }
+}
+
+SBWatchpointLocation::SBWatchpointLocation(const SBWatchpointLocation &rhs) :
+    m_opaque_sp (rhs.m_opaque_sp)
+{
+}
+
+const SBWatchpointLocation &
+SBWatchpointLocation::operator = (const SBWatchpointLocation &rhs)
+{
+    if (this != &rhs)
+        m_opaque_sp = rhs.m_opaque_sp;
+    return *this;
+}
+
+
+SBWatchpointLocation::~SBWatchpointLocation ()
+{
+}
+
+bool
+SBWatchpointLocation::IsValid() const
+{
+    return m_opaque_sp.get() != NULL;
+}
+
+addr_t
+SBWatchpointLocation::GetWatchAddress () const
+{
+    addr_t ret_addr = LLDB_INVALID_ADDRESS;
+
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        ret_addr = m_opaque_sp->GetLoadAddress();
+    }
+
+    return ret_addr;
+}
+
+size_t
+SBWatchpointLocation::GetWatchSize () const
+{
+    size_t watch_size = 0;
+
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        watch_size = m_opaque_sp->GetByteSize();
+    }
+
+    return watch_size;
+}
+
+void
+SBWatchpointLocation::SetEnabled (bool enabled)
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        m_opaque_sp->SetEnabled (enabled);
+    }
+}
+
+bool
+SBWatchpointLocation::IsEnabled ()
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        return m_opaque_sp->IsEnabled();
+    }
+    else
+        return false;
+}
+
+uint32_t
+SBWatchpointLocation::GetIgnoreCount ()
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        return m_opaque_sp->GetIgnoreCount();
+    }
+    else
+        return 0;
+}
+
+void
+SBWatchpointLocation::SetIgnoreCount (uint32_t n)
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        m_opaque_sp->SetIgnoreCount (n);
+    }
+}
+
+bool
+SBWatchpointLocation::GetDescription (SBStream &description, DescriptionLevel level)
+{
+    if (m_opaque_sp)
+    {
+        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        description.ref();
+        m_opaque_sp->GetDescription (description.get(), level);
+        description.get()->EOL();
+    }
+    else
+        description.Printf ("No value");
+
+    return true;
+}
+
+lldb_private::WatchpointLocation *
+SBWatchpointLocation::operator->() const
+{
+    return m_opaque_sp.get();
+}
+
+lldb_private::WatchpointLocation *
+SBWatchpointLocation::get() const
+{
+    return m_opaque_sp.get();
+}
+
+lldb::WatchpointLocationSP &
+SBWatchpointLocation::operator *()
+{
+    return m_opaque_sp;
+}
+
+const lldb::WatchpointLocationSP &
+SBWatchpointLocation::operator *() const
+{
+    return m_opaque_sp;
+}
+

Modified: lldb/trunk/source/Breakpoint/WatchpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocation.cpp?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointLocation.cpp Mon Sep 26 17:40:50 2011
@@ -20,6 +20,7 @@
 
 WatchpointLocation::WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware) :
     StoppointLocation (GetNextID(), addr, size, hardware),
+    m_target(NULL),
     m_enabled(0),
     m_is_hardware(hardware),
     m_watch_read(0),

Modified: lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp Mon Sep 26 17:40:50 2011
@@ -14,7 +14,6 @@
 // Project includes
 #include "lldb/Breakpoint/WatchpointLocationList.h"
 #include "lldb/Breakpoint/WatchpointLocation.h"
-#include "lldb/Target/Target.h"
 
 using namespace lldb;
 using namespace lldb_private;

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Mon Sep 26 17:40:50 2011
@@ -14,6 +14,7 @@
 #include <string>
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Breakpoint/WatchpointLocation.h"
 #include "lldb/Core/DataVisualization.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"

Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Mon Sep 26 17:40:50 2011
@@ -13,6 +13,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Breakpoint/WatchpointLocation.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Target/Process.h"

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Mon Sep 26 17:40:50 2011
@@ -19,6 +19,7 @@
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Breakpoint/WatchpointLocation.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Expression/ClangUserExpression.h"

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=140575&r1=140574&r2=140575&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Sep 26 17:40:50 2011
@@ -18,6 +18,7 @@
 #include "lldb/Breakpoint/BreakpointResolverFileLine.h"
 #include "lldb/Breakpoint/BreakpointResolverFileRegex.h"
 #include "lldb/Breakpoint/BreakpointResolverName.h"
+#include "lldb/Breakpoint/WatchpointLocation.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/Log.h"
@@ -439,6 +440,7 @@
             return wp_loc_sp;
         }
         new_loc->SetWatchpointType(type);
+        new_loc->SetTarget(this);
         wp_loc_sp.reset(new_loc);
         m_watchpoint_location_list.Add(wp_loc_sp);
     }





More information about the lldb-commits mailing list