How to fix threading problems in Linux?

I am trying to debug an application problem on Linux. It tends to break with SIGSEGV at random places in libstdc++.soor libstdc.so.

It seems that there are no obvious race conditions anywhere, since the work in the stream that I added is very isolated. But he still falls almost all the time.

The application is compiled with g++ -c ... -pthread -D_REENTRANTand linked tog++ -pthread -o ...

But it still crashes almost all the time in one of the functions libstdc*.so. I spent several days trying to find out what happened, but not to leave ...

Does anyone have any tips? Is there a way to make sure libstdc*.socompiled as a stream? Any gdb commands that could help me? Debug heaps?

I have been working with Linux for only a few years, so I'm lost ...

+3
source share
2 answers

There are several things you should do:

Write unit tests. Although they do not help much in finding thread problems, they can help you find the wrong memory access problems.

+4
source

Try using it -gwhen compiling, if you haven’t already done so, to get symbolic information about the debugger.

? , gdb :

gdb <my-exe> <my-core-file>

(, -g) info threads, , . , seg libstdc++.so libstdc.so, , . , .

, ?

, : , :

gdb <my-exe> <my-process-id>

, .

+4

All Articles