< incurable diseases >GDB debugging multithreaded Program error: Interrupted system call

Source: Internet
Author: User

One. Ubuntu system, using the GDB debug program, the method is as follows:

1) Compile the source code, GDB can only debug executable files. If you compile a C + + program with CMake, you need to add the following flag to the CMakeLists.txt, which provides basic debugging information and intermediate variable information during debugging.

Set (gcc_coverage_compile_flags "-G") Set (Cmake_cxx_flags  "${cmake_cxx_flags} ${gcc_coverage_compile_flags}")

2) terminal jump to the directory where the compiled executable file is located, run gdb xxxx to start debugging the program.

Two. Debug multi-threaded threads

When I used GDB to debug multi-threaded threads, the error "interrupted system call", I referred to 37906091

Workaround: Set GDB to Non-stop mode, set as follows.

Open ~/.gdbinit (If you don't have this file, create a new document of the same name yourself), then add three lines.

set target-async 1set  pagination offset non-stop on

< incurable diseases >GDB debugging multithreaded Program error: Interrupted system call

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.