diff options
Diffstat (limited to 'lldb/source/Plugins')
8 files changed, 31 insertions, 6 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp index a82394592c4..02c0ad5013e 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp @@ -74,11 +74,16 @@ ClangFunctionCaller::~ClangFunctionCaller() } unsigned -ClangFunctionCaller::CompileFunction(DiagnosticManager &diagnostic_manager) + +ClangFunctionCaller::CompileFunction (lldb::ThreadSP thread_to_use_sp, + DiagnosticManager &diagnostic_manager) { if (m_compiled) return 0; + // Compilation might call code, make sure to keep on the thread the caller indicated. + ThreadList::ExpressionExecutionThreadPusher execution_thread_pusher(thread_to_use_sp); + // FIXME: How does clang tell us there's no return value? We need to handle that case. unsigned num_errors = 0; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h index f37c3b30472..468b9c1c76d 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h @@ -137,6 +137,11 @@ public: //------------------------------------------------------------------ /// Compile the wrapper function /// + /// @param[in] thread_to_use_sp + /// Compilation might end up calling functions. Pass in the thread you + /// want the compilation to use. If you pass in an empty ThreadSP it will + /// use the currently selected thread. + /// /// @param[in] diagnostic_manager /// The diagnostic manager to report parser errors to. /// @@ -144,7 +149,8 @@ public: /// The number of errors. //------------------------------------------------------------------ unsigned - CompileFunction(DiagnosticManager &diagnostic_manager) override; + CompileFunction (lldb::ThreadSP thread_to_use_sp, + DiagnosticManager &diagnostic_manager) override; ExpressionTypeSystemHelper * GetTypeSystemHelper() override diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 638b651d513..4ad5e0c919e 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1308,6 +1308,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table get_class_info_function = m_get_class_info_code->MakeFunctionCaller(clang_uint32_t_type, arguments, + thread_sp, error); if (error.Fail()) @@ -1567,6 +1568,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() get_shared_cache_class_info_function = m_get_shared_cache_class_info_code->MakeFunctionCaller(clang_uint32_t_type, arguments, + thread_sp, error); if (get_shared_cache_class_info_function == nullptr) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index b9994d63952..614c267d0be 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -741,9 +741,11 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process lldb::addr_t AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, ValueList &dispatch_values) { - ExecutionContext exe_ctx(thread.shared_from_this()); + ThreadSP thread_sp(thread.shared_from_this()); + ExecutionContext exe_ctx (thread_sp); DiagnosticManager diagnostics; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *impl_function_caller = nullptr; @@ -795,6 +797,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, ValueList &dis impl_function_caller = m_impl_code->MakeFunctionCaller(clang_void_ptr_type, dispatch_values, + thread_sp, error); if (error.Fail()) { diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp index 19f89f077cd..688626e717d 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -189,6 +189,7 @@ AppleGetItemInfoHandler::SetupGetItemInfoFunction(Thread &thread, ValueList &get get_item_info_caller = m_get_item_info_impl_code->MakeFunctionCaller(get_item_info_return_type, get_item_info_arglist, + thread.shared_from_this(), error); if (error.Fail()) { diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp index cda7264d17b..c262ffc9fba 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -139,9 +139,11 @@ AppleGetPendingItemsHandler::Detach () lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(Thread &thread, ValueList &get_pending_items_arglist) { - ExecutionContext exe_ctx(thread.shared_from_this()); + ThreadSP thread_sp (thread.shared_from_this()); + ExecutionContext exe_ctx (thread_sp); DiagnosticManager diagnostics; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_pending_items_caller = nullptr; @@ -191,6 +193,7 @@ AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(Thread &thread, ValueL CompilerType get_pending_items_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); get_pending_items_caller = m_get_pending_items_impl_code->MakeFunctionCaller (get_pending_items_return_type, get_pending_items_arglist, + thread_sp, error); if (error.Fail()) { diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp index e005d500e0c..e1f045124ee 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -147,7 +147,9 @@ AppleGetQueuesHandler::Detach () lldb::addr_t AppleGetQueuesHandler::SetupGetQueuesFunction (Thread &thread, ValueList &get_queues_arglist) { - ExecutionContext exe_ctx(thread.shared_from_this()); + ThreadSP thread_sp(thread.shared_from_this()); + ExecutionContext exe_ctx (thread_sp); + Address impl_code_address; DiagnosticManager diagnostics; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); @@ -205,6 +207,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction (Thread &thread, ValueList &get_qu Error error; get_queues_caller = m_get_queues_impl_code_up->MakeFunctionCaller (get_queues_return_type, get_queues_arglist, + thread_sp, error); if (error.Fail()) { diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp index a528dafb97a..266e461a8a4 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -142,7 +142,8 @@ AppleGetThreadItemInfoHandler::Detach () lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction (Thread &thread, ValueList &get_thread_item_info_arglist) { - ExecutionContext exe_ctx(thread.shared_from_this()); + ThreadSP thread_sp(thread.shared_from_this()); + ExecutionContext exe_ctx (thread_sp); Address impl_code_address; DiagnosticManager diagnostics; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); @@ -199,6 +200,7 @@ AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction (Thread &thread, V get_thread_item_info_caller = m_get_thread_item_info_impl_code->MakeFunctionCaller (get_thread_item_info_return_type, get_thread_item_info_arglist, + thread_sp, error); if (error.Fail()) { |