I don't know how to execute a single thread in a single step. I have only one thread in the current mode.
When the current thread is tuned, other threads are always running, which is difficult to control. I do not like multi-threaded debugging. I usually try to convert a multi-threaded program into a single thread for debugging,
Run each function after it is successfully adjusted. The original print method will not be used.
------------------
The following Source: http://book.77169.org/ask30/how210438.htm
The key point is to run the program first, and then attach the thread number for debugging.
1. Run your main program first
2. Use ps to view the thread number of your program, or print it out in the thread program.
3. Run gdb and the "attach thread number"
4. Info stack: Check where the job is running and set the breakpoint in the thread file.
5. Tracking debugging
6. "Detach thread number" to cancel debugging this thread
I have tried it, and the success or failure is basically half-open.
------------------
How to view the thread Number:
To get info about threads:
Ps-eLf
Ps axms
When used with-L, the NLWP (number of threads) and LWP (thread ID)
------------------
How to generate core files:
[Gan @ localhost tmp] $ ulimit-
Core file size (blocks,-c) 0
...
[Gan @ localhost tmp] $ ulimit-c unlimited
[Gan @ localhost tmp] $ ulimit-
Core file size (blocks,-c) unlimited
...
[Gan @ localhost tmp] $./a. out
Segment error (core dumped)
The core. [pid] file is generated in the current directory.
-------------------
You must also note that the gcc-g parameter can be tuned using gdb. However, if you only have one execution file, there is no way to tune it. after testing today, we took the execution file from another machine to gdb on our machine. It turns out that gdb needs to access the original file. c file to display detailed code information.