[Lldb-commits] [lldb] r141925 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Breakpoint/ include/lldb/Target/ lldb.xcodeproj/ scripts/Python/ scripts/Python/interface/ source/API/ source/Breakpoint/ source/Commands/ source/Plugins/Process/MacOSX-Kernel/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Target/ test/ test/python_api/default-constructor/ test/python_api/watchpoint/ test/python_api/watchpoint/watchlocation/

Johnny Chen johnny.chen at apple.com
Thu Oct 13 17:42:25 PDT 2011


Author: johnny
Date: Thu Oct 13 19:42:25 2011
New Revision: 141925

URL: http://llvm.org/viewvc/llvm-project?rev=141925&view=rev
Log:
SBValue::Watch() and SBValue::WatchPointee() are now the official API for creating
a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee
encapsulated by SBValue (WatchPointee).

Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that.

Modified the watchpoint related test suite to reflect the change.

Plus replacing WatchpointLocation with Watchpoint throughout the code base.

There are still cleanups to be dome.  This patch passes the whole test suite.
Check it in so that we aggressively catch regressions.

Added:
    lldb/trunk/include/lldb/Breakpoint/Watchpoint.h
      - copied, changed from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h
    lldb/trunk/include/lldb/Breakpoint/WatchpointList.h
      - copied, changed from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h
    lldb/trunk/source/Breakpoint/Watchpoint.cpp
      - copied, changed from r141877, lldb/trunk/source/Breakpoint/WatchpointLocation.cpp
    lldb/trunk/source/Breakpoint/WatchpointList.cpp
      - copied, changed from r141877, lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp
    lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py
      - copied unchanged from r141917, lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py
    lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py
      - copied, changed from r141905, lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py
Removed:
    lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h
    lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h
    lldb/trunk/source/Breakpoint/WatchpointLocation.cpp
    lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp
    lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py
    lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py
Modified:
    lldb/trunk/include/lldb/API/SBFrame.h
    lldb/trunk/include/lldb/API/SBValue.h
    lldb/trunk/include/lldb/API/SBWatchpoint.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/include/lldb/lldb-forward-rtti.h
    lldb/trunk/include/lldb/lldb-forward.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/scripts/Python/interface/SBFrame.i
    lldb/trunk/scripts/Python/interface/SBTarget.i
    lldb/trunk/scripts/Python/interface/SBValue.i
    lldb/trunk/scripts/Python/interface/SBWatchpoint.i
    lldb/trunk/scripts/Python/modify-python-lldb.py
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/API/SBValue.cpp
    lldb/trunk/source/API/SBWatchpoint.cpp
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
    lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/StopInfo.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/test/lldbutil.py
    lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
    lldb/trunk/test/python_api/default-constructor/sb_frame.py
    lldb/trunk/test/python_api/default-constructor/sb_target.py
    lldb/trunk/test/python_api/default-constructor/sb_value.py
    lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py
    lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
    lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py

Modified: lldb/trunk/include/lldb/API/SBFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFrame.h (original)
+++ lldb/trunk/include/lldb/API/SBFrame.h Thu Oct 13 19:42:25 2011
@@ -12,6 +12,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBValueList.h"
+#include "lldb/API/SBWatchpoint.h"
 
 namespace lldb {
 
@@ -220,7 +221,6 @@
     
 #endif
 
-
     void
     SetFrame (const lldb::StackFrameSP &lldb_object_sp);
 

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Thu Oct 13 19:42:25 2011
@@ -360,6 +360,10 @@
 #endif
 
 private:
+    // Helper function for SBValue::Watch() and SBValue::WatchPointee().
+    lldb::SBWatchpoint
+    WatchValue(bool read, bool write, bool watch_pointee);
+
     lldb::ValueObjectSP m_opaque_sp;
 };
 

Modified: lldb/trunk/include/lldb/API/SBWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpoint.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBWatchpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBWatchpoint.h Thu Oct 13 19:42:25 2011
@@ -67,26 +67,27 @@
     GetDescription (lldb::SBStream &description, DescriptionLevel level);
 
 #ifndef SWIG
-    SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp);
+    SBWatchpoint (const lldb::WatchpointSP &wp_sp);
 #endif
 
 private:
     friend class SBTarget;
+    friend class SBValue;
 
 #ifndef SWIG
 
-    lldb_private::WatchpointLocation *
+    lldb_private::Watchpoint *
     operator->();
 
-    lldb_private::WatchpointLocation *
+    lldb_private::Watchpoint *
     get();
 
-    lldb::WatchpointLocationSP &
+    lldb::WatchpointSP &
     operator *();
 
 #endif
 
-    lldb::WatchpointLocationSP m_opaque_sp;
+    lldb::WatchpointSP m_opaque_sp;
 
 };
 

Copied: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h (from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Watchpoint.h?p2=lldb/trunk/include/lldb/Breakpoint/Watchpoint.h&p1=lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h&r1=141877&r2=141925&rev=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Watchpoint.h Thu Oct 13 19:42:25 2011
@@ -1,4 +1,4 @@
-//===-- WatchpointLocation.h ------------------------------------*- C++ -*-===//
+//===-- Watchpoint.h --------------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef liblldb_WatchpointLocation_h_
-#define liblldb_WatchpointLocation_h_
+#ifndef liblldb_Watchpoint_h_
+#define liblldb_Watchpoint_h_
 
 // C Includes
 
@@ -26,14 +26,14 @@
 
 namespace lldb_private {
 
-class WatchpointLocation :
+class Watchpoint :
     public StoppointLocation
 {
 public:
 
-    WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware = true);
+    Watchpoint (lldb::addr_t addr, size_t size, bool hardware = true);
 
-    ~WatchpointLocation ();
+    ~Watchpoint ();
 
     bool
     IsEnabled () const;
@@ -79,9 +79,9 @@
     static lldb::break_id_t
     GetNextID();
 
-    DISALLOW_COPY_AND_ASSIGN (WatchpointLocation);
+    DISALLOW_COPY_AND_ASSIGN (Watchpoint);
 };
 
 } // namespace lldb_private
 
-#endif  // liblldb_WatchpointLocation_h_
+#endif  // liblldb_Watchpoint_h_

Copied: lldb/trunk/include/lldb/Breakpoint/WatchpointList.h (from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointList.h?p2=lldb/trunk/include/lldb/Breakpoint/WatchpointList.h&p1=lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h&r1=141877&r2=141925&rev=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointList.h Thu Oct 13 19:42:25 2011
@@ -1,4 +1,4 @@
-//===-- WatchpointLocationList.h --------------------------------*- C++ -*-===//
+//===-- WatchpointList.h ----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef liblldb_WatchpointLocationList_h_
-#define liblldb_WatchpointLocationList_h_
+#ifndef liblldb_WatchpointList_h_
+#define liblldb_WatchpointList_h_
 
 // C Includes
 // C++ Includes
@@ -23,41 +23,41 @@
 namespace lldb_private {
 
 //----------------------------------------------------------------------
-/// @class WatchpointLocationList WatchpointLocationList.h "lldb/Breakpoint/WatchpointLocationList.h"
-/// @brief This class is used by Watchpoint to manage a list of watchpoint locations,
-//  each watchpoint location in the list
-/// has a unique ID, and is unique by Address as well.
+/// @class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h"
+/// @brief This class is used by Watchpoint to manage a list of watchpoints,
+//  each watchpoint in the list has a unique ID, and is unique by Address as
+//  well.
 //----------------------------------------------------------------------
 
-class WatchpointLocationList
+class WatchpointList
 {
-// Only Target can make the location list, or add elements to it.
-// This is not just some random collection of locations.  Rather, the act of adding the location
-// to this list sets its ID.
-friend class WatchpointLocation;
+// Only Target can make the watchpoint list, or add elements to it.
+// This is not just some random collection of watchpoints.  Rather, the act of
+// adding the watchpoint to this list sets its ID.
+friend class Watchpoint;
 
 public:
     //------------------------------------------------------------------
     /// Default constructor makes an empty list.
     //------------------------------------------------------------------
-    WatchpointLocationList();
+    WatchpointList();
 
     //------------------------------------------------------------------
     /// Destructor, currently does nothing.
     //------------------------------------------------------------------
-    ~WatchpointLocationList();
+    ~WatchpointList();
 
     //------------------------------------------------------------------
-    /// Add a WatchpointLocation to the list.
+    /// Add a Watchpoint to the list.
     ///
-    /// @param[in] wp_loc_sp
-    ///    A shared pointer to a watchpoint location being added to the list.
+    /// @param[in] wp_sp
+    ///    A shared pointer to a watchpoint being added to the list.
     ///
     /// @return
-    ///    The ID of the WatchpointLocation in the list.
+    ///    The ID of the Watchpoint in the list.
     //------------------------------------------------------------------
     lldb::watch_id_t
-    Add (const lldb::WatchpointLocationSP& wp_loc_sp);
+    Add (const lldb::WatchpointSP& wp_sp);
 
     //------------------------------------------------------------------
     /// Standard "Dump" method.
@@ -72,8 +72,8 @@
     DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
 
     //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location at address
-    /// \a addr - const version.
+    /// Returns a shared pointer to the watchpoint at address /// \a addr -
+    /// const version.
     ///
     /// @param[in] addr
     ///     The address to look for.
@@ -82,12 +82,12 @@
     ///     A shared pointer to the watchpoint.  May contain a NULL
     ///     pointer if the watchpoint doesn't exist.
     //------------------------------------------------------------------
-    const lldb::WatchpointLocationSP
+    const lldb::WatchpointSP
     FindByAddress (lldb::addr_t addr) const;
 
     //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location with id
-    /// \a breakID, const version.
+    /// Returns a shared pointer to the watchpoint with id /// \a breakID, const
+    /// version.
     ///
     /// @param[in] breakID
     ///     The watchpoint location ID to seek for.
@@ -96,74 +96,72 @@
     ///     A shared pointer to the watchpoint.  May contain a NULL
     ///     pointer if the watchpoint doesn't exist.
     //------------------------------------------------------------------
-    lldb::WatchpointLocationSP
+    lldb::WatchpointSP
     FindByID (lldb::watch_id_t watchID) const;
 
     //------------------------------------------------------------------
-    /// Returns the watchpoint location id to the watchpoint location
-    /// at address \a addr.
+    /// Returns the watchpoint id to the watchpoint /// at address \a addr.
     ///
     /// @param[in] addr
     ///     The address to match.
     ///
     /// @result
-    ///     The ID of the watchpoint location, or LLDB_INVALID_WATCH_ID.
+    ///     The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
     //------------------------------------------------------------------
     lldb::watch_id_t
     FindIDByAddress (lldb::addr_t addr);
 
     //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location with
-    /// index \a i.
+    /// Returns a shared pointer to the watchpoint with index \a i.
     ///
     /// @param[in] i
-    ///     The watchpoint location index to seek for.
+    ///     The watchpoint index to seek for.
     ///
     /// @result
-    ///     A shared pointer to the watchpoint location.  May contain a NULL
-    ///     pointer if the watchpoint location doesn't exist.
+    ///     A shared pointer to the watchpoint.  May contain a NULL pointer if
+    ///     the watchpoint doesn't exist.
     //------------------------------------------------------------------
-    lldb::WatchpointLocationSP
+    lldb::WatchpointSP
     GetByIndex (uint32_t i);
 
     //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location with index
-    /// \a i, const version.
+    /// Returns a shared pointer to the watchpoint with index \a i, const
+    /// version.
     ///
     /// @param[in] i
-    ///     The watchpoint location index to seek for.
+    ///     The watchpoint index to seek for.
     ///
     /// @result
-    ///     A shared pointer to the watchpoint location.  May contain a NULL
-    ///     pointer if the watchpoint location doesn't exist.
+    ///     A shared pointer to the watchpoint.  May contain a NULL pointer if
+    ///     the watchpoint location doesn't exist.
     //------------------------------------------------------------------
-    const lldb::WatchpointLocationSP
+    const lldb::WatchpointSP
     GetByIndex (uint32_t i) const;
 
     //------------------------------------------------------------------
-    /// Removes the watchpoint location given by \b watchID from this list.
+    /// Removes the watchpoint given by \b watchID from this list.
     ///
     /// @param[in] watchID
-    ///   The watchpoint location ID to remove.
+    ///   The watchpoint ID to remove.
     ///
     /// @result
-    ///   \b true if the watchpoint location \a watchID was in the list.
+    ///   \b true if the watchpoint \a watchID was in the list.
     //------------------------------------------------------------------
     bool
     Remove (lldb::watch_id_t watchID);
 
     //------------------------------------------------------------------
-    /// Returns the number hit count of all locations in this list.
+    /// Returns the number hit count of all watchpoints in this list.
     ///
     /// @result
-    ///     Hit count of all locations in this list.
+    ///     Hit count of all watchpoints in this list.
     //------------------------------------------------------------------
     uint32_t
     GetHitCount () const;
 
     //------------------------------------------------------------------
-    /// Enquires of the watchpoint location in this list with ID \a
-    /// watchID whether we should stop.
+    /// Enquires of the watchpoint in this list with ID \a watchID whether we
+    /// should stop.
     ///
     /// @param[in] context
     ///     This contains the information about this stop.
@@ -179,7 +177,7 @@
                 lldb::watch_id_t watchID);
 
     //------------------------------------------------------------------
-    /// Returns the number of elements in this watchpoint location list.
+    /// Returns the number of elements in this watchpoint list.
     ///
     /// @result
     ///     The number of elements.
@@ -188,12 +186,11 @@
     GetSize() const
     {
         Mutex::Locker locker(m_mutex);
-        return m_address_to_location.size();
+        return m_address_to_watchpoint.size();
     }
 
     //------------------------------------------------------------------
-    /// Print a description of the watchpoint locations in this list to
-    /// the stream \a s.
+    /// Print a description of the watchpoints in this list to the stream \a s.
     ///
     /// @param[in] s
     ///     The stream to which to print the description.
@@ -215,7 +212,7 @@
     RemoveAll ();
     
     //------------------------------------------------------------------
-    /// Sets the passed in Locker to hold the Watchpoint Location List mutex.
+    /// Sets the passed in Locker to hold the Watchpoint List mutex.
     ///
     /// @param[in] locker
     ///   The locker object that is set.
@@ -224,7 +221,7 @@
     GetListMutex (lldb_private::Mutex::Locker &locker);
 
 protected:
-    typedef std::map<lldb::addr_t, lldb::WatchpointLocationSP> addr_map;
+    typedef std::map<lldb::addr_t, lldb::WatchpointSP> addr_map;
 
     addr_map::iterator
     GetIDIterator(lldb::watch_id_t watchID);
@@ -232,10 +229,10 @@
     addr_map::const_iterator
     GetIDConstIterator(lldb::watch_id_t watchID) const;
 
-    addr_map m_address_to_location;
+    addr_map m_address_to_watchpoint;
     mutable Mutex m_mutex;
 };
 
 } // namespace lldb_private
 
-#endif  // liblldb_WatchpointLocationList_h_
+#endif  // liblldb_WatchpointList_h_

Removed: lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h?rev=141924&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (removed)
@@ -1,87 +0,0 @@
-//===-- WatchpointLocation.h ------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_WatchpointLocation_h_
-#define liblldb_WatchpointLocation_h_
-
-// C Includes
-
-// C++ Includes
-#include <list>
-#include <string>
-
-// Other libraries and framework includes
-
-// Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Core/UserID.h"
-#include "lldb/Breakpoint/StoppointLocation.h"
-
-namespace lldb_private {
-
-class WatchpointLocation :
-    public StoppointLocation
-{
-public:
-
-    WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware = true);
-
-    ~WatchpointLocation ();
-
-    bool
-    IsEnabled () const;
-
-    void
-    SetEnabled (bool enabled);
-
-    virtual bool
-    IsHardware () const;
-
-    virtual bool
-    ShouldStop (StoppointCallbackContext *context);
-
-    bool        WatchpointRead () const;
-    bool        WatchpointWrite () const;
-    uint32_t    GetIgnoreCount () const;
-    void        SetIgnoreCount (uint32_t n);
-    void        SetWatchpointType (uint32_t type);
-    bool        SetCallback (WatchpointHitCallback callback, void *callback_baton);
-    void        SetDeclInfo (std::string &str);
-    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
-                m_watch_write:1,    // 1 if we stop when the watched data is written to
-                m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access
-                m_watch_was_written:1;  // Set to 1 when watchpoint is hit for a write access
-    uint32_t    m_ignore_count;     // Number of times to ignore this breakpoint
-    WatchpointHitCallback m_callback;
-    void *      m_callback_baton;   // Callback user data to pass to callback
-    std::string m_decl_str;         // Declaration information, if any.
-
-    static lldb::break_id_t
-    GetNextID();
-
-    DISALLOW_COPY_AND_ASSIGN (WatchpointLocation);
-};
-
-} // namespace lldb_private
-
-#endif  // liblldb_WatchpointLocation_h_

Removed: lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h?rev=141924&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h (removed)
@@ -1,241 +0,0 @@
-//===-- WatchpointLocationList.h --------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_WatchpointLocationList_h_
-#define liblldb_WatchpointLocationList_h_
-
-// C Includes
-// C++ Includes
-#include <vector>
-#include <map>
-// Other libraries and framework includes
-// Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Core/Address.h"
-#include "lldb/Host/Mutex.h"
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class WatchpointLocationList WatchpointLocationList.h "lldb/Breakpoint/WatchpointLocationList.h"
-/// @brief This class is used by Watchpoint to manage a list of watchpoint locations,
-//  each watchpoint location in the list
-/// has a unique ID, and is unique by Address as well.
-//----------------------------------------------------------------------
-
-class WatchpointLocationList
-{
-// Only Target can make the location list, or add elements to it.
-// This is not just some random collection of locations.  Rather, the act of adding the location
-// to this list sets its ID.
-friend class WatchpointLocation;
-
-public:
-    //------------------------------------------------------------------
-    /// Default constructor makes an empty list.
-    //------------------------------------------------------------------
-    WatchpointLocationList();
-
-    //------------------------------------------------------------------
-    /// Destructor, currently does nothing.
-    //------------------------------------------------------------------
-    ~WatchpointLocationList();
-
-    //------------------------------------------------------------------
-    /// Add a WatchpointLocation to the list.
-    ///
-    /// @param[in] wp_loc_sp
-    ///    A shared pointer to a watchpoint location being added to the list.
-    ///
-    /// @return
-    ///    The ID of the WatchpointLocation in the list.
-    //------------------------------------------------------------------
-    lldb::watch_id_t
-    Add (const lldb::WatchpointLocationSP& wp_loc_sp);
-
-    //------------------------------------------------------------------
-    /// Standard "Dump" method.
-    //------------------------------------------------------------------
-    void
-    Dump (Stream *s) const;
-
-    //------------------------------------------------------------------
-    /// Dump with lldb::DescriptionLevel.
-    //------------------------------------------------------------------
-    void
-    DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
-
-    //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location at address
-    /// \a addr - const version.
-    ///
-    /// @param[in] addr
-    ///     The address to look for.
-    ///
-    /// @result
-    ///     A shared pointer to the watchpoint.  May contain a NULL
-    ///     pointer if the watchpoint doesn't exist.
-    //------------------------------------------------------------------
-    const lldb::WatchpointLocationSP
-    FindByAddress (lldb::addr_t addr) const;
-
-    //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location with id
-    /// \a breakID, const version.
-    ///
-    /// @param[in] breakID
-    ///     The watchpoint location ID to seek for.
-    ///
-    /// @result
-    ///     A shared pointer to the watchpoint.  May contain a NULL
-    ///     pointer if the watchpoint doesn't exist.
-    //------------------------------------------------------------------
-    lldb::WatchpointLocationSP
-    FindByID (lldb::watch_id_t watchID) const;
-
-    //------------------------------------------------------------------
-    /// Returns the watchpoint location id to the watchpoint location
-    /// at address \a addr.
-    ///
-    /// @param[in] addr
-    ///     The address to match.
-    ///
-    /// @result
-    ///     The ID of the watchpoint location, or LLDB_INVALID_WATCH_ID.
-    //------------------------------------------------------------------
-    lldb::watch_id_t
-    FindIDByAddress (lldb::addr_t addr);
-
-    //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location with
-    /// index \a i.
-    ///
-    /// @param[in] i
-    ///     The watchpoint location index to seek for.
-    ///
-    /// @result
-    ///     A shared pointer to the watchpoint location.  May contain a NULL
-    ///     pointer if the watchpoint location doesn't exist.
-    //------------------------------------------------------------------
-    lldb::WatchpointLocationSP
-    GetByIndex (uint32_t i);
-
-    //------------------------------------------------------------------
-    /// Returns a shared pointer to the watchpoint location with index
-    /// \a i, const version.
-    ///
-    /// @param[in] i
-    ///     The watchpoint location index to seek for.
-    ///
-    /// @result
-    ///     A shared pointer to the watchpoint location.  May contain a NULL
-    ///     pointer if the watchpoint location doesn't exist.
-    //------------------------------------------------------------------
-    const lldb::WatchpointLocationSP
-    GetByIndex (uint32_t i) const;
-
-    //------------------------------------------------------------------
-    /// Removes the watchpoint location given by \b watchID from this list.
-    ///
-    /// @param[in] watchID
-    ///   The watchpoint location ID to remove.
-    ///
-    /// @result
-    ///   \b true if the watchpoint location \a watchID was in the list.
-    //------------------------------------------------------------------
-    bool
-    Remove (lldb::watch_id_t watchID);
-
-    //------------------------------------------------------------------
-    /// Returns the number hit count of all locations in this list.
-    ///
-    /// @result
-    ///     Hit count of all locations in this list.
-    //------------------------------------------------------------------
-    uint32_t
-    GetHitCount () const;
-
-    //------------------------------------------------------------------
-    /// Enquires of the watchpoint location in this list with ID \a
-    /// watchID whether we should stop.
-    ///
-    /// @param[in] context
-    ///     This contains the information about this stop.
-    ///
-    /// @param[in] watchID
-    ///     This watch ID that we hit.
-    ///
-    /// @return
-    ///     \b true if we should stop, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    ShouldStop (StoppointCallbackContext *context,
-                lldb::watch_id_t watchID);
-
-    //------------------------------------------------------------------
-    /// Returns the number of elements in this watchpoint location list.
-    ///
-    /// @result
-    ///     The number of elements.
-    //------------------------------------------------------------------
-    size_t
-    GetSize() const
-    {
-        Mutex::Locker locker(m_mutex);
-        return m_address_to_location.size();
-    }
-
-    //------------------------------------------------------------------
-    /// Print a description of the watchpoint locations in this list to
-    /// the stream \a s.
-    ///
-    /// @param[in] s
-    ///     The stream to which to print the description.
-    ///
-    /// @param[in] level
-    ///     The description level that indicates the detail level to
-    ///     provide.
-    ///
-    /// @see lldb::DescriptionLevel
-    //------------------------------------------------------------------
-    void
-    GetDescription (Stream *s,
-                    lldb::DescriptionLevel level);
-
-    void
-    SetEnabledAll (bool enabled);
-
-    void
-    RemoveAll ();
-    
-    //------------------------------------------------------------------
-    /// Sets the passed in Locker to hold the Watchpoint Location List mutex.
-    ///
-    /// @param[in] locker
-    ///   The locker object that is set.
-    //------------------------------------------------------------------
-    void
-    GetListMutex (lldb_private::Mutex::Locker &locker);
-
-protected:
-    typedef std::map<lldb::addr_t, lldb::WatchpointLocationSP> addr_map;
-
-    addr_map::iterator
-    GetIDIterator(lldb::watch_id_t watchID);
-
-    addr_map::const_iterator
-    GetIDConstIterator(lldb::watch_id_t watchID) const;
-
-    addr_map m_address_to_location;
-    mutable Mutex m_mutex;
-};
-
-} // namespace lldb_private
-
-#endif  // liblldb_WatchpointLocationList_h_

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu Oct 13 19:42:25 2011
@@ -2480,10 +2480,10 @@
     // Process Watchpoints (optional)
     //----------------------------------------------------------------------
     virtual Error
-    EnableWatchpoint (WatchpointLocation *bp_loc);
+    EnableWatchpoint (Watchpoint *wp);
 
     virtual Error
-    DisableWatchpoint (WatchpointLocation *bp_loc);
+    DisableWatchpoint (Watchpoint *wp);
 
     //------------------------------------------------------------------
     // Thread Queries

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Oct 13 19:42:25 2011
@@ -18,7 +18,7 @@
 #include "lldb/lldb-public.h"
 #include "lldb/Breakpoint/BreakpointList.h"
 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
-#include "lldb/Breakpoint/WatchpointLocationList.h"
+#include "lldb/Breakpoint/WatchpointList.h"
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/ModuleList.h"
@@ -292,22 +292,22 @@
                       lldb::BreakpointResolverSP &resolver_sp,
                       bool internal = false);
 
-    // Use this to create a watchpoint location:
-    lldb::WatchpointLocationSP
-    CreateWatchpointLocation (lldb::addr_t addr,
-                              size_t size,
-                              uint32_t type);
+    // Use this to create a watchpoint:
+    lldb::WatchpointSP
+    CreateWatchpoint (lldb::addr_t addr,
+                      size_t size,
+                      uint32_t type);
 
-    lldb::WatchpointLocationSP
-    GetLastCreatedWatchpointLocation ()
+    lldb::WatchpointSP
+    GetLastCreatedWatchpoint ()
     {
-        return m_last_created_watchpoint_location;
+        return m_last_created_watchpoint;
     }
 
-    WatchpointLocationList &
-    GetWatchpointLocationList()
+    WatchpointList &
+    GetWatchpointList()
     {
-        return m_watchpoint_location_list;
+        return m_watchpoint_list;
     }
 
     void
@@ -332,28 +332,28 @@
     // performed end to end, for both the debugger and the debuggee.
 
     bool
-    RemoveAllWatchpointLocations (bool end_to_end = true);
+    RemoveAllWatchpoints (bool end_to_end = true);
 
     bool
-    DisableAllWatchpointLocations (bool end_to_end = true);
+    DisableAllWatchpoints (bool end_to_end = true);
 
     bool
-    EnableAllWatchpointLocations (bool end_to_end = true);
+    EnableAllWatchpoints (bool end_to_end = true);
 
     bool
-    IgnoreAllWatchpointLocations (uint32_t ignore_count);
+    IgnoreAllWatchpoints (uint32_t ignore_count);
 
     bool
-    DisableWatchpointLocationByID (lldb::watch_id_t watch_id);
+    DisableWatchpointByID (lldb::watch_id_t watch_id);
 
     bool
-    EnableWatchpointLocationByID (lldb::watch_id_t watch_id);
+    EnableWatchpointByID (lldb::watch_id_t watch_id);
 
     bool
-    RemoveWatchpointLocationByID (lldb::watch_id_t watch_id);
+    RemoveWatchpointByID (lldb::watch_id_t watch_id);
 
     bool
-    IgnoreWatchpointLocationByID (lldb::watch_id_t watch_id, uint32_t ignore_count);
+    IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count);
 
     void
     ModulesDidLoad (ModuleList &module_list);
@@ -877,8 +877,8 @@
     BreakpointList  m_breakpoint_list;
     BreakpointList  m_internal_breakpoint_list;
     lldb::BreakpointSP m_last_created_breakpoint;
-    WatchpointLocationList  m_watchpoint_location_list;
-    lldb::WatchpointLocationSP m_last_created_watchpoint_location;
+    WatchpointList  m_watchpoint_list;
+    lldb::WatchpointSP m_last_created_watchpoint;
     // We want to tightly control the process destruction process so
     // we can correctly tear down everything that we need to, so the only
     // class that knows about the process lifespan is this target class.

Modified: lldb/trunk/include/lldb/lldb-forward-rtti.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
+++ lldb/trunk/include/lldb/lldb-forward-rtti.h Thu Oct 13 19:42:25 2011
@@ -87,7 +87,7 @@
     typedef SharedPtr<lldb_private::Variable>::Type VariableSP;
     typedef SharedPtr<lldb_private::VariableList>::Type VariableListSP;
     typedef SharedPtr<lldb_private::ValueObjectList>::Type ValueObjectListSP;
-    typedef SharedPtr<lldb_private::WatchpointLocation>::Type WatchpointLocationSP;
+    typedef SharedPtr<lldb_private::Watchpoint>::Type WatchpointSP;
 
 } // namespace lldb
 

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Thu Oct 13 19:42:25 2011
@@ -197,8 +197,8 @@
 class   ValueObjectList;
 class   Variable;
 class   VariableList;
-class   WatchpointLocation;
-class   WatchpointLocationList;
+class   Watchpoint;
+class   WatchpointList;
 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=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Oct 13 19:42:25 2011
@@ -92,7 +92,7 @@
 		2689000B13353DB600698AC0 /* Stoppoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1610F1B83100F91463 /* Stoppoint.cpp */; };
 		2689000D13353DB600698AC0 /* StoppointCallbackContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E0910F1B83100F91463 /* StoppointCallbackContext.cpp */; };
 		2689000F13353DB600698AC0 /* StoppointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */; };
-		2689001113353DB600698AC0 /* WatchpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */; };
+		2689001113353DB600698AC0 /* Watchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1810F1B83100F91463 /* Watchpoint.cpp */; };
 		2689001213353DDE00698AC0 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; };
 		2689001313353DDE00698AC0 /* CommandObjectArgs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 499F381F11A5B3F300F5CE02 /* CommandObjectArgs.cpp */; };
 		2689001413353DDE00698AC0 /* CommandObjectBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */; };
@@ -450,7 +450,7 @@
 		B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */; };
 		B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */; };
 		B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; };
-		B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointLocationList.cpp */; };
+		B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointList.cpp */; };
 		B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; };
 		B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpoint.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; };
@@ -843,7 +843,7 @@
 		26BC7CF910F1B71400F91463 /* SearchFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SearchFilter.h; path = include/lldb/Core/SearchFilter.h; sourceTree = "<group>"; };
 		26BC7CFA10F1B71400F91463 /* Stoppoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stoppoint.h; path = include/lldb/Breakpoint/Stoppoint.h; sourceTree = "<group>"; };
 		26BC7CFB10F1B71400F91463 /* StoppointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StoppointLocation.h; path = include/lldb/Breakpoint/StoppointLocation.h; sourceTree = "<group>"; };
-		26BC7CFC10F1B71400F91463 /* WatchpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WatchpointLocation.h; path = include/lldb/Breakpoint/WatchpointLocation.h; sourceTree = "<group>"; };
+		26BC7CFC10F1B71400F91463 /* Watchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Watchpoint.h; path = include/lldb/Breakpoint/Watchpoint.h; sourceTree = "<group>"; };
 		26BC7D1410F1B76300F91463 /* CommandObjectBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectBreakpoint.h; path = source/Commands/CommandObjectBreakpoint.h; sourceTree = "<group>"; };
 		26BC7D1710F1B76300F91463 /* CommandObjectDisassemble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectDisassemble.h; path = source/Commands/CommandObjectDisassemble.h; sourceTree = "<group>"; };
 		26BC7D1810F1B76300F91463 /* CommandObjectExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectExpression.h; path = source/Commands/CommandObjectExpression.h; sourceTree = "<group>"; };
@@ -946,7 +946,7 @@
 		26BC7E1510F1B83100F91463 /* SearchFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SearchFilter.cpp; path = source/Core/SearchFilter.cpp; sourceTree = "<group>"; };
 		26BC7E1610F1B83100F91463 /* Stoppoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stoppoint.cpp; path = source/Breakpoint/Stoppoint.cpp; sourceTree = "<group>"; };
 		26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StoppointLocation.cpp; path = source/Breakpoint/StoppointLocation.cpp; sourceTree = "<group>"; };
-		26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointLocation.cpp; path = source/Breakpoint/WatchpointLocation.cpp; sourceTree = "<group>"; };
+		26BC7E1810F1B83100F91463 /* Watchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Watchpoint.cpp; path = source/Breakpoint/Watchpoint.cpp; sourceTree = "<group>"; };
 		26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpoint.cpp; path = source/Commands/CommandObjectBreakpoint.cpp; sourceTree = "<group>"; };
 		26BC7E3010F1B84700F91463 /* CommandObjectDisassemble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectDisassemble.cpp; path = source/Commands/CommandObjectDisassemble.cpp; sourceTree = "<group>"; };
 		26BC7E3110F1B84700F91463 /* CommandObjectExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectExpression.cpp; path = source/Commands/CommandObjectExpression.cpp; sourceTree = "<group>"; };
@@ -1361,8 +1361,8 @@
 		B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupWatchpoint.cpp; path = source/Interpreter/OptionGroupWatchpoint.cpp; sourceTree = "<group>"; };
 		B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupWatchpoint.h; path = include/lldb/Interpreter/OptionGroupWatchpoint.h; sourceTree = "<group>"; };
 		B2462249141AE62200F3D409 /* Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Utils.h; path = include/lldb/Utility/Utils.h; sourceTree = "<group>"; };
-		B27318411416AC12006039C8 /* WatchpointLocationList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointLocationList.cpp; path = source/Breakpoint/WatchpointLocationList.cpp; sourceTree = "<group>"; };
-		B27318431416AC43006039C8 /* WatchpointLocationList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WatchpointLocationList.h; path = include/lldb/Breakpoint/WatchpointLocationList.h; sourceTree = "<group>"; };
+		B27318411416AC12006039C8 /* WatchpointList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointList.cpp; path = source/Breakpoint/WatchpointList.cpp; sourceTree = "<group>"; };
+		B27318431416AC43006039C8 /* WatchpointList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WatchpointList.h; path = include/lldb/Breakpoint/WatchpointList.h; sourceTree = "<group>"; };
 		B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InferiorCallPOSIX.cpp; path = Utility/InferiorCallPOSIX.cpp; sourceTree = "<group>"; };
 		B28058A2139988C6002D96D0 /* InferiorCallPOSIX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InferiorCallPOSIX.h; path = Utility/InferiorCallPOSIX.h; sourceTree = "<group>"; };
 		B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMDefines.h; path = Utility/ARMDefines.h; sourceTree = "<group>"; };
@@ -2309,10 +2309,10 @@
 				26BC7E0910F1B83100F91463 /* StoppointCallbackContext.cpp */,
 				26BC7CFB10F1B71400F91463 /* StoppointLocation.h */,
 				26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */,
-				26BC7CFC10F1B71400F91463 /* WatchpointLocation.h */,
-				B27318431416AC43006039C8 /* WatchpointLocationList.h */,
-				26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */,
-				B27318411416AC12006039C8 /* WatchpointLocationList.cpp */,
+				26BC7CFC10F1B71400F91463 /* Watchpoint.h */,
+				B27318431416AC43006039C8 /* WatchpointList.h */,
+				26BC7E1810F1B83100F91463 /* Watchpoint.cpp */,
+				B27318411416AC12006039C8 /* WatchpointList.cpp */,
 			);
 			name = Breakpoint;
 			sourceTree = "<group>";
@@ -3199,7 +3199,7 @@
 				2689000B13353DB600698AC0 /* Stoppoint.cpp in Sources */,
 				2689000D13353DB600698AC0 /* StoppointCallbackContext.cpp in Sources */,
 				2689000F13353DB600698AC0 /* StoppointLocation.cpp in Sources */,
-				2689001113353DB600698AC0 /* WatchpointLocation.cpp in Sources */,
+				2689001113353DB600698AC0 /* Watchpoint.cpp in Sources */,
 				2689001213353DDE00698AC0 /* CommandObjectApropos.cpp in Sources */,
 				2689001313353DDE00698AC0 /* CommandObjectArgs.cpp in Sources */,
 				2689001413353DDE00698AC0 /* CommandObjectBreakpoint.cpp in Sources */,
@@ -3498,7 +3498,7 @@
 				94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */,
 				949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */,
 				26A0DA4E140F7226006DA411 /* HashedNameToDIE.cpp in Sources */,
-				B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */,
+				B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */,
 				26E152261419CAD4007967D0 /* ObjectFilePECOFF.cpp in Sources */,
 				B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */,
 				49A71FE7141FFA5C00D59478 /* IRInterpreter.cpp in Sources */,

Modified: lldb/trunk/scripts/Python/interface/SBFrame.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFrame.i?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBFrame.i (original)
+++ lldb/trunk/scripts/Python/interface/SBFrame.i Thu Oct 13 19:42:25 2011
@@ -215,25 +215,6 @@
     lldb::SBValue
     FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
 
-    %feature("docstring", "
-    /// Find and watch a variable using the frame as the scope.
-    /// It returns an SBValue, similar to FindValue() method, if find-and-watch
-    /// operation succeeds.  Otherwise, an invalid SBValue is returned.
-    /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
-    ") WatchValue;
-    lldb::SBValue
-    WatchValue (const char *name, ValueType value_type, uint32_t watch_type);
-
-    %feature("docstring", "
-    /// Find and watch the location pointed to by a variable using the frame as
-    /// the scope.
-    /// It returns an SBValue, similar to FindValue() method, if find-and-watch
-    /// operation succeeds.  Otherwise, an invalid SBValue is returned.
-    /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
-    ") WatchLocation;
-    lldb::SBValue
-    WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size);
-
     bool
     GetDescription (lldb::SBStream &description);
 

Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Thu Oct 13 19:42:25 2011
@@ -12,8 +12,7 @@
 %feature("docstring",
 "Represents the target program running under the debugger.
 
-SBTarget supports module, breakpoint, and watchpoint_location iterations. For
-example,
+SBTarget supports module, breakpoint, and watchpoint iterations. For example,
 
     for m in target.module_iter():
         print m
@@ -39,14 +38,14 @@
 
 and,
 
-    for wp_loc in target.watchpoint_location_iter():
+    for wp_loc in target.watchpoint_iter():
         print wp_loc
 
 produces:
 
-WatchpointLocation 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
+Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
     declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
-    hw_index = 0  hit_count = 2     ignore_count = 0     callback =      0x0 baton =      0x0"
+    hw_index = 0  hit_count = 2     ignore_count = 0"
 ) SBTarget;
 class SBTarget
 {

Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Thu Oct 13 19:42:25 2011
@@ -278,9 +278,17 @@
     lldb::SBFrame
     GetFrame();
     
+    %feature("docstring", "
+    /// Find and watch a variable.
+    /// It returns an SBWatchpoint, which may be invalid.
+    ") Watch;
     lldb::SBWatchpoint
     Watch (bool resolve_location, bool read, bool write);
 
+    %feature("docstring", "
+    /// Find and watch the location pointed to by a variable.
+    /// It returns an SBWatchpoint, which may be invalid.
+    ") WatchPointee;
     lldb::SBWatchpoint
     WatchPointee (bool resolve_location, bool read, bool write);
 

Modified: lldb/trunk/scripts/Python/interface/SBWatchpoint.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBWatchpoint.i?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBWatchpoint.i (original)
+++ lldb/trunk/scripts/Python/interface/SBWatchpoint.i Thu Oct 13 19:42:25 2011
@@ -10,14 +10,13 @@
 namespace lldb {
 
 %feature("docstring",
-"Represents an instance of watchpoint location for a specific target program.
+"Represents an instance of watchpoint for a specific target program.
 
-A watchpoint location is determined by the address and the byte size that
-resulted in this particular instantiation.  Each watchpoint location has its
-settable options.
+A watchpoint is determined by the address and the byte size that resulted in
+this particular instantiation.  Each watchpoint has its settable options.
 
-See also SBTarget.watchpoint_location_iter() for for example usage of iterating
-through the watchpoint locations of the target."
+See also SBTarget.watchpoint_iter() for for example usage of iterating through
+the watchpoints of the target."
 ) SBWatchpoint;
 class SBWatchpoint
 {

Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Thu Oct 13 19:42:25 2011
@@ -173,7 +173,7 @@
 iter_def = "    def __iter__(self): return lldb_iter(self, '%s', '%s')"
 module_iter = "    def module_iter(self): return lldb_iter(self, '%s', '%s')"
 breakpoint_iter = "    def breakpoint_iter(self): return lldb_iter(self, '%s', '%s')"
-watchpoint_location_iter = "    def watchpoint_location_iter(self): return lldb_iter(self, '%s', '%s')"
+watchpoint_iter = "    def watchpoint_iter(self): return lldb_iter(self, '%s', '%s')"
 section_iter = "    def section_iter(self): return lldb_iter(self, '%s', '%s')"
 
 # Called to implement the built-in function len().
@@ -222,7 +222,7 @@
       # SBTarget needs special processing, see below.
       'SBTarget': {'module':     ('GetNumModules', 'GetModuleAtIndex'),
                    'breakpoint': ('GetNumBreakpoints', 'GetBreakpointAtIndex'),
-                   'watchpoint_location': ('GetNumWatchpointLocations', 'GetWatchpointLocationAtIndex')
+                   'watchpoint': ('GetNumWatchpoints', 'GetWatchpointAtIndex')
                    },
 
       # SBModule has an additional section_iter(), see below.
@@ -369,7 +369,7 @@
             if cls == "SBTarget":
                 new_content.add_line(module_iter % (d[cls]['module']))
                 new_content.add_line(breakpoint_iter % (d[cls]['breakpoint']))
-                new_content.add_line(watchpoint_location_iter % (d[cls]['watchpoint_location']))
+                new_content.add_line(watchpoint_iter % (d[cls]['watchpoint']))
             else:
                 if (state & DEFINING_ITERATOR):
                     new_content.add_line(iter_def % d[cls])

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Thu Oct 13 19:42:25 2011
@@ -14,7 +14,6 @@
 
 #include "lldb/lldb-types.h"
 
-#include "lldb/Breakpoint/WatchpointLocation.h"
 #include "lldb/Core/Address.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Log.h"
@@ -406,119 +405,6 @@
     return value;
 }
 
-/// Find and watch a variable using the frame as the scope.
-/// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
-SBValue
-SBFrame::WatchValue (const char *name, ValueType value_type, uint32_t watch_type)
-{
-    SBValue sb_value_empty;
-
-    if (!IsValid())
-        return sb_value_empty;
-
-    // Acquire the API locker, to be released at the end of the method call.
-    Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
-
-    switch (value_type) {
-    case eValueTypeVariableGlobal:      // global variable
-    case eValueTypeVariableStatic:      // static variable
-    case eValueTypeVariableArgument:    // function argument variables
-    case eValueTypeVariableLocal:       // function local variables
-        break;
-    default:
-        return sb_value_empty;          // these are not eligible for watching
-    }
-
-    SBValue sb_value = FindValue(name, value_type);
-    // If the SBValue is not valid, there's no point in even trying to watch it.
-    if (!sb_value.IsValid())
-        return sb_value;
-
-    addr_t addr = sb_value.GetLoadAddress();
-    size_t size = sb_value.GetByteSize();
-
-    WatchpointLocationSP wp_loc_sp = m_opaque_sp->GetThread().GetProcess().GetTarget().
-        CreateWatchpointLocation(addr, size, watch_type);
-
-    if (wp_loc_sp) {
-        // StackFrame::GetInScopeVariableList(true) to get file globals as well.
-        VariableListSP var_list_sp(m_opaque_sp->GetInScopeVariableList(true));
-        VariableSP var_sp = var_list_sp->FindVariable(ConstString(name));
-        if (var_sp && var_sp->GetDeclaration().GetFile()) {
-            StreamString ss;
-            // True to show fullpath for declaration file.
-            var_sp->GetDeclaration().DumpStopContext(&ss, true);
-            wp_loc_sp->SetDeclInfo(ss.GetString());
-        }
-    }
-
-    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-    if (log)
-        log->Printf ("SBFrame(%p)::WatchValue (name=\"%s\", value_type=%i, watch_type=%i) => SBValue(%p) & wp_loc(%p)", 
-                     m_opaque_sp.get(), name, value_type, watch_type, sb_value.get(), wp_loc_sp.get());
-
-    return wp_loc_sp ? sb_value : sb_value_empty;
-}
-
-/// Find and watch the location pointed to by a variable using the frame as
-/// the scope.
-/// It returns an SBValue, similar to FindValue() method, if find-and-watch
-/// operation succeeds.  Otherwise, an invalid SBValue is returned.
-/// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
-SBValue
-SBFrame::WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size)
-{
-    SBValue sb_value_empty;
-
-    if (!IsValid())
-        return sb_value_empty;
-
-    // Acquire the API locker, to be released at the end of the method call.
-    Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
-
-    switch (value_type) {
-    case eValueTypeVariableGlobal:      // global variable
-    case eValueTypeVariableStatic:      // static variable
-    case eValueTypeVariableArgument:    // function argument variables
-    case eValueTypeVariableLocal:       // function local variables
-        break;
-    default:
-        return sb_value_empty;          // these are not eligible for watching
-    }
-
-    SBValue sb_pointer = FindValue(name, value_type);
-    // If the sb_pointer is not valid, there's no point in even trying to watch it.
-    if (!sb_pointer.IsValid() || !sb_pointer.GetType().IsPointerType())
-        return sb_value_empty;
-
-    addr_t addr = sb_pointer.GetValueAsUnsigned(0);
-    if (!addr)
-        return sb_value_empty;
-
-    SBValue sb_value = sb_pointer.CreateValueFromAddress("pointee", addr, sb_pointer.GetType().GetPointeeType());
-    WatchpointLocationSP wp_loc_sp = m_opaque_sp->GetThread().GetProcess().GetTarget().
-        CreateWatchpointLocation(addr, size, watch_type);
-
-    if (wp_loc_sp) {
-        // StackFrame::GetInScopeVariableList(true) to get file globals as well.
-        VariableListSP var_list_sp(m_opaque_sp->GetInScopeVariableList(true));
-        VariableSP var_sp = var_list_sp->FindVariable(ConstString(name));
-        if (var_sp && var_sp->GetDeclaration().GetFile()) {
-            StreamString ss;
-            // True to show fullpath for declaration file.
-            var_sp->GetDeclaration().DumpStopContext(&ss, true);
-            wp_loc_sp->SetDeclInfo(ss.GetString());
-        }
-    }
-
-    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-    if (log)
-        log->Printf ("SBFrame(%p)::WatchLocation (name=\"%s\", value_type=%i, watch_type=%i, size=%lu) => SBValue(%p) & wp_loc(%p)", 
-                     m_opaque_sp.get(), name, value_type, watch_type, size, sb_value.get(), wp_loc_sp.get());
-
-    return wp_loc_sp ? sb_value : sb_value_empty;
-}
-
 SBValue
 SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic)
 {

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Thu Oct 13 19:42:25 2011
@@ -887,8 +887,8 @@
 {
     if (m_opaque_sp)
     {
-        // The watchpoint location list is thread safe, no need to lock
-        return m_opaque_sp->GetWatchpointLocationList().GetSize();
+        // The watchpoint list is thread safe, no need to lock
+        return m_opaque_sp->GetWatchpointList().GetSize();
     }
     return 0;
 }
@@ -896,13 +896,13 @@
 SBWatchpoint
 SBTarget::GetWatchpointAtIndex (uint32_t idx) const
 {
-    SBWatchpoint sb_watchpoint_location;
+    SBWatchpoint sb_watchpoint;
     if (m_opaque_sp)
     {
-        // The watchpoint location list is thread safe, no need to lock
-        *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().GetByIndex(idx);
+        // The watchpoint list is thread safe, no need to lock
+        *sb_watchpoint = m_opaque_sp->GetWatchpointList().GetByIndex(idx);
     }
-    return sb_watchpoint_location;
+    return sb_watchpoint;
 }
 
 bool
@@ -914,12 +914,12 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        result = m_opaque_sp->RemoveWatchpointLocationByID (wp_id);
+        result = m_opaque_sp->RemoveWatchpointByID (wp_id);
     }
 
     if (log)
     {
-        log->Printf ("SBTarget(%p)::WatchpointLocationDelete (wp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) wp_id, result);
+        log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) wp_id, result);
     }
 
     return result;
@@ -934,12 +934,12 @@
     if (m_opaque_sp && wp_id != LLDB_INVALID_WATCH_ID)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        *sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id);
+        *sb_watchpoint = m_opaque_sp->GetWatchpointList().FindByID(wp_id);
     }
 
     if (log)
     {
-        log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpoint(%p)", 
+        log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)", 
                      m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint.get());
     }
 
@@ -955,8 +955,9 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        // TODO: Johnny fill this in
-        //*sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id);
+        uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) |
+            (write ? LLDB_WATCH_TYPE_WRITE : 0);
+        WatchpointSP wp_sp = m_opaque_sp->CreateWatchpoint(addr, size, watch_type);
     }
     
     if (log)
@@ -974,7 +975,7 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        m_opaque_sp->EnableAllWatchpointLocations ();
+        m_opaque_sp->EnableAllWatchpoints ();
         return true;
     }
     return false;
@@ -986,7 +987,7 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        m_opaque_sp->DisableAllWatchpointLocations ();
+        m_opaque_sp->DisableAllWatchpoints ();
         return true;
     }
     return false;
@@ -998,7 +999,7 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex());
-        m_opaque_sp->RemoveAllWatchpointLocations ();
+        m_opaque_sp->RemoveAllWatchpoints ();
         return true;
     }
     return false;

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Thu Oct 13 19:42:25 2011
@@ -10,6 +10,7 @@
 #include "lldb/API/SBValue.h"
 #include "lldb/API/SBStream.h"
 
+#include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
@@ -22,6 +23,7 @@
 #include "lldb/Symbol/Block.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Variable.h"
+#include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
@@ -1102,12 +1104,19 @@
 SBValue::Watch (bool resolve_location, bool read, bool write)
 {
     lldb::SBWatchpoint sb_watchpoint;
+    if (!m_opaque_sp)
+        return sb_watchpoint;
+
     Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
     if (target)
     {
         Mutex::Locker api_locker (target->GetAPIMutex());
-        // TODO: Johnny fill this in
+        sb_watchpoint = WatchValue(read, write, false);
     }
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+    if (log)
+        log->Printf ("SBValue(%p)::Watch (resolve_location=%i, read=%i, write=%i) => wp(%p)", 
+                     m_opaque_sp.get(), resolve_location, read, write, sb_watchpoint.get());
     return sb_watchpoint;
 }
 
@@ -1115,13 +1124,70 @@
 SBValue::WatchPointee (bool resolve_location, bool read, bool write)
 {
     lldb::SBWatchpoint sb_watchpoint;
+    if (!m_opaque_sp)
+        return sb_watchpoint;
+
     Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
     if (target)
     {
         Mutex::Locker api_locker (target->GetAPIMutex());
-        // TODO: Johnny fill this in
+        sb_watchpoint = WatchValue(read, write, true);
     }
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+    if (log)
+        log->Printf ("SBValue(%p)::WatchPointee (resolve_location=%i, read=%i, write=%i) => wp(%p)", 
+                     m_opaque_sp.get(), resolve_location, read, write, sb_watchpoint.get());
     return sb_watchpoint;
 }
 
+// Helper function for SBValue::Watch() and SBValue::WatchPointee().
+SBWatchpoint
+SBValue::WatchValue(bool read, bool write, bool watch_pointee)
+{
+    SBWatchpoint sb_wp_empty;
+
+    // If the SBValue is not valid, there's no point in even trying to watch it.
+    if (!IsValid() || !GetFrame().IsValid())
+        return sb_wp_empty;
+
+    // Read and Write cannot both be false.
+    if (!read && !write)
+        return sb_wp_empty;
+
+    // If we are watching the pointee, check that the SBValue is a pointer type.
+    if (watch_pointee && !GetType().IsPointerType())
+        return sb_wp_empty;
+
+    addr_t addr;
+    size_t size;
+    if (watch_pointee) {
+        addr = GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+        size = GetType().GetPointeeType().GetByteSize();
+    } else {
+        addr = GetLoadAddress();
+        size = GetByteSize();
+    }
+
+    // Sanity check the address and the size before calling Target::CreateWatchpoint().
+    if (addr == LLDB_INVALID_ADDRESS || size == 0)
+        return sb_wp_empty;
+
+    uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) |
+        (write ? LLDB_WATCH_TYPE_WRITE : 0);
+    WatchpointSP wp_sp = GetFrame().m_opaque_sp->GetThread().GetProcess().GetTarget().
+        CreateWatchpoint(addr, size, watch_type);
+
+    if (wp_sp) {
+        // StackFrame::GetInScopeVariableList(true) to get file globals as well.
+        VariableListSP var_list_sp(GetFrame().m_opaque_sp->GetInScopeVariableList(true));
+        VariableSP var_sp = var_list_sp->FindVariable(ConstString(GetName()));
+        if (var_sp && var_sp->GetDeclaration().GetFile()) {
+            StreamString ss;
+            // True to show fullpath for declaration file.
+            var_sp->GetDeclaration().DumpStopContext(&ss, true);
+            wp_sp->SetDeclInfo(ss.GetString());
+        }
+    }
+    return wp_sp;
+}
 

Modified: lldb/trunk/source/API/SBWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/API/SBWatchpoint.cpp (original)
+++ lldb/trunk/source/API/SBWatchpoint.cpp Thu Oct 13 19:42:25 2011
@@ -15,8 +15,8 @@
 
 #include "lldb/lldb-types.h"
 #include "lldb/lldb-defines.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
-#include "lldb/Breakpoint/WatchpointLocationList.h"
+#include "lldb/Breakpoint/Watchpoint.h"
+#include "lldb/Breakpoint/WatchpointList.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
@@ -31,8 +31,8 @@
 {
 }
 
-SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp) :
-    m_opaque_sp (watch_loc_sp)
+SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp) :
+    m_opaque_sp (wp_sp)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
@@ -40,8 +40,8 @@
     {
         SBStream sstr;
         GetDescription (sstr, lldb::eDescriptionLevelBrief);
-        log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationsSP &watch_loc_sp"
-                     "=%p)  => this.sp = %p (%s)", watch_loc_sp.get(), m_opaque_sp.get(), sstr.GetData());
+        log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp"
+                     "=%p)  => this.sp = %p (%s)", wp_sp.get(), m_opaque_sp.get(), sstr.GetData());
     }
 }
 
@@ -156,7 +156,7 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
-        m_opaque_sp->GetTarget().DisableWatchpointLocationByID(m_opaque_sp->GetID());
+        m_opaque_sp->GetTarget().DisableWatchpointByID(m_opaque_sp->GetID());
     }
 }
 
@@ -227,19 +227,19 @@
     return true;
 }
 
-lldb_private::WatchpointLocation *
+lldb_private::Watchpoint *
 SBWatchpoint::operator->()
 {
     return m_opaque_sp.get();
 }
 
-lldb_private::WatchpointLocation *
+lldb_private::Watchpoint *
 SBWatchpoint::get()
 {
     return m_opaque_sp.get();
 }
 
-lldb::WatchpointLocationSP &
+lldb::WatchpointSP &
 SBWatchpoint::operator *()
 {
     return m_opaque_sp;

Copied: lldb/trunk/source/Breakpoint/Watchpoint.cpp (from r141877, lldb/trunk/source/Breakpoint/WatchpointLocation.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?p2=lldb/trunk/source/Breakpoint/Watchpoint.cpp&p1=lldb/trunk/source/Breakpoint/WatchpointLocation.cpp&r1=141877&r2=141925&rev=141925&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Thu Oct 13 19:42:25 2011
@@ -1,4 +1,4 @@
-//===-- WatchpointLocation.cpp ----------------------------------*- C++ -*-===//
+//===-- Watchpoint.cpp ------------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 
 // C Includes
 // C++ Includes
@@ -18,7 +18,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-WatchpointLocation::WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware) :
+Watchpoint::Watchpoint (lldb::addr_t addr, size_t size, bool hardware) :
     StoppointLocation (GetNextID(), addr, size, hardware),
     m_target(NULL),
     m_enabled(0),
@@ -33,19 +33,19 @@
 {
 }
 
-WatchpointLocation::~WatchpointLocation()
+Watchpoint::~Watchpoint()
 {
 }
 
 break_id_t
-WatchpointLocation::GetNextID()
+Watchpoint::GetNextID()
 {
     static break_id_t g_next_ID = 0;
     return ++g_next_ID;
 }
 
 bool
-WatchpointLocation::SetCallback (WatchpointHitCallback callback, void *callback_baton)
+Watchpoint::SetCallback (WatchpointHitCallback callback, void *callback_baton)
 {
     m_callback = callback;
     m_callback_baton = callback_baton;
@@ -53,7 +53,7 @@
 }
 
 void
-WatchpointLocation::SetDeclInfo (std::string &str)
+Watchpoint::SetDeclInfo (std::string &str)
 {
     m_decl_str = str;
     return;
@@ -61,7 +61,7 @@
 
 
 bool
-WatchpointLocation::IsHardware () const
+Watchpoint::IsHardware () const
 {
     return m_is_hardware;
 }
@@ -70,7 +70,7 @@
 // should continue.
 
 bool
-WatchpointLocation::ShouldStop (StoppointCallbackContext *context)
+Watchpoint::ShouldStop (StoppointCallbackContext *context)
 {
     ++m_hit_count;
 
@@ -93,20 +93,20 @@
 }
 
 void
-WatchpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
+Watchpoint::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
     DumpWithLevel(s, level);
     return;
 }
 
 void
-WatchpointLocation::Dump(Stream *s) const
+Watchpoint::Dump(Stream *s) const
 {
     DumpWithLevel(s, lldb::eDescriptionLevelBrief);
 }
 
 void
-WatchpointLocation::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const
+Watchpoint::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const
 {
     if (s == NULL)
         return;
@@ -114,7 +114,7 @@
     assert(description_level >= lldb::eDescriptionLevelBrief &&
            description_level <= lldb::eDescriptionLevelVerbose);
 
-    s->Printf("WatchpointLocation %u: addr = 0x%8.8llx size = %zu state = %s type = %s%s",
+    s->Printf("Watchpoint %u: addr = 0x%8.8llx size = %zu state = %s type = %s%s",
               GetID(),
               (uint64_t)m_addr,
               m_byte_size,
@@ -141,13 +141,13 @@
 }
 
 bool
-WatchpointLocation::IsEnabled() const
+Watchpoint::IsEnabled() const
 {
     return m_enabled;
 }
 
 void
-WatchpointLocation::SetEnabled(bool enabled)
+Watchpoint::SetEnabled(bool enabled)
 {
     if (!enabled)
         SetHardwareIndex(LLDB_INVALID_INDEX32);
@@ -155,30 +155,30 @@
 }
 
 void
-WatchpointLocation::SetWatchpointType (uint32_t type)
+Watchpoint::SetWatchpointType (uint32_t type)
 {
     m_watch_read = (type & LLDB_WATCH_TYPE_READ) != 0;
     m_watch_write = (type & LLDB_WATCH_TYPE_WRITE) != 0;
 }
 
 bool
-WatchpointLocation::WatchpointRead () const
+Watchpoint::WatchpointRead () const
 {
     return m_watch_read != 0;
 }
 bool
-WatchpointLocation::WatchpointWrite () const
+Watchpoint::WatchpointWrite () const
 {
     return m_watch_write != 0;
 }
 uint32_t
-WatchpointLocation::GetIgnoreCount () const
+Watchpoint::GetIgnoreCount () const
 {
     return m_ignore_count;
 }
 
 void
-WatchpointLocation::SetIgnoreCount (uint32_t n)
+Watchpoint::SetIgnoreCount (uint32_t n)
 {
     m_ignore_count = n;
 }

Copied: lldb/trunk/source/Breakpoint/WatchpointList.cpp (from r141877, lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointList.cpp?p2=lldb/trunk/source/Breakpoint/WatchpointList.cpp&p1=lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp&r1=141877&r2=141925&rev=141925&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointList.cpp Thu Oct 13 19:42:25 2011
@@ -1,4 +1,4 @@
-//===-- WatchpointLocationList.cpp ------------------------------*- C++ -*-===//
+//===-- WatchpointList.cpp --------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,19 +12,19 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Breakpoint/WatchpointLocationList.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/WatchpointList.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-WatchpointLocationList::WatchpointLocationList() :
-    m_address_to_location (),
+WatchpointList::WatchpointList() :
+    m_address_to_watchpoint (),
     m_mutex (Mutex::eMutexTypeRecursive)
 {
 }
 
-WatchpointLocationList::~WatchpointLocationList()
+WatchpointList::~WatchpointList()
 {
 }
 
@@ -32,65 +32,65 @@
 // list, then replace it with the input one.
 
 lldb::watch_id_t
-WatchpointLocationList::Add (const WatchpointLocationSP &wp_loc_sp)
+WatchpointList::Add (const WatchpointSP &wp_sp)
 {
     Mutex::Locker locker (m_mutex);
-    lldb::addr_t wp_addr = wp_loc_sp->GetLoadAddress();
-    addr_map::iterator iter = m_address_to_location.find(wp_addr);
+    lldb::addr_t wp_addr = wp_sp->GetLoadAddress();
+    addr_map::iterator iter = m_address_to_watchpoint.find(wp_addr);
 
-    if (iter == m_address_to_location.end())
-        m_address_to_location.insert(iter, addr_map::value_type(wp_addr, wp_loc_sp));
+    if (iter == m_address_to_watchpoint.end())
+        m_address_to_watchpoint.insert(iter, addr_map::value_type(wp_addr, wp_sp));
     else
-        m_address_to_location[wp_addr] = wp_loc_sp;
+        m_address_to_watchpoint[wp_addr] = wp_sp;
 
-    return wp_loc_sp->GetID();
+    return wp_sp->GetID();
 }
 
 void
-WatchpointLocationList::Dump (Stream *s) const
+WatchpointList::Dump (Stream *s) const
 {
     DumpWithLevel(s, lldb::eDescriptionLevelBrief);
 }
 
 void
-WatchpointLocationList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
+WatchpointList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
 {
     Mutex::Locker locker (m_mutex);
     s->Printf("%p: ", this);
     //s->Indent();
-    s->Printf("WatchpointLocationList with %zu WatchpointLocations:\n",
-              m_address_to_location.size());
+    s->Printf("WatchpointList with %zu Watchpoints:\n",
+              m_address_to_watchpoint.size());
     s->IndentMore();
-    addr_map::const_iterator pos, end = m_address_to_location.end();
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
+    addr_map::const_iterator pos, end = m_address_to_watchpoint.end();
+    for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos)
         pos->second->DumpWithLevel(s, description_level);
     s->IndentLess();
 }
 
-const WatchpointLocationSP
-WatchpointLocationList::FindByAddress (lldb::addr_t addr) const
+const WatchpointSP
+WatchpointList::FindByAddress (lldb::addr_t addr) const
 {
-    WatchpointLocationSP wp_loc_sp;
+    WatchpointSP wp_sp;
     Mutex::Locker locker (m_mutex);
-    if (!m_address_to_location.empty())
+    if (!m_address_to_watchpoint.empty())
     {
-        addr_map::const_iterator pos = m_address_to_location.find (addr);
-        if (pos != m_address_to_location.end())
-            wp_loc_sp = pos->second;
+        addr_map::const_iterator pos = m_address_to_watchpoint.find (addr);
+        if (pos != m_address_to_watchpoint.end())
+            wp_sp = pos->second;
     }
 
-    return wp_loc_sp;
+    return wp_sp;
 }
 
-class WatchpointLocationIDMatches
+class WatchpointIDMatches
 {
 public:
-    WatchpointLocationIDMatches (lldb::watch_id_t watch_id) :
+    WatchpointIDMatches (lldb::watch_id_t watch_id) :
         m_watch_id(watch_id)
     {
     }
 
-    bool operator() (std::pair <lldb::addr_t, WatchpointLocationSP> val_pair) const
+    bool operator() (std::pair <lldb::addr_t, WatchpointSP> val_pair) const
     {
         return m_watch_id == val_pair.second.get()->GetID();
     }
@@ -99,119 +99,119 @@
    const lldb::watch_id_t m_watch_id;
 };
 
-WatchpointLocationList::addr_map::iterator
-WatchpointLocationList::GetIDIterator (lldb::watch_id_t watch_id)
+WatchpointList::addr_map::iterator
+WatchpointList::GetIDIterator (lldb::watch_id_t watch_id)
 {
-    return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range
-                        WatchpointLocationIDMatches(watch_id));                     // Predicate
+    return std::find_if(m_address_to_watchpoint.begin(), m_address_to_watchpoint.end(), // Search full range
+                        WatchpointIDMatches(watch_id));                                 // Predicate
 }
 
-WatchpointLocationList::addr_map::const_iterator
-WatchpointLocationList::GetIDConstIterator (lldb::watch_id_t watch_id) const
+WatchpointList::addr_map::const_iterator
+WatchpointList::GetIDConstIterator (lldb::watch_id_t watch_id) const
 {
-    return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range
-                        WatchpointLocationIDMatches(watch_id));                     // Predicate
+    return std::find_if(m_address_to_watchpoint.begin(), m_address_to_watchpoint.end(), // Search full range
+                        WatchpointIDMatches(watch_id));                                 // Predicate
 }
 
-WatchpointLocationSP
-WatchpointLocationList::FindByID (lldb::watch_id_t watch_id) const
+WatchpointSP
+WatchpointList::FindByID (lldb::watch_id_t watch_id) const
 {
-    WatchpointLocationSP wp_loc_sp;
+    WatchpointSP wp_sp;
     Mutex::Locker locker (m_mutex);
     addr_map::const_iterator pos = GetIDConstIterator(watch_id);
-    if (pos != m_address_to_location.end())
-        wp_loc_sp = pos->second;
+    if (pos != m_address_to_watchpoint.end())
+        wp_sp = pos->second;
 
-    return wp_loc_sp;
+    return wp_sp;
 }
 
 lldb::watch_id_t
-WatchpointLocationList::FindIDByAddress (lldb::addr_t addr)
+WatchpointList::FindIDByAddress (lldb::addr_t addr)
 {
-    WatchpointLocationSP wp_loc_sp = FindByAddress (addr);
-    if (wp_loc_sp)
+    WatchpointSP wp_sp = FindByAddress (addr);
+    if (wp_sp)
     {
-        return wp_loc_sp->GetID();
+        return wp_sp->GetID();
     }
     return LLDB_INVALID_WATCH_ID;
 }
 
-WatchpointLocationSP
-WatchpointLocationList::GetByIndex (uint32_t i)
+WatchpointSP
+WatchpointList::GetByIndex (uint32_t i)
 {
     Mutex::Locker locker (m_mutex);
-    WatchpointLocationSP wp_loc_sp;
-    if (i < m_address_to_location.size())
+    WatchpointSP wp_sp;
+    if (i < m_address_to_watchpoint.size())
     {
-        addr_map::const_iterator pos = m_address_to_location.begin();
+        addr_map::const_iterator pos = m_address_to_watchpoint.begin();
         std::advance(pos, i);
-        wp_loc_sp = pos->second;
+        wp_sp = pos->second;
     }
-    return wp_loc_sp;
+    return wp_sp;
 }
 
-const WatchpointLocationSP
-WatchpointLocationList::GetByIndex (uint32_t i) const
+const WatchpointSP
+WatchpointList::GetByIndex (uint32_t i) const
 {
     Mutex::Locker locker (m_mutex);
-    WatchpointLocationSP wp_loc_sp;
-    if (i < m_address_to_location.size())
+    WatchpointSP wp_sp;
+    if (i < m_address_to_watchpoint.size())
     {
-        addr_map::const_iterator pos = m_address_to_location.begin();
+        addr_map::const_iterator pos = m_address_to_watchpoint.begin();
         std::advance(pos, i);
-        wp_loc_sp = pos->second;
+        wp_sp = pos->second;
     }
-    return wp_loc_sp;
+    return wp_sp;
 }
 
 bool
-WatchpointLocationList::Remove (lldb::watch_id_t watch_id)
+WatchpointList::Remove (lldb::watch_id_t watch_id)
 {
     Mutex::Locker locker (m_mutex);
     addr_map::iterator pos = GetIDIterator(watch_id);
-    if (pos != m_address_to_location.end())
+    if (pos != m_address_to_watchpoint.end())
     {
-        m_address_to_location.erase(pos);
+        m_address_to_watchpoint.erase(pos);
         return true;
     }
     return false;
 }
 
 uint32_t
-WatchpointLocationList::GetHitCount () const
+WatchpointList::GetHitCount () const
 {
     uint32_t hit_count = 0;
     Mutex::Locker locker (m_mutex);
-    addr_map::const_iterator pos, end = m_address_to_location.end();
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
+    addr_map::const_iterator pos, end = m_address_to_watchpoint.end();
+    for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos)
         hit_count += pos->second->GetHitCount();
     return hit_count;
 }
 
 bool
-WatchpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watch_id)
+WatchpointList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watch_id)
 {
 
-    WatchpointLocationSP wp_loc_sp = FindByID (watch_id);
-    if (wp_loc_sp)
+    WatchpointSP wp_sp = FindByID (watch_id);
+    if (wp_sp)
     {
-        // Let the WatchpointLocation decide if it should stop here (could not have
+        // Let the Watchpoint decide if it should stop here (could not have
         // reached it's target hit count yet, or it could have a callback
         // that decided it shouldn't stop.
-        return wp_loc_sp->ShouldStop (context);
+        return wp_sp->ShouldStop (context);
     }
-    // We should stop here since this WatchpointLocation isn't valid anymore or it
+    // We should stop here since this Watchpoint isn't valid anymore or it
     // doesn't exist.
     return true;
 }
 
 void
-WatchpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level)
+WatchpointList::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
     Mutex::Locker locker (m_mutex);
-    addr_map::iterator pos, end = m_address_to_location.end();
+    addr_map::iterator pos, end = m_address_to_watchpoint.end();
 
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
+    for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos)
     {
         s->Printf(" ");
         pos->second->Dump(s);
@@ -219,24 +219,24 @@
 }
 
 void
-WatchpointLocationList::SetEnabledAll (bool enabled)
+WatchpointList::SetEnabledAll (bool enabled)
 {
     Mutex::Locker locker(m_mutex);
 
-    addr_map::iterator pos, end = m_address_to_location.end();
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
+    addr_map::iterator pos, end = m_address_to_watchpoint.end();
+    for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos)
         pos->second->SetEnabled (enabled);
 }
 
 void
-WatchpointLocationList::RemoveAll ()
+WatchpointList::RemoveAll ()
 {
     Mutex::Locker locker(m_mutex);
-    m_address_to_location.clear();
+    m_address_to_watchpoint.clear();
 }
 
 void
-WatchpointLocationList::GetListMutex (Mutex::Locker &locker)
+WatchpointList::GetListMutex (Mutex::Locker &locker)
 {
     return locker.Reset (m_mutex.GetMutex());
 }

Removed: lldb/trunk/source/Breakpoint/WatchpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocation.cpp?rev=141924&view=auto
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (removed)
@@ -1,184 +0,0 @@
-//===-- WatchpointLocation.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/Breakpoint/WatchpointLocation.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Stream.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-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),
-    m_watch_write(0),
-    m_watch_was_read(0),
-    m_watch_was_written(0),
-    m_ignore_count(0),
-    m_callback(NULL),
-    m_callback_baton(NULL)
-{
-}
-
-WatchpointLocation::~WatchpointLocation()
-{
-}
-
-break_id_t
-WatchpointLocation::GetNextID()
-{
-    static break_id_t g_next_ID = 0;
-    return ++g_next_ID;
-}
-
-bool
-WatchpointLocation::SetCallback (WatchpointHitCallback callback, void *callback_baton)
-{
-    m_callback = callback;
-    m_callback_baton = callback_baton;
-    return true;
-}
-
-void
-WatchpointLocation::SetDeclInfo (std::string &str)
-{
-    m_decl_str = str;
-    return;
-}
-
-
-bool
-WatchpointLocation::IsHardware () const
-{
-    return m_is_hardware;
-}
-
-// RETURNS - true if we should stop at this breakpoint, false if we
-// should continue.
-
-bool
-WatchpointLocation::ShouldStop (StoppointCallbackContext *context)
-{
-    ++m_hit_count;
-
-    if (!IsEnabled())
-        return false;
-
-    if (m_hit_count <= GetIgnoreCount())
-        return false;
-
-    uint32_t access = 0;
-    if (m_watch_was_read)
-        access |= LLDB_WATCH_TYPE_READ;
-    if (m_watch_was_written)
-        access |= LLDB_WATCH_TYPE_WRITE;
-
-    if (m_callback)
-        return m_callback(m_callback_baton, context, GetID(), access);
-    else
-        return true;
-}
-
-void
-WatchpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
-    DumpWithLevel(s, level);
-    return;
-}
-
-void
-WatchpointLocation::Dump(Stream *s) const
-{
-    DumpWithLevel(s, lldb::eDescriptionLevelBrief);
-}
-
-void
-WatchpointLocation::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const
-{
-    if (s == NULL)
-        return;
-
-    assert(description_level >= lldb::eDescriptionLevelBrief &&
-           description_level <= lldb::eDescriptionLevelVerbose);
-
-    s->Printf("WatchpointLocation %u: addr = 0x%8.8llx size = %zu state = %s type = %s%s",
-              GetID(),
-              (uint64_t)m_addr,
-              m_byte_size,
-              m_enabled ? "enabled" : "disabled",
-              m_watch_read ? "r" : "",
-              m_watch_write ? "w" : "");
-
-    if (description_level >= lldb::eDescriptionLevelFull)
-        s->Printf("\n    declare @ '%s'", m_decl_str.c_str());
-
-    if (description_level >= lldb::eDescriptionLevelVerbose)
-        if (m_callback)
-            s->Printf("\n    hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %8p baton = %8p",
-                      GetHardwareIndex(),
-                      GetHitCount(),
-                      GetIgnoreCount(),
-                      m_callback,
-                      m_callback_baton);
-        else
-            s->Printf("\n    hw_index = %i  hit_count = %-4u  ignore_count = %-4u",
-                      GetHardwareIndex(),
-                      GetHitCount(),
-                      GetIgnoreCount());
-}
-
-bool
-WatchpointLocation::IsEnabled() const
-{
-    return m_enabled;
-}
-
-void
-WatchpointLocation::SetEnabled(bool enabled)
-{
-    if (!enabled)
-        SetHardwareIndex(LLDB_INVALID_INDEX32);
-    m_enabled = enabled;
-}
-
-void
-WatchpointLocation::SetWatchpointType (uint32_t type)
-{
-    m_watch_read = (type & LLDB_WATCH_TYPE_READ) != 0;
-    m_watch_write = (type & LLDB_WATCH_TYPE_WRITE) != 0;
-}
-
-bool
-WatchpointLocation::WatchpointRead () const
-{
-    return m_watch_read != 0;
-}
-bool
-WatchpointLocation::WatchpointWrite () const
-{
-    return m_watch_write != 0;
-}
-uint32_t
-WatchpointLocation::GetIgnoreCount () const
-{
-    return m_ignore_count;
-}
-
-void
-WatchpointLocation::SetIgnoreCount (uint32_t n)
-{
-    m_ignore_count = n;
-}

Removed: lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp?rev=141924&view=auto
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp (removed)
@@ -1,242 +0,0 @@
-//===-- WatchpointLocationList.cpp ------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Breakpoint/WatchpointLocationList.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-WatchpointLocationList::WatchpointLocationList() :
-    m_address_to_location (),
-    m_mutex (Mutex::eMutexTypeRecursive)
-{
-}
-
-WatchpointLocationList::~WatchpointLocationList()
-{
-}
-
-// Add watchpoint loc to the list.  However, if the element already exists in the
-// list, then replace it with the input one.
-
-lldb::watch_id_t
-WatchpointLocationList::Add (const WatchpointLocationSP &wp_loc_sp)
-{
-    Mutex::Locker locker (m_mutex);
-    lldb::addr_t wp_addr = wp_loc_sp->GetLoadAddress();
-    addr_map::iterator iter = m_address_to_location.find(wp_addr);
-
-    if (iter == m_address_to_location.end())
-        m_address_to_location.insert(iter, addr_map::value_type(wp_addr, wp_loc_sp));
-    else
-        m_address_to_location[wp_addr] = wp_loc_sp;
-
-    return wp_loc_sp->GetID();
-}
-
-void
-WatchpointLocationList::Dump (Stream *s) const
-{
-    DumpWithLevel(s, lldb::eDescriptionLevelBrief);
-}
-
-void
-WatchpointLocationList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
-{
-    Mutex::Locker locker (m_mutex);
-    s->Printf("%p: ", this);
-    //s->Indent();
-    s->Printf("WatchpointLocationList with %zu WatchpointLocations:\n",
-              m_address_to_location.size());
-    s->IndentMore();
-    addr_map::const_iterator pos, end = m_address_to_location.end();
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
-        pos->second->DumpWithLevel(s, description_level);
-    s->IndentLess();
-}
-
-const WatchpointLocationSP
-WatchpointLocationList::FindByAddress (lldb::addr_t addr) const
-{
-    WatchpointLocationSP wp_loc_sp;
-    Mutex::Locker locker (m_mutex);
-    if (!m_address_to_location.empty())
-    {
-        addr_map::const_iterator pos = m_address_to_location.find (addr);
-        if (pos != m_address_to_location.end())
-            wp_loc_sp = pos->second;
-    }
-
-    return wp_loc_sp;
-}
-
-class WatchpointLocationIDMatches
-{
-public:
-    WatchpointLocationIDMatches (lldb::watch_id_t watch_id) :
-        m_watch_id(watch_id)
-    {
-    }
-
-    bool operator() (std::pair <lldb::addr_t, WatchpointLocationSP> val_pair) const
-    {
-        return m_watch_id == val_pair.second.get()->GetID();
-    }
-
-private:
-   const lldb::watch_id_t m_watch_id;
-};
-
-WatchpointLocationList::addr_map::iterator
-WatchpointLocationList::GetIDIterator (lldb::watch_id_t watch_id)
-{
-    return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range
-                        WatchpointLocationIDMatches(watch_id));                     // Predicate
-}
-
-WatchpointLocationList::addr_map::const_iterator
-WatchpointLocationList::GetIDConstIterator (lldb::watch_id_t watch_id) const
-{
-    return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range
-                        WatchpointLocationIDMatches(watch_id));                     // Predicate
-}
-
-WatchpointLocationSP
-WatchpointLocationList::FindByID (lldb::watch_id_t watch_id) const
-{
-    WatchpointLocationSP wp_loc_sp;
-    Mutex::Locker locker (m_mutex);
-    addr_map::const_iterator pos = GetIDConstIterator(watch_id);
-    if (pos != m_address_to_location.end())
-        wp_loc_sp = pos->second;
-
-    return wp_loc_sp;
-}
-
-lldb::watch_id_t
-WatchpointLocationList::FindIDByAddress (lldb::addr_t addr)
-{
-    WatchpointLocationSP wp_loc_sp = FindByAddress (addr);
-    if (wp_loc_sp)
-    {
-        return wp_loc_sp->GetID();
-    }
-    return LLDB_INVALID_WATCH_ID;
-}
-
-WatchpointLocationSP
-WatchpointLocationList::GetByIndex (uint32_t i)
-{
-    Mutex::Locker locker (m_mutex);
-    WatchpointLocationSP wp_loc_sp;
-    if (i < m_address_to_location.size())
-    {
-        addr_map::const_iterator pos = m_address_to_location.begin();
-        std::advance(pos, i);
-        wp_loc_sp = pos->second;
-    }
-    return wp_loc_sp;
-}
-
-const WatchpointLocationSP
-WatchpointLocationList::GetByIndex (uint32_t i) const
-{
-    Mutex::Locker locker (m_mutex);
-    WatchpointLocationSP wp_loc_sp;
-    if (i < m_address_to_location.size())
-    {
-        addr_map::const_iterator pos = m_address_to_location.begin();
-        std::advance(pos, i);
-        wp_loc_sp = pos->second;
-    }
-    return wp_loc_sp;
-}
-
-bool
-WatchpointLocationList::Remove (lldb::watch_id_t watch_id)
-{
-    Mutex::Locker locker (m_mutex);
-    addr_map::iterator pos = GetIDIterator(watch_id);
-    if (pos != m_address_to_location.end())
-    {
-        m_address_to_location.erase(pos);
-        return true;
-    }
-    return false;
-}
-
-uint32_t
-WatchpointLocationList::GetHitCount () const
-{
-    uint32_t hit_count = 0;
-    Mutex::Locker locker (m_mutex);
-    addr_map::const_iterator pos, end = m_address_to_location.end();
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
-        hit_count += pos->second->GetHitCount();
-    return hit_count;
-}
-
-bool
-WatchpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watch_id)
-{
-
-    WatchpointLocationSP wp_loc_sp = FindByID (watch_id);
-    if (wp_loc_sp)
-    {
-        // Let the WatchpointLocation decide if it should stop here (could not have
-        // reached it's target hit count yet, or it could have a callback
-        // that decided it shouldn't stop.
-        return wp_loc_sp->ShouldStop (context);
-    }
-    // We should stop here since this WatchpointLocation isn't valid anymore or it
-    // doesn't exist.
-    return true;
-}
-
-void
-WatchpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
-    Mutex::Locker locker (m_mutex);
-    addr_map::iterator pos, end = m_address_to_location.end();
-
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
-    {
-        s->Printf(" ");
-        pos->second->Dump(s);
-    }
-}
-
-void
-WatchpointLocationList::SetEnabledAll (bool enabled)
-{
-    Mutex::Locker locker(m_mutex);
-
-    addr_map::iterator pos, end = m_address_to_location.end();
-    for (pos = m_address_to_location.begin(); pos != end; ++pos)
-        pos->second->SetEnabled (enabled);
-}
-
-void
-WatchpointLocationList::RemoveAll ()
-{
-    Mutex::Locker locker(m_mutex);
-    m_address_to_location.clear();
-}
-
-void
-WatchpointLocationList::GetListMutex (Mutex::Locker &locker)
-{
-    return locker.Reset (m_mutex.GetMutex());
-}

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Oct 13 19:42:25 2011
@@ -14,7 +14,7 @@
 #include <string>
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Core/DataVisualization.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
@@ -550,19 +550,19 @@
                                     size = m_option_watchpoint.watch_size;
                                 }
                                 uint32_t watch_type = m_option_watchpoint.watch_type;
-                                WatchpointLocation *wp_loc = exe_ctx.GetTargetRef().CreateWatchpointLocation(addr, size, watch_type).get();
-                                if (wp_loc)
+                                Watchpoint *wp = exe_ctx.GetTargetRef().CreateWatchpoint(addr, size, watch_type).get();
+                                if (wp)
                                 {
                                     if (var_sp && var_sp->GetDeclaration().GetFile())
                                     {
                                         StreamString ss;
                                         // True to show fullpath for declaration file.
                                         var_sp->GetDeclaration().DumpStopContext(&ss, true);
-                                        wp_loc->SetDeclInfo(ss.GetString());
+                                        wp->SetDeclInfo(ss.GetString());
                                     }
                                     StreamString ss;
                                     output_stream.Printf("Watchpoint created: ");
-                                    wp_loc->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
+                                    wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
                                     output_stream.EOL();
                                     result.SetStatus(eReturnStatusSuccessFinishResult);
                                 }
@@ -571,7 +571,7 @@
                                     result.AppendErrorWithFormat("Watchpoint creation failed.\n");
                                     result.SetStatus(eReturnStatusFailed);
                                 }
-                                return (wp_loc != NULL);
+                                return (wp != NULL);
                             }
                         }
                         else

Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Thu Oct 13 19:42:25 2011
@@ -13,8 +13,8 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Breakpoint/WatchpointLocation.h"
-#include "lldb/Breakpoint/WatchpointLocationList.h"
+#include "lldb/Breakpoint/Watchpoint.h"
+#include "lldb/Breakpoint/WatchpointList.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
@@ -27,10 +27,10 @@
 using namespace lldb_private;
 
 static void
-AddWatchpointDescription(Stream *s, WatchpointLocation *wp_loc, lldb::DescriptionLevel level)
+AddWatchpointDescription(Stream *s, Watchpoint *wp, lldb::DescriptionLevel level)
 {
     s->IndentMore();
-    wp_loc->GetDescription(s, level);
+    wp->GetDescription(s, level);
     s->IndentLess();
     s->EOL();
 }
@@ -280,9 +280,9 @@
         return true;
     }
 
-    const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList();
+    const WatchpointList &watchpoints = target->GetWatchpointList();
     Mutex::Locker locker;
-    target->GetWatchpointLocationList().GetListMutex(locker);
+    target->GetWatchpointList().GetListMutex(locker);
 
     size_t num_watchpoints = watchpoints.GetSize();
 
@@ -301,8 +301,8 @@
         result.AppendMessage ("Current watchpoints:");
         for (size_t i = 0; i < num_watchpoints; ++i)
         {
-            WatchpointLocation *wp_loc = watchpoints.GetByIndex(i).get();
-            AddWatchpointDescription(&output_stream, wp_loc, m_options.m_level);
+            Watchpoint *wp = watchpoints.GetByIndex(i).get();
+            AddWatchpointDescription(&output_stream, wp, m_options.m_level);
         }
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
     }
@@ -320,9 +320,9 @@
         const size_t size = wp_ids.size();
         for (size_t i = 0; i < size; ++i)
         {
-            WatchpointLocation *wp_loc = watchpoints.FindByID(wp_ids[i]).get();
-            if (wp_loc)
-                AddWatchpointDescription(&output_stream, wp_loc, m_options.m_level);
+            Watchpoint *wp = watchpoints.FindByID(wp_ids[i]).get();
+            if (wp)
+                AddWatchpointDescription(&output_stream, wp, m_options.m_level);
             result.SetStatus(eReturnStatusSuccessFinishNoResult);
         }
     }
@@ -359,9 +359,9 @@
         return false;
 
     Mutex::Locker locker;
-    target->GetWatchpointLocationList().GetListMutex(locker);
+    target->GetWatchpointList().GetListMutex(locker);
 
-    const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList();
+    const WatchpointList &watchpoints = target->GetWatchpointList();
 
     size_t num_watchpoints = watchpoints.GetSize();
 
@@ -375,7 +375,7 @@
     if (args.GetArgumentCount() == 0)
     {
         // No watchpoint selected; enable all currently set watchpoints.
-        target->EnableAllWatchpointLocations();
+        target->EnableAllWatchpoints();
         result.AppendMessageWithFormat("All watchpoints enabled. (%lu watchpoints)\n", num_watchpoints);
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
     }
@@ -393,7 +393,7 @@
         int count = 0;
         const size_t size = wp_ids.size();
         for (size_t i = 0; i < size; ++i)
-            if (target->EnableWatchpointLocationByID(wp_ids[i]))
+            if (target->EnableWatchpointByID(wp_ids[i]))
                 ++count;
         result.AppendMessageWithFormat("%d watchpoints enabled.\n", count);
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
@@ -431,9 +431,9 @@
         return false;
 
     Mutex::Locker locker;
-    target->GetWatchpointLocationList().GetListMutex(locker);
+    target->GetWatchpointList().GetListMutex(locker);
 
-    const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList();
+    const WatchpointList &watchpoints = target->GetWatchpointList();
     size_t num_watchpoints = watchpoints.GetSize();
 
     if (num_watchpoints == 0)
@@ -446,7 +446,7 @@
     if (args.GetArgumentCount() == 0)
     {
         // No watchpoint selected; disable all currently set watchpoints.
-        if (target->DisableAllWatchpointLocations())
+        if (target->DisableAllWatchpoints())
         {
             result.AppendMessageWithFormat("All watchpoints disabled. (%lu watchpoints)\n", num_watchpoints);
             result.SetStatus(eReturnStatusSuccessFinishNoResult);
@@ -471,7 +471,7 @@
         int count = 0;
         const size_t size = wp_ids.size();
         for (size_t i = 0; i < size; ++i)
-            if (target->DisableWatchpointLocationByID(wp_ids[i]))
+            if (target->DisableWatchpointByID(wp_ids[i]))
                 ++count;
         result.AppendMessageWithFormat("%d watchpoints disabled.\n", count);
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
@@ -509,9 +509,9 @@
         return false;
 
     Mutex::Locker locker;
-    target->GetWatchpointLocationList().GetListMutex(locker);
+    target->GetWatchpointList().GetListMutex(locker);
     
-    const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList();
+    const WatchpointList &watchpoints = target->GetWatchpointList();
 
     size_t num_watchpoints = watchpoints.GetSize();
 
@@ -530,7 +530,7 @@
         }
         else
         {
-            target->RemoveAllWatchpointLocations();
+            target->RemoveAllWatchpoints();
             result.AppendMessageWithFormat("All watchpoints removed. (%lu watchpoints)\n", num_watchpoints);
         }
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
@@ -549,7 +549,7 @@
         int count = 0;
         const size_t size = wp_ids.size();
         for (size_t i = 0; i < size; ++i)
-            if (target->RemoveWatchpointLocationByID(wp_ids[i]))
+            if (target->RemoveWatchpointByID(wp_ids[i]))
                 ++count;
         result.AppendMessageWithFormat("%d watchpoints deleted.\n",count);
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
@@ -651,9 +651,9 @@
         return false;
 
     Mutex::Locker locker;
-    target->GetWatchpointLocationList().GetListMutex(locker);
+    target->GetWatchpointList().GetListMutex(locker);
     
-    const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList();
+    const WatchpointList &watchpoints = target->GetWatchpointList();
 
     size_t num_watchpoints = watchpoints.GetSize();
 
@@ -666,7 +666,7 @@
 
     if (args.GetArgumentCount() == 0)
     {
-        target->IgnoreAllWatchpointLocations(m_options.m_ignore_count);
+        target->IgnoreAllWatchpoints(m_options.m_ignore_count);
         result.AppendMessageWithFormat("All watchpoints ignored. (%lu watchpoints)\n", num_watchpoints);
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
     }
@@ -684,7 +684,7 @@
         int count = 0;
         const size_t size = wp_ids.size();
         for (size_t i = 0; i < size; ++i)
-            if (target->IgnoreWatchpointLocationByID(wp_ids[i], m_options.m_ignore_count))
+            if (target->IgnoreWatchpointByID(wp_ids[i], m_options.m_ignore_count))
                 ++count;
         result.AppendMessageWithFormat("%d watchpoints ignored.\n",count);
         result.SetStatus (eReturnStatusSuccessFinishNoResult);

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Oct 13 19:42:25 2011
@@ -607,7 +607,7 @@
 }
 
 Error
-ProcessKDP::EnableWatchpoint (WatchpointLocation *wp)
+ProcessKDP::EnableWatchpoint (Watchpoint *wp)
 {
     Error error;
     error.SetErrorString ("watchpoints are not suppported in kdp remote debugging");
@@ -615,7 +615,7 @@
 }
 
 Error
-ProcessKDP::DisableWatchpoint (WatchpointLocation *wp)
+ProcessKDP::DisableWatchpoint (Watchpoint *wp)
 {
     Error error;
     error.SetErrorString ("watchpoints are not suppported in kdp remote debugging");

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h Thu Oct 13 19:42:25 2011
@@ -178,10 +178,10 @@
     // Process Watchpoints
     //----------------------------------------------------------------------
     virtual lldb_private::Error
-    EnableWatchpoint (lldb_private::WatchpointLocation *wp_loc);
+    EnableWatchpoint (lldb_private::Watchpoint *wp);
     
     virtual lldb_private::Error
-    DisableWatchpoint (lldb_private::WatchpointLocation *wp_loc);
+    DisableWatchpoint (lldb_private::Watchpoint *wp);
     
     CommunicationKDP &
     GetCommunication()

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp Thu Oct 13 19:42:25 2011
@@ -21,7 +21,7 @@
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Unwind.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 
 #include "ProcessKDP.h"
 #include "ProcessKDPLog.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=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Thu Oct 13 19:42:25 2011
@@ -13,7 +13,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Target/Process.h"
@@ -306,15 +306,15 @@
 
                         // It's a watchpoint, then.
                         // The exc_sub_code indicates the data break address.
-                        lldb::WatchpointLocationSP wp_loc_sp =
-                            thread.GetProcess().GetTarget().GetWatchpointLocationList().FindByAddress((lldb::addr_t)exc_sub_code);
-                        if (wp_loc_sp)
+                        lldb::WatchpointSP wp_sp =
+                            thread.GetProcess().GetTarget().GetWatchpointList().FindByAddress((lldb::addr_t)exc_sub_code);
+                        if (wp_sp)
                         {
                             // Debugserver may piggyback the hardware index of the fired watchpoint in the exception data.
                             // Set the hardware index if that's the case.
                             if (exc_data_count >=3)
-                                wp_loc_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
-                            return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_loc_sp->GetID());
+                                wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
+                            return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_sp->GetID());
                         }
                     }
                     else if (exc_code == 2) // EXC_I386_BPT

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Oct 13 19:42:25 2011
@@ -22,7 +22,7 @@
 
 // Other libraries and framework includes
 
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Debugger.h"
@@ -1900,7 +1900,7 @@
 
 // Pre-requisite: wp != NULL.
 static GDBStoppointType
-GetGDBStoppointType (WatchpointLocation *wp)
+GetGDBStoppointType (Watchpoint *wp)
 {
     assert(wp);
     bool watch_read = wp->WatchpointRead();
@@ -1917,7 +1917,7 @@
 }
 
 Error
-ProcessGDBRemote::EnableWatchpoint (WatchpointLocation *wp)
+ProcessGDBRemote::EnableWatchpoint (Watchpoint *wp)
 {
     Error error;
     if (wp)
@@ -1951,7 +1951,7 @@
     }
     else
     {
-        error.SetErrorString("Watchpoint location argument was NULL.");
+        error.SetErrorString("Watchpoint argument was NULL.");
     }
     if (error.Success())
         error.SetErrorToGenericError();
@@ -1959,7 +1959,7 @@
 }
 
 Error
-ProcessGDBRemote::DisableWatchpoint (WatchpointLocation *wp)
+ProcessGDBRemote::DisableWatchpoint (Watchpoint *wp)
 {
     Error error;
     if (wp)
@@ -1995,7 +1995,7 @@
     }
     else
     {
-        error.SetErrorString("Watchpoint location argument was NULL.");
+        error.SetErrorString("Watchpoint argument was NULL.");
     }
     if (error.Success())
         error.SetErrorToGenericError();

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Thu Oct 13 19:42:25 2011
@@ -200,10 +200,10 @@
     // Process Watchpoints
     //----------------------------------------------------------------------
     virtual lldb_private::Error
-    EnableWatchpoint (lldb_private::WatchpointLocation *wp_loc);
+    EnableWatchpoint (lldb_private::Watchpoint *wp);
 
     virtual lldb_private::Error
-    DisableWatchpoint (lldb_private::WatchpointLocation *wp_loc);
+    DisableWatchpoint (lldb_private::Watchpoint *wp);
 
     virtual bool
     StartNoticingNewThreads();    

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Oct 13 19:42:25 2011
@@ -19,7 +19,7 @@
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Unwind.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 
 #include "ProcessGDBRemote.h"
 #include "ProcessGDBRemoteLog.h"

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Oct 13 19:42:25 2011
@@ -1997,7 +1997,7 @@
 
 
 Error
-Process::EnableWatchpoint (WatchpointLocation *watchpoint)
+Process::EnableWatchpoint (Watchpoint *watchpoint)
 {
     Error error;
     error.SetErrorString("watchpoints are not supported");
@@ -2005,7 +2005,7 @@
 }
 
 Error
-Process::DisableWatchpoint (WatchpointLocation *watchpoint)
+Process::DisableWatchpoint (Watchpoint *watchpoint)
 {
     Error error;
     error.SetErrorString("watchpoints are not supported");

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Thu Oct 13 19:42:25 2011
@@ -19,7 +19,7 @@
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Expression/ClangUserExpression.h"
@@ -349,9 +349,9 @@
         if (m_should_stop_is_valid)
             return m_should_stop;
 
-        WatchpointLocationSP wp_loc_sp =
-            m_thread.GetProcess().GetTarget().GetWatchpointLocationList().FindByID(GetValue());
-        if (wp_loc_sp)
+        WatchpointSP wp_sp =
+            m_thread.GetProcess().GetTarget().GetWatchpointList().FindByID(GetValue());
+        if (wp_sp)
         {
             // Check if we should stop at a watchpoint.
             StoppointCallbackContext context (event_ptr, 
@@ -360,7 +360,7 @@
                                               m_thread.GetStackFrameAtIndex(0).get(),
                                               true);
                 
-            m_should_stop = wp_loc_sp->ShouldStop (&context);
+            m_should_stop = wp_sp->ShouldStop (&context);
         }
         else
         {

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu Oct 13 19:42:25 2011
@@ -18,7 +18,7 @@
 #include "lldb/Breakpoint/BreakpointResolverFileLine.h"
 #include "lldb/Breakpoint/BreakpointResolverFileRegex.h"
 #include "lldb/Breakpoint/BreakpointResolverName.h"
-#include "lldb/Breakpoint/WatchpointLocation.h"
+#include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/Log.h"
@@ -55,7 +55,7 @@
     m_section_load_list (),
     m_breakpoint_list (false),
     m_internal_breakpoint_list (true),
-    m_watchpoint_location_list (),
+    m_watchpoint_list (),
     m_process_sp (),
     m_search_filter_sp (),
     m_image_search_paths (ImageSearchPathsChanged, this),
@@ -126,8 +126,8 @@
         // clean up needs some help from the process.
         m_breakpoint_list.ClearAllBreakpointSites();
         m_internal_breakpoint_list.ClearAllBreakpointSites();
-        // Disable watchpoint locations just on the debugger side.
-        DisableAllWatchpointLocations(false);
+        // Disable watchpoints just on the debugger side.
+        DisableAllWatchpoints(false);
         m_process_sp.reset();
     }
 }
@@ -167,7 +167,7 @@
     m_breakpoint_list.RemoveAll(notify);
     m_internal_breakpoint_list.RemoveAll(notify);
     m_last_created_breakpoint.reset();
-    m_last_created_watchpoint_location.reset();
+    m_last_created_watchpoint.reset();
     m_search_filter_sp.reset();
     m_image_search_paths.Clear(notify);
     m_scratch_ast_context_ap.reset();
@@ -397,67 +397,66 @@
     return (m_process_sp && m_process_sp->IsAlive());
 }
 
-// See also WatchpointLocation::SetWatchpointType(uint32_t type) and
+// See also Watchpoint::SetWatchpointType(uint32_t type) and
 // the OptionGroupWatchpoint::WatchType enum type.
-WatchpointLocationSP
-Target::CreateWatchpointLocation(lldb::addr_t addr, size_t size, uint32_t type)
+WatchpointSP
+Target::CreateWatchpoint(lldb::addr_t addr, size_t size, uint32_t type)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf("Target::%s (addr = 0x%8.8llx size = %zu type = %u)\n",
                     __FUNCTION__, addr, size, type);
 
-    WatchpointLocationSP wp_loc_sp;
+    WatchpointSP wp_sp;
     if (!ProcessIsValid())
-        return wp_loc_sp;
+        return wp_sp;
     if (addr == LLDB_INVALID_ADDRESS || size == 0)
-        return wp_loc_sp;
+        return wp_sp;
 
-    // Currently we only support one watchpoint location per address, with total
-    // number of watchpoint locations limited by the hardware which the inferior
-    // is running on.
-    WatchpointLocationSP matched_sp = m_watchpoint_location_list.FindByAddress(addr);
+    // Currently we only support one watchpoint per address, with total number
+    // of watchpoints limited by the hardware which the inferior is running on.
+    WatchpointSP matched_sp = m_watchpoint_list.FindByAddress(addr);
     if (matched_sp)
     {
         size_t old_size = matched_sp->GetByteSize();
         uint32_t old_type =
             (matched_sp->WatchpointRead() ? LLDB_WATCH_TYPE_READ : 0) |
             (matched_sp->WatchpointWrite() ? LLDB_WATCH_TYPE_WRITE : 0);
-        // Return the existing watchpoint location if both size and type match.
+        // Return the existing watchpoint if both size and type match.
         if (size == old_size && type == old_type) {
-            wp_loc_sp = matched_sp;
-            wp_loc_sp->SetEnabled(false);
+            wp_sp = matched_sp;
+            wp_sp->SetEnabled(false);
         } else {
-            // Nil the matched watchpoint location; we will be creating a new one.
+            // Nil the matched watchpoint; we will be creating a new one.
             m_process_sp->DisableWatchpoint(matched_sp.get());
-            m_watchpoint_location_list.Remove(matched_sp->GetID());
+            m_watchpoint_list.Remove(matched_sp->GetID());
         }
     }
 
-    if (!wp_loc_sp) {
-        WatchpointLocation *new_loc = new WatchpointLocation(addr, size);
-        if (!new_loc) {
-            printf("WatchpointLocation ctor failed, out of memory?\n");
-            return wp_loc_sp;
+    if (!wp_sp) {
+        Watchpoint *new_wp = new Watchpoint(addr, size);
+        if (!new_wp) {
+            printf("Watchpoint ctor failed, out of memory?\n");
+            return wp_sp;
         }
-        new_loc->SetWatchpointType(type);
-        new_loc->SetTarget(this);
-        wp_loc_sp.reset(new_loc);
-        m_watchpoint_location_list.Add(wp_loc_sp);
+        new_wp->SetWatchpointType(type);
+        new_wp->SetTarget(this);
+        wp_sp.reset(new_wp);
+        m_watchpoint_list.Add(wp_sp);
     }
 
-    Error rc = m_process_sp->EnableWatchpoint(wp_loc_sp.get());
+    Error rc = m_process_sp->EnableWatchpoint(wp_sp.get());
     if (log)
             log->Printf("Target::%s (creation of watchpoint %s with id = %u)\n",
                         __FUNCTION__,
                         rc.Success() ? "succeeded" : "failed",
-                        wp_loc_sp->GetID());
+                        wp_sp->GetID());
 
     if (rc.Fail())
-        wp_loc_sp.reset();
+        wp_sp.reset();
     else
-        m_last_created_watchpoint_location = wp_loc_sp;
-    return wp_loc_sp;
+        m_last_created_watchpoint = wp_sp;
+    return wp_sp;
 }
 
 void
@@ -572,17 +571,17 @@
 // The flag 'end_to_end', default to true, signifies that the operation is
 // performed end to end, for both the debugger and the debuggee.
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list
-// for end to end operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end
+// to end operations.
 bool
-Target::RemoveAllWatchpointLocations (bool end_to_end)
+Target::RemoveAllWatchpoints (bool end_to_end)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
     if (!end_to_end) {
-        m_watchpoint_location_list.RemoveAll();
+        m_watchpoint_list.RemoveAll();
         return true;
     }
 
@@ -591,32 +590,32 @@
     if (!ProcessIsValid())
         return false;
 
-    size_t num_watchpoints = m_watchpoint_location_list.GetSize();
+    size_t num_watchpoints = m_watchpoint_list.GetSize();
     for (size_t i = 0; i < num_watchpoints; ++i)
     {
-        WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i);
-        if (!wp_loc_sp)
+        WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i);
+        if (!wp_sp)
             return false;
 
-        Error rc = m_process_sp->DisableWatchpoint(wp_loc_sp.get());
+        Error rc = m_process_sp->DisableWatchpoint(wp_sp.get());
         if (rc.Fail())
             return false;
     }
-    m_watchpoint_location_list.RemoveAll ();
+    m_watchpoint_list.RemoveAll ();
     return true; // Success!
 }
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list
-// for end to end operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to
+// end operations.
 bool
-Target::DisableAllWatchpointLocations (bool end_to_end)
+Target::DisableAllWatchpoints (bool end_to_end)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
     if (!end_to_end) {
-        m_watchpoint_location_list.SetEnabledAll(false);
+        m_watchpoint_list.SetEnabledAll(false);
         return true;
     }
 
@@ -625,31 +624,31 @@
     if (!ProcessIsValid())
         return false;
 
-    size_t num_watchpoints = m_watchpoint_location_list.GetSize();
+    size_t num_watchpoints = m_watchpoint_list.GetSize();
     for (size_t i = 0; i < num_watchpoints; ++i)
     {
-        WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i);
-        if (!wp_loc_sp)
+        WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i);
+        if (!wp_sp)
             return false;
 
-        Error rc = m_process_sp->DisableWatchpoint(wp_loc_sp.get());
+        Error rc = m_process_sp->DisableWatchpoint(wp_sp.get());
         if (rc.Fail())
             return false;
     }
     return true; // Success!
 }
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list
-// for end to end operations.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to
+// end operations.
 bool
-Target::EnableAllWatchpointLocations (bool end_to_end)
+Target::EnableAllWatchpoints (bool end_to_end)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
     if (!end_to_end) {
-        m_watchpoint_location_list.SetEnabledAll(true);
+        m_watchpoint_list.SetEnabledAll(true);
         return true;
     }
 
@@ -658,24 +657,24 @@
     if (!ProcessIsValid())
         return false;
 
-    size_t num_watchpoints = m_watchpoint_location_list.GetSize();
+    size_t num_watchpoints = m_watchpoint_list.GetSize();
     for (size_t i = 0; i < num_watchpoints; ++i)
     {
-        WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i);
-        if (!wp_loc_sp)
+        WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i);
+        if (!wp_sp)
             return false;
 
-        Error rc = m_process_sp->EnableWatchpoint(wp_loc_sp.get());
+        Error rc = m_process_sp->EnableWatchpoint(wp_sp.get());
         if (rc.Fail())
             return false;
     }
     return true; // Success!
 }
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list
 // during these operations.
 bool
-Target::IgnoreAllWatchpointLocations (uint32_t ignore_count)
+Target::IgnoreAllWatchpoints (uint32_t ignore_count)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
@@ -684,21 +683,21 @@
     if (!ProcessIsValid())
         return false;
 
-    size_t num_watchpoints = m_watchpoint_location_list.GetSize();
+    size_t num_watchpoints = m_watchpoint_list.GetSize();
     for (size_t i = 0; i < num_watchpoints; ++i)
     {
-        WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i);
-        if (!wp_loc_sp)
+        WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i);
+        if (!wp_sp)
             return false;
 
-        wp_loc_sp->SetIgnoreCount(ignore_count);
+        wp_sp->SetIgnoreCount(ignore_count);
     }
     return true; // Success!
 }
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool
-Target::DisableWatchpointLocationByID (lldb::watch_id_t watch_id)
+Target::DisableWatchpointByID (lldb::watch_id_t watch_id)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
@@ -707,10 +706,10 @@
     if (!ProcessIsValid())
         return false;
 
-    WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.FindByID (watch_id);
-    if (wp_loc_sp)
+    WatchpointSP wp_sp = m_watchpoint_list.FindByID (watch_id);
+    if (wp_sp)
     {
-        Error rc = m_process_sp->DisableWatchpoint(wp_loc_sp.get());
+        Error rc = m_process_sp->DisableWatchpoint(wp_sp.get());
         if (rc.Success())
             return true;
 
@@ -719,9 +718,9 @@
     return false;
 }
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool
-Target::EnableWatchpointLocationByID (lldb::watch_id_t watch_id)
+Target::EnableWatchpointByID (lldb::watch_id_t watch_id)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
@@ -730,10 +729,10 @@
     if (!ProcessIsValid())
         return false;
 
-    WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.FindByID (watch_id);
-    if (wp_loc_sp)
+    WatchpointSP wp_sp = m_watchpoint_list.FindByID (watch_id);
+    if (wp_sp)
     {
-        Error rc = m_process_sp->EnableWatchpoint(wp_loc_sp.get());
+        Error rc = m_process_sp->EnableWatchpoint(wp_sp.get());
         if (rc.Success())
             return true;
 
@@ -742,25 +741,25 @@
     return false;
 }
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool
-Target::RemoveWatchpointLocationByID (lldb::watch_id_t watch_id)
+Target::RemoveWatchpointByID (lldb::watch_id_t watch_id)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
-    if (DisableWatchpointLocationByID (watch_id))
+    if (DisableWatchpointByID (watch_id))
     {
-        m_watchpoint_location_list.Remove(watch_id);
+        m_watchpoint_list.Remove(watch_id);
         return true;
     }
     return false;
 }
 
-// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool
-Target::IgnoreWatchpointLocationByID (lldb::watch_id_t watch_id, uint32_t ignore_count)
+Target::IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
@@ -769,10 +768,10 @@
     if (!ProcessIsValid())
         return false;
 
-    WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.FindByID (watch_id);
-    if (wp_loc_sp)
+    WatchpointSP wp_sp = m_watchpoint_list.FindByID (watch_id);
+    if (wp_sp)
     {
-        wp_loc_sp->SetIgnoreCount(ignore_count);
+        wp_sp->SetIgnoreCount(ignore_count);
         return true;
     }
     return false;

Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Thu Oct 13 19:42:25 2011
@@ -105,8 +105,9 @@
 def get_description(obj, option=None):
     """Calls lldb_obj.GetDescription() and returns a string, or None.
 
-    For SBTarget and SBBreakpointLocation lldb objects, an extra option can be
-    passed in to describe the detailed level of description desired:
+    For SBTarget, SBBreakpointLocation, and SBWatchpoint lldb objects, an extra
+    option can be passed in to describe the detailed level of description
+    desired:
         o lldb.eDescriptionLevelBrief
         o lldb.eDescriptionLevelFull
         o lldb.eDescriptionLevelVerbose
@@ -114,7 +115,7 @@
     method = getattr(obj, 'GetDescription')
     if not method:
         return None
-    tuple = (lldb.SBTarget, lldb.SBBreakpointLocation, lldb.SBWatchpointLocation)
+    tuple = (lldb.SBTarget, lldb.SBBreakpointLocation, lldb.SBWatchpoint)
     if isinstance(obj, tuple):
         if option is None:
             option = lldb.eDescriptionLevelBrief

Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Thu Oct 13 19:42:25 2011
@@ -350,14 +350,14 @@
         sb_valuelist.fuzz_obj(obj)
 
     @python_api_test
-    def test_SBWatchpointLocation(self):
-        obj = lldb.SBWatchpointLocation()
+    def test_SBWatchpoint(self):
+        obj = lldb.SBWatchpoint()
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
         # Do fuzz testing on the invalid obj, it should not crash lldb.
-        import sb_watchpointlocation
-        sb_watchpointlocation.fuzz_obj(obj)
+        import sb_watchpoint
+        sb_watchpoint.fuzz_obj(obj)
 
 
 if __name__ == '__main__':

Modified: lldb/trunk/test/python_api/default-constructor/sb_frame.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_frame.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_frame.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_frame.py Thu Oct 13 19:42:25 2011
@@ -33,6 +33,5 @@
     obj.FindVariable("my_var", lldb.eDynamicCanRunTarget)
     obj.FindValue("your_var", lldb.eValueTypeVariableGlobal)
     obj.FindValue("your_var", lldb.eValueTypeVariableStatic, lldb.eDynamicCanRunTarget)
-    obj.WatchValue("global_var", lldb.eValueTypeVariableGlobal, lldb.LLDB_WATCH_TYPE_READ)
     obj.GetDescription(lldb.SBStream())
     obj.Clear()

Modified: lldb/trunk/test/python_api/default-constructor/sb_target.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_target.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_target.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_target.py Thu Oct 13 19:42:25 2011
@@ -40,14 +40,13 @@
     obj.EnableAllBreakpoints()
     obj.DisableAllBreakpoints()
     obj.DeleteAllBreakpoints()
-    obj.GetNumWatchpointLocations()
-    obj.GetLastCreatedWatchpointLocation()
-    obj.GetWatchpointLocationAtIndex(0)
-    obj.WatchpointLocationDelete(0)
-    obj.FindWatchpointLocationByID(0)
-    obj.EnableAllWatchpointLocations()
-    obj.DisableAllWatchpointLocations()
-    obj.DeleteAllWatchpointLocations()
+    obj.GetNumWatchpoints()
+    obj.GetWatchpointAtIndex(0)
+    obj.DeleteWatchpoint(0)
+    obj.FindWatchpointByID(0)
+    obj.EnableAllWatchpoints()
+    obj.DisableAllWatchpoints()
+    obj.DeleteAllWatchpoints()
     obj.GetBroadcaster()
     obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief)
     obj.Clear()
@@ -55,5 +54,5 @@
         print module
     for bp in obj.breakpoint_iter():
         print bp
-    for wp_loc in obj.watchpoint_location_iter():
+    for wp_loc in obj.watchpoint_iter():
         print wp_loc

Modified: lldb/trunk/test/python_api/default-constructor/sb_value.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_value.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_value.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_value.py Thu Oct 13 19:42:25 2011
@@ -33,5 +33,7 @@
     obj.GetDescription(stream)
     obj.GetExpressionPath(stream)
     obj.GetExpressionPath(stream, True)
+    obj.Watch(True, True, False)
+    obj.WatchPointee(True, False, True)
     for child_val in obj:
         print child_val

Removed: lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py?rev=141924&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py (removed)
@@ -1,18 +0,0 @@
-"""
-Fuzz tests an object after the default construction to make sure it does not crash lldb.
-"""
-
-import sys
-import lldb
-
-def fuzz_obj(obj):
-    obj.GetID()
-    obj.GetHardwareIndex()
-    obj.GetWatchAddress()
-    obj.GetWatchSize()
-    obj.SetEnabled(True)
-    obj.IsEnabled()
-    obj.GetHitCount()
-    obj.GetIgnoreCount()
-    obj.SetIgnoreCount(5)
-    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose)

Modified: lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py (original)
+++ lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py Thu Oct 13 19:42:25 2011
@@ -1,5 +1,5 @@
 """
-Use lldb Python SBFrame API to create a watchpoint for read_write of 'globl' var.
+Use lldb Python SBValue API to create a watchpoint for read_write of 'globl' var.
 """
 
 import os, time
@@ -23,13 +23,13 @@
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     def test_watch_val_with_dsym(self):
-        """Exercise SBFrame.WatchValue() API to set a watchpoint."""
+        """Exercise SBValue.Watch() API to set a watchpoint."""
         self.buildDsym()
         self.do_set_watchpoint()
 
     @python_api_test
     def test_watch_val_with_dwarf(self):
-        """Exercise SBFrame.WatchValue() API to set a watchpoint."""
+        """Exercise SBValue.Watch() API to set a watchpoint."""
         self.buildDwarf()
         self.do_set_watchpoint()
 
@@ -57,12 +57,19 @@
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
         frame0 = thread.GetFrameAtIndex(0)
 
-        value = frame0.WatchValue('global',
-                                  lldb.eValueTypeVariableGlobal,
-                                  lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE)
-        self.assertTrue(value, "Successfully found the variable and set a watchpoint")
+        # Watch 'global' for read and write.
+        value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
+        watchpoint = value.Watch(True, True, True)
+        self.assertTrue(value and watchpoint,
+                        "Successfully found the variable and set a watchpoint")
         self.DebugSBValue(value)
 
+        # Hide stdout if not running with '-t' option.
+        if not self.TraceOn():
+            self.HideStdout()
+
+        print watchpoint
+
         # Continue.  Expect the program to stop due to the variable being written to.
         process.Continue()
 

Modified: lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py (original)
+++ lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py Thu Oct 13 19:42:25 2011
@@ -1,5 +1,5 @@
 """
-Use lldb Python SBWatchpointLocation API to set the ignore count.
+Use lldb Python SBWatchpoint API to set the ignore count.
 """
 
 import os, time
@@ -22,19 +22,19 @@
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
-    def test_set_watch_loc_ignore_count_with_dsym(self):
-        """Test SBWatchpointLocation.SetIgnoreCount() API."""
+    def test_set_watch_ignore_count_with_dsym(self):
+        """Test SBWatchpoint.SetIgnoreCount() API."""
         self.buildDsym()
-        self.do_watchpoint_location_ignore_count()
+        self.do_watchpoint_ignore_count()
 
     @python_api_test
-    def test_set_watch_loc_ignore_count_with_dwarf(self):
-        """Test SBWatchpointLocation.SetIgnoreCount() API."""
+    def test_set_watch_ignore_count_with_dwarf(self):
+        """Test SBWatchpoint.SetIgnoreCount() API."""
         self.buildDwarf()
-        self.do_watchpoint_location_ignore_count()
+        self.do_watchpoint_ignore_count()
 
-    def do_watchpoint_location_ignore_count(self):
-        """Test SBWatchpointLocation.SetIgnoreCount() API."""
+    def do_watchpoint_ignore_count(self):
+        """Test SBWatchpoint.SetIgnoreCount() API."""
         exe = os.path.join(os.getcwd(), "a.out")
 
         # Create a target by the debugger.
@@ -58,10 +58,10 @@
         frame0 = thread.GetFrameAtIndex(0)
 
         # Watch 'global' for read and write.
-        value = frame0.WatchValue('global',
-                                  lldb.eValueTypeVariableGlobal,
-                                  lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE)
-        self.assertTrue(value, "Successfully found the variable and set a watchpoint")
+        value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
+        watchpoint = value.Watch(True, True, True)
+        self.assertTrue(value and watchpoint,
+                        "Successfully found the variable and set a watchpoint")
         self.DebugSBValue(value)
 
         # Hide stdout if not running with '-t' option.
@@ -69,30 +69,28 @@
             self.HideStdout()
 
         # There should be only 1 watchpoint location under the target.
-        self.assertTrue(target.GetNumWatchpointLocations() == 1)
-        wp_loc = target.GetWatchpointLocationAtIndex(0)
-        last_created = target.GetLastCreatedWatchpointLocation()
-        self.assertTrue(wp_loc == last_created)
-        self.assertTrue(wp_loc.IsEnabled())
-        self.assertTrue(wp_loc.GetIgnoreCount() == 0)
-        watch_id = wp_loc.GetID()
+        self.assertTrue(target.GetNumWatchpoints() == 1)
+        watchpoint = target.GetWatchpointAtIndex(0)
+        self.assertTrue(watchpoint.IsEnabled())
+        self.assertTrue(watchpoint.GetIgnoreCount() == 0)
+        watch_id = watchpoint.GetID()
         self.assertTrue(watch_id != 0)
-        print wp_loc
+        print watchpoint
 
         # Now immediately set the ignore count to 2.  When we continue, expect the
         # inferior to run to its completion without stopping due to watchpoint.
-        wp_loc.SetIgnoreCount(2)
-        print wp_loc
+        watchpoint.SetIgnoreCount(2)
+        print watchpoint
         process.Continue()
 
         # At this point, the inferior process should have exited.
         self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
 
         # Verify some vital statistics.
-        self.assertTrue(wp_loc)
-        self.assertTrue(wp_loc.GetWatchSize() == 4)
-        self.assertTrue(wp_loc.GetHitCount() == 2)
-        print wp_loc
+        self.assertTrue(watchpoint)
+        self.assertTrue(watchpoint.GetWatchSize() == 4)
+        self.assertTrue(watchpoint.GetHitCount() == 2)
+        print watchpoint
 
 
 if __name__ == '__main__':

Copied: lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py (from r141905, lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py?p2=lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py&p1=lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py&r1=141905&r2=141925&rev=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py (original)
+++ lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py Thu Oct 13 19:42:25 2011
@@ -8,7 +8,7 @@
 import lldb, lldbutil
 from lldbtest import *
 
-class WatchpointLocationIteratorTestCase(TestBase):
+class WatchpointIteratorTestCase(TestBase):
 
     mydir = os.path.join("python_api", "watchpoint")
 
@@ -22,19 +22,19 @@
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
-    def test_watch_loc_iter_with_dsym(self):
-        """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations."""
+    def test_watch_iter_with_dsym(self):
+        """Exercise SBTarget.watchpoint_iter() API to iterate on the available watchpoints."""
         self.buildDsym()
-        self.do_watchpoint_location_iter()
+        self.do_watchpoint_iter()
 
     @python_api_test
-    def test_watch_loc_iter_with_dwarf(self):
-        """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations."""
+    def test_watch_iter_with_dwarf(self):
+        """Exercise SBTarget.watchpoint_iter() API to iterate on the available watchpoints."""
         self.buildDwarf()
-        self.do_watchpoint_location_iter()
+        self.do_watchpoint_iter()
 
-    def do_watchpoint_location_iter(self):
-        """Use SBTarget.watchpoint_location_iter() to do Pythonic iteration on the available watchpoint locations."""
+    def do_watchpoint_iter(self):
+        """Use SBTarget.watchpoint_iter() to do Pythonic iteration on the available watchpoints."""
         exe = os.path.join(os.getcwd(), "a.out")
 
         # Create a target by the debugger.
@@ -57,19 +57,21 @@
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
         frame0 = thread.GetFrameAtIndex(0)
 
-        value = frame0.WatchValue('global',
-                                  lldb.eValueTypeVariableGlobal,
-                                  lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE)
-        self.assertTrue(value, "Successfully found the variable and set a watchpoint")
+        # Watch 'global' for read and write.
+        value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
+        watchpoint = value.Watch(True, True, True)
+        self.assertTrue(value and watchpoint,
+                        "Successfully found the variable and set a watchpoint")
         self.DebugSBValue(value)
 
+        # Hide stdout if not running with '-t' option.
+        if not self.TraceOn():
+            self.HideStdout()
+
         # There should be only 1 watchpoint location under the target.
-        self.assertTrue(target.GetNumWatchpointLocations() == 1)
-        wp_loc = target.GetWatchpointLocationAtIndex(0)
-        last_created = target.GetLastCreatedWatchpointLocation()
-        self.assertTrue(wp_loc == last_created)
-        self.assertTrue(wp_loc.IsEnabled())
-        watch_id = wp_loc.GetID()
+        self.assertTrue(target.GetNumWatchpoints() == 1)
+        self.assertTrue(watchpoint.IsEnabled())
+        watch_id = watchpoint.GetID()
         self.assertTrue(watch_id != 0)
 
         # Continue.  Expect the program to stop due to the variable being written to.
@@ -89,17 +91,17 @@
         # We currently only support hardware watchpoint.  Verify that we have a
         # meaningful hardware index at this point.  Exercise the printed repr of
         # SBWatchpointLocation.
-        print wp_loc
-        self.assertTrue(wp_loc.GetHardwareIndex() != -1)
+        print watchpoint
+        self.assertTrue(watchpoint.GetHardwareIndex() != -1)
 
-        # SBWatchpointLocation.GetDescription() takes a description level arg.
-        print lldbutil.get_description(wp_loc, lldb.eDescriptionLevelFull)
+        # SBWatchpoint.GetDescription() takes a description level arg.
+        print lldbutil.get_description(watchpoint, lldb.eDescriptionLevelFull)
 
         # Now disable the 'rw' watchpoint.  The program won't stop when it reads
         # 'global' next.
-        wp_loc.SetEnabled(False)
-        self.assertTrue(wp_loc.GetHardwareIndex() == -1)
-        self.assertFalse(wp_loc.IsEnabled())
+        watchpoint.SetEnabled(False)
+        self.assertTrue(watchpoint.GetHardwareIndex() == -1)
+        self.assertFalse(watchpoint.IsEnabled())
 
         # Continue.  The program does not stop again when the variable is being
         # read from because the watchpoint location has been disabled.
@@ -109,11 +111,11 @@
         self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
 
         # Verify some vital statistics and exercise the iterator API.
-        for wp_loc in target.watchpoint_location_iter():
-            self.assertTrue(wp_loc)
-            self.assertTrue(wp_loc.GetWatchSize() == 4)
-            self.assertTrue(wp_loc.GetHitCount() == 1)
-            print wp_loc
+        for watchpoint in target.watchpoint_iter():
+            self.assertTrue(watchpoint)
+            self.assertTrue(watchpoint.GetWatchSize() == 4)
+            self.assertTrue(watchpoint.GetHitCount() == 1)
+            print watchpoint
 
 
 if __name__ == '__main__':

Removed: lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py?rev=141924&view=auto
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py (original)
+++ lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py (removed)
@@ -1,123 +0,0 @@
-"""
-Use lldb Python SBTarget API to iterate on the watchpoint(s) for the target.
-"""
-
-import os, time
-import re
-import unittest2
-import lldb, lldbutil
-from lldbtest import *
-
-class WatchpointLocationIteratorTestCase(TestBase):
-
-    mydir = os.path.join("python_api", "watchpoint")
-
-    def setUp(self):
-        # Call super's setUp().
-        TestBase.setUp(self)
-        # Our simple source filename.
-        self.source = 'main.c'
-        # Find the line number to break inside main().
-        self.line = line_number(self.source, '// Set break point at this line.')
-
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
-    @python_api_test
-    def test_watch_loc_iter_with_dsym(self):
-        """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations."""
-        self.buildDsym()
-        self.do_watchpoint_location_iter()
-
-    @python_api_test
-    def test_watch_loc_iter_with_dwarf(self):
-        """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations."""
-        self.buildDwarf()
-        self.do_watchpoint_location_iter()
-
-    def do_watchpoint_location_iter(self):
-        """Use SBTarget.watchpoint_location_iter() to do Pythonic iteration on the available watchpoint locations."""
-        exe = os.path.join(os.getcwd(), "a.out")
-
-        # Create a target by the debugger.
-        target = self.dbg.CreateTarget(exe)
-        self.assertTrue(target, VALID_TARGET)
-
-        # Create a breakpoint on main.c in order to set our watchpoint later.
-        breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
-        self.assertTrue(breakpoint and
-                        breakpoint.GetNumLocations() == 1,
-                        VALID_BREAKPOINT)
-
-        # Now launch the process, and do not stop at the entry point.
-        process = target.LaunchSimple(None, None, os.getcwd())
-
-        # We should be stopped due to the breakpoint.  Get frame #0.
-        process = target.GetProcess()
-        self.assertTrue(process.GetState() == lldb.eStateStopped,
-                        PROCESS_STOPPED)
-        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        frame0 = thread.GetFrameAtIndex(0)
-
-        value = frame0.WatchValue('global',
-                                  lldb.eValueTypeVariableGlobal,
-                                  lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE)
-        self.assertTrue(value, "Successfully found the variable and set a watchpoint")
-        self.DebugSBValue(value)
-
-        # There should be only 1 watchpoint location under the target.
-        self.assertTrue(target.GetNumWatchpointLocations() == 1)
-        wp_loc = target.GetWatchpointLocationAtIndex(0)
-        last_created = target.GetLastCreatedWatchpointLocation()
-        self.assertTrue(wp_loc == last_created)
-        self.assertTrue(wp_loc.IsEnabled())
-        watch_id = wp_loc.GetID()
-        self.assertTrue(watch_id != 0)
-
-        # Continue.  Expect the program to stop due to the variable being written to.
-        process.Continue()
-
-        # Hide stdout if not running with '-t' option.
-        if not self.TraceOn():
-            self.HideStdout()
-
-        # Print the stack traces.
-        lldbutil.print_stacktraces(process)
-
-        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
-        self.assertTrue(thread, "The thread stopped due to watchpoint")
-        self.DebugSBValue(value)
-
-        # We currently only support hardware watchpoint.  Verify that we have a
-        # meaningful hardware index at this point.  Exercise the printed repr of
-        # SBWatchpointLocation.
-        print wp_loc
-        self.assertTrue(wp_loc.GetHardwareIndex() != -1)
-
-        # SBWatchpointLocation.GetDescription() takes a description level arg.
-        print lldbutil.get_description(wp_loc, lldb.eDescriptionLevelFull)
-
-        # Now disable the 'rw' watchpoint.  The program won't stop when it reads
-        # 'global' next.
-        wp_loc.SetEnabled(False)
-        self.assertTrue(wp_loc.GetHardwareIndex() == -1)
-        self.assertFalse(wp_loc.IsEnabled())
-
-        # Continue.  The program does not stop again when the variable is being
-        # read from because the watchpoint location has been disabled.
-        process.Continue()
-
-        # At this point, the inferior process should have exited.
-        self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
-
-        # Verify some vital statistics and exercise the iterator API.
-        for wp_loc in target.watchpoint_location_iter():
-            self.assertTrue(wp_loc)
-            self.assertTrue(wp_loc.GetWatchSize() == 4)
-            self.assertTrue(wp_loc.GetHitCount() == 1)
-            print wp_loc
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()

Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py?rev=141925&r1=141924&r2=141925&view=diff
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py (original)
+++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Thu Oct 13 19:42:25 2011
@@ -1,5 +1,5 @@
 """
-Use lldb Python SBFrame.WatchLocation() API to create a watchpoint for write of '*g_char_ptr'.
+Use lldb Python SBValue.WatchPointee() API to create a watchpoint for write of '*g_char_ptr'.
 """
 
 import os, time
@@ -59,12 +59,23 @@
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
         frame0 = thread.GetFrameAtIndex(0)
 
-        value = frame0.WatchLocation('g_char_ptr',
-                                     lldb.eValueTypeVariableGlobal,
-                                     lldb.LLDB_WATCH_TYPE_WRITE,
-                                     1)
-        self.assertTrue(value, "Successfully found the location and set a watchpoint")
+        value = frame0.FindValue('g_char_ptr',
+                                 lldb.eValueTypeVariableGlobal)
+        pointee = value.CreateValueFromAddress("pointee",
+                                               value.GetValueAsUnsigned(0),
+                                               value.GetType().GetPointeeType())
+        # Watch for write to *g_char_ptr.
+        watchpoint = value.WatchPointee(True, False, True)
+        self.assertTrue(value and watchpoint,
+                        "Successfully found the pointer and set a watchpoint")
         self.DebugSBValue(value)
+        self.DebugSBValue(pointee)
+
+        # Hide stdout if not running with '-t' option.
+        if not self.TraceOn():
+            self.HideStdout()
+
+        print watchpoint
 
         # Continue.  Expect the program to stop due to the variable being written to.
         process.Continue()
@@ -75,6 +86,7 @@
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
         self.assertTrue(thread, "The thread stopped due to watchpoint")
         self.DebugSBValue(value)
+        self.DebugSBValue(pointee)
 
         self.expect(lldbutil.print_stacktrace(thread, string_buffer=True), exe=False,
             substrs = [self.violating_func])





More information about the lldb-commits mailing list