[Lldb-commits] [lldb] r141979 - in /lldb/trunk: include/lldb/API/SBWatchpoint.h include/lldb/Breakpoint/Watchpoint.h scripts/Python/interface/SBWatchpoint.i source/API/SBWatchpoint.cpp source/Breakpoint/Watchpoint.cpp test/python_api/default-constructor/sb_watchpoint.py

Johnny Chen johnny.chen at apple.com
Fri Oct 14 12:15:48 PDT 2011


Author: johnny
Date: Fri Oct 14 14:15:48 2011
New Revision: 141979

URL: http://llvm.org/viewvc/llvm-project?rev=141979&view=rev
Log:
Add SBWatchpoint::GetError() API, which is not currently populated as yet.

Modified:
    lldb/trunk/include/lldb/API/SBWatchpoint.h
    lldb/trunk/include/lldb/Breakpoint/Watchpoint.h
    lldb/trunk/scripts/Python/interface/SBWatchpoint.i
    lldb/trunk/source/API/SBWatchpoint.cpp
    lldb/trunk/source/Breakpoint/Watchpoint.cpp
    lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py

Modified: lldb/trunk/include/lldb/API/SBWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpoint.h?rev=141979&r1=141978&r2=141979&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBWatchpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBWatchpoint.h Fri Oct 14 14:15:48 2011
@@ -29,15 +29,15 @@
     operator = (const lldb::SBWatchpoint &rhs);
 #endif
 
-    lldb::SBError
-    GetError ();
+    bool
+    IsValid() const;
+
+    SBError
+    GetError();
 
     watch_id_t
     GetID ();
 
-    bool
-    IsValid() const;
-
     /// With -1 representing an invalid hardware index.
     int32_t
     GetHardwareIndex ();

Modified: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Watchpoint.h?rev=141979&r1=141978&r2=141979&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/Watchpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Watchpoint.h Fri Oct 14 14:15:48 2011
@@ -58,6 +58,7 @@
     void        Dump (Stream *s) const;
     void        DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
     Target      &GetTarget() { return *m_target; }
+    const Error &GetError() { return m_error; }
 
 private:
     friend class Target;
@@ -65,16 +66,18 @@
     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
+    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.
+    void *      m_callback_baton;      // Callback user data to pass to callback
+    std::string m_decl_str;            // Declaration information, if any.
+    Error       m_error;               // An error object describing errors creating watchpoint.
+
 
     static lldb::break_id_t
     GetNextID();

Modified: lldb/trunk/scripts/Python/interface/SBWatchpoint.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBWatchpoint.i?rev=141979&r1=141978&r2=141979&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBWatchpoint.i (original)
+++ lldb/trunk/scripts/Python/interface/SBWatchpoint.i Fri Oct 14 14:15:48 2011
@@ -28,12 +28,15 @@
 
     ~SBWatchpoint ();
 
-    watch_id_t
-    GetID ();
-
     bool
     IsValid();
 
+    SBError
+    GetError();
+
+    watch_id_t
+    GetID ();
+
     %feature("docstring", "
     //------------------------------------------------------------------
     /// With -1 representing an invalid hardware index.

Modified: lldb/trunk/source/API/SBWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=141979&r1=141978&r2=141979&view=diff
==============================================================================
--- lldb/trunk/source/API/SBWatchpoint.cpp (original)
+++ lldb/trunk/source/API/SBWatchpoint.cpp Fri Oct 14 14:15:48 2011
@@ -86,25 +86,19 @@
 bool
 SBWatchpoint::IsValid() const
 {
-    return m_opaque_sp.get() != NULL;
-#if 0
-    if (m_opaque_sp)
-        return m_opaque_sp->GetError().Success();
+    if (m_opaque_sp && m_opaque_sp->GetError().Success())
+        return true;
     return false;
-#endif
 }
 
 SBError
 SBWatchpoint::GetError ()
 {
     SBError sb_error;
-#if 0
     if (m_opaque_sp)
     {
-        // TODO: Johnny fill this in
-        sb_error.ref() = m_opaque_sp->GetError();
+        sb_error.SetError(m_opaque_sp->GetError());
     }
-#endif
     return sb_error;
 }
 

Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=141979&r1=141978&r2=141979&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Fri Oct 14 14:15:48 2011
@@ -29,7 +29,9 @@
     m_watch_was_written(0),
     m_ignore_count(0),
     m_callback(NULL),
-    m_callback_baton(NULL)
+    m_callback_baton(NULL),
+    m_decl_str(),
+    m_error()
 {
 }
 

Modified: lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py?rev=141979&r1=141978&r2=141979&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py Fri Oct 14 14:15:48 2011
@@ -7,6 +7,8 @@
 
 def fuzz_obj(obj):
     obj.GetID()
+    obj.IsValid()
+    obj.GetError()
     obj.GetHardwareIndex()
     obj.GetWatchAddress()
     obj.GetWatchSize()





More information about the lldb-commits mailing list