[Lldb-commits] [lldb] r106578 - in /lldb/trunk: include/lldb/Breakpoint/BreakpointLocation.h include/lldb/Breakpoint/BreakpointOptions.h source/API/SBBreakpointLocation.cpp source/Breakpoint/BreakpointLocation.cpp source/Breakpoint/BreakpointOptions.cpp source/Commands/CommandObjectBreakpointCommand.cpp

Jim Ingham jingham at apple.com
Tue Jun 22 14:12:54 PDT 2010


Author: jingham
Date: Tue Jun 22 16:12:54 2010
New Revision: 106578

URL: http://llvm.org/viewvc/llvm-project?rev=106578&view=rev
Log:
Make an explicit GetThreadSpecNoCreate accessor so you don't have to get the const-ness right to ensure you are not making a copy of the owning breakpoint's ThreadSpec in a breakpoint location.  Also change the name from NoCopy to NoCreate since that's clearer.

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
    lldb/trunk/source/API/SBBreakpointLocation.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=106578&r1=106577&r2=106578&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Tue Jun 22 16:12:54 2010
@@ -251,14 +251,16 @@
     GetLocationOptions ();
 
     //------------------------------------------------------------------
-    /// Use this to access location specific breakpoint options.
+    /// Use this to access breakpoint options from this breakpoint location.
+    /// This will point to the owning breakpoint's options unless options have
+    /// been set specifically on this location.
     ///
     /// @return
     ///     A pointer to the containing breakpoint's options if this
     ///     location doesn't have its own copy.
     //------------------------------------------------------------------
     const BreakpointOptions *
-    GetOptionsNoCopy () const;
+    GetOptionsNoCreate () const;
     
     bool
     ValidForThisThread (Thread *thread);

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=106578&r1=106577&r2=106578&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Tue Jun 22 16:12:54 2010
@@ -125,13 +125,14 @@
     //------------------------------------------------------------------
 
     //------------------------------------------------------------------
-    /// Return the current thread spec.  This is used to pass to Thread::MatchesSpec.
+    /// Return the current thread spec for this option.  This will return NULL if the no thread
+    /// specifications have been set for this Option yet.     
     /// @return
     ///     The thread specification pointer for this option, or NULL if none has
     ///     been set yet.
     //------------------------------------------------------------------
     const ThreadSpec *
-    GetThreadSpec () const;
+    GetThreadSpecNoCreate () const;
 
     //------------------------------------------------------------------
     /// Returns a pointer to the ThreadSpec for this option, creating it.

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=106578&r1=106577&r2=106578&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Tue Jun 22 16:12:54 2010
@@ -104,7 +104,7 @@
 {
     tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID;
     if (m_break_loc_sp)
-        sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->GetTID();
+        sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
 
     return sb_thread_id;
 }
@@ -121,7 +121,7 @@
 {
     if (m_break_loc_sp)
     {
-        const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec();
+        const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
         if (thread_spec == NULL)
             return 0;
         else
@@ -143,7 +143,7 @@
 {
     if (m_break_loc_sp)
     {
-        const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec();
+        const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
         if (thread_spec == NULL)
             return NULL;
         else
@@ -164,7 +164,7 @@
 {
     if (m_break_loc_sp)
     {
-        const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec();
+        const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
         if (thread_spec == NULL)
             return NULL;
         else

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=106578&r1=106577&r2=106578&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Tue Jun 22 16:12:54 2010
@@ -140,7 +140,7 @@
 int32_t
 BreakpointLocation::GetIgnoreCount ()
 {
-    return GetOptionsNoCopy()->GetIgnoreCount();
+    return GetOptionsNoCreate()->GetIgnoreCount();
 }
 
 void
@@ -150,7 +150,7 @@
 }
 
 const BreakpointOptions *
-BreakpointLocation::GetOptionsNoCopy () const
+BreakpointLocation::GetOptionsNoCreate () const
 {
     if (m_options_ap.get() != NULL)
         return m_options_ap.get();
@@ -173,7 +173,7 @@
 bool
 BreakpointLocation::ValidForThisThread (Thread *thread)
 {
-    return thread->MatchesSpec(GetOptionsNoCopy()->GetThreadSpec());
+    return thread->MatchesSpec(GetOptionsNoCreate()->GetThreadSpecNoCreate());
 }
 
 // RETURNS - true if we should stop at this breakpoint, false if we
@@ -383,7 +383,7 @@
     s->Printf("BreakpointLocation %u: tid = %4.4x  load addr = 0x%8.8llx  state = %s  type = %s breakpoint  "
               "hw_index = %i  hit_count = %-4u  ignore_count = %-4u",
             GetID(),
-            GetOptionsNoCopy()->GetThreadSpec()->GetTID(),
+            GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(),
             (uint64_t) m_address.GetLoadAddress(m_owner.GetTarget().GetProcessSP().get()),
             (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled",
             IsHardware() ? "hardware" : "software",

Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=106578&r1=106577&r2=106578&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Tue Jun 22 16:12:54 2010
@@ -173,7 +173,7 @@
 }
 
 const ThreadSpec *
-BreakpointOptions::GetThreadSpec () const
+BreakpointOptions::GetThreadSpecNoCreate () const
 {
     return m_thread_spec_ap.get();
 }
@@ -200,7 +200,7 @@
     // Figure out if there are any options not at their default value, and only print 
     // anything if there are:
     
-    if (m_ignore_count != 0 || !m_enabled || (GetThreadSpec() != NULL && GetThreadSpec()->HasSpecification ()))
+    if (m_ignore_count != 0 || !m_enabled || (GetThreadSpecNoCreate() != NULL && GetThreadSpecNoCreate()->HasSpecification ()))
     {
         if (level == lldb::eDescriptionLevelVerbose)
         {

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=106578&r1=106577&r2=106578&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Tue Jun 22 16:12:54 2010
@@ -536,7 +536,7 @@
                     {
                         BreakpointLocationSP bp_loc_sp(bp->FindLocationByID (cur_bp_id.GetLocationID()));
                         if (bp_loc_sp)
-                            bp_options = bp_loc_sp->GetOptionsNoCopy();
+                            bp_options = bp_loc_sp->GetOptionsNoCreate();
                         else
                         {
                             result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n", 





More information about the lldb-commits mailing list