kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #28111
Re: [PATCH] Fix MacOS coroutine segfault
Backtrace attached. Boost is 1.63.0.
On Thu, Feb 23, 2017 at 11:36:02AM +0100, Maciej Sumiński wrote:
> Hi Chris,
>
> Would you give more details about the problem? Boost version, backtrace?
>
> Regards,
> Orson
>
> On 02/23/2017 02:23 AM, Chris Pavlina wrote:
> > Hi,
> >
> > pcbnew is segfaulting on launch on my MacOS Sierra build, due to a null
> > dereference in the coroutine code:
> >
> > coroutine.h
> > 408 static CONTEXT_T callerStub( CONTEXT_T caller, INVOCATION_ARGS* aArgsPtr )
> > 409 {
> > 410 const auto& args = *aArgsPtr;
> > 411 auto* cor = args.destination;
> >
> > aArgsPtr is null and I don't understand WHY. However, I was able to make
> > things appear to work by short-circuiting this function if the argument
> > is null.
> >
> > Patch attached. It Works For Me™, but I'd like someone who knows the
> > coroutine code to look and make sure I haven't made a mess of things.
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help : https://help.launchpad.net/ListHelp
> >
>
>
(lldb) bt
* thread #1: tid = 0x4fa9, 0x000000010ea6aaf1 _pcbnew.kiface`COROUTINE<int, TOOL_EVENT const&>::callerStub(caller=(fctx_ = 0x00007fff5fbfc3d0), aArgsPtr=0x0000000000000000) + 17 at coroutine.h:411, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
* frame #0: 0x000000010ea6aaf1 _pcbnew.kiface`COROUTINE<int, TOOL_EVENT const&>::callerStub(caller=(fctx_ = 0x00007fff5fbfc3d0), aArgsPtr=0x0000000000000000) + 17 at coroutine.h:411 [opt]
frame #1: 0x000000010ea6ae13 _pcbnew.kiface`std::__1::enable_if<!(std::is_member_pointer<std::__1::decay<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*)>::type>::value), std::__1::result_of<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*&& (boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>&&, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*&&))(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*)>::type>::type boost::context::detail::invoke<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (fn=<unavailable>, args=<unavailable>, args=<unavailable>)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*), boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*&&)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*), boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>&&, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*&&) + 35 at invoke.hpp:41 [opt]
frame #2: 0x000000010ea6ad4d _pcbnew.kiface`boost::context::detail::record<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, boost::context::basic_protected_fixedsize_stack<boost::context::stack_traits>, boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*)>::run(boost::context::detail::transfer_t) [inlined] decltype(fn=<unavailable>)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*)>(fp)std::get<0ul, 1ul>(std::forward<std::__1::tuple<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>&&, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> >(fp0)))) boost::context::detail::apply_impl<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*), std::__1::tuple<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>&&, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, 0ul, 1ul>(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*&&)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*), std::__1::tuple<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>&&, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>&&, boost::context::detail::index_sequence<0ul, 1ul>) + 45 at apply.hpp:46 [opt]
frame #3: 0x000000010ea6ad44 _pcbnew.kiface`boost::context::detail::record<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, boost::context::basic_protected_fixedsize_stack<boost::context::stack_traits>, boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*)>::run(boost::context::detail::transfer_t) [inlined] _ZN5boost7context6detail5applyIPFNS0_17execution_contextIJPN9COROUTINEIiRK10TOOL_EVENTE15INVOCATION_ARGSEEEESB_SA_ENSt3__15tupleIJOSB_SA_EEEEEDTcl10apply_implclsr3stdE7forwardIT_Efp_Eclsr3stdE7forwardIT0_Efp0_EcvNS1_19make_index_sequenceIXsr3std10tuple_sizeINSE_5decayISJ_E4typeEEE5valueEEEilEEEOSI_OSJ_(fn=<unavailable>) at apply.hpp:59 [opt]
frame #4: 0x000000010ea6ad44 _pcbnew.kiface`boost::context::detail::record<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, boost::context::basic_protected_fixedsize_stack<boost::context::stack_traits>, boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*)>::run(this=<unavailable>, t=<unavailable>) + 36 at execution_context_v2.hpp:113 [opt]
frame #5: 0x000000010ea6acdc _pcbnew.kiface`void boost::context::detail::context_entry<boost::context::detail::record<boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, boost::context::basic_protected_fixedsize_stack<boost::context::stack_traits>, boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*> (*)(boost::context::execution_context<COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*>, COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*)> >(t_=<unavailable>) + 28 at execution_context_v2.hpp:383 [opt]
frame #6: 0x00000001013cf538 libboost_context-mt.dylib`trampoline + 3
(lldb) l
415
416 if( args.type == INVOCATION_ARGS::FROM_ROOT )
417 cor->m_callContext->SetMainStack( &cor->m_caller );
418
419 // call the coroutine method
420 cor->m_retVal = cor->m_func( *(cor->m_args) );
421 cor->m_running = false;
(lldb)
Follow ups
References