[Lldb-commits] [lldb] r134571 - in /lldb/trunk/include/lldb/API: SBBreakpoint.h SBBreakpointLocation.h SBFunction.h SBThread.h

Johnny Chen johnny.chen at apple.com
Wed Jul 6 17:14:13 PDT 2011


Author: johnny
Date: Wed Jul  6 19:14:13 2011
New Revision: 134571

URL: http://llvm.org/viewvc/llvm-project?rev=134571&view=rev
Log:
Add class docstrings with example usage for SBBreakpoint and SBBreakpointLocation.

Modified:
    lldb/trunk/include/lldb/API/SBBreakpoint.h
    lldb/trunk/include/lldb/API/SBBreakpointLocation.h
    lldb/trunk/include/lldb/API/SBFunction.h
    lldb/trunk/include/lldb/API/SBThread.h

Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=134571&r1=134570&r2=134571&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Wed Jul  6 19:14:13 2011
@@ -15,8 +15,70 @@
 
 namespace lldb {
 
+#ifdef SWIG
+%feature("docstring",
+"Represents a logical breakpoint and its associated settings.
+
+For example (from test/functionalities/breakpoint/breakpoint_ignore_count/
+TestBreakpointIgnoreCount.py),
+
+    def breakpoint_ignore_count_python(self):
+        '''Use Python APIs to set breakpoint ignore count.'''
+        exe = os.path.join(os.getcwd(), 'a.out')
+
+        # Create a target by the debugger.
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        # Now create a breakpoint on main.c by name 'c'.
+        breakpoint = target.BreakpointCreateByName('c', 'a.out')
+        self.assertTrue(breakpoint and
+                        breakpoint.GetNumLocations() == 1,
+                        VALID_BREAKPOINT)
+
+        # Get the breakpoint location from breakpoint after we verified that,
+        # indeed, it has one location.
+        location = breakpoint.GetLocationAtIndex(0)
+        self.assertTrue(location and
+                        location.IsEnabled(),
+                        VALID_BREAKPOINT_LOCATION)
+
+        # Set the ignore count on the breakpoint location.
+        location.SetIgnoreCount(2)
+        self.assertTrue(location.GetIgnoreCount() == 2,
+                        'SetIgnoreCount() works correctly')
+
+        # Now launch the process, and do not stop at entry point.
+        process = target.LaunchSimple(None, None, os.getcwd())
+        self.assertTrue(process, PROCESS_IS_VALID)
+
+        # Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and
+        # frame#2 should be on main.c:48.
+        #lldbutil.print_stacktraces(process)
+        from lldbutil import get_stopped_thread
+        thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+        self.assertTrue(thread != None, 'There should be a thread stopped due to breakpoint')
+        frame0 = thread.GetFrameAtIndex(0)
+        frame1 = thread.GetFrameAtIndex(1)
+        frame2 = thread.GetFrameAtIndex(2)
+        self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and
+                        frame1.GetLineEntry().GetLine() == self.line3 and
+                        frame2.GetLineEntry().GetLine() == self.line4,
+                        STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT)
+
+        # The hit count for the breakpoint should be 3.
+        self.assertTrue(breakpoint.GetHitCount() == 3)
+
+        process.Continue()
+
+"
+         ) SBBreakpoint;
+#endif
 class SBBreakpoint
 {
+#ifdef SWIG
+    %feature("autodoc", "1");
+#endif
 public:
 
     typedef bool (*BreakpointHitCallback) (void *baton, 

Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=134571&r1=134570&r2=134571&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Wed Jul  6 19:14:13 2011
@@ -15,8 +15,24 @@
 
 namespace lldb {
 
+#ifdef SWIG
+%feature("docstring",
+"Represents one unique instance (by address) of a logical breakpoint.
+
+A breakpoint location is defined by the breakpoint that produces it,
+and the address that resulted in this particular instantiation.
+Each breakpoint location has its settable options.
+
+SBBreakpoint contains SBBreakpointLocation(s). See docstring of SBBreakpoint
+for retrieval of an SBBreakpointLocation from an SBBreakpoint.
+"
+         ) SBBreakpointLocation;
+#endif
 class SBBreakpointLocation
 {
+#ifdef SWIG
+    %feature("autodoc", "1");
+#endif
 public:
 
     SBBreakpointLocation ();
@@ -87,7 +103,9 @@
     SBBreakpoint
     GetBreakpoint ();
 
+#ifndef SWIG
     SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp);
+#endif
 
 private:
     friend class SBBreakpoint;

Modified: lldb/trunk/include/lldb/API/SBFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFunction.h?rev=134571&r1=134570&r2=134571&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFunction.h (original)
+++ lldb/trunk/include/lldb/API/SBFunction.h Wed Jul  6 19:14:13 2011
@@ -20,7 +20,7 @@
 %feature("docstring",
 "Represents a generic function, which can be inlined or not.
 
-For example (in test/lldbutil.py, but slightly modified for doc purpose),
+For example (from test/lldbutil.py, but slightly modified for doc purpose),
 
         ...
 

Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=134571&r1=134570&r2=134571&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Wed Jul  6 19:14:13 2011
@@ -22,7 +22,7 @@
 %feature("docstring",
 "Represents a thread of execution. SBProcess contains SBThread(s).
 
-For example (in test/lldbutil.py),
+For example (from test/lldbutil.py),
 
 # ==================================================
 # Utility functions related to Threads and Processes





More information about the lldb-commits mailing list