[Lldb-commits] [lldb] r176741 - Fix a reversed test for "for_expression" in creating C++ exception breakpoints.

Jim Ingham jingham at apple.com
Fri Mar 8 16:48:58 PST 2013


Author: jingham
Date: Fri Mar  8 18:48:58 2013
New Revision: 176741

URL: http://llvm.org/viewvc/llvm-project?rev=176741&view=rev
Log:
Fix a reversed test for "for_expression" in creating C++ exception breakpoints.
Add a missing "break" in processing the -h option to "breakpoint set".

Modified:
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=176741&r1=176740&r2=176741&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Mar  8 18:48:58 2013
@@ -189,7 +189,7 @@ public:
                     if (!success)
                         error.SetErrorStringWithFormat ("Invalid boolean value for on-catch option: '%s'", option_arg);
                 }
-
+                break;
                 case 'i':
                 {
                     m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);

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=176741&r1=176740&r2=176741&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Fri Mar  8 18:48:58 2013
@@ -338,8 +338,17 @@ ItaniumABILanguageRuntime::GetPluginVers
     return 1;
 }
 
+// This is an array of symbol names to use in setting exception breakpoints.  The names are laid out:
+//
+//  catch_names, general_throw_names, throw_names_for_use_in_expressions
+//
+// Then you can use the following constants to pick out the part of the array you want to pass to the breakpoint
+// resolver.
+
 static const char *exception_names[] = { "__cxa_begin_catch", "__cxa_throw", "__cxa_rethrow", "__cxa_allocate_exception"};
-static const int num_throw_names = 3;
+static const int num_exception_names = sizeof (exception_names)/sizeof (char *);
+static const int num_catch_names = 1;
+static const int num_throw_names = num_exception_names - num_catch_names;
 static const int num_expression_throw_names = 1;
 
 BreakpointResolverSP
@@ -352,7 +361,6 @@ BreakpointResolverSP
 ItaniumABILanguageRuntime::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions)
 {
     BreakpointResolverSP resolver_sp;
-    static const int total_expressions = sizeof (exception_names)/sizeof (char *);
     
     // One complication here is that most users DON'T want to stop at __cxa_allocate_expression, but until we can do
     // anything better with predicting unwinding the expression parser does.  So we have two forms of the exception
@@ -363,9 +371,9 @@ ItaniumABILanguageRuntime::CreateExcepti
     if (catch_bp && throw_bp)
     {
         if (for_expressions)
-            num_expressions = total_expressions;
+            num_expressions = num_exception_names;
         else
-            num_expressions = total_expressions - num_expression_throw_names;
+            num_expressions = num_exception_names - num_expression_throw_names;
             
         resolver_sp.reset (new BreakpointResolverName (bkpt,
                                                        exception_names,
@@ -376,12 +384,12 @@ ItaniumABILanguageRuntime::CreateExcepti
     else if (throw_bp)
     {
         if (for_expressions)
-            num_expressions = num_throw_names - num_expression_throw_names;
-        else
             num_expressions = num_throw_names;
-            
+        else
+            num_expressions = num_throw_names - num_expression_throw_names;
+        
         resolver_sp.reset (new BreakpointResolverName (bkpt,
-                                                       exception_names + 1,
+                                                       exception_names + num_catch_names,
                                                        num_expressions,
                                                        eFunctionNameTypeBase,
                                                        eLazyBoolNo));
@@ -389,7 +397,7 @@ ItaniumABILanguageRuntime::CreateExcepti
     else if (catch_bp)
         resolver_sp.reset (new BreakpointResolverName (bkpt,
                                                        exception_names,
-                                                       total_expressions - num_throw_names,
+                                                       num_catch_names,
                                                        eFunctionNameTypeBase,
                                                        eLazyBoolNo));
 





More information about the lldb-commits mailing list