Boost logo

Boost Users :

Subject: Re: [Boost-users] Trouble with asio using lib pion and boost.function
From: Stephan Menzel (stephan.menzel_at_[hidden])
Date: 2008-11-27 03:51:00

Hi Steven

> >>> return static_cast<vtable_type*>(vtable)->invoker
> >>> }

> >> a) Is the error on the static_cast or on reading the function pointer?

> You could look at the disassembly...

Good call!

Neat feature, this Visual stuff has got here. I see lots of things along those lines. I try to boil it down to a more interesting part:

  ::operator()(BOOST_FUNCTION_PARMS) const
1004E4B0 push ebp
1004E4B1 mov ebp,esp
1004E4B3 push 0FFFFFFFFh
1004E4B5 push offset __ehhandler$??R?$function1_at_XV?$shared_ptr_at_VTCPConnection@net_at_pion@@@boost@@@boost@@QBEXV?$shared_ptr_at_VTCPConnection@net_at_pion@@@1@@Z (1005A600h)
1004E4BA mov eax,dword ptr fs:[00000000h]
1004E4C0 push eax
1004E4C1 sub esp,40h
1004E4C4 push edi
1004E4C5 push ecx
1004E4C6 lea edi,[ebp-4Ch]
1004E4C9 mov ecx,10h
1004E4CE mov eax,0CCCCCCCCh
1004E4D3 rep stos dword ptr es:[edi]
1004E4D5 pop ecx
1004E4D6 mov eax,dword ptr [___security_cookie (1007C920h)]
1004E4DB xor eax,ebp
1004E4DD push eax
1004E4DE lea eax,[ebp-0Ch]
1004E4E1 mov dword ptr fs:[00000000h],eax
1004E4E7 mov dword ptr [ebp-10h],ecx
1004E4EA mov dword ptr [ebp-4],0
    if (this->empty())
1004E4F1 mov ecx,dword ptr [ebp-10h]
1004E4F4 call boost::function_base::empty (100033B4h)
1004E4F9 movzx eax,al
1004E4FC test eax,eax
1004E4FE je boost::function1<void,boost::shared_ptr<pion::net::TCPConnection> >::operator()+7Dh (1004E52Dh)
1004E500 lea ecx,[ebp-3Ch]
1004E503 call boost::bad_function_call::bad_function_call (100015B9h)
1004E508 mov dword ptr [ebp-44h],eax
1004E50B mov ecx,dword ptr [ebp-44h]
1004E50E mov dword ptr [ebp-48h],ecx
1004E511 mov byte ptr [ebp-4],1
1004E515 mov edx,dword ptr [ebp-48h]
1004E518 push edx
1004E519 call boost::throw_exception<boost::bad_function_call> (100024FAh)
1004E51E add esp,4
1004E521 mov byte ptr [ebp-4],0
1004E525 lea ecx,[ebp-3Ch]
1004E528 call boost::bad_function_call::~bad_function_call (10002199h)

    return static_cast<vtable_type*>(vtable)->invoker
             (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
1004E52D sub esp,8
1004E530 mov ecx,esp
1004E532 mov dword ptr [ebp-40h],esp
1004E535 lea eax,[ebp+8]
1004E538 push eax
1004E539 call boost::shared_ptr<pion::net::TCPConnection>::shared_ptr<pion::net::TCPConnection> (10003003h)
1004E53E mov dword ptr [ebp-4Ch],eax
1004E541 mov ecx,dword ptr [ebp-10h]
1004E544 add ecx,8
1004E547 push ecx
1004E548 mov edx,dword ptr [ebp-10h]
1004E54B mov eax,dword ptr [edx]
1004E54D mov ecx,dword ptr [eax+4]
1004E550 call ecx

and so on and so forth and suchlike.

> However, in the light of the following, it seem more likely that
> the "this" pointer is invalid.

Indeed. There's even a

    if (this->empty())

to be seen.
What I see is either this exception or it is a crash trying to access this. In any case, it's platform specific.

But I still don't know how to proceed. Wouldn't here be a bug report in order?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at