Laura Moreno
Laura Moreno

Reputation: 1

How to find reason for SEGFAULT in large multi-thread C program?

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.

Upvotes: 0

Views: 723

Answers (0)

Related Questions