How to continue one thread at a time when debugging a multithreaded program in GDB?

后端 未结 3 1012
花落未央
花落未央 2020-12-08 00:38

I have a program which uses two threads. I have put the break point in both the threads. While running the program under gdb I want to switch between the threads and make th

3条回答
  •  不思量自难忘°
    2020-12-08 01:02

    use break conditions

    (gdb) break frik.c:13 thread 28 if bartab > lim
    

    see Debugging with GDB

    Edit:

    (gdb) break  thread 2
    (gdb) break  thread 1
    (gdb) thread 1
    (gdb) continue
    (gdb) ... thread 1 finishes
    (gdb) thread 2
    (gdb) continue
    

    You can put these commands inside a .gdbrc file.

提交回复
热议问题