0

I am working with a multi-thread program for Linux embedded systems that crashes very randomly through SEGFAULT signal.

I need to find the issue WITHOUT using gdb since the crash occurs only under production environment, never during testing.

I know the symbol table of the program and I'm using sigaction() and backtrace() in main thread but I don't get enough information. The backtraced lines are from sigaction function itself. I allow 50 frames to be captured and I use -g flag in gcc for compilation:

Caught segfault at address 0xe76acc
Obtained 3 stack frames.
./mbca(_Z11print_tracev+0x20) [0x37530]
./mbca(_Z18segfault_sigactioniP7siginfoPv+0x34) [0x375f4]
/lib/libc.so.6(__default_rt_sa_restorer_v2+0) [0x40db5a60]

As the program is running 15 threads, I would like to get a clue about from which one is coming the signal so I can limit the possibilities. FYI Main thread creates a fork and that fork creates the remaining 14 threads.

How can I achive this? What can I do with the information I already have?

Thank you all for your help

PD: I also tried Core-dump file but it is not generated because this option was not included in kernel compilation and I cannot modify it.

  • 1
    I have two ideas you could try: use addr2line on an address, to have an idea where that occurs, or instrument your threads with backtrace also. Does that help? – g_bor Oct 03 '20 at 17:47
  • I tried addr2line for 0xe76acc but no line was found: ??:0. So what you mean is to call a backtrace function for each thread from the sigaction() in main-thread? – Laura Moreno Oct 03 '20 at 18:07
  • See this for more info:https://stackoverflow.com/questions/6402160/getting-a-backtrace-of-other-thread – g_bor Oct 03 '20 at 18:08
  • I tested it in a simplified code and forced SEGFAULT. However the signal is caught by any running thread, not only by the one causing it. – Laura Moreno Oct 05 '20 at 14:58

0 Answers0