Re: [Lldb-commits] [lldb] r202561 - Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid thread.

2014-03-03 Thread Ed Maste
On 28 February 2014 19:17, Jim Ingham jing...@apple.com wrote:
 Author: jingham
 Date: Fri Feb 28 18:17:06 2014
 New Revision: 202561

 URL: http://llvm.org/viewvc/llvm-project?rev=202561view=rev
 Log:
 Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid 
 thread.

 rdar://problem/15949113

Hi Jim,

I saw a couple of test failures after this change.  One of them
suggests it should be permissible to execute w/o a valid thread if the
expression can be evaluated statically (and that seems to be
sensible):

1: test_backticks_no_target
(TestBackticksWithoutATarget.BackticksWithNoTargetTestCase)
   A simple test of backticks without a target. ... runCmd: print `1+2-3`
runCmd failed!
error: ClangUserExpression::Execute called with no thread selected.

I added a !m_can_interpret to the condition in r202722.  My change
means we will again call PrepareToExecuteJITExpression and
FinalizeJITExecution with an exe_ctx with no valid thread, but only
with a successful IRInterpreter::Interpret call (or we return error
and do not call FinalizeJITExecution).

Please let me know if there's more context in rdar 15949113 that makes
this simple change incorrect and I can try to take a second look.
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r202561 - Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid thread.

2014-03-03 Thread jingham
My bad, you should be able to run the JIT code provided it only touches global 
objects without a thread.  I should have moved the check for having a 
ThreadScope down to where we were preparing to actually run code, since it is 
impossible to do that without a valid thread to run on.  I think that's a 
clearer fix than adding m_can_interpret to the if conditional.  Thanks for 
catching this.

Jim

On Mar 3, 2014, at 7:55 AM, Ed Maste ema...@freebsd.org wrote:

 On 28 February 2014 19:17, Jim Ingham jing...@apple.com wrote:
 Author: jingham
 Date: Fri Feb 28 18:17:06 2014
 New Revision: 202561
 
 URL: http://llvm.org/viewvc/llvm-project?rev=202561view=rev
 Log:
 Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid 
 thread.
 
 rdar://problem/15949113
 
 Hi Jim,
 
 I saw a couple of test failures after this change.  One of them
 suggests it should be permissible to execute w/o a valid thread if the
 expression can be evaluated statically (and that seems to be
 sensible):
 
 1: test_backticks_no_target
 (TestBackticksWithoutATarget.BackticksWithNoTargetTestCase)
   A simple test of backticks without a target. ... runCmd: print `1+2-3`
 runCmd failed!
 error: ClangUserExpression::Execute called with no thread selected.
 
 I added a !m_can_interpret to the condition in r202722.  My change
 means we will again call PrepareToExecuteJITExpression and
 FinalizeJITExecution with an exe_ctx with no valid thread, but only
 with a successful IRInterpreter::Interpret call (or we return error
 and do not call FinalizeJITExecution).
 
 Please let me know if there's more context in rdar 15949113 that makes
 this simple change incorrect and I can try to take a second look.

___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r202561 - Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid thread.

2014-02-28 Thread Jim Ingham
Author: jingham
Date: Fri Feb 28 18:17:06 2014
New Revision: 202561

URL: http://llvm.org/viewvc/llvm-project?rev=202561view=rev
Log:
Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid thread.

rdar://problem/15949113

Modified:
lldb/trunk/source/Expression/ClangUserExpression.cpp

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=202561r1=202560r2=202561view=diff
==
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Feb 28 18:17:06 
2014
@@ -763,6 +763,12 @@ ClangUserExpression::Execute (Stream er
 // expression, it's quite convenient to have these logs come out with the 
STEP log as well.
 Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | 
LIBLLDB_LOG_STEP));
 
+if (!exe_ctx.HasThreadScope())
+{
+error_stream.Printf(ClangUserExpression::Execute called with no 
thread selected.);
+return eExecutionSetupError;
+}
+
 if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret)
 {
 lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits