X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/94ba3e61c1cf68520a2ddc8706aad9da7f54f37e..5d6dd7f0a4a1dd08189c44dfbb20c7adb5ceb9c5:/src/kernel/context/ContextBoost.cpp diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index 87b490ea80..567329504a 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -75,7 +75,7 @@ BoostContext::BoostContext(std::function code, void_pfn_smxprocess_t cle #else void* stack = this->stack_; #endif - ASAN_EVAL(this->asan_stack_ = stack); + ASAN_ONLY(this->asan_stack_ = stack); #if BOOST_VERSION < 106100 this->fc_ = boost::context::make_fcontext(stack, smx_context_usable_stack_size, BoostContext::wrapper); #else @@ -106,10 +106,10 @@ void BoostContext::wrapper(BoostContext::arg_type arg) #if BOOST_VERSION < 106100 BoostContext* context = reinterpret_cast(arg); #else - ASAN_FINISH_SWITCH(nullptr, &static_cast(arg.data)[0]->asan_stack_, - &static_cast(arg.data)[0]->asan_stack_size_); + BoostContext* context = static_cast(arg.data)[1]; + ASAN_ONLY(xbt_assert(context->asan_ctx_ == static_cast(arg.data)[0])); + ASAN_FINISH_SWITCH(nullptr, &context->asan_ctx_->asan_stack_, &context->asan_ctx_->asan_stack_size_); static_cast(arg.data)[0]->fc_ = arg.fctx; - BoostContext* context = static_cast(arg.data)[1]; #endif try { (*context)(); @@ -117,7 +117,7 @@ void BoostContext::wrapper(BoostContext::arg_type arg) } catch (StopRequest const&) { XBT_DEBUG("Caught a StopRequest"); } - ASAN_EVAL(context->asan_stop_ = true); + ASAN_ONLY(context->asan_stop_ = true); context->suspend(); } @@ -129,11 +129,12 @@ inline void BoostContext::swap(BoostContext* from, BoostContext* to) boost::context::jump_fcontext(&from->fc_, to->fc_, reinterpret_cast(to)); #else BoostContext* ctx[2] = {from, to}; - void* fake_stack = nullptr; + ASAN_ONLY(void* fake_stack = nullptr); + ASAN_ONLY(to->asan_ctx_ = from); ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_); boost::context::detail::transfer_t arg = boost::context::detail::jump_fcontext(to->fc_, ctx); - ASAN_FINISH_SWITCH(fake_stack, &static_cast(arg.data)[0]->asan_stack_, - &static_cast(arg.data)[0]->asan_stack_size_); + ASAN_ONLY(xbt_assert(from->asan_ctx_ == static_cast(arg.data)[0])); + ASAN_FINISH_SWITCH(fake_stack, &from->asan_ctx_->asan_stack_, &from->asan_ctx_->asan_stack_size_); static_cast(arg.data)[0]->fc_ = arg.fctx; #endif }