[Lldb-commits] [lldb] r183440 - Fixed a problem where evaluating a breakpoint

Sean Callanan scallanan at apple.com
Thu Jun 6 13:18:50 PDT 2013


Author: spyffe
Date: Thu Jun  6 15:18:50 2013
New Revision: 183440

URL: http://llvm.org/viewvc/llvm-project?rev=183440&view=rev
Log:
Fixed a problem where evaluating a breakpoint
condition in two different processes (with the
same target) could cause crashes.  Now the breakpoint
condition is always evaluated (and possibly parsed)
by one thread at a time.

<rdar://problem/14083737>

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=183440&r1=183439&r2=183440&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Thu Jun  6 15:18:50 2013
@@ -20,10 +20,11 @@
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Breakpoint/StoppointLocation.h"
-#include "lldb/Core/UserID.h"
 #include "lldb/Core/Address.h"
-#include "lldb/Target/Process.h"
 #include "lldb/Core/StringList.h"
+#include "lldb/Core/UserID.h"
+#include "lldb/Host/Mutex.h"
+#include "lldb/Target/Process.h"
 #include "lldb/Expression/ClangUserExpression.h"
 
 namespace lldb_private {
@@ -386,6 +387,7 @@ private:
     std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
     lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
     ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
+    Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
     size_t m_condition_hash; ///< For testing whether the condition source code changed.
 
     void

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=183440&r1=183439&r2=183440&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Thu Jun  6 15:18:50 2013
@@ -46,7 +46,8 @@ BreakpointLocation::BreakpointLocation
     m_address (addr),
     m_owner (owner),
     m_options_ap (),
-    m_bp_site_sp ()
+    m_bp_site_sp (),
+    m_condition_mutex ()
 {
     SetThreadID (tid);
     m_being_created = false;
@@ -249,6 +250,8 @@ bool
 BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
 {
     Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+ 
+    Mutex::Locker evaluation_locker(m_condition_mutex);
     
     size_t condition_hash;
     const char *condition_text = GetConditionText(&condition_hash);





More information about the lldb-commits mailing list