|
Boost Users : |
From: Jaime Rios (xdev74_at_[hidden])
Date: 2007-08-07 16:47:19
Hi,
I'm working on a project that uses the Boost thread library. The code is
pretty simple and creates one thread to a function. To test out the code I
created, I create a console app and tested the code on 2 platforms: Mac OS X
for Intel and Mac OS X for PowerPC. The code worked fine in the console app
so I incorporated the code into my main project, which is a dylib. The code
worked fine on the Intel Mac, but when I debugged the dylib on the PowerPC
Mac, I get a EXC_BAD_ACCESS error.
After spending many hours trying to find out what the cause of the problem
is, the only thing I could derive was that the address that Boost was using
to access my function was wrong. Before the error, I have the following
address to my function:
(gdb) print f
$1 = (void (*)(void)) 0x33658e4 <MyWorkerThread()>
When I get the EXC_BAD_ACCESS error, the debugger stops at the following
line:
On line 95 of file function_template.hpp
struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER
{
static BOOST_FUNCTION_VOID_RETURN_TYPE
invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA
BOOST_FUNCTION_PARMS)
{
HERE--> FunctionPtr f =
reinterpret_cast<FunctionPtr>(function_ptr.func_ptr);
BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));
}
};
The address at this point is the following:
(gdb) print f
$2 = (void (*)(void)) 0xf0798dd0
I went over the code over and over again but I cannot figure out what is
causing the original function address to be changed.
Now for the question! How can I debug this better? The problem that I am
finding is that my debugger jumps to different parts of the project, but I
cannot pinpoint the actual code that is causing this problem. Any
suggestions? Thanks in advance!
-Jaime
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