[Lldb-commits] [lldb] r119720 - in /lldb/trunk: include/lldb/API/SBThread.h include/lldb/Breakpoint/BreakpointLocation.h lldb.xcodeproj/project.pbxproj source/API/SBBreakpointLocation.cpp source/API/SBThread.cpp source/Breakpoint/BreakpointLocationCollection.cpp source/Breakpoint/BreakpointSite.cpp source/Target/StopInfo.cpp tools/debugserver/debugserver.xcodeproj/project.pbxproj

Greg Clayton gclayton at apple.com
Thu Nov 18 10:52:37 PST 2010


Author: gclayton
Date: Thu Nov 18 12:52:36 2010
New Revision: 119720

URL: http://llvm.org/viewvc/llvm-project?rev=119720&view=rev
Log:
Added the ability to get more information on the SBThread's stop reason
by being able to get the data count and data. Each thread stop reason
has one or more data words that can help describe the stop. To do this
I added:

    size_t
	SBThread::GetStopReasonDataCount();

	uint64_t
	SBThread::GetStopReasonDataAtIndex(uint32_t idx);



Modified:
    lldb/trunk/include/lldb/API/SBThread.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/API/SBBreakpointLocation.cpp
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp
    lldb/trunk/source/Breakpoint/BreakpointSite.cpp
    lldb/trunk/source/Target/StopInfo.cpp
    lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj

Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Thu Nov 18 12:52:36 2010
@@ -35,30 +35,30 @@
 
     lldb::StopReason
     GetStopReason();
-//
-//    // Get the number of words associated with the stop reason.
-//    size_t
-//    GetStopReasonDataCount();
-//
-//    //--------------------------------------------------------------------------
-//    // Get information associated with a stop reason.
-//    //
-//    // Breakpoint and watchpoint stop reasons will have data that consists of 
-//    // pairs of breakpoint/watchpoint IDs followed by the breakpoint/watchpoint
-//    // location IDs (they always come in pairs).
-//    //
-//    // Stop Reason              Count Data Type
-//    // ======================== ===== ==========================================
-//    // eStopReasonNone          0
-//    // eStopReasonTrace         0
-//    // eStopReasonBreakpoint    N     duple: {breakpoint id, location id}
-//    // eStopReasonWatchpoint    N     duple: {watchpoint id, location id}
-//    // eStopReasonSignal        1     unix signal number
-//    // eStopReasonException     N     exception data
-//    // eStopReasonPlanComplete  0
-//    //--------------------------------------------------------------------------
-//    uint64_t
-//    GetStopReasonDataAtIndex(uint32_t idx);
+
+    // Get the number of words associated with the stop reason.
+    size_t
+    GetStopReasonDataCount();
+
+    //--------------------------------------------------------------------------
+    // Get information associated with a stop reason.
+    //
+    // Breakpoint stop reasons will have data that consists of pairs of 
+    // breakpoint IDs followed by the breakpoint location IDs (they always come
+    // in pairs).
+    //
+    // Stop Reason              Count Data Type
+    // ======================== ===== ==========================================
+    // eStopReasonNone          0
+    // eStopReasonTrace         0
+    // eStopReasonBreakpoint    N     duple: {breakpoint id, location id}
+    // eStopReasonWatchpoint    N     duple: {watchpoint id, location id}
+    // eStopReasonSignal        1     unix signal number
+    // eStopReasonException     N     exception data
+    // eStopReasonPlanComplete  0
+    //--------------------------------------------------------------------------
+    uint64_t
+    GetStopReasonDataAtIndex(uint32_t idx);
 
     size_t
     GetStopDescription (char *dst, size_t dst_len);

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Thu Nov 18 12:52:36 2010
@@ -20,11 +20,9 @@
 
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Core/UserID.h"
 #include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Core/UserID.h"
 #include "lldb/Core/Address.h"
-#include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Breakpoint/BreakpointOptions.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Core/StringList.h"
 
@@ -165,7 +163,8 @@
     /// @param[in] condition
     ///    The condition expression to evaluate when the breakpoint is hit.
     //------------------------------------------------------------------
-    void SetCondition (const char *condition);
+    void 
+    SetCondition (const char *condition);
     
     //------------------------------------------------------------------
     /// Test the breakpoint location's condition in the Execution context passed in.
@@ -179,7 +178,9 @@
     /// @return
     ///     A thread plan to run to test the condition, or NULL if there is no condition.
     //------------------------------------------------------------------
-    ThreadPlan *GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, Stream &error);
+    ThreadPlan *
+    GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, 
+                                  Stream &error);
     
     //------------------------------------------------------------------
     /// Return a pointer to the text of the condition expression.
@@ -188,7 +189,8 @@
     ///    A pointer to the condition expression text, or NULL if no
     //     condition has been set.
     //------------------------------------------------------------------
-    const char *GetConditionText ();
+    const char *
+    GetConditionText ();
 
 
     //------------------------------------------------------------------

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov 18 12:52:36 2010
@@ -2452,7 +2452,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
 			compatibilityVersion = "Xcode 3.1";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				en,

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Thu Nov 18 12:52:36 2010
@@ -14,6 +14,7 @@
 
 #include "lldb/lldb-types.h"
 #include "lldb/lldb-defines.h"
+#include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Target/ThreadSpec.h"
 #include "lldb/Core/Log.h"

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Thu Nov 18 12:52:36 2010
@@ -12,6 +12,7 @@
 #include "lldb/API/SBSymbolContext.h"
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBStream.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
@@ -109,6 +110,109 @@
 }
 
 size_t
+SBThread::GetStopReasonDataCount ()
+{
+    if (m_opaque_sp)
+    {
+        StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
+        if (stop_info_sp)
+        {
+            StopReason reason = stop_info_sp->GetStopReason();
+            switch (reason)
+            {
+            case eStopReasonInvalid:
+            case eStopReasonNone:
+            case eStopReasonTrace:
+            case eStopReasonPlanComplete:
+                // There is no data for these stop reasons.
+                return 0;
+
+            case eStopReasonBreakpoint:
+                {
+                    break_id_t site_id = stop_info_sp->GetValue();
+                    lldb::BreakpointSiteSP bp_site_sp (m_opaque_sp->GetProcess().GetBreakpointSiteList().FindByID (site_id));
+                    if (bp_site_sp)
+                        return bp_site_sp->GetNumberOfOwners () * 2;
+                    else
+                        return 0; // Breakpoint must have cleared itself...
+                }
+                break;
+
+            case eStopReasonWatchpoint:
+                assert (!"implement watchpoint support in SBThread::GetStopReasonDataCount ()");
+                return 0; // We don't have watchpoint support yet...
+
+            case eStopReasonSignal:
+                return 1;
+
+            case eStopReasonException:
+                return 1;
+            }
+        }
+    }
+    return 0;
+}
+
+uint64_t
+SBThread::GetStopReasonDataAtIndex (uint32_t idx)
+{
+    if (m_opaque_sp)
+    {
+        StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
+        if (stop_info_sp)
+        {
+            StopReason reason = stop_info_sp->GetStopReason();
+            switch (reason)
+            {
+            case eStopReasonInvalid:
+            case eStopReasonNone:
+            case eStopReasonTrace:
+            case eStopReasonPlanComplete:
+                // There is no data for these stop reasons.
+                return 0;
+
+            case eStopReasonBreakpoint:
+                {
+                    break_id_t site_id = stop_info_sp->GetValue();
+                    lldb::BreakpointSiteSP bp_site_sp (m_opaque_sp->GetProcess().GetBreakpointSiteList().FindByID (site_id));
+                    if (bp_site_sp)
+                    {
+                        uint32_t bp_index = idx / 2;
+                        BreakpointLocationSP bp_loc_sp (bp_site_sp->GetOwnerAtIndex (bp_index));
+                        if (bp_loc_sp)
+                        {
+                            if (bp_index & 1)
+                            {
+                                // Odd idx, return the breakpoint location ID
+                                return bp_loc_sp->GetID();
+                            }
+                            else
+                            {
+                                // Even idx, return the breakpoint ID
+                                return bp_loc_sp->GetBreakpoint().GetID();
+                            }
+                        }
+                    }
+                    return LLDB_INVALID_BREAK_ID;
+                }
+                break;
+
+            case eStopReasonWatchpoint:
+                assert (!"implement watchpoint support in SBThread::GetStopReasonDataCount ()");
+                return 0; // We don't have watchpoint support yet...
+
+            case eStopReasonSignal:
+                return stop_info_sp->GetValue();
+
+            case eStopReasonException:
+                return stop_info_sp->GetValue();
+            }
+        }
+    }
+    return 0;
+}
+
+size_t
 SBThread::GetStopDescription (char *dst, size_t dst_len)
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));

Modified: lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp Thu Nov 18 12:52:36 2010
@@ -14,6 +14,7 @@
 // Project includes
 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
 #include "lldb/Core/ModuleList.h"
+#include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/BreakpointLocationList.h"
 #include "lldb/Target/Thread.h"

Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Thu Nov 18 12:52:36 2010
@@ -13,6 +13,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/BreakpointSiteList.h"
 

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Thu Nov 18 12:52:36 2010
@@ -16,6 +16,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Log.h"
+#include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/StreamString.h"

Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=119720&r1=119719&r2=119720&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Thu Nov 18 12:52:36 2010
@@ -372,7 +372,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */;
 			compatibilityVersion = "Xcode 3.1";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,





More information about the lldb-commits mailing list