Hello.
I'm using buildroot based system with ARM samsung processor (s3c2443).
I've found a case, when i get segfault in my application. Using x86
debian compilers doesn't reproduce error.
Attaching test program to this letter. There is an exception getting
throw from constructor of child-class (DisplayPassDevice). At that time
parent destructor (~PassageDevice) getting called. When exiting from
parent destructor i got segfault.
# ./throw
~PassageDevice
Aborted (core dumped)
One more necessary condition. The bug appears only when i compile my
code with pthread:
../minipos-OS-build/host/usr/bin/arm-linux-g++ throw.cpp -o throw -lpthread
When i compile without -lpthread flag, program works OK.
# ./throw
~PassageDevice
catched
I don't know what does this problem belongs to, so i write there for
help. Probably you'll just point me, where to report it.
Software i use is following: gcc 4.5.4, uClibc 0.9.33.2, linux 3.6.
#include <stdio.h>
#include <stdexcept>
class PassageDevice
{
public:
virtual void OnPassageOpen() = 0;
virtual void OnPassageClose() = 0;
virtual ~PassageDevice()
{
printf("~PassageDevice\n");
}
};
class DisplayPassDevice: public PassageDevice
{
public:
class Exception {};
DisplayPassDevice(void * config)
{
throw Exception();
}
~DisplayPassDevice()
{
printf("~DisplayPassDevice\n");
}
virtual void OnPassageOpen() {printf("OnPassageOpen\n");}
virtual void OnPassageClose() {printf("OnPassageClose\n");}
};
DisplayPassDevice * disp=0;
int main()
{
try {
disp = new DisplayPassDevice(0);
} catch(DisplayPassDevice::Exception) {
printf("catched\n" );
return 1;
}
return 0;
}
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc