11월, 2022의 게시물 표시

C/C++ Debugging - Useful tips on strace

이미지
 Recently, I am making a daemon program to use at the call center. The program collects network packets, restores call center calls, and converts calls into text. However, during the test process, it was found that the program was terminated about once every few days. At first, I thought it was a Segmentation Fault, so I checked whether a coredump occurred, but it was not.  And the log level of the program was changed and the log was added around the code suspected of error. However, because the program consists of several threads and has a lot of loop statements, it was quickly found that there was a limit to adding logs.  I looked for suitable debugging tools to find the part where the error occurred more easily. I was able to find the most commonly used gdb, valgrind, which is effective for checking memory leaks, and strace that can easily investigate system calls and signals, among which I decided to use trace. Common Daemon Program Errors The fatal errors encountered...