[Lldb-commits] [lldb] r151965 - in /lldb/trunk: include/lldb/Breakpoint/ include/lldb/Target/ source/Breakpoint/ source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Target/

Jim Ingham jingham at apple.com
Fri Mar 2 18:05:12 PST 2012


Author: jingham
Date: Fri Mar  2 20:05:11 2012
New Revision: 151965

URL: http://llvm.org/viewvc/llvm-project?rev=151965&view=rev
Log:
First step to making an LanguageRuntime Exception breakpoint API.
<rdar://problem/10196277>

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h
    lldb/trunk/include/lldb/Target/LanguageRuntime.h
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h Fri Mar  2 20:05:11 2012
@@ -121,7 +121,8 @@
         FileLineResolver, // This is an instance of BreakpointResolverFileLine
         AddressResolver,  // This is an instance of BreakpointResolverAddress
         NameResolver,      // This is an instance of BreakpointResolverName
-        FileRegexResolver
+        FileRegexResolver,
+        ExceptionResolver
     };
 
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h Fri Mar  2 20:05:11 2012
@@ -35,6 +35,13 @@
                             Breakpoint::MatchType type,
                             bool skip_prologue);
 
+    // This one takes an array of names.  It is always MatchType = Name.
+    BreakpointResolverName (Breakpoint *bkpt,
+                            const char *names[],
+                            size_t num_names,
+                            uint32_t name_type_mask,
+                            bool skip_prologue);
+
     // Creates a function breakpoint by regular expression.  Takes over control of the lifespan of func_regex.
     BreakpointResolverName (Breakpoint *bkpt,
                             RegularExpression &func_regex,
@@ -71,7 +78,7 @@
     }
 
 protected:
-    ConstString m_func_name;
+    std::vector<ConstString> m_func_names;
     uint32_t m_func_name_type_mask;  // See FunctionNameType
     ConstString m_class_name;  // FIXME: Not used yet.  The idea would be to stop on methods of this class.
     RegularExpression m_regex;

Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Fri Mar  2 20:05:11 2012
@@ -15,6 +15,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
+#include "lldb/Breakpoint/BreakpointResolver.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ValueObject.h"
@@ -68,10 +69,18 @@
     {
         return false;
     }
+    
 protected:
     //------------------------------------------------------------------
     // Classes that inherit from LanguageRuntime can see and modify these
     //------------------------------------------------------------------
+    
+    // The Target is the one that knows how to create breakpoints, so this function is meant to be used either
+    // by the target or internally in Set/ClearExceptionBreakpoints.
+    
+    virtual lldb::BreakpointSP
+    CreateExceptionBreakpoint (bool catch_bp, bool throw_bp, bool is_internal = false) = 0;
+        
     LanguageRuntime(Process *process);
     Process *m_process;
 private:

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Fri Mar  2 20:05:11 2012
@@ -468,6 +468,19 @@
                       uint32_t func_name_type_mask, 
                       bool internal = false,
                       LazyBool skip_prologue = eLazyBoolCalculate);
+    
+    // This is the same as the func_name breakpoint except that you can specify a vector of names.  This is cheaper
+    // than a regular expression breakpoint in the case where you just want to set a breakpoint on a set of names
+    // you already know.
+    lldb::BreakpointSP
+    CreateBreakpoint (const FileSpecList *containingModules,
+                      const FileSpecList *containingSourceFiles,
+                      const char *func_names[],
+                      size_t num_names, 
+                      uint32_t func_name_type_mask, 
+                      bool internal = false,
+                      LazyBool skip_prologue = eLazyBoolCalculate);
+
 
     // Use this to create a general breakpoint:
     lldb::BreakpointSP

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Fri Mar  2 20:05:11 2012
@@ -31,24 +31,42 @@
     bool skip_prologue
 ) :
     BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
-    m_func_name (func_name),
     m_func_name_type_mask (func_name_type_mask),
     m_class_name (),
     m_regex (),
     m_match_type (type),
     m_skip_prologue (skip_prologue)
 {
-
+    
     if (m_match_type == Breakpoint::Regexp)
     {
-        if (!m_regex.Compile (m_func_name.AsCString()))
+        if (!m_regex.Compile (func_name))
         {
             LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
 
             if (log)
-                log->Warning ("function name regexp: \"%s\" did not compile.", m_func_name.AsCString());
+                log->Warning ("function name regexp: \"%s\" did not compile.", func_name);
         }
     }
+    else
+    {
+        m_func_names.push_back(ConstString(func_name));
+    }
+}
+
+BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
+                                                const char *names[],
+                                                size_t num_names,
+                                                uint32_t name_type_mask,
+                                                bool skip_prologue) :
+    BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
+    m_func_name_type_mask (name_type_mask),
+    m_skip_prologue (skip_prologue)
+{
+    for (size_t i = 0; i < num_names; i++)
+    {
+        m_func_names.push_back (ConstString (names[i]));
+    }
 }
 
 BreakpointResolverName::BreakpointResolverName
@@ -58,7 +76,6 @@
     bool skip_prologue
 ) :
     BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
-    m_func_name (NULL),
     m_class_name (NULL),
     m_regex (func_regex),
     m_match_type (Breakpoint::Regexp),
@@ -75,13 +92,12 @@
     bool skip_prologue
 ) :
     BreakpointResolver (bkpt, BreakpointResolver::NameResolver),
-    m_func_name (method),
     m_class_name (class_name),
     m_regex (),
     m_match_type (type),
     m_skip_prologue (skip_prologue)
 {
-
+    m_func_names.push_back(ConstString(method));
 }
 
 BreakpointResolverName::~BreakpointResolverName ()
@@ -121,7 +137,7 @@
     
     const bool include_symbols = false;
     const bool include_inlines = true;
-    const bool append = false;
+    const bool append = true;
     bool filter_by_cu = (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0;
 
     switch (m_match_type)
@@ -129,20 +145,24 @@
         case Breakpoint::Exact:
             if (context.module_sp)
             {
-                uint32_t num_functions = context.module_sp->FindFunctions (m_func_name, 
-                                                                           NULL,
-                                                                           m_func_name_type_mask, 
-                                                                           include_symbols,
-                                                                           include_inlines, 
-                                                                           append, 
-                                                                           func_list);
-                // If the search filter specifies a Compilation Unit, then we don't need to bother to look in plain
-                // symbols, since all the ones from a set compilation unit will have been found above already.
-                
-                if (num_functions == 0 && !filter_by_cu)
+                size_t num_names = m_func_names.size();
+                for (int i = 0; i < num_names; i++)
                 {
-                    if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeAuto))
-                        context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list);
+                    uint32_t num_functions = context.module_sp->FindFunctions (m_func_names[i], 
+                                                                               NULL,
+                                                                               m_func_name_type_mask, 
+                                                                               include_symbols,
+                                                                               include_inlines, 
+                                                                               append, 
+                                                                               func_list);
+                    // If the search filter specifies a Compilation Unit, then we don't need to bother to look in plain
+                    // symbols, since all the ones from a set compilation unit will have been found above already.
+                    
+                    if (num_functions == 0 && !filter_by_cu)
+                    {
+                        if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeAuto))
+                            context.module_sp->FindSymbolsWithNameAndType (m_func_names[i], eSymbolTypeCode, sym_list);
+                    }
                 }
             }
             break;
@@ -299,7 +319,20 @@
     if (m_match_type == Breakpoint::Regexp)
         s->Printf("regex = '%s'", m_regex.GetText());
     else
-        s->Printf("name = '%s'", m_func_name.AsCString());
+    {
+        size_t num_names = m_func_names.size();
+        if (num_names == 1)
+            s->Printf("name = '%s'", m_func_names[0].AsCString());
+        else
+        {
+            s->Printf("names = {");
+            for (size_t i = 0; i < num_names - 1; i++)
+            {
+                s->Printf ("'%s', ", m_func_names[i].AsCString());
+            }
+            s->Printf ("'%s'}", m_func_names[num_names - 1].AsCString());
+        }
+    }
 }
 
 void

Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Fri Mar  2 20:05:11 2012
@@ -209,7 +209,7 @@
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
-lldb_private::LanguageRuntime *
+LanguageRuntime *
 ItaniumABILanguageRuntime::CreateInstance (Process *process, lldb::LanguageType language)
 {
     // FIXME: We have to check the process and make sure we actually know that this process supports
@@ -255,29 +255,56 @@
     return 1;
 }
 
+static const char *exception_names[] = {"__cxa_throw", "__cxa_allocate", "__cxa_rethrow", "__cxa_catch"};
+static const int num_throw_names = 3;
+
+BreakpointSP
+ItaniumABILanguageRuntime::CreateExceptionBreakpoint (bool catch_bp, bool throw_bp, bool is_internal)
+{
+    BreakpointSP exc_breakpt_sp;
+    if (catch_bp && throw_bp)
+        exc_breakpt_sp = m_process->GetTarget().CreateBreakpoint (NULL,
+                                                                  NULL,
+                                                                  exception_names,
+                                                                  sizeof (exception_names)/sizeof (char *),
+                                                                  eFunctionNameTypeBase, 
+                                                                  is_internal, 
+                                                                  eLazyBoolNo);
+    else if (throw_bp)
+        exc_breakpt_sp = m_process->GetTarget().CreateBreakpoint (NULL,
+                                                                  NULL,
+                                                                  exception_names,
+                                                                  num_throw_names,
+                                                                  eFunctionNameTypeBase, 
+                                                                  is_internal, 
+                                                                  eLazyBoolNo);
+    else if (catch_bp)
+        exc_breakpt_sp = m_process->GetTarget().CreateBreakpoint (NULL,
+                                                                  NULL,
+                                                                  exception_names + num_throw_names,
+                                                                  sizeof (exception_names)/sizeof (char *) - num_throw_names,
+                                                                  eFunctionNameTypeBase, 
+                                                                  is_internal, 
+                                                                  eLazyBoolNo);
+
+    return exc_breakpt_sp;
+}
+
 void
 ItaniumABILanguageRuntime::SetExceptionBreakpoints ()
 {
     if (!m_process)
         return;
     
+    const bool catch_bp = false;
+    const bool throw_bp = true;
+    const bool is_internal = true;
+    
     if (!m_cxx_exception_bp_sp)
-        m_cxx_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL,
-                                                                         NULL,
-                                                                         "__cxa_throw",
-                                                                         eFunctionNameTypeBase, 
-                                                                         true);
+        m_cxx_exception_bp_sp = CreateExceptionBreakpoint (catch_bp, throw_bp, is_internal);
     else
         m_cxx_exception_bp_sp->SetEnabled (true);
     
-    if (!m_cxx_exception_alloc_bp_sp)
-        m_cxx_exception_alloc_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL,
-                                                                               NULL,
-                                                                               "__cxa_allocate",
-                                                                               eFunctionNameTypeBase,
-                                                                               true);
-    else
-        m_cxx_exception_alloc_bp_sp->SetEnabled (true);
 }
 
 void
@@ -289,12 +316,7 @@
     if (m_cxx_exception_bp_sp.get())
     {
         m_cxx_exception_bp_sp->SetEnabled (false);
-    }
-    
-    if (m_cxx_exception_alloc_bp_sp.get())
-    {
-        m_cxx_exception_bp_sp->SetEnabled (false);
-    }
+    }    
 }
 
 bool
@@ -315,30 +337,18 @@
     
     uint32_t num_owners = bp_site_sp->GetNumberOfOwners();
     
-    bool        check_cxx_exception = false;
     break_id_t  cxx_exception_bid;
     
-    bool        check_cxx_exception_alloc = false;
-    break_id_t  cxx_exception_alloc_bid;
-    
-    if (m_cxx_exception_bp_sp)
-    {
-        check_cxx_exception = true;
-        cxx_exception_bid = m_cxx_exception_bp_sp->GetID();
-    }
-    
-    if (m_cxx_exception_alloc_bp_sp)
-    {
-        check_cxx_exception_alloc = true;
-        cxx_exception_alloc_bid = m_cxx_exception_alloc_bp_sp->GetID();
-    }
-    
+    if (!m_cxx_exception_bp_sp)
+        return false;
+        
+    cxx_exception_bid = m_cxx_exception_bp_sp->GetID();
+        
     for (uint32_t i = 0; i < num_owners; i++)
     {
         break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID();
         
-        if ((check_cxx_exception        && (bid == cxx_exception_bid)) ||
-            (check_cxx_exception_alloc  && (bid == cxx_exception_alloc_bid)))
+        if (bid == cxx_exception_bid)
             return true;
     }
     

Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h Fri Mar  2 20:05:11 2012
@@ -15,6 +15,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
+#include "lldb/Breakpoint/BreakpointResolver.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Core/Value.h"
@@ -73,11 +74,13 @@
         ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason);
         
     protected:
+        virtual lldb::BreakpointSP
+        CreateExceptionBreakpoint (bool catch_bp, bool throw_bp, bool is_internal = false);
+
     private:
         ItaniumABILanguageRuntime(Process *process) : lldb_private::CPPLanguageRuntime(process) { } // Call CreateInstance instead.
         
         lldb::BreakpointSP                              m_cxx_exception_bp_sp;
-        lldb::BreakpointSP                              m_cxx_exception_alloc_bp_sp;
     };
     
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Fri Mar  2 20:05:11 2012
@@ -288,6 +288,20 @@
 }
 
 void
+AppleObjCRuntime::SetExceptionBreakpoints ()
+{
+    const bool catch_bp = false;
+    const bool throw_bp = true;
+    const bool is_internal = true;
+    
+    if (!m_objc_exception_bp_sp)
+        m_objc_exception_bp_sp = CreateExceptionBreakpoint (catch_bp, throw_bp, is_internal);
+    else
+        m_objc_exception_bp_sp->SetEnabled(true);
+}
+
+
+void
 AppleObjCRuntime::ClearExceptionBreakpoints ()
 {
     if (!m_process)
@@ -317,20 +331,18 @@
     
     uint32_t num_owners = bp_site_sp->GetNumberOfOwners();
     
-    bool        check_objc_exception = false;
     break_id_t  objc_exception_bid;
     
-    if (m_objc_exception_bp_sp)
-    {
-        check_objc_exception = true;
-        objc_exception_bid = m_objc_exception_bp_sp->GetID();
-    }
+    if (!m_objc_exception_bp_sp)
+        return false;
+
+    objc_exception_bid = m_objc_exception_bp_sp->GetID();
     
     for (uint32_t i = 0; i < num_owners; i++)
     {
         break_id_t bid = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().GetID();
         
-        if ((check_objc_exception && (bid == objc_exception_bid)))
+        if (bid == objc_exception_bid)
             return true;
     }
     

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Fri Mar  2 20:05:11 2012
@@ -104,6 +104,8 @@
     // PluginInterface protocol
     //------------------------------------------------------------------
 public:
+    virtual void
+    SetExceptionBreakpoints();
 
     virtual void
     ClearExceptionBreakpoints ();

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Fri Mar  2 20:05:11 2012
@@ -104,22 +104,22 @@
     return 1;
 }
 
-void
-AppleObjCRuntimeV1::SetExceptionBreakpoints ()
+BreakpointSP
+AppleObjCRuntimeV1::CreateExceptionBreakpoint (bool catch_bp, bool throw_bp, bool is_internal)
 {
+    BreakpointSP exc_breakpt_sp;
     if (!m_process)
-        return;
-        
-    if (!m_objc_exception_bp_sp)
-    {
-        m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL,
-                                                                          NULL,
-                                                                          "objc_exception_throw",
-                                                                          eFunctionNameTypeBase, 
-                                                                          true);
-    }
-    else
-        m_objc_exception_bp_sp->SetEnabled (true);
+        return exc_breakpt_sp;
+    
+    
+    // FIXME: Only do throw for now...
+    if (throw_bp)
+        exc_breakpt_sp = m_process->GetTarget().CreateBreakpoint (NULL,
+                                                                  NULL,
+                                                                  "objc_exception_throw",
+                                                                  eFunctionNameTypeBase, 
+                                                                  is_internal);
+    return exc_breakpt_sp;
 }
 
 struct BufStruct {

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Fri Mar  2 20:05:11 2012
@@ -60,9 +60,6 @@
     virtual uint32_t
     GetPluginVersion();
     
-    virtual void
-    SetExceptionBreakpoints ();
-    
     virtual ObjCRuntimeVersions
     GetRuntimeVersion ()
     {
@@ -94,7 +91,9 @@
     }
 
 protected:
-    
+    virtual lldb::BreakpointSP
+    CreateExceptionBreakpoint (bool catch_bp, bool throw_bp, bool is_internal = false);
+            
 private:
     AppleObjCRuntimeV1(Process *process) : 
         lldb_private::AppleObjCRuntime (process)

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri Mar  2 20:05:11 2012
@@ -444,22 +444,22 @@
     return 1;
 }
 
-void
-AppleObjCRuntimeV2::SetExceptionBreakpoints ()
+BreakpointSP
+AppleObjCRuntimeV2::CreateExceptionBreakpoint (bool catch_bp, bool throw_bp, bool is_internal)
 {
+    BreakpointSP exc_breakpt_sp;
     if (!m_process)
-        return;
-        
-    if (!m_objc_exception_bp_sp)
-    {
-        m_objc_exception_bp_sp = m_process->GetTarget().CreateBreakpoint (NULL,
-                                                                          NULL,
-                                                                          "__cxa_throw",
-                                                                          eFunctionNameTypeBase, 
-                                                                          true);
-    }
-    else
-        m_objc_exception_bp_sp->SetEnabled (true);
+        return exc_breakpt_sp;
+    
+    
+    // FIXME: Only do throw for now...
+    if (throw_bp)
+        exc_breakpt_sp = m_process->GetTarget().CreateBreakpoint (NULL,
+                                                                  NULL,
+                                                                  "objc_exception_throw",
+                                                                  eFunctionNameTypeBase, 
+                                                                  is_internal);
+    return exc_breakpt_sp;
 }
 
 ClangUtilityFunction *

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Fri Mar  2 20:05:11 2012
@@ -64,9 +64,6 @@
     virtual uint32_t
     GetPluginVersion();
     
-    virtual void
-    SetExceptionBreakpoints ();
-
     virtual ObjCRuntimeVersions
     GetRuntimeVersion ()
     {
@@ -100,7 +97,9 @@
     GetSymbolVendor();
     
 protected:
-    
+    virtual lldb::BreakpointSP
+    CreateExceptionBreakpoint (bool catch_bp, bool throw_bp, bool is_internal = false);
+
 private:
     
     typedef std::map<ObjCLanguageRuntime::ObjCISA, ConstString> ISAToNameCache;

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=151965&r1=151964&r2=151965&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Mar  2 20:05:11 2012
@@ -287,6 +287,29 @@
     return bp_sp;
 }
 
+BreakpointSP
+Target::CreateBreakpoint (const FileSpecList *containingModules,
+                          const FileSpecList *containingSourceFiles,
+                          const char *func_names[],
+                          size_t num_names, 
+                          uint32_t func_name_type_mask, 
+                          bool internal,
+                          LazyBool skip_prologue)
+{
+    BreakpointSP bp_sp;
+    if (num_names > 0)
+    {
+        SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, containingSourceFiles));
+        
+        BreakpointResolverSP resolver_sp (new BreakpointResolverName (NULL, 
+                                                                      func_names,
+                                                                      num_names, 
+                                                                      func_name_type_mask, 
+                                                                      skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue));
+        bp_sp = CreateBreakpoint (filter_sp, resolver_sp, internal);
+    }
+    return bp_sp;
+}
 
 SearchFilterSP
 Target::GetSearchFilterForModule (const FileSpec *containingModule)





More information about the lldb-commits mailing list