Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] Interrupting a thread causes a segmentation fault
From: Viatcheslav.Sysoltsev_at_[hidden]
Date: 2011-02-18 03:49:29


On Thu, 17 Feb 2011 17:32:47 +0100, W Frane
<molluskadvertising_at_[hidden]> wrote:

> CALL STACK
> =============================================================================
> #0 00000000 0x00406410 in __cxa_throw() (??:??)
> #1 00403070 boost::this_thread::interruption_point()
> (libs\thread\src\win32\thread.cpp:495)
> #2 00401359 testingThread() (C:\Documents and Settings\WFrane\My
> Documents\C++ code\boost thread interrupt
> test\boost_thread_interrupt_test\main.cpp:12)
> #3 00422666 boost::detail::thread_data<void (*)() (C:/Program
> Files/boost/boost_1_45_0/boost/thread/detail/thread.hpp:61)
> #4 00401BFF thread_start_function(param=0x243198)
> (libs\thread\src\win32\thread.cpp:171)
> #5 77C3A3B0 msvcrt!_endthreadex() (C:\WINDOWS\system32\msvcrt.dll:??)
> #6 7C80B729 KERNEL32!GetModuleFileNameA()
> (C:\WINDOWS\system32\kernel32.dll:??)
> #7 00000000 0x00000000 in ??() (??:??)
> =============================================================================
>
> CURRENT STACK FRAME
> =============================================================================
> Stack level 1, frame at 0x78fe68:
> eip = 0x403070 in boost::this_thread::interruption_point()
> (libs\thread\src\win32\thread.cpp:495); saved eip 0x401359
> called by frame at 0x78fef8, caller of frame at 0x78fe48
> source language c++.
> Arglist at 0x78fe60, args:
> Locals at 0x78fe60, Previous frame's sp is 0x78fe68
> Saved registers:
> ebp at 0x78fe60, eip at 0x78fe64
> =============================================================================
>
> DISASSEMBLY
> =============================================================================
> Frame function: boost::this_thread::interruption_point()
> (libs\thread\src\win32\thread.cpp:495)
> Frame address : 0078FE68
> --------------------------------------------------------------------------------
> 0040300D push %ebp
> 0040300E mov %esp,%ebp
> 00403010 sub $0x18,%esp
> 00403013 call 0x403072 <boost::this_thread::interruption_enabled()>
> 00403018 test %al,%al
> 0040301A je 0x403029 <boost::this_thread::interruption_point()+28>
> 0040301C call 0x403095
> <boost::this_thread::interruption_requested()>
> 00403021 test %al,%al
> 00403023 je 0x403029 <boost::this_thread::interruption_point()+28>
> 00403025 mov $0x1,%al
> 00403027 jmp 0x40302b <boost::this_thread::interruption_point()+30>
> 00403029 mov $0x0,%al
> 0040302B test %al,%al
> 0040302D je 0x403070 <boost::this_thread::interruption_point()+99>
> 0040302F call 0x40184c <get_current_thread_data>
> 00403034 add $0xc,%eax
> 00403037 mov %eax,(%esp)
> 0040303A call 0x4280dc
> <boost::detail::win32::handle_manager::operator void*() const>
> 0040303F mov %eax,(%esp)
> 00403042 mov 0x488298,%eax
> 00403047 call *%eax
> 00403049 sub $0x4,%esp
> 0040304C movl $0x1,(%esp)
> 00403053 call 0x405e8c <__cxa_allocate_exception>
> 00403058 movl $0x0,0x8(%esp)
> 00403060 movl $0x47ccec,0x4(%esp)
> 00403068 mov %eax,(%esp)
> 0040306B call 0x40640c <__cxa_throw>
> 00403070 leave
> 00403071 ret

Are you sure your compiler supports exception handling in your setup? I'd
try some simple exception hanlding program with the same compiler switches.
If you set breakpoint on 0040306B, does __cxa_throw resolve to 00000000 or
you get there from inside __cxa_throw? If first, there something wrong
with linking or compiler setup; if latter, something wrong with EH
structures in generated code (either in boost or in your test program).
Have you build boost yourelf? If not, maybe it is worthy to try to rebuild
boost with the same compiler and try it. Make sure -fexceptions or
whatevers it must be for mingw is used in build process.

-- Slava


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net