Page 2 of 2
Re: Help with debugging a shared objects(?) crash
Posted: Thu Feb 27, 2014 9:30 pm
by Raziel
ssolie wrote:Raziel wrote:What if i link pthread (and only pthread) statically rather than as a shared object?
I don't think you understand. As long as "g++ -v" returns "Thread model: single" the C++ language itself and the C++ standard library are not thread aware. You will mistakenly believe everything is fine until a C++ exception is thrown in one thread and is caught in another thread (i.e. undefined behaviour).
The easiest workaround is to compile your C++ project with no threading support. Another workaround is to turn off C++ exceptions and RTTI support (both optional language features).
If anybody would like to work on creating a C++ compiler which is thread aware, the source code is available
on SourceForge.
So that means even if a static build (contrary to a shared build) does not throw errors *right now*, it is to expected it *will* throw errors later *if* the program uses threading?
Ill check the options you provided.
Thank you very much again
Re: Help with debugging a shared objects(?) crash
Posted: Fri Feb 28, 2014 4:59 am
by ssolie
Raziel wrote:So that means even if a static build (contrary to a shared build) does not throw errors *right now*, it is to expected it *will* throw errors later *if* the program uses threading?
It means if you try to use multi-threading with a C++ compiler that doesn't support multi-threading you are in undefined territory. That goes for any platform.
Re: Help with debugging a shared objects(?) crash
Posted: Sat Mar 01, 2014 2:40 pm
by Raziel
ssolie wrote:Raziel wrote:So that means even if a static build (contrary to a shared build) does not throw errors *right now*, it is to expected it *will* throw errors later *if* the program uses threading?
It means if you try to use multi-threading with a C++ compiler that doesn't support multi-threading you are in undefined territory. That goes for any platform.
Gotcha, now i have the information i need to pass to "the other" devs

Re: Help with debugging a shared objects(?) crash
Posted: Sun Mar 02, 2014 6:00 pm
by kas1e
@Raziel
Threading in c++ possible (i.e. c++ don't stop you from starting new threads/tasks, but, without C++ multi-threading support, you need to respect some limitations such as exceptions). There is bunch of apps (ported, or native) which use pthreads.library, and which done on c++ and works fine. In our single-threaded gcc is not exactly "threading" problem, but when you use from c++ multi-threading + exceptions and co. If code do not use them, its fine. You can read more about here:
http://www.os4coding.net/forum/start-coding-amigaos4 (last few posts of topic). I.e. creating of threads and use them are ok for c++ and single-threaded gcc, just when time come to those special cases there where problems starts. And in your case your bug can be not because of our single-threaded gcc.
Re: Help with debugging a shared objects(?) crash
Posted: Sun Mar 02, 2014 9:26 pm
by Raziel
kas1e wrote:@Raziel
Threading in c++ possible (i.e. c++ don't stop you from starting new threads/tasks, but, without C++ multi-threading support, you need to respect some limitations such as exceptions). There is bunch of apps (ported, or native) which use pthreads.library, and which done on c++ and works fine. In our single-threaded gcc is not exactly "threading" problem, but when you use from c++ multi-threading + exceptions and co. If code do not use them, its fine. You can read more about here:
http://www.os4coding.net/forum/start-coding-amigaos4 (last few posts of topic). I.e. creating of threads and use them are ok for c++ and single-threaded gcc, just when time come to those special cases there where problems starts. And in your case your bug can be not because of our single-threaded gcc.
I wasnt able to re-check for threading in the project yet and im in hiatus right now because i dont have access to any miggy.
But i was also already wondering if it might not be a genuine bug in libstdc++ in the first place...after all it crashes right at the start of the program, with no GUI, no audio, no engines, no other extensions whatsoever being loaded.
Be assured i will post here when i talked to the devs and checked for threading.
Thanks for the link, ill check it out aswell
Re: Help with debugging a shared objects(?) crash
Posted: Sat Mar 08, 2014 9:27 am
by Raziel
Ok, so no multi-threading used.
No pthread.so either linked to the exe.
Could this be a genuine bug in libstdc++?
I am not able to delve deeper into libstdc++ with my debug log because addr2line gives me ??:0 when i try to read out the crashing function name from libstdc++.
Then again it might have not been build with debug flags or i'm trying to do something stupid...again?

Any other hints?
TIA