Multi-Threaded DEBUG commands
1. Info Threads:
This command shows all threads currently available for debugging, and GDB assigns an ID to each thread. the thread in front of * is the thread that is currently being debugged.
2. Thread ID:
Switches to the thread that is currently being debugged for the specified ID.
3. Thread Apply all command:
To have all the threads being debugged execute command commands
4. Thread Apply ID1 ID2 ... command:
This command is to let the thread number is ID1,ID2 ... And so on, the threads all execute command commands
5. Set Scheduler-locking Off|on|step:
When debugging a currently debugged thread using the step or Continue command, the other threads are executed concurrently, and if we only want the thread being debugged to execute, and the other threads stop waiting, then lock the thread to be debugged and let it run.
OFF: No threads are locked and all threads are executed.
On: Only threads that are currently being debugged will execute.
Step: Prevents other threads from seizing the current thread while stepping through the current thread. Other threads will be re-run only when next, continue, Util, and finish are available.
6, show scheduler-locking:
This command is to view the mode of the currently locked thread.
7.I Threads
Implement inter-thread switching
8. when compiling, it is important to remember to add the dynamic link library and-G.
Gcc-g *.c-o xxx-lxxx
my: gcc-g rwlock.c main.c-o A-lpthread
A little hint:
When you enter GdB xx, the GDB command is entered, and some information is output. As shown above, most of this information is about GDB, and you can not let him output,
such as: Gdb-q XX
In this, a is the file name of the debug information I generated.
Debugging of GDB thread under Linux